From cd29f98bf12eae566b0d7571caa23314fa69844a Mon Sep 17 00:00:00 2001 From: xerox Date: Sun, 11 Oct 2020 16:59:15 -0700 Subject: [PATCH] remove edk2 source files and added more compile options --- Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj | 245 +- .../PayLoad (AMD).vcxproj.filters | 3 + .../PayLoad (AMD)/PayLoad (AMD).vcxproj.user | 4 + Voyager/PayLoad (AMD)/pg_table.h | 113 + Voyager/PayLoad (AMD)/types.h | 2 - .../PayLoad (Intel)/PayLoad (Intel).vcxproj | 589 +- .../PayLoad (Intel).vcxproj.filters | 3 + Voyager/PayLoad (Intel)/pg_table.h | 113 + Voyager/PayLoad (Intel)/types.h | 1 - Voyager/Voyager.sln | 139 +- Voyager/Voyager/BootMgfw.c | 21 + Voyager/Voyager/HvLoader.c | 20 + Voyager/Voyager/HvLoader.h | 38 +- Voyager/Voyager/ShitHook.c | 10 +- Voyager/Voyager/ShitHook.h | 13 +- Voyager/Voyager/Utils.h | 14 +- Voyager/Voyager/Voyager.vcxproj | 430 +- Voyager/Voyager/WinLoad.c | 22 + Voyager/Voyager/WinLoad.h | 7 + Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dec | 43 - Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dsc | 130 - Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.uni | 25 - .../Voyager/edk2/CryptoPkg/CryptoPkgExtra.uni | 20 - .../Library/BaseCryptLib/BaseCryptLib.inf | 102 - .../Library/BaseCryptLib/BaseCryptLib.uni | 25 - .../Library/BaseCryptLib/Cipher/CryptAes.c | 323 - .../BaseCryptLib/Cipher/CryptAesNull.c | 165 - .../Library/BaseCryptLib/Cipher/CryptArc4.c | 211 - .../BaseCryptLib/Cipher/CryptArc4Null.c | 130 - .../Library/BaseCryptLib/Cipher/CryptTdes.c | 370 -- .../BaseCryptLib/Cipher/CryptTdesNull.c | 166 - .../Library/BaseCryptLib/Hash/CryptMd4.c | 229 - .../Library/BaseCryptLib/Hash/CryptMd4Null.c | 149 - .../Library/BaseCryptLib/Hash/CryptMd5.c | 231 - .../Library/BaseCryptLib/Hash/CryptSha1.c | 230 - .../Library/BaseCryptLib/Hash/CryptSha256.c | 229 - .../Library/BaseCryptLib/Hash/CryptSha512.c | 446 -- .../BaseCryptLib/Hash/CryptSha512Null.c | 281 - .../Library/BaseCryptLib/Hmac/CryptHmacMd5.c | 256 - .../BaseCryptLib/Hmac/CryptHmacMd5Null.c | 165 - .../Library/BaseCryptLib/Hmac/CryptHmacSha1.c | 256 - .../BaseCryptLib/Hmac/CryptHmacSha1Null.c | 165 - .../BaseCryptLib/Hmac/CryptHmacSha256.c | 256 - .../BaseCryptLib/Hmac/CryptHmacSha256Null.c | 165 - .../Library/BaseCryptLib/InternalCryptLib.h | 68 - .../Library/BaseCryptLib/PeiCryptLib.inf | 99 - .../Library/BaseCryptLib/PeiCryptLib.uni | 31 - .../Library/BaseCryptLib/Pem/CryptPem.c | 135 - .../Library/BaseCryptLib/Pem/CryptPemNull.c | 44 - .../BaseCryptLib/Pk/CryptAuthenticode.c | 198 - .../BaseCryptLib/Pk/CryptAuthenticodeNull.c | 51 - .../Library/BaseCryptLib/Pk/CryptDh.c | 312 - .../Library/BaseCryptLib/Pk/CryptDhNull.c | 156 - .../BaseCryptLib/Pk/CryptPkcs5Pbkdf2.c | 101 - .../BaseCryptLib/Pk/CryptPkcs5Pbkdf2Null.c | 56 - .../Library/BaseCryptLib/Pk/CryptPkcs7Sign.c | 200 - .../BaseCryptLib/Pk/CryptPkcs7SignNull.c | 60 - .../BaseCryptLib/Pk/CryptPkcs7VerifyBase.c | 131 - .../BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c | 916 --- .../BaseCryptLib/Pk/CryptPkcs7VerifyNull.c | 169 - .../BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c | 45 - .../Library/BaseCryptLib/Pk/CryptRsaBasic.c | 325 - .../Library/BaseCryptLib/Pk/CryptRsaExt.c | 362 - .../Library/BaseCryptLib/Pk/CryptRsaExtNull.c | 125 - .../Library/BaseCryptLib/Pk/CryptTs.c | 665 -- .../Library/BaseCryptLib/Pk/CryptTsNull.c | 48 - .../Library/BaseCryptLib/Pk/CryptX509.c | 730 --- .../Library/BaseCryptLib/Pk/CryptX509Null.c | 238 - .../Library/BaseCryptLib/Rand/CryptRand.c | 110 - .../Library/BaseCryptLib/Rand/CryptRandItc.c | 118 - .../Library/BaseCryptLib/Rand/CryptRandNull.c | 63 - .../Library/BaseCryptLib/Rand/CryptRandTsc.c | 118 - .../Library/BaseCryptLib/RuntimeCryptLib.inf | 107 - .../Library/BaseCryptLib/RuntimeCryptLib.uni | 30 - .../Library/BaseCryptLib/SmmCryptLib.inf | 104 - .../Library/BaseCryptLib/SmmCryptLib.uni | 30 - .../BaseCryptLib/SysCall/BaseMemAllocation.c | 118 - .../BaseCryptLib/SysCall/ConstantTimeClock.c | 43 - .../Library/BaseCryptLib/SysCall/CrtWrapper.c | 474 -- .../SysCall/RuntimeMemAllocation.c | 461 -- .../BaseCryptLib/SysCall/TimerWrapper.c | 174 - .../CryptoPkg/Library/Include/CrtLibSupport.h | 195 - .../edk2/CryptoPkg/Library/Include/assert.h | 15 - .../edk2/CryptoPkg/Library/Include/ctype.h | 15 - .../edk2/CryptoPkg/Library/Include/errno.h | 15 - .../Library/Include/internal/dso_conf.h | 0 .../edk2/CryptoPkg/Library/Include/limits.h | 15 - .../edk2/CryptoPkg/Library/Include/memory.h | 15 - .../Library/Include/openssl/opensslconf.h | 314 - .../edk2/CryptoPkg/Library/Include/stdarg.h | 15 - .../edk2/CryptoPkg/Library/Include/stddef.h | 15 - .../edk2/CryptoPkg/Library/Include/stdio.h | 15 - .../edk2/CryptoPkg/Library/Include/stdlib.h | 15 - .../edk2/CryptoPkg/Library/Include/string.h | 15 - .../edk2/CryptoPkg/Library/Include/strings.h | 15 - .../edk2/CryptoPkg/Library/Include/sys/time.h | 15 - .../CryptoPkg/Library/Include/sys/types.h | 15 - .../edk2/CryptoPkg/Library/Include/syslog.h | 15 - .../edk2/CryptoPkg/Library/Include/time.h | 15 - .../edk2/CryptoPkg/Library/Include/unistd.h | 15 - .../Library/IntrinsicLib/BaseIntrinsicLib.uni | 22 - .../CryptoPkg/Library/IntrinsicLib/CopyMem.c | 23 - .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 - .../Library/IntrinsicLib/Ia32/MathLShiftS64.c | 54 - .../IntrinsicLib/Ia32/MathLShiftS64.nasm | 48 - .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 - .../Library/IntrinsicLib/Ia32/MathRShiftU64.c | 57 - .../IntrinsicLib/Ia32/MathRShiftU64.nasm | 49 - .../Library/IntrinsicLib/IntrinsicLib.inf | 73 - .../Library/IntrinsicLib/MemoryIntrinsics.c | 60 - .../Library/OpensslLib/OpenSSL-HOWTO.txt | 53 - .../Library/OpensslLib/OpensslLib.inf | 597 -- .../Library/OpensslLib/OpensslLib.uni | 22 - .../Library/OpensslLib/OpensslLibCrypto.inf | 558 -- .../Library/OpensslLib/OpensslLibCrypto.uni | 22 - .../CryptoPkg/Library/OpensslLib/buildinf.h | 2 - .../Library/OpensslLib/process_files.pl | 224 - .../CryptoPkg/Library/TlsLib/InternalTlsLib.h | 47 - .../edk2/CryptoPkg/Library/TlsLib/TlsConfig.c | 1217 ---- .../edk2/CryptoPkg/Library/TlsLib/TlsInit.c | 269 - .../edk2/CryptoPkg/Library/TlsLib/TlsLib.inf | 56 - .../edk2/CryptoPkg/Library/TlsLib/TlsLib.uni | 19 - .../CryptoPkg/Library/TlsLib/TlsProcess.c | 463 -- .../BaseCacheMaintenanceLib/ArmCache.c | 247 - .../BaseCacheMaintenanceLib.inf | 55 - .../BaseCacheMaintenanceLib.uni | 23 - .../BaseCacheMaintenanceLib/EbcCache.c | 231 - .../BaseCacheMaintenanceLib/X86Cache.c | 278 - .../Library/BaseCpuLib/AArch64/CpuFlushTlb.S | 38 - .../BaseCpuLib/AArch64/CpuFlushTlb.asm | 39 - .../Library/BaseCpuLib/AArch64/CpuSleep.S | 39 - .../Library/BaseCpuLib/AArch64/CpuSleep.asm | 40 - .../Library/BaseCpuLib/Arm/CpuFlushTlb.S | 36 - .../Library/BaseCpuLib/Arm/CpuFlushTlb.asm | 37 - .../MdePkg/Library/BaseCpuLib/Arm/CpuSleep.S | 43 - .../Library/BaseCpuLib/Arm/CpuSleep.asm | 44 - .../MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 74 - .../MdePkg/Library/BaseCpuLib/BaseCpuLib.uni | 24 - .../Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c | 46 - .../Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 34 - .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 37 - .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 32 - .../MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c | 34 - .../Library/BaseCpuLib/Ia32/CpuSleep.nasm | 36 - .../Library/BaseCpuLib/Ia32/CpuSleepGcc.c | 33 - .../Library/BaseCpuLib/X64/CpuFlushTlb.S | 35 - .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 38 - .../MdePkg/Library/BaseCpuLib/X64/CpuSleep.S | 34 - .../Library/BaseCpuLib/X64/CpuSleep.nasm | 37 - .../BaseDebugLibNull/BaseDebugLibNull.inf | 36 - .../BaseDebugLibNull/BaseDebugLibNull.uni | 21 - .../Library/BaseDebugLibNull/DebugLib.c | 198 - .../BaseDebugLibSerialPort.inf | 49 - .../BaseDebugLibSerialPort.uni | 21 - .../Library/BaseDebugLibSerialPort/DebugLib.c | 284 - .../BaseDebugPrintErrorLevelLib.c | 59 - .../BaseDebugPrintErrorLevelLib.inf | 40 - .../BaseDebugPrintErrorLevelLib.uni | 21 - .../BaseExtractGuidedSectionLib.c | 484 -- .../BaseExtractGuidedSectionLib.inf | 54 - .../BaseExtractGuidedSectionLib.uni | 27 - .../BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S | 148 - .../AArch64/ArmVirtMmio.asm | 149 - .../BaseIoLibIntrinsic/Arm/ArmVirtMmio.S | 147 - .../BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm | 151 - .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 71 - .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni | 24 - .../BaseIoLibIntrinsicArmVirt.inf | 52 - .../BaseIoLibIntrinsicArmVirt.uni | 23 - .../BaseIoLibIntrinsicInternal.h | 26 - .../BaseIoLibIntrinsicSev.inf | 59 - .../BaseIoLibIntrinsic/Ia32/IoFifo.nasm | 137 - .../BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm | 299 - .../Library/BaseIoLibIntrinsic/IoHighLevel.c | 2356 ------- .../MdePkg/Library/BaseIoLibIntrinsic/IoLib.c | 317 - .../Library/BaseIoLibIntrinsic/IoLibArm.c | 599 -- .../Library/BaseIoLibIntrinsic/IoLibArmVirt.c | 733 --- .../Library/BaseIoLibIntrinsic/IoLibEbc.c | 342 - .../Library/BaseIoLibIntrinsic/IoLibGcc.c | 196 - .../Library/BaseIoLibIntrinsic/IoLibIcc.c | 214 - .../BaseIoLibIntrinsic/IoLibMmioBuffer.c | 411 -- .../Library/BaseIoLibIntrinsic/IoLibMsc.c | 228 - .../BaseIoLibIntrinsic/X64/IoFifo.nasm | 126 - .../BaseIoLibIntrinsic/X64/IoFifoSev.nasm | 288 - .../Library/BaseLib/AArch64/CpuBreakpoint.S | 37 - .../Library/BaseLib/AArch64/CpuBreakpoint.asm | 39 - .../BaseLib/AArch64/DisableInterrupts.S | 36 - .../BaseLib/AArch64/DisableInterrupts.asm | 37 - .../BaseLib/AArch64/EnableInterrupts.S | 36 - .../BaseLib/AArch64/EnableInterrupts.asm | 37 - .../BaseLib/AArch64/GetInterruptsState.S | 45 - .../BaseLib/AArch64/GetInterruptsState.asm | 49 - .../Library/BaseLib/AArch64/MemoryFence.S | 39 - .../Library/BaseLib/AArch64/MemoryFence.asm | 38 - .../Library/BaseLib/AArch64/SetJumpLongJump.S | 97 - .../BaseLib/AArch64/SetJumpLongJump.asm | 101 - .../BaseLib/AArch64/SpeculationBarrier.S | 39 - .../BaseLib/AArch64/SpeculationBarrier.asm | 38 - .../Library/BaseLib/AArch64/SwitchStack.S | 71 - .../Library/BaseLib/AArch64/SwitchStack.asm | 71 - .../edk2/MdePkg/Library/BaseLib/ARShiftU64.c | 41 - .../Library/BaseLib/Arm/CpuBreakpoint.S | 36 - .../Library/BaseLib/Arm/CpuBreakpoint.asm | 41 - .../MdePkg/Library/BaseLib/Arm/CpuPause.asm | 41 - .../Library/BaseLib/Arm/DisableInterrupts.S | 35 - .../Library/BaseLib/Arm/DisableInterrupts.asm | 37 - .../Library/BaseLib/Arm/EnableInterrupts.S | 36 - .../Library/BaseLib/Arm/EnableInterrupts.asm | 37 - .../Library/BaseLib/Arm/GetInterruptsState.S | 43 - .../BaseLib/Arm/GetInterruptsState.asm | 45 - .../Library/BaseLib/Arm/InternalSwitchStack.c | 79 - .../edk2/MdePkg/Library/BaseLib/Arm/Math64.S | 269 - .../MdePkg/Library/BaseLib/Arm/MemoryFence.S | 39 - .../Library/BaseLib/Arm/MemoryFence.asm | 39 - .../Library/BaseLib/Arm/SetJumpLongJump.S | 70 - .../Library/BaseLib/Arm/SetJumpLongJump.asm | 70 - .../Library/BaseLib/Arm/SpeculationBarrier.S | 39 - .../BaseLib/Arm/SpeculationBarrier.asm | 39 - .../MdePkg/Library/BaseLib/Arm/SwitchStack.S | 68 - .../Library/BaseLib/Arm/SwitchStack.asm | 45 - .../MdePkg/Library/BaseLib/Arm/Unaligned.c | 252 - .../edk2/MdePkg/Library/BaseLib/BaseLib.inf | 626 -- .../edk2/MdePkg/Library/BaseLib/BaseLib.uni | 23 - .../MdePkg/Library/BaseLib/BaseLibInternals.h | 875 --- .../edk2/MdePkg/Library/BaseLib/BitField.c | 1008 --- .../edk2/MdePkg/Library/BaseLib/CheckSum.c | 632 -- .../edk2/MdePkg/Library/BaseLib/ChkStkGcc.c | 24 - .../Voyager/edk2/MdePkg/Library/BaseLib/Cpu.c | 65 - .../edk2/MdePkg/Library/BaseLib/CpuDeadLoop.c | 38 - .../Library/BaseLib/DivS64x64Remainder.c | 53 - .../edk2/MdePkg/Library/BaseLib/DivU64x32.c | 45 - .../Library/BaseLib/DivU64x32Remainder.c | 49 - .../Library/BaseLib/DivU64x64Remainder.c | 49 - .../Library/BaseLib/Ebc/CpuBreakpoint.c | 129 - .../Library/BaseLib/Ebc/SetJumpLongJump.c | 68 - .../Library/BaseLib/Ebc/SpeculationBarrier.c | 30 - .../MdePkg/Library/BaseLib/Ebc/SwitchStack.c | 58 - .../edk2/MdePkg/Library/BaseLib/FilePaths.c | 121 - .../MdePkg/Library/BaseLib/GetPowerOfTwo32.c | 44 - .../MdePkg/Library/BaseLib/GetPowerOfTwo64.c | 44 - .../MdePkg/Library/BaseLib/HighBitSet32.c | 47 - .../MdePkg/Library/BaseLib/HighBitSet64.c | 55 - .../MdePkg/Library/BaseLib/Ia32/ARShiftU64.S | 43 - .../MdePkg/Library/BaseLib/Ia32/ARShiftU64.c | 51 - .../Library/BaseLib/Ia32/ARShiftU64.nasm | 45 - .../Library/BaseLib/Ia32/CpuBreakpoint.c | 41 - .../Library/BaseLib/Ia32/CpuBreakpoint.nasm | 36 - .../edk2/MdePkg/Library/BaseLib/Ia32/CpuId.S | 63 - .../edk2/MdePkg/Library/BaseLib/Ia32/CpuId.c | 74 - .../MdePkg/Library/BaseLib/Ia32/CpuId.nasm | 65 - .../MdePkg/Library/BaseLib/Ia32/CpuIdEx.S | 67 - .../MdePkg/Library/BaseLib/Ia32/CpuIdEx.c | 82 - .../MdePkg/Library/BaseLib/Ia32/CpuIdEx.nasm | 67 - .../MdePkg/Library/BaseLib/Ia32/CpuPause.c | 35 - .../MdePkg/Library/BaseLib/Ia32/CpuPause.nasm | 36 - .../Library/BaseLib/Ia32/DisableCache.S | 39 - .../Library/BaseLib/Ia32/DisableCache.c | 36 - .../Library/BaseLib/Ia32/DisableCache.nasm | 42 - .../Library/BaseLib/Ia32/DisableInterrupts.c | 32 - .../BaseLib/Ia32/DisableInterrupts.nasm | 37 - .../Library/BaseLib/Ia32/DisablePaging32.S | 52 - .../Library/BaseLib/Ia32/DisablePaging32.c | 77 - .../Library/BaseLib/Ia32/DisablePaging32.nasm | 54 - .../Library/BaseLib/Ia32/DivS64x64Remainder.c | 53 - .../MdePkg/Library/BaseLib/Ia32/DivU64x32.S | 41 - .../MdePkg/Library/BaseLib/Ia32/DivU64x32.c | 50 - .../Library/BaseLib/Ia32/DivU64x32.nasm | 43 - .../Library/BaseLib/Ia32/DivU64x32Remainder.S | 46 - .../Library/BaseLib/Ia32/DivU64x32Remainder.c | 55 - .../BaseLib/Ia32/DivU64x32Remainder.nasm | 48 - .../Library/BaseLib/Ia32/DivU64x64Remainder.S | 89 - .../BaseLib/Ia32/DivU64x64Remainder.nasm | 94 - .../MdePkg/Library/BaseLib/Ia32/EnableCache.S | 39 - .../MdePkg/Library/BaseLib/Ia32/EnableCache.c | 36 - .../Library/BaseLib/Ia32/EnableCache.nasm | 42 - .../BaseLib/Ia32/EnableDisableInterrupts.S | 36 - .../BaseLib/Ia32/EnableDisableInterrupts.c | 36 - .../BaseLib/Ia32/EnableDisableInterrupts.nasm | 38 - .../Library/BaseLib/Ia32/EnableInterrupts.c | 32 - .../BaseLib/Ia32/EnableInterrupts.nasm | 37 - .../Library/BaseLib/Ia32/EnablePaging32.S | 52 - .../Library/BaseLib/Ia32/EnablePaging32.c | 81 - .../Library/BaseLib/Ia32/EnablePaging32.nasm | 54 - .../Library/BaseLib/Ia32/EnablePaging64.S | 63 - .../Library/BaseLib/Ia32/EnablePaging64.nasm | 65 - .../Library/BaseLib/Ia32/FlushCacheLine.c | 58 - .../Library/BaseLib/Ia32/FlushCacheLine.nasm | 51 - .../MdePkg/Library/BaseLib/Ia32/FxRestore.c | 40 - .../Library/BaseLib/Ia32/FxRestore.nasm | 38 - .../edk2/MdePkg/Library/BaseLib/Ia32/FxSave.c | 40 - .../MdePkg/Library/BaseLib/Ia32/FxSave.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/GccInline.c | 1771 ----- .../BaseLib/Ia32/InternalSwitchStack.S | 48 - .../BaseLib/Ia32/InternalSwitchStack.c | 60 - .../BaseLib/Ia32/InternalSwitchStack.nasm | 47 - .../edk2/MdePkg/Library/BaseLib/Ia32/Invd.c | 35 - .../MdePkg/Library/BaseLib/Ia32/Invd.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/LRotU64.S | 48 - .../MdePkg/Library/BaseLib/Ia32/LRotU64.c | 55 - .../MdePkg/Library/BaseLib/Ia32/LRotU64.nasm | 50 - .../MdePkg/Library/BaseLib/Ia32/LShiftU64.S | 43 - .../MdePkg/Library/BaseLib/Ia32/LShiftU64.c | 51 - .../Library/BaseLib/Ia32/LShiftU64.nasm | 45 - .../MdePkg/Library/BaseLib/Ia32/Lfence.nasm | 36 - .../MdePkg/Library/BaseLib/Ia32/LongJump.S | 41 - .../MdePkg/Library/BaseLib/Ia32/LongJump.c | 76 - .../MdePkg/Library/BaseLib/Ia32/LongJump.nasm | 66 - .../MdePkg/Library/BaseLib/Ia32/ModU64x32.S | 40 - .../MdePkg/Library/BaseLib/Ia32/ModU64x32.c | 48 - .../Library/BaseLib/Ia32/ModU64x32.nasm | 42 - .../MdePkg/Library/BaseLib/Ia32/Monitor.S | 40 - .../MdePkg/Library/BaseLib/Ia32/Monitor.c | 48 - .../MdePkg/Library/BaseLib/Ia32/Monitor.nasm | 42 - .../MdePkg/Library/BaseLib/Ia32/MultU64x32.S | 41 - .../MdePkg/Library/BaseLib/Ia32/MultU64x32.c | 47 - .../Library/BaseLib/Ia32/MultU64x32.nasm | 40 - .../MdePkg/Library/BaseLib/Ia32/MultU64x64.S | 44 - .../MdePkg/Library/BaseLib/Ia32/MultU64x64.c | 51 - .../Library/BaseLib/Ia32/MultU64x64.nasm | 46 - .../edk2/MdePkg/Library/BaseLib/Ia32/Mwait.S | 38 - .../edk2/MdePkg/Library/BaseLib/Ia32/Mwait.c | 44 - .../MdePkg/Library/BaseLib/Ia32/Mwait.nasm | 40 - .../Library/BaseLib/Ia32/Non-existing.c | 57 - .../MdePkg/Library/BaseLib/Ia32/RRotU64.S | 48 - .../MdePkg/Library/BaseLib/Ia32/RRotU64.c | 55 - .../MdePkg/Library/BaseLib/Ia32/RRotU64.nasm | 50 - .../MdePkg/Library/BaseLib/Ia32/RShiftU64.S | 46 - .../MdePkg/Library/BaseLib/Ia32/RShiftU64.c | 51 - .../Library/BaseLib/Ia32/RShiftU64.nasm | 45 - .../edk2/MdePkg/Library/BaseLib/Ia32/RdRand.S | 80 - .../MdePkg/Library/BaseLib/Ia32/RdRand.nasm | 90 - .../MdePkg/Library/BaseLib/Ia32/ReadCr0.c | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadCr0.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadCr2.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadCr2.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadCr3.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadCr3.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadCr4.c | 40 - .../MdePkg/Library/BaseLib/Ia32/ReadCr4.nasm | 37 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadCs.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr0.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr0.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr1.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr1.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr2.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr2.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr3.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr3.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr4.c | 40 - .../MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm | 44 - .../MdePkg/Library/BaseLib/Ia32/ReadDr5.c | 40 - .../MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm | 44 - .../MdePkg/Library/BaseLib/Ia32/ReadDr6.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr6.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadDr7.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDr7.nasm | 37 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadDs.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadEflags.c | 39 - .../Library/BaseLib/Ia32/ReadEflags.nasm | 38 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadEs.nasm | 37 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadFs.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadGdtr.c | 39 - .../MdePkg/Library/BaseLib/Ia32/ReadGdtr.nasm | 38 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadGs.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadIdtr.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadIdtr.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadLdtr.c | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadLdtr.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadMm0.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm0.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm1.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm1.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm2.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm2.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm3.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm3.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm4.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm4.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm5.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm5.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm6.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm6.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMm7.c | 42 - .../MdePkg/Library/BaseLib/Ia32/ReadMm7.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/ReadMsr64.c | 43 - .../Library/BaseLib/Ia32/ReadMsr64.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadPmc.c | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadPmc.nasm | 38 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.c | 38 - .../MdePkg/Library/BaseLib/Ia32/ReadSs.nasm | 37 - .../edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.c | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadTr.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadTsc.c | 37 - .../MdePkg/Library/BaseLib/Ia32/ReadTsc.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/SetJump.S | 44 - .../MdePkg/Library/BaseLib/Ia32/SetJump.c | 101 - .../MdePkg/Library/BaseLib/Ia32/SetJump.nasm | 69 - .../MdePkg/Library/BaseLib/Ia32/SwapBytes64.S | 38 - .../MdePkg/Library/BaseLib/Ia32/SwapBytes64.c | 43 - .../Library/BaseLib/Ia32/SwapBytes64.nasm | 40 - .../MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 - .../MdePkg/Library/BaseLib/Ia32/Thunk16.nasm | 263 - .../edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.c | 35 - .../MdePkg/Library/BaseLib/Ia32/Wbinvd.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteCr0.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteCr0.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteCr2.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteCr2.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteCr3.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteCr3.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteCr4.c | 39 - .../MdePkg/Library/BaseLib/Ia32/WriteCr4.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr0.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr0.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr1.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr1.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr2.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr2.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr3.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr3.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr4.c | 39 - .../MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm | 45 - .../MdePkg/Library/BaseLib/Ia32/WriteDr5.c | 39 - .../MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm | 45 - .../MdePkg/Library/BaseLib/Ia32/WriteDr6.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr6.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteDr7.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteDr7.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteGdtr.c | 39 - .../Library/BaseLib/Ia32/WriteGdtr.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteIdtr.c | 41 - .../Library/BaseLib/Ia32/WriteIdtr.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/WriteLdtr.c | 39 - .../Library/BaseLib/Ia32/WriteLdtr.nasm | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm0.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm0.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm1.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm1.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm2.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm2.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm3.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm3.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm4.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm4.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm5.c | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm5.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm6.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm6.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMm7.c | 38 - .../MdePkg/Library/BaseLib/Ia32/WriteMm7.nasm | 37 - .../MdePkg/Library/BaseLib/Ia32/WriteMsr64.c | 49 - .../Library/BaseLib/Ia32/WriteMsr64.nasm | 41 - .../MdePkg/Library/BaseLib/Ia32/WriteTr.nasm | 36 - .../edk2/MdePkg/Library/BaseLib/LRotU32.c | 42 - .../edk2/MdePkg/Library/BaseLib/LRotU64.c | 42 - .../edk2/MdePkg/Library/BaseLib/LShiftU64.c | 41 - .../edk2/MdePkg/Library/BaseLib/LinkedList.c | 605 -- .../edk2/MdePkg/Library/BaseLib/LongJump.c | 47 - .../edk2/MdePkg/Library/BaseLib/LowBitSet32.c | 47 - .../edk2/MdePkg/Library/BaseLib/LowBitSet64.c | 50 - .../edk2/MdePkg/Library/BaseLib/Math64.c | 368 -- .../edk2/MdePkg/Library/BaseLib/ModU64x32.c | 45 - .../edk2/MdePkg/Library/BaseLib/MultS64x64.c | 42 - .../edk2/MdePkg/Library/BaseLib/MultU64x32.c | 46 - .../edk2/MdePkg/Library/BaseLib/MultU64x64.c | 46 - .../edk2/MdePkg/Library/BaseLib/RRotU32.c | 42 - .../edk2/MdePkg/Library/BaseLib/RRotU64.c | 42 - .../edk2/MdePkg/Library/BaseLib/RShiftU64.c | 41 - .../edk2/MdePkg/Library/BaseLib/SafeString.c | 3650 ----------- .../edk2/MdePkg/Library/BaseLib/SetJump.c | 40 - .../edk2/MdePkg/Library/BaseLib/String.c | 2143 ------ .../edk2/MdePkg/Library/BaseLib/SwapBytes16.c | 39 - .../edk2/MdePkg/Library/BaseLib/SwapBytes32.c | 45 - .../edk2/MdePkg/Library/BaseLib/SwapBytes64.c | 39 - .../edk2/MdePkg/Library/BaseLib/SwitchStack.c | 76 - .../edk2/MdePkg/Library/BaseLib/Unaligned.c | 222 - .../Library/BaseLib/X64/CpuBreakpoint.c | 39 - .../Library/BaseLib/X64/CpuBreakpoint.nasm | 37 - .../edk2/MdePkg/Library/BaseLib/X64/CpuId.S | 60 - .../MdePkg/Library/BaseLib/X64/CpuId.nasm | 64 - .../edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S | 62 - .../MdePkg/Library/BaseLib/X64/CpuIdEx.nasm | 66 - .../MdePkg/Library/BaseLib/X64/CpuPause.nasm | 37 - .../MdePkg/Library/BaseLib/X64/DisableCache.S | 39 - .../Library/BaseLib/X64/DisableCache.nasm | 43 - .../BaseLib/X64/DisableInterrupts.nasm | 38 - .../Library/BaseLib/X64/DisablePaging64.S | 82 - .../Library/BaseLib/X64/DisablePaging64.nasm | 84 - .../MdePkg/Library/BaseLib/X64/EnableCache.S | 39 - .../Library/BaseLib/X64/EnableCache.nasm | 43 - .../BaseLib/X64/EnableDisableInterrupts.S | 36 - .../BaseLib/X64/EnableDisableInterrupts.nasm | 39 - .../Library/BaseLib/X64/EnableInterrupts.nasm | 38 - .../Library/BaseLib/X64/FlushCacheLine.nasm | 39 - .../MdePkg/Library/BaseLib/X64/FxRestore.nasm | 38 - .../MdePkg/Library/BaseLib/X64/FxSave.nasm | 38 - .../MdePkg/Library/BaseLib/X64/GccInline.c | 1806 ----- .../edk2/MdePkg/Library/BaseLib/X64/Invd.nasm | 38 - .../MdePkg/Library/BaseLib/X64/Lfence.nasm | 37 - .../MdePkg/Library/BaseLib/X64/LongJump.S | 54 - .../MdePkg/Library/BaseLib/X64/LongJump.nasm | 83 - .../MdePkg/Library/BaseLib/X64/Monitor.nasm | 43 - .../MdePkg/Library/BaseLib/X64/Mwait.nasm | 41 - .../MdePkg/Library/BaseLib/X64/Non-existing.c | 153 - .../edk2/MdePkg/Library/BaseLib/X64/RdRand.S | 72 - .../MdePkg/Library/BaseLib/X64/RdRand.nasm | 83 - .../MdePkg/Library/BaseLib/X64/ReadCr0.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadCr2.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadCr3.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadCr4.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadCs.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr0.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr1.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr2.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr3.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr4.nasm | 42 - .../MdePkg/Library/BaseLib/X64/ReadDr5.nasm | 42 - .../MdePkg/Library/BaseLib/X64/ReadDr6.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDr7.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadDs.nasm | 38 - .../Library/BaseLib/X64/ReadEflags.nasm | 39 - .../MdePkg/Library/BaseLib/X64/ReadEs.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadFs.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadGdtr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadGs.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadIdtr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadLdtr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadMm0.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm1.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm2.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm3.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm4.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm5.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm6.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMm7.nasm | 41 - .../MdePkg/Library/BaseLib/X64/ReadMsr64.c | 39 - .../MdePkg/Library/BaseLib/X64/ReadMsr64.nasm | 40 - .../MdePkg/Library/BaseLib/X64/ReadPmc.nasm | 40 - .../MdePkg/Library/BaseLib/X64/ReadSs.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadTr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/ReadTsc.nasm | 40 - .../edk2/MdePkg/Library/BaseLib/X64/SetJump.S | 53 - .../MdePkg/Library/BaseLib/X64/SetJump.nasm | 87 - .../MdePkg/Library/BaseLib/X64/SwitchStack.S | 52 - .../Library/BaseLib/X64/SwitchStack.nasm | 51 - .../edk2/MdePkg/Library/BaseLib/X64/Thunk16.S | 334 - .../MdePkg/Library/BaseLib/X64/Thunk16.nasm | 325 - .../MdePkg/Library/BaseLib/X64/Wbinvd.nasm | 38 - .../MdePkg/Library/BaseLib/X64/WriteCr0.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteCr2.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteCr3.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteCr4.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr0.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr1.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr2.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr3.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr4.nasm | 43 - .../MdePkg/Library/BaseLib/X64/WriteDr5.nasm | 43 - .../MdePkg/Library/BaseLib/X64/WriteDr6.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteDr7.nasm | 39 - .../MdePkg/Library/BaseLib/X64/WriteGdtr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/WriteIdtr.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteLdtr.nasm | 38 - .../MdePkg/Library/BaseLib/X64/WriteMm0.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm1.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm2.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm3.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm4.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm5.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm6.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMm7.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteMsr64.c | 42 - .../Library/BaseLib/X64/WriteMsr64.nasm | 41 - .../MdePkg/Library/BaseLib/X64/WriteTr.nasm | 37 - .../Library/BaseLib/X86DisablePaging32.c | 66 - .../Library/BaseLib/X86DisablePaging64.c | 63 - .../Library/BaseLib/X86EnablePaging32.c | 69 - .../Library/BaseLib/X86EnablePaging64.c | 65 - .../MdePkg/Library/BaseLib/X86FxRestore.c | 49 - .../edk2/MdePkg/Library/BaseLib/X86FxSave.c | 48 - .../Library/BaseLib/X86GetInterruptState.c | 41 - .../MdePkg/Library/BaseLib/X86MemoryFence.c | 32 - .../edk2/MdePkg/Library/BaseLib/X86Msr.c | 660 -- .../Library/BaseLib/X86PatchInstruction.c | 89 - .../edk2/MdePkg/Library/BaseLib/X86RdRand.c | 79 - .../edk2/MdePkg/Library/BaseLib/X86ReadGdtr.c | 39 - .../edk2/MdePkg/Library/BaseLib/X86ReadIdtr.c | 39 - .../Library/BaseLib/X86SpeculationBarrier.c | 32 - .../edk2/MdePkg/Library/BaseLib/X86Thunk.c | 268 - .../MdePkg/Library/BaseLib/X86WriteGdtr.c | 39 - .../MdePkg/Library/BaseLib/X86WriteIdtr.c | 39 - .../Library/BaseMemoryLib/BaseMemoryLib.inf | 57 - .../Library/BaseMemoryLib/BaseMemoryLib.uni | 21 - .../Library/BaseMemoryLib/CompareMemWrapper.c | 66 - .../MdePkg/Library/BaseMemoryLib/CopyMem.c | 154 - .../Library/BaseMemoryLib/CopyMemWrapper.c | 63 - .../BaseMemoryLib/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLib/MemLibGeneric.c | 293 - .../MdePkg/Library/BaseMemoryLib/MemLibGuid.c | 171 - .../Library/BaseMemoryLib/MemLibInternals.h | 251 - .../Library/BaseMemoryLib/ScanMem16Wrapper.c | 67 - .../Library/BaseMemoryLib/ScanMem32Wrapper.c | 66 - .../Library/BaseMemoryLib/ScanMem64Wrapper.c | 67 - .../Library/BaseMemoryLib/ScanMem8Wrapper.c | 99 - .../MdePkg/Library/BaseMemoryLib/SetMem.c | 87 - .../Library/BaseMemoryLib/SetMem16Wrapper.c | 64 - .../Library/BaseMemoryLib/SetMem32Wrapper.c | 64 - .../Library/BaseMemoryLib/SetMem64Wrapper.c | 64 - .../Library/BaseMemoryLib/SetMemWrapper.c | 91 - .../Library/BaseMemoryLib/ZeroMemWrapper.c | 56 - .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 129 - .../BaseMemoryLibMmx/BaseMemoryLibMmx.uni | 22 - .../BaseMemoryLibMmx/CompareMemWrapper.c | 66 - .../Library/BaseMemoryLibMmx/CopyMemWrapper.c | 63 - .../BaseMemoryLibMmx/Ia32/CompareMem.S | 55 - .../BaseMemoryLibMmx/Ia32/CompareMem.nasm | 57 - .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S | 86 - .../BaseMemoryLibMmx/Ia32/CopyMem.nasm | 77 - .../BaseMemoryLibMmx/Ia32/IsZeroBuffer.nasm | 55 - .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S | 52 - .../BaseMemoryLibMmx/Ia32/ScanMem16.nasm | 54 - .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S | 52 - .../BaseMemoryLibMmx/Ia32/ScanMem32.nasm | 54 - .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S | 61 - .../BaseMemoryLibMmx/Ia32/ScanMem64.nasm | 63 - .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S | 52 - .../BaseMemoryLibMmx/Ia32/ScanMem8.nasm | 54 - .../Library/BaseMemoryLibMmx/Ia32/SetMem.S | 66 - .../Library/BaseMemoryLibMmx/Ia32/SetMem.nasm | 68 - .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S | 59 - .../BaseMemoryLibMmx/Ia32/SetMem16.nasm | 61 - .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S | 52 - .../BaseMemoryLibMmx/Ia32/SetMem32.nasm | 55 - .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S | 43 - .../BaseMemoryLibMmx/Ia32/SetMem64.nasm | 46 - .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S | 54 - .../BaseMemoryLibMmx/Ia32/ZeroMem.nasm | 54 - .../BaseMemoryLibMmx/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLibMmx/MemLibGuid.c | 171 - .../BaseMemoryLibMmx/MemLibInternals.h | 251 - .../BaseMemoryLibMmx/ScanMem16Wrapper.c | 67 - .../BaseMemoryLibMmx/ScanMem32Wrapper.c | 66 - .../BaseMemoryLibMmx/ScanMem64Wrapper.c | 67 - .../BaseMemoryLibMmx/ScanMem8Wrapper.c | 99 - .../BaseMemoryLibMmx/SetMem16Wrapper.c | 64 - .../BaseMemoryLibMmx/SetMem32Wrapper.c | 64 - .../BaseMemoryLibMmx/SetMem64Wrapper.c | 64 - .../Library/BaseMemoryLibMmx/SetMemWrapper.c | 91 - .../Library/BaseMemoryLibMmx/X64/CompareMem.S | 59 - .../BaseMemoryLibMmx/X64/CompareMem.nasm | 58 - .../Library/BaseMemoryLibMmx/X64/CopyMem.S | 74 - .../Library/BaseMemoryLibMmx/X64/CopyMem.nasm | 74 - .../BaseMemoryLibMmx/X64/IsZeroBuffer.nasm | 55 - .../Library/BaseMemoryLibMmx/X64/ScanMem16.S | 56 - .../BaseMemoryLibMmx/X64/ScanMem16.nasm | 55 - .../Library/BaseMemoryLibMmx/X64/ScanMem32.S | 56 - .../BaseMemoryLibMmx/X64/ScanMem32.nasm | 55 - .../Library/BaseMemoryLibMmx/X64/ScanMem64.S | 55 - .../BaseMemoryLibMmx/X64/ScanMem64.nasm | 55 - .../Library/BaseMemoryLibMmx/X64/ScanMem8.S | 56 - .../BaseMemoryLibMmx/X64/ScanMem8.nasm | 55 - .../Library/BaseMemoryLibMmx/X64/SetMem.S | 61 - .../Library/BaseMemoryLibMmx/X64/SetMem.nasm | 60 - .../Library/BaseMemoryLibMmx/X64/SetMem16.S | 60 - .../BaseMemoryLibMmx/X64/SetMem16.nasm | 59 - .../Library/BaseMemoryLibMmx/X64/SetMem32.S | 55 - .../BaseMemoryLibMmx/X64/SetMem32.nasm | 53 - .../Library/BaseMemoryLibMmx/X64/SetMem64.S | 47 - .../BaseMemoryLibMmx/X64/SetMem64.nasm | 46 - .../Library/BaseMemoryLibMmx/X64/ZeroMem.S | 57 - .../Library/BaseMemoryLibMmx/X64/ZeroMem.nasm | 56 - .../Library/BaseMemoryLibMmx/ZeroMemWrapper.c | 56 - .../BaseMemoryLibOptDxe/AArch64/CompareGuid.S | 40 - .../BaseMemoryLibOptDxe/AArch64/CompareMem.S | 142 - .../BaseMemoryLibOptDxe/AArch64/CopyMem.S | 284 - .../BaseMemoryLibOptDxe/AArch64/ScanMem.S | 161 - .../BaseMemoryLibOptDxe/AArch64/SetMem.S | 247 - .../BaseMemoryLibOptDxe/Arm/CompareGuid.S | 66 - .../BaseMemoryLibOptDxe/Arm/CompareGuid.asm | 70 - .../BaseMemoryLibOptDxe/Arm/CompareMem.S | 139 - .../BaseMemoryLibOptDxe/Arm/CompareMem.asm | 140 - .../Library/BaseMemoryLibOptDxe/Arm/CopyMem.S | 176 - .../BaseMemoryLibOptDxe/Arm/CopyMem.asm | 147 - .../BaseMemoryLibOptDxe/Arm/MemLibGuid.c | 165 - .../Library/BaseMemoryLibOptDxe/Arm/ScanMem.S | 148 - .../BaseMemoryLibOptDxe/Arm/ScanMem.asm | 147 - .../BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c | 142 - .../Library/BaseMemoryLibOptDxe/Arm/SetMem.S | 94 - .../BaseMemoryLibOptDxe/Arm/SetMem.asm | 96 - .../BaseMemoryLibOptDxe.inf | 152 - .../BaseMemoryLibOptDxe.uni | 22 - .../BaseMemoryLibOptDxe/CompareMemWrapper.c | 66 - .../BaseMemoryLibOptDxe/CopyMemWrapper.c | 63 - .../BaseMemoryLibOptDxe/Ia32/CompareMem.S | 55 - .../BaseMemoryLibOptDxe/Ia32/CompareMem.nasm | 57 - .../BaseMemoryLibOptDxe/Ia32/CopyMem.S | 85 - .../BaseMemoryLibOptDxe/Ia32/CopyMem.nasm | 84 - .../Ia32/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibOptDxe/Ia32/ScanMem16.S | 52 - .../BaseMemoryLibOptDxe/Ia32/ScanMem16.nasm | 54 - .../BaseMemoryLibOptDxe/Ia32/ScanMem32.S | 52 - .../BaseMemoryLibOptDxe/Ia32/ScanMem32.nasm | 54 - .../BaseMemoryLibOptDxe/Ia32/ScanMem64.S | 61 - .../BaseMemoryLibOptDxe/Ia32/ScanMem64.nasm | 63 - .../BaseMemoryLibOptDxe/Ia32/ScanMem8.S | 52 - .../BaseMemoryLibOptDxe/Ia32/ScanMem8.nasm | 54 - .../Library/BaseMemoryLibOptDxe/Ia32/SetMem.S | 50 - .../BaseMemoryLibOptDxe/Ia32/SetMem.nasm | 52 - .../BaseMemoryLibOptDxe/Ia32/SetMem16.S | 43 - .../BaseMemoryLibOptDxe/Ia32/SetMem16.nasm | 44 - .../BaseMemoryLibOptDxe/Ia32/SetMem32.S | 43 - .../BaseMemoryLibOptDxe/Ia32/SetMem32.nasm | 44 - .../BaseMemoryLibOptDxe/Ia32/SetMem64.S | 46 - .../BaseMemoryLibOptDxe/Ia32/SetMem64.nasm | 48 - .../BaseMemoryLibOptDxe/Ia32/ZeroMem.S | 49 - .../BaseMemoryLibOptDxe/Ia32/ZeroMem.nasm | 49 - .../BaseMemoryLibOptDxe/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLibOptDxe/MemLibGuid.c | 171 - .../BaseMemoryLibOptDxe/MemLibInternals.h | 251 - .../BaseMemoryLibOptDxe/ScanMem16Wrapper.c | 67 - .../BaseMemoryLibOptDxe/ScanMem32Wrapper.c | 66 - .../BaseMemoryLibOptDxe/ScanMem64Wrapper.c | 67 - .../BaseMemoryLibOptDxe/ScanMem8Wrapper.c | 100 - .../BaseMemoryLibOptDxe/SetMem16Wrapper.c | 64 - .../BaseMemoryLibOptDxe/SetMem32Wrapper.c | 64 - .../BaseMemoryLibOptDxe/SetMem64Wrapper.c | 64 - .../BaseMemoryLibOptDxe/SetMemWrapper.c | 91 - .../BaseMemoryLibOptDxe/X64/CompareMem.S | 59 - .../BaseMemoryLibOptDxe/X64/CompareMem.nasm | 58 - .../Library/BaseMemoryLibOptDxe/X64/CopyMem.S | 82 - .../BaseMemoryLibOptDxe/X64/CopyMem.nasm | 83 - .../BaseMemoryLibOptDxe/X64/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibOptDxe/X64/ScanMem16.S | 56 - .../BaseMemoryLibOptDxe/X64/ScanMem16.nasm | 55 - .../BaseMemoryLibOptDxe/X64/ScanMem32.S | 56 - .../BaseMemoryLibOptDxe/X64/ScanMem32.nasm | 55 - .../BaseMemoryLibOptDxe/X64/ScanMem64.S | 55 - .../BaseMemoryLibOptDxe/X64/ScanMem64.nasm | 55 - .../BaseMemoryLibOptDxe/X64/ScanMem8.S | 56 - .../BaseMemoryLibOptDxe/X64/ScanMem8.nasm | 55 - .../Library/BaseMemoryLibOptDxe/X64/SetMem.S | 57 - .../BaseMemoryLibOptDxe/X64/SetMem.nasm | 62 - .../BaseMemoryLibOptDxe/X64/SetMem16.S | 47 - .../BaseMemoryLibOptDxe/X64/SetMem16.nasm | 47 - .../BaseMemoryLibOptDxe/X64/SetMem32.S | 47 - .../BaseMemoryLibOptDxe/X64/SetMem32.nasm | 47 - .../BaseMemoryLibOptDxe/X64/SetMem64.S | 46 - .../BaseMemoryLibOptDxe/X64/SetMem64.nasm | 46 - .../Library/BaseMemoryLibOptDxe/X64/ZeroMem.S | 51 - .../BaseMemoryLibOptDxe/X64/ZeroMem.nasm | 50 - .../BaseMemoryLibOptDxe/ZeroMemWrapper.c | 56 - .../BaseMemoryLibOptPei.inf | 130 - .../BaseMemoryLibOptPei.uni | 22 - .../BaseMemoryLibOptPei/CompareMemWrapper.c | 66 - .../BaseMemoryLibOptPei/CopyMemWrapper.c | 63 - .../BaseMemoryLibOptPei/Ia32/CompareMem.S | 55 - .../BaseMemoryLibOptPei/Ia32/CompareMem.nasm | 57 - .../BaseMemoryLibOptPei/Ia32/CopyMem.S | 62 - .../BaseMemoryLibOptPei/Ia32/CopyMem.nasm | 62 - .../Ia32/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibOptPei/Ia32/ScanMem16.S | 52 - .../BaseMemoryLibOptPei/Ia32/ScanMem16.nasm | 54 - .../BaseMemoryLibOptPei/Ia32/ScanMem32.S | 52 - .../BaseMemoryLibOptPei/Ia32/ScanMem32.nasm | 54 - .../BaseMemoryLibOptPei/Ia32/ScanMem64.S | 61 - .../BaseMemoryLibOptPei/Ia32/ScanMem64.nasm | 63 - .../BaseMemoryLibOptPei/Ia32/ScanMem8.S | 52 - .../BaseMemoryLibOptPei/Ia32/ScanMem8.nasm | 54 - .../Library/BaseMemoryLibOptPei/Ia32/SetMem.S | 50 - .../BaseMemoryLibOptPei/Ia32/SetMem.nasm | 52 - .../BaseMemoryLibOptPei/Ia32/SetMem16.S | 43 - .../BaseMemoryLibOptPei/Ia32/SetMem16.nasm | 44 - .../BaseMemoryLibOptPei/Ia32/SetMem32.S | 43 - .../BaseMemoryLibOptPei/Ia32/SetMem32.nasm | 44 - .../BaseMemoryLibOptPei/Ia32/SetMem64.S | 46 - .../BaseMemoryLibOptPei/Ia32/SetMem64.nasm | 48 - .../BaseMemoryLibOptPei/Ia32/ZeroMem.S | 49 - .../BaseMemoryLibOptPei/Ia32/ZeroMem.nasm | 49 - .../BaseMemoryLibOptPei/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLibOptPei/MemLibGuid.c | 171 - .../BaseMemoryLibOptPei/MemLibInternals.h | 251 - .../BaseMemoryLibOptPei/ScanMem16Wrapper.c | 67 - .../BaseMemoryLibOptPei/ScanMem32Wrapper.c | 66 - .../BaseMemoryLibOptPei/ScanMem64Wrapper.c | 67 - .../BaseMemoryLibOptPei/ScanMem8Wrapper.c | 99 - .../BaseMemoryLibOptPei/SetMem16Wrapper.c | 64 - .../BaseMemoryLibOptPei/SetMem32Wrapper.c | 64 - .../BaseMemoryLibOptPei/SetMem64Wrapper.c | 64 - .../BaseMemoryLibOptPei/SetMemWrapper.c | 91 - .../BaseMemoryLibOptPei/X64/CompareMem.S | 59 - .../BaseMemoryLibOptPei/X64/CompareMem.nasm | 58 - .../Library/BaseMemoryLibOptPei/X64/CopyMem.S | 66 - .../BaseMemoryLibOptPei/X64/CopyMem.nasm | 65 - .../BaseMemoryLibOptPei/X64/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibOptPei/X64/ScanMem16.S | 56 - .../BaseMemoryLibOptPei/X64/ScanMem16.nasm | 55 - .../BaseMemoryLibOptPei/X64/ScanMem32.S | 56 - .../BaseMemoryLibOptPei/X64/ScanMem32.nasm | 55 - .../BaseMemoryLibOptPei/X64/ScanMem64.S | 56 - .../BaseMemoryLibOptPei/X64/ScanMem64.nasm | 55 - .../BaseMemoryLibOptPei/X64/ScanMem8.S | 56 - .../BaseMemoryLibOptPei/X64/ScanMem8.nasm | 55 - .../Library/BaseMemoryLibOptPei/X64/SetMem.S | 47 - .../BaseMemoryLibOptPei/X64/SetMem.nasm | 47 - .../BaseMemoryLibOptPei/X64/SetMem16.S | 47 - .../BaseMemoryLibOptPei/X64/SetMem16.nasm | 46 - .../BaseMemoryLibOptPei/X64/SetMem32.S | 47 - .../BaseMemoryLibOptPei/X64/SetMem32.nasm | 46 - .../BaseMemoryLibOptPei/X64/SetMem64.S | 46 - .../BaseMemoryLibOptPei/X64/SetMem64.nasm | 45 - .../Library/BaseMemoryLibOptPei/X64/ZeroMem.S | 50 - .../BaseMemoryLibOptPei/X64/ZeroMem.nasm | 49 - .../BaseMemoryLibOptPei/ZeroMemWrapper.c | 56 - .../BaseMemoryLibRepStr.inf | 127 - .../BaseMemoryLibRepStr.uni | 22 - .../BaseMemoryLibRepStr/CompareMemWrapper.c | 66 - .../BaseMemoryLibRepStr/CopyMemWrapper.c | 63 - .../BaseMemoryLibRepStr/Ia32/CompareMem.S | 55 - .../BaseMemoryLibRepStr/Ia32/CompareMem.nasm | 57 - .../BaseMemoryLibRepStr/Ia32/CopyMem.S | 65 - .../BaseMemoryLibRepStr/Ia32/CopyMem.nasm | 64 - .../Ia32/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibRepStr/Ia32/ScanMem16.S | 54 - .../BaseMemoryLibRepStr/Ia32/ScanMem16.nasm | 56 - .../BaseMemoryLibRepStr/Ia32/ScanMem32.S | 54 - .../BaseMemoryLibRepStr/Ia32/ScanMem32.nasm | 56 - .../BaseMemoryLibRepStr/Ia32/ScanMem64.S | 63 - .../BaseMemoryLibRepStr/Ia32/ScanMem64.nasm | 65 - .../BaseMemoryLibRepStr/Ia32/ScanMem8.S | 54 - .../BaseMemoryLibRepStr/Ia32/ScanMem8.nasm | 56 - .../Library/BaseMemoryLibRepStr/Ia32/SetMem.S | 46 - .../BaseMemoryLibRepStr/Ia32/SetMem.nasm | 44 - .../BaseMemoryLibRepStr/Ia32/SetMem16.S | 43 - .../BaseMemoryLibRepStr/Ia32/SetMem16.nasm | 44 - .../BaseMemoryLibRepStr/Ia32/SetMem32.S | 43 - .../BaseMemoryLibRepStr/Ia32/SetMem32.nasm | 44 - .../BaseMemoryLibRepStr/Ia32/SetMem64.S | 46 - .../BaseMemoryLibRepStr/Ia32/SetMem64.nasm | 48 - .../BaseMemoryLibRepStr/Ia32/ZeroMem.S | 49 - .../BaseMemoryLibRepStr/Ia32/ZeroMem.nasm | 49 - .../BaseMemoryLibRepStr/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLibRepStr/MemLibGuid.c | 171 - .../BaseMemoryLibRepStr/MemLibInternals.h | 251 - .../BaseMemoryLibRepStr/ScanMem16Wrapper.c | 67 - .../BaseMemoryLibRepStr/ScanMem32Wrapper.c | 66 - .../BaseMemoryLibRepStr/ScanMem64Wrapper.c | 67 - .../BaseMemoryLibRepStr/ScanMem8Wrapper.c | 99 - .../BaseMemoryLibRepStr/SetMem16Wrapper.c | 64 - .../BaseMemoryLibRepStr/SetMem32Wrapper.c | 64 - .../BaseMemoryLibRepStr/SetMem64Wrapper.c | 64 - .../BaseMemoryLibRepStr/SetMemWrapper.c | 91 - .../BaseMemoryLibRepStr/X64/CompareMem.S | 59 - .../BaseMemoryLibRepStr/X64/CompareMem.nasm | 58 - .../Library/BaseMemoryLibRepStr/X64/CopyMem.S | 66 - .../BaseMemoryLibRepStr/X64/CopyMem.nasm | 65 - .../BaseMemoryLibRepStr/X64/IsZeroBuffer.nasm | 55 - .../BaseMemoryLibRepStr/X64/ScanMem16.S | 56 - .../BaseMemoryLibRepStr/X64/ScanMem16.nasm | 55 - .../BaseMemoryLibRepStr/X64/ScanMem32.S | 56 - .../BaseMemoryLibRepStr/X64/ScanMem32.nasm | 55 - .../BaseMemoryLibRepStr/X64/ScanMem64.S | 56 - .../BaseMemoryLibRepStr/X64/ScanMem64.nasm | 55 - .../BaseMemoryLibRepStr/X64/ScanMem8.S | 56 - .../BaseMemoryLibRepStr/X64/ScanMem8.nasm | 55 - .../Library/BaseMemoryLibRepStr/X64/SetMem.S | 47 - .../BaseMemoryLibRepStr/X64/SetMem.nasm | 46 - .../BaseMemoryLibRepStr/X64/SetMem16.S | 47 - .../BaseMemoryLibRepStr/X64/SetMem16.nasm | 46 - .../BaseMemoryLibRepStr/X64/SetMem32.S | 47 - .../BaseMemoryLibRepStr/X64/SetMem32.nasm | 46 - .../BaseMemoryLibRepStr/X64/SetMem64.S | 46 - .../BaseMemoryLibRepStr/X64/SetMem64.nasm | 45 - .../Library/BaseMemoryLibRepStr/X64/ZeroMem.S | 50 - .../BaseMemoryLibRepStr/X64/ZeroMem.nasm | 49 - .../BaseMemoryLibRepStr/ZeroMemWrapper.c | 56 - .../BaseMemoryLibSse2/BaseMemoryLibSse2.inf | 126 - .../BaseMemoryLibSse2/BaseMemoryLibSse2.uni | 21 - .../BaseMemoryLibSse2/CompareMemWrapper.c | 66 - .../BaseMemoryLibSse2/CopyMemWrapper.c | 63 - .../BaseMemoryLibSse2/Ia32/CompareMem.S | 55 - .../BaseMemoryLibSse2/Ia32/CompareMem.nasm | 57 - .../Library/BaseMemoryLibSse2/Ia32/CopyMem.S | 85 - .../BaseMemoryLibSse2/Ia32/CopyMem.nasm | 84 - .../BaseMemoryLibSse2/Ia32/IsZeroBuffer.nasm | 74 - .../BaseMemoryLibSse2/Ia32/ScanMem16.S | 52 - .../BaseMemoryLibSse2/Ia32/ScanMem16.nasm | 54 - .../BaseMemoryLibSse2/Ia32/ScanMem32.S | 52 - .../BaseMemoryLibSse2/Ia32/ScanMem32.nasm | 54 - .../BaseMemoryLibSse2/Ia32/ScanMem64.S | 61 - .../BaseMemoryLibSse2/Ia32/ScanMem64.nasm | 63 - .../Library/BaseMemoryLibSse2/Ia32/ScanMem8.S | 52 - .../BaseMemoryLibSse2/Ia32/ScanMem8.nasm | 54 - .../Library/BaseMemoryLibSse2/Ia32/SetMem.S | 76 - .../BaseMemoryLibSse2/Ia32/SetMem.nasm | 73 - .../Library/BaseMemoryLibSse2/Ia32/SetMem16.S | 69 - .../BaseMemoryLibSse2/Ia32/SetMem16.nasm | 69 - .../Library/BaseMemoryLibSse2/Ia32/SetMem32.S | 68 - .../BaseMemoryLibSse2/Ia32/SetMem32.nasm | 68 - .../Library/BaseMemoryLibSse2/Ia32/SetMem64.S | 58 - .../BaseMemoryLibSse2/Ia32/SetMem64.nasm | 60 - .../Library/BaseMemoryLibSse2/Ia32/ZeroMem.S | 65 - .../BaseMemoryLibSse2/Ia32/ZeroMem.nasm | 65 - .../BaseMemoryLibSse2/IsZeroBufferWrapper.c | 54 - .../Library/BaseMemoryLibSse2/MemLibGuid.c | 171 - .../BaseMemoryLibSse2/MemLibInternals.h | 251 - .../BaseMemoryLibSse2/ScanMem16Wrapper.c | 67 - .../BaseMemoryLibSse2/ScanMem32Wrapper.c | 66 - .../BaseMemoryLibSse2/ScanMem64Wrapper.c | 67 - .../BaseMemoryLibSse2/ScanMem8Wrapper.c | 99 - .../BaseMemoryLibSse2/SetMem16Wrapper.c | 64 - .../BaseMemoryLibSse2/SetMem32Wrapper.c | 64 - .../BaseMemoryLibSse2/SetMem64Wrapper.c | 64 - .../Library/BaseMemoryLibSse2/SetMemWrapper.c | 91 - .../BaseMemoryLibSse2/X64/CompareMem.S | 59 - .../BaseMemoryLibSse2/X64/CompareMem.nasm | 58 - .../Library/BaseMemoryLibSse2/X64/CopyMem.S | 83 - .../BaseMemoryLibSse2/X64/CopyMem.nasm | 83 - .../BaseMemoryLibSse2/X64/IsZeroBuffer.nasm | 76 - .../Library/BaseMemoryLibSse2/X64/ScanMem16.S | 56 - .../BaseMemoryLibSse2/X64/ScanMem16.nasm | 55 - .../Library/BaseMemoryLibSse2/X64/ScanMem32.S | 56 - .../BaseMemoryLibSse2/X64/ScanMem32.nasm | 55 - .../Library/BaseMemoryLibSse2/X64/ScanMem64.S | 56 - .../BaseMemoryLibSse2/X64/ScanMem64.nasm | 55 - .../Library/BaseMemoryLibSse2/X64/ScanMem8.S | 56 - .../BaseMemoryLibSse2/X64/ScanMem8.nasm | 55 - .../Library/BaseMemoryLibSse2/X64/SetMem.S | 72 - .../Library/BaseMemoryLibSse2/X64/SetMem.nasm | 71 - .../Library/BaseMemoryLibSse2/X64/SetMem16.S | 70 - .../BaseMemoryLibSse2/X64/SetMem16.nasm | 69 - .../Library/BaseMemoryLibSse2/X64/SetMem32.S | 69 - .../BaseMemoryLibSse2/X64/SetMem32.nasm | 68 - .../Library/BaseMemoryLibSse2/X64/SetMem64.S | 60 - .../BaseMemoryLibSse2/X64/SetMem64.nasm | 59 - .../Library/BaseMemoryLibSse2/X64/ZeroMem.S | 65 - .../BaseMemoryLibSse2/X64/ZeroMem.nasm | 65 - .../BaseMemoryLibSse2/ZeroMemWrapper.c | 56 - .../BaseOrderedCollectionRedBlackTreeLib.c | 1454 ----- .../BaseOrderedCollectionRedBlackTreeLib.inf | 51 - .../BaseOrderedCollectionRedBlackTreeLib.uni | 31 - .../Library/BasePcdLibNull/BasePcdLibNull.inf | 42 - .../Library/BasePcdLibNull/BasePcdLibNull.uni | 22 - .../MdePkg/Library/BasePcdLibNull/PcdLib.c | 1480 ----- .../Library/BasePciCf8Lib/BasePciCf8Lib.inf | 42 - .../Library/BasePciCf8Lib/BasePciCf8Lib.uni | 22 - .../MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c | 1784 ----- .../BasePciExpressLib/BasePciExpressLib.inf | 46 - .../BasePciExpressLib/BasePciExpressLib.uni | 22 - .../Library/BasePciExpressLib/PciExpressLib.c | 1419 ---- .../Library/BasePciLibCf8/BasePciLibCf8.inf | 40 - .../Library/BasePciLibCf8/BasePciLibCf8.uni | 22 - .../MdePkg/Library/BasePciLibCf8/PciLib.c | 1138 ---- .../BasePciLibPciExpress.inf | 41 - .../BasePciLibPciExpress.uni | 22 - .../Library/BasePciLibPciExpress/PciLib.c | 1138 ---- .../BasePciSegmentInfoLibNull.inf | 41 - .../BasePciSegmentInfoLibNull.uni | 20 - .../PciSegmentInfoLib.c | 38 - .../BasePciSegmentLibPci.inf | 43 - .../BasePciSegmentLibPci.uni | 21 - .../BasePciSegmentLibPci/PciSegmentLib.c | 1290 ---- .../BasePeCoffExtraActionLibNull.inf | 38 - .../PeCoffExtraActionLib.c | 54 - .../PeCoffExtraActionLibNull.uni | 21 - .../BasePeCoffGetEntryPointLib.inf | 40 - .../BasePeCoffGetEntryPointLib.uni | 21 - .../PeCoffGetEntryPoint.c | 388 -- .../BasePeCoffLib/Arm/PeCoffLoaderEx.c | 250 - .../MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 1949 ------ .../Library/BasePeCoffLib/BasePeCoffLib.inf | 56 - .../Library/BasePeCoffLib/BasePeCoffLib.uni | 29 - .../BasePeCoffLib/BasePeCoffLibInternals.h | 133 - .../Library/BasePeCoffLib/PeCoffLoaderEx.c | 90 - .../BasePerformanceLibNull.inf | 45 - .../BasePerformanceLibNull.uni | 21 - .../BasePerformanceLibNull/PerformanceLib.c | 361 - .../BasePostCodeLibDebug.inf | 50 - .../BasePostCodeLibDebug.uni | 22 - .../Library/BasePostCodeLibDebug/PostCode.c | 127 - .../BasePostCodeLibPort80.inf | 48 - .../BasePostCodeLibPort80.uni | 21 - .../Library/BasePostCodeLibPort80/PostCode.c | 145 - .../Library/BasePrintLib/BasePrintLib.inf | 50 - .../Library/BasePrintLib/BasePrintLib.uni | 21 - .../MdePkg/Library/BasePrintLib/PrintLib.c | 961 --- .../Library/BasePrintLib/PrintLibInternal.c | 1269 ---- .../Library/BasePrintLib/PrintLibInternal.h | 277 - .../BaseReportStatusCodeLib.c | 392 -- .../BaseReportStatusCodeLibNull.inf | 39 - .../BaseReportStatusCodeLibNull.uni | 21 - .../edk2/MdePkg/Library/BaseRngLib/BaseRng.c | 189 - .../MdePkg/Library/BaseRngLib/BaseRngLib.inf | 41 - .../MdePkg/Library/BaseRngLib/BaseRngLib.uni | 22 - .../BaseS3BootScriptLibNull.inf | 43 - .../BaseS3BootScriptLibNull.uni | 24 - .../BaseS3BootScriptLibNull/BootScriptLib.c | 568 -- .../Library/BaseS3IoLib/BaseS3IoLib.inf | 46 - .../Library/BaseS3IoLib/BaseS3IoLib.uni | 23 - .../edk2/MdePkg/Library/BaseS3IoLib/S3IoLib.c | 3312 ---------- .../Library/BaseS3PciLib/BaseS3PciLib.inf | 47 - .../Library/BaseS3PciLib/BaseS3PciLib.uni | 23 - .../MdePkg/Library/BaseS3PciLib/S3PciLib.c | 1269 ---- .../BaseS3PciSegmentLib.inf | 45 - .../BaseS3PciSegmentLib.uni | 23 - .../BaseS3PciSegmentLib/S3PciSegmentLib.c | 1249 ---- .../Library/BaseS3SmbusLib/BaseS3SmbusLib.inf | 47 - .../Library/BaseS3SmbusLib/BaseS3SmbusLib.uni | 23 - .../Library/BaseS3SmbusLib/S3SmbusLib.c | 502 -- .../Library/BaseS3StallLib/BaseS3StallLib.inf | 45 - .../Library/BaseS3StallLib/BaseS3StallLib.uni | 23 - .../Library/BaseS3StallLib/S3StallLib.c | 52 - .../Library/BaseSafeIntLib/BaseSafeIntLib.inf | 62 - .../Library/BaseSafeIntLib/SafeIntLib.c | 4165 ------------ .../Library/BaseSafeIntLib/SafeIntLib32.c | 555 -- .../Library/BaseSafeIntLib/SafeIntLib64.c | 508 -- .../Library/BaseSafeIntLib/SafeIntLibEbc.c | 614 -- .../BaseSerialPortLibNull.c | 197 - .../BaseSerialPortLibNull.inf | 36 - .../BaseSerialPortLibNull.uni | 21 - .../BaseSmbusLibNull/BaseSmbusLibNull.c | 544 -- .../BaseSmbusLibNull/BaseSmbusLibNull.inf | 35 - .../BaseSmbusLibNull/BaseSmbusLibNull.uni | 21 - .../BaseStackCheckLib/BaseStackCheckGcc.c | 55 - .../BaseStackCheckLib/BaseStackCheckLib.inf | 45 - .../BaseStackCheckLib/BaseStackCheckLib.uni | 21 - .../BaseStackCheckLib/BaseStackCheckNull.c | 15 - .../AArch64/Synchronization.S | 205 - .../AArch64/Synchronization.asm | 205 - .../Arm/Synchronization.S | 213 - .../Arm/Synchronization.asm | 214 - .../BaseSynchronizationLib.inf | 97 - .../BaseSynchronizationLib.uni | 22 - .../BaseSynchronizationLibInternals.h | 151 - .../Ebc/Synchronization.c | 147 - .../BaseSynchronizationLib/Ia32/GccInline.c | 207 - .../Ia32/InterlockedCompareExchange16.c | 51 - .../Ia32/InterlockedCompareExchange16.nasm | 43 - .../Ia32/InterlockedCompareExchange32.c | 50 - .../Ia32/InterlockedCompareExchange32.nasm | 42 - .../Ia32/InterlockedCompareExchange64.c | 50 - .../Ia32/InterlockedCompareExchange64.nasm | 48 - .../Ia32/InterlockedDecrement.nasm | 39 - .../Ia32/InterlockedIncrement.nasm | 40 - .../Ia32/InternalGetSpinLockProperties.c | 64 - .../InterlockedDecrementMsc.c | 46 - .../InterlockedIncrementMsc.c | 46 - .../BaseSynchronizationLib/Synchronization.c | 416 -- .../SynchronizationGcc.c | 432 -- .../SynchronizationMsc.c | 434 -- .../BaseSynchronizationLib/X64/GccInline.c | 206 - .../X64/InterlockedCompareExchange16.c | 54 - .../X64/InterlockedCompareExchange16.nasm | 42 - .../X64/InterlockedCompareExchange32.c | 54 - .../X64/InterlockedCompareExchange32.nasm | 41 - .../X64/InterlockedCompareExchange64.c | 53 - .../X64/InterlockedCompareExchange64.nasm | 41 - .../X64/InterlockedDecrement.nasm | 39 - .../X64/InterlockedIncrement.nasm | 40 - .../BaseTimerLibNullTemplate.inf | 45 - .../BaseTimerLibNullTemplate.uni | 24 - .../BaseTimerLibNullTemplate/TimerLibNull.c | 134 - .../BaseUefiDecompressLib.c | 822 --- .../BaseUefiDecompressLib.inf | 43 - .../BaseUefiDecompressLib.uni | 21 - .../BaseUefiDecompressLibInternals.h | 211 - .../DxeCoreEntryPoint/DxeCoreEntryPoint.c | 79 - .../DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 41 - .../DxeCoreEntryPoint/DxeCoreEntryPoint.uni | 21 - .../Library/DxeCoreHobLib/DxeCoreHobLib.inf | 44 - .../Library/DxeCoreHobLib/DxeCoreHobLib.uni | 22 - .../MdePkg/Library/DxeCoreHobLib/HobLib.c | 603 -- .../DxeExtractGuidedSectionLib.c | 455 -- .../DxeExtractGuidedSectionLib.inf | 47 - .../DxeExtractGuidedSectionLib.uni | 21 - .../MdePkg/Library/DxeHobLib/DxeHobLib.inf | 48 - .../MdePkg/Library/DxeHobLib/DxeHobLib.uni | 22 - .../edk2/MdePkg/Library/DxeHobLib/HobLib.c | 637 -- .../MdePkg/Library/DxeHstiLib/DxeHstiLib.inf | 48 - .../MdePkg/Library/DxeHstiLib/DxeHstiLib.uni | 19 - .../edk2/MdePkg/Library/DxeHstiLib/HstiAip.c | 175 - .../edk2/MdePkg/Library/DxeHstiLib/HstiDxe.c | 612 -- .../edk2/MdePkg/Library/DxeHstiLib/HstiDxe.h | 65 - .../DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h | 172 - .../Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf | 53 - .../Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni | 22 - .../Library/DxeIoLibCpuIo2/IoHighLevel.c | 2307 ------- .../MdePkg/Library/DxeIoLibCpuIo2/IoLib.c | 869 --- .../Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c | 413 -- .../edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c | 1626 ----- .../MdePkg/Library/DxePcdLib/DxePcdLib.inf | 68 - .../MdePkg/Library/DxePcdLib/DxePcdLib.uni | 31 - .../DxeRuntimeDebugLibSerialPort/DebugLib.c | 346 - .../DxeRuntimeDebugLibSerialPort.inf | 55 - .../DxeRuntimeDebugLibSerialPort.uni | 21 - .../DxeRuntimePciExpressLib.inf | 58 - .../DxeRuntimePciExpressLib.uni | 26 - .../DxeRuntimePciExpressLib/PciExpressLib.c | 1660 ----- .../MdePkg/Library/DxeServicesLib/Allocate.c | 54 - .../Library/DxeServicesLib/DxeServicesLib.c | 1098 ---- .../Library/DxeServicesLib/DxeServicesLib.inf | 65 - .../Library/DxeServicesLib/DxeServicesLib.uni | 23 - .../Library/DxeServicesLib/X64/Allocate.c | 69 - .../DxeServicesTableLib/DxeServicesTableLib.c | 68 - .../DxeServicesTableLib.inf | 49 - .../DxeServicesTableLib.uni | 22 - .../MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c | 104 - .../Library/DxeSmbusLib/DxeSmbusLib.inf | 51 - .../Library/DxeSmbusLib/DxeSmbusLib.uni | 21 - .../Library/DxeSmbusLib/InternalSmbusLib.h | 85 - .../MdePkg/Library/DxeSmbusLib/SmbusLib.c | 592 -- .../MmServicesTableLib/MmServicesTableLib.c | 63 - .../MmServicesTableLib/MmServicesTableLib.inf | 45 - .../MmServicesTableLib/MmServicesTableLib.uni | 23 - .../BasePciSegmentLib.c | 71 - .../BasePciSegmentLibSegmentInfo.inf | 46 - .../BasePciSegmentLibSegmentInfo.uni | 21 - .../DxeRuntimePciSegmentLib.c | 321 - .../DxeRuntimePciSegmentLibSegmentInfo.inf | 55 - .../DxeRuntimePciSegmentLibSegmentInfo.uni | 21 - .../PciSegmentLibCommon.c | 1375 ---- .../PciSegmentLibCommon.h | 57 - .../PeiCoreEntryPoint/PeiCoreEntryPoint.c | 101 - .../PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 39 - .../PeiCoreEntryPoint/PeiCoreEntryPoint.uni | 21 - .../PeiDxePostCodeLibReportStatusCode.inf | 45 - .../PeiDxePostCodeLibReportStatusCode.uni | 21 - .../PostCode.c | 159 - .../PeiExtractGuidedSectionLib.c | 519 -- .../PeiExtractGuidedSectionLib.inf | 48 - .../PeiExtractGuidedSectionLib.uni | 21 - .../edk2/MdePkg/Library/PeiHobLib/HobLib.c | 858 --- .../MdePkg/Library/PeiHobLib/PeiHobLib.inf | 56 - .../MdePkg/Library/PeiHobLib/PeiHobLib.uni | 21 - .../Library/PeiIoLibCpuIo/IoHighLevel.c | 2356 ------- .../edk2/MdePkg/Library/PeiIoLibCpuIo/IoLib.c | 835 --- .../Library/PeiIoLibCpuIo/IoLibMmioBuffer.c | 418 -- .../Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf | 48 - .../Library/PeiIoLibCpuIo/PeiIoLibCpuIo.uni | 22 - .../MemoryAllocationLib.c | 848 --- .../PeiMemoryAllocationLib.inf | 45 - .../PeiMemoryAllocationLib.uni | 22 - .../Library/PeiMemoryLib/CompareMemWrapper.c | 66 - .../Library/PeiMemoryLib/CopyMemWrapper.c | 63 - .../PeiMemoryLib/IsZeroBufferWrapper.c | 54 - .../edk2/MdePkg/Library/PeiMemoryLib/MemLib.c | 71 - .../Library/PeiMemoryLib/MemLibGeneric.c | 289 - .../MdePkg/Library/PeiMemoryLib/MemLibGuid.c | 171 - .../Library/PeiMemoryLib/MemLibInternals.h | 249 - .../Library/PeiMemoryLib/PeiMemoryLib.inf | 60 - .../Library/PeiMemoryLib/PeiMemoryLib.uni | 22 - .../Library/PeiMemoryLib/ScanMem16Wrapper.c | 67 - .../Library/PeiMemoryLib/ScanMem32Wrapper.c | 66 - .../Library/PeiMemoryLib/ScanMem64Wrapper.c | 67 - .../Library/PeiMemoryLib/ScanMem8Wrapper.c | 99 - .../Library/PeiMemoryLib/SetMem16Wrapper.c | 64 - .../Library/PeiMemoryLib/SetMem32Wrapper.c | 64 - .../Library/PeiMemoryLib/SetMem64Wrapper.c | 64 - .../Library/PeiMemoryLib/SetMemWrapper.c | 91 - .../Library/PeiMemoryLib/ZeroMemWrapper.c | 56 - .../edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 1625 ----- .../MdePkg/Library/PeiPcdLib/PeiPcdLib.inf | 66 - .../MdePkg/Library/PeiPcdLib/PeiPcdLib.uni | 33 - .../MdePkg/Library/PeiPciLibPciCfg2/PciLib.c | 1422 ---- .../PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf | 56 - .../PeiPciLibPciCfg2/PeiPciLibPciCfg2.uni | 25 - .../PeiPciSegmentLibPciCfg2/PciSegmentLib.c | 1414 ---- .../PeiPciSegmentLibPciCfg2.inf | 53 - .../PeiPciSegmentLibPciCfg2.uni | 24 - .../PeiResourcePublicationLib.c | 58 - .../PeiResourcePublicationLib.inf | 42 - .../PeiResourcePublicationLib.uni | 21 - .../Library/PeiServicesLib/PeiServicesLib.c | 817 --- .../Library/PeiServicesLib/PeiServicesLib.inf | 48 - .../Library/PeiServicesLib/PeiServicesLib.uni | 21 - .../PeiServicesTablePointer.c | 116 - .../PeiServicesTablePointerLib.inf | 44 - .../PeiServicesTablePointerLib.uni | 23 - .../PeiServicesTablePointer.c | 131 - .../PeiServicesTablePointerLibIdt.inf | 43 - .../PeiServicesTablePointerLibIdt.uni | 22 - .../PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h | 80 - .../PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c | 95 - .../PeiSmbusLibSmbus2Ppi.inf | 50 - .../PeiSmbusLibSmbus2Ppi.uni | 21 - .../Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c | 584 -- .../Library/PeimEntryPoint/PeimEntryPoint.c | 81 - .../Library/PeimEntryPoint/PeimEntryPoint.inf | 39 - .../Library/PeimEntryPoint/PeimEntryPoint.uni | 21 - .../SecPeiDxeTimerLibCpu.inf | 59 - .../SecPeiDxeTimerLibCpu.uni | 31 - .../SecPeiDxeTimerLibCpu/X86TimerLib.c | 375 -- .../SmiHandlerProfileLibNull.c | 78 - .../SmiHandlerProfileLibNull.inf | 36 - .../SmiHandlerProfileLibNull.uni | 21 - .../edk2/MdePkg/Library/SmmIoLib/SmmIoLib.c | 331 - .../edk2/MdePkg/Library/SmmIoLib/SmmIoLib.inf | 53 - .../edk2/MdePkg/Library/SmmIoLib/SmmIoLib.uni | 23 - .../Library/SmmIoLibSmmCpuIo2/IoHighLevel.c | 2312 ------- .../MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c | 803 --- .../SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c | 417 -- .../SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h | 118 - .../SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf | 49 - .../SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.uni | 22 - .../MdePkg/Library/SmmLibNull/SmmLibNull.c | 103 - .../MdePkg/Library/SmmLibNull/SmmLibNull.inf | 37 - .../MdePkg/Library/SmmLibNull/SmmLibNull.uni | 21 - .../edk2/MdePkg/Library/SmmMemLib/SmmMemLib.c | 658 -- .../MdePkg/Library/SmmMemLib/SmmMemLib.inf | 62 - .../MdePkg/Library/SmmMemLib/SmmMemLib.uni | 24 - .../MemoryAllocationLib.c | 982 --- .../SmmMemoryAllocationLib.inf | 50 - .../SmmMemoryAllocationLib.uni | 22 - .../Library/SmmPciExpressLib/PciExpressLib.c | 1430 ---- .../SmmPciExpressLib/SmmPciExpressLib.inf | 42 - .../Library/SmmPciLibPciRootBridgeIo/PciLib.c | 1434 ---- .../SmmPciLibPciRootBridgeIo.inf | 55 - .../SmmPciLibPciRootBridgeIo.uni | 25 - .../SmmPeriodicSmiLib/SmmPeriodicSmiLib.c | 1175 ---- .../SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf | 52 - .../SmmPeriodicSmiLib/SmmPeriodicSmiLib.uni | 21 - .../SmmServicesTableLib/SmmServicesTableLib.c | 85 - .../SmmServicesTableLib.inf | 45 - .../SmmServicesTableLib.uni | 21 - .../StandaloneMmDriverEntryPoint.c | 87 - .../StandaloneMmDriverEntryPoint.inf | 43 - .../StandaloneMmDriverEntryPoint.uni | 22 - .../StandaloneMmServicesTableLib.c | 41 - .../StandaloneMmServicesTableLib.inf | 39 - .../StandaloneMmServicesTableLib.uni | 20 - .../ApplicationEntryPoint.c | 121 - .../UefiApplicationEntryPoint.inf | 40 - .../UefiApplicationEntryPoint.uni | 21 - .../UefiBootServicesTableLib.c | 66 - .../UefiBootServicesTableLib.inf | 40 - .../UefiBootServicesTableLib.uni | 21 - .../Library/UefiDebugLibConOut/DebugLib.c | 278 - .../UefiDebugLibConOut/UefiDebugLibConOut.inf | 54 - .../UefiDebugLibConOut/UefiDebugLibConOut.uni | 21 - .../UefiDebugLibDebugPortProtocol/DebugLib.c | 331 - .../UefiDebugLibDebugPortProtocol.inf | 57 - .../UefiDebugLibDebugPortProtocol.uni | 21 - .../Library/UefiDebugLibStdErr/DebugLib.c | 279 - .../UefiDebugLibStdErr/UefiDebugLibStdErr.inf | 52 - .../UefiDebugLibStdErr/UefiDebugLibStdErr.uni | 21 - .../UefiDevicePathLib/DevicePathFromText.c | 3672 ----------- .../UefiDevicePathLib/DevicePathToText.c | 2461 ------- .../UefiDevicePathLib/DevicePathUtilities.c | 903 --- .../UefiDevicePathLib/UefiDevicePathLib.c | 360 - .../UefiDevicePathLib/UefiDevicePathLib.h | 457 -- .../UefiDevicePathLib/UefiDevicePathLib.inf | 79 - .../UefiDevicePathLib/UefiDevicePathLib.uni | 21 - ...iDevicePathLibOptionalDevicePathProtocol.c | 484 -- ...evicePathLibOptionalDevicePathProtocol.inf | 89 - ...evicePathLibOptionalDevicePathProtocol.uni | 23 - .../UefiDevicePathLib.c | 871 --- .../UefiDevicePathLibDevicePathProtocol.inf | 61 - .../UefiDevicePathLibDevicePathProtocol.uni | 22 - .../UefiDriverEntryPoint/DriverEntryPoint.c | 173 - .../UefiDriverEntryPoint.inf | 67 - .../UefiDriverEntryPoint.uni | 21 - .../UefiFileHandleLib/UefiFileHandleLib.c | 1272 ---- .../UefiFileHandleLib/UefiFileHandleLib.inf | 48 - .../UefiFileHandleLib/UefiFileHandleLib.uni | 26 - .../edk2/MdePkg/Library/UefiLib/Acpi.c | 428 -- .../edk2/MdePkg/Library/UefiLib/Console.c | 572 -- .../MdePkg/Library/UefiLib/UefiDriverModel.c | 2026 ------ .../edk2/MdePkg/Library/UefiLib/UefiLib.c | 2001 ------ .../edk2/MdePkg/Library/UefiLib/UefiLib.inf | 93 - .../edk2/MdePkg/Library/UefiLib/UefiLib.uni | 25 - .../MdePkg/Library/UefiLib/UefiLibInternal.h | 44 - .../MdePkg/Library/UefiLib/UefiLibPrint.c | 822 --- .../MdePkg/Library/UefiLib/UefiNotTiano.c | 336 - .../MemoryAllocationLib.c | 821 --- .../UefiMemoryAllocationLib.inf | 42 - .../UefiMemoryAllocationLib.uni | 22 - .../Library/UefiMemoryLib/CompareMemWrapper.c | 66 - .../Library/UefiMemoryLib/CopyMemWrapper.c | 63 - .../UefiMemoryLib/IsZeroBufferWrapper.c | 54 - .../MdePkg/Library/UefiMemoryLib/MemLib.c | 63 - .../Library/UefiMemoryLib/MemLibGeneric.c | 289 - .../MdePkg/Library/UefiMemoryLib/MemLibGuid.c | 171 - .../Library/UefiMemoryLib/MemLibInternals.h | 249 - .../Library/UefiMemoryLib/ScanMem16Wrapper.c | 67 - .../Library/UefiMemoryLib/ScanMem32Wrapper.c | 66 - .../Library/UefiMemoryLib/ScanMem64Wrapper.c | 67 - .../Library/UefiMemoryLib/ScanMem8Wrapper.c | 99 - .../Library/UefiMemoryLib/SetMem16Wrapper.c | 64 - .../Library/UefiMemoryLib/SetMem32Wrapper.c | 64 - .../Library/UefiMemoryLib/SetMem64Wrapper.c | 64 - .../Library/UefiMemoryLib/SetMemWrapper.c | 91 - .../Library/UefiMemoryLib/UefiMemoryLib.inf | 60 - .../Library/UefiMemoryLib/UefiMemoryLib.uni | 22 - .../Library/UefiMemoryLib/ZeroMemWrapper.c | 56 - .../UefiPciLibPciRootBridgeIo/PciLib.c | 1434 ---- .../UefiPciLibPciRootBridgeIo.inf | 57 - .../UefiPciLibPciRootBridgeIo.uni | 25 - .../PciSegmentLib.c | 1491 ----- .../PciSegmentLib.h | 58 - .../UefiPciSegmentLibPciRootBridgeIo.inf | 60 - .../UefiPciSegmentLibPciRootBridgeIo.uni | 25 - .../Library/UefiRuntimeLib/RuntimeLib.c | 843 --- .../Library/UefiRuntimeLib/UefiRuntimeLib.inf | 51 - .../Library/UefiRuntimeLib/UefiRuntimeLib.uni | 23 - .../UefiRuntimeServicesTableLib.c | 49 - .../UefiRuntimeServicesTableLib.inf | 41 - .../UefiRuntimeServicesTableLib.uni | 21 - .../MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 2067 ------ .../Library/UefiScsiLib/UefiScsiLib.inf | 47 - .../Library/UefiScsiLib/UefiScsiLib.uni | 22 - .../edk2/MdePkg/Library/UefiUsbLib/Hid.c | 488 -- .../MdePkg/Library/UefiUsbLib/UefiUsbLib.inf | 48 - .../MdePkg/Library/UefiUsbLib/UefiUsbLib.uni | 22 - .../Library/UefiUsbLib/UefiUsbLibInternal.h | 29 - .../MdePkg/Library/UefiUsbLib/UsbDxeLib.c | 672 -- Voyager/Voyager/edk2/MdePkg/MdePkg.dec | 2307 ------- Voyager/Voyager/edk2/MdePkg/MdePkg.dsc | 158 - Voyager/Voyager/edk2/MdePkg/MdePkg.uni | 413 -- Voyager/Voyager/edk2/MdePkg/MdePkgExtra.uni | 20 - .../Application/Shell/ConsoleLogger.c | 1243 ---- .../Application/Shell/ConsoleLogger.h | 323 - .../Application/Shell/ConsoleWrappers.c | 514 -- .../Application/Shell/ConsoleWrappers.h | 80 - .../Application/Shell/FileHandleInternal.h | 65 - .../Application/Shell/FileHandleWrappers.c | 2153 ------ .../Application/Shell/FileHandleWrappers.h | 93 - .../edk2/ShellPkg/Application/Shell/Shell.c | 3189 --------- .../edk2/ShellPkg/Application/Shell/Shell.h | 396 -- .../edk2/ShellPkg/Application/Shell/Shell.inf | 110 - .../edk2/ShellPkg/Application/Shell/Shell.uni | 58 - .../ShellPkg/Application/Shell/ShellEnvVar.c | 578 -- .../ShellPkg/Application/Shell/ShellEnvVar.h | 288 - .../Application/Shell/ShellManParser.c | 754 --- .../Application/Shell/ShellManParser.h | 84 - .../Shell/ShellParametersProtocol.c | 1417 ---- .../Shell/ShellParametersProtocol.h | 215 - .../Application/Shell/ShellProtocol.c | 3835 ----------- .../Application/Shell/ShellProtocol.h | 944 --- .../Application/ShellCTestApp/README.txt | 5 - .../Application/ShellCTestApp/ShellCTestApp.c | 51 - .../ShellCTestApp/ShellCTestApp.inf | 39 - .../Application/ShellCTestApp/TestArgv.log | Bin 3320 -> 0 bytes .../Application/ShellCTestApp/TestArgv.nsh | 64 - .../Application/ShellExecTestApp/SA.c | 38 - .../Application/ShellExecTestApp/SA.inf | 41 - .../ShellSortTestApp/ShellSortTestApp.c | 83 - .../ShellSortTestApp/ShellSortTestApp.inf | 42 - .../DynamicCommand/DpDynamicCommand/Dp.c | 972 --- .../DynamicCommand/DpDynamicCommand/Dp.h | 146 - .../DynamicCommand/DpDynamicCommand/Dp.uni | 134 - .../DynamicCommand/DpDynamicCommand/DpApp.c | 53 - .../DynamicCommand/DpDynamicCommand/DpApp.inf | 69 - .../DpDynamicCommand/DpDynamicCommand.c | 131 - .../DpDynamicCommand/DpDynamicCommand.inf | 73 - .../DpDynamicCommand/DpInternal.h | 321 - .../DynamicCommand/DpDynamicCommand/DpTrace.c | 910 --- .../DpDynamicCommand/DpUtilities.c | 428 -- .../DpDynamicCommand/Literals.c | 28 - .../DpDynamicCommand/Literals.h | 32 - .../DynamicCommand/TftpDynamicCommand/Tftp.c | 1135 ---- .../DynamicCommand/TftpDynamicCommand/Tftp.h | 75 - .../TftpDynamicCommand/Tftp.uni | 100 - .../TftpDynamicCommand/TftpApp.c | 54 - .../TftpDynamicCommand/TftpApp.inf | 59 - .../TftpDynamicCommand/TftpDynamicCommand.c | 132 - .../TftpDynamicCommand/TftpDynamicCommand.inf | 64 - .../UefiHandleParsingLib.c | 3745 ----------- .../UefiHandleParsingLib.h | 300 - .../UefiHandleParsingLib.inf | 356 - .../UefiHandleParsingLib.uni | 529 -- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 692 -- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 815 --- .../AcpiTableParser.c | 220 - .../AcpiTableParser.h | 133 - .../UefiShellAcpiViewCommandLib/AcpiView.c | 627 -- .../UefiShellAcpiViewCommandLib/AcpiView.h | 116 - .../Parsers/Bgrt/BgrtParser.c | 71 - .../Parsers/Dbg2/Dbg2Parser.c | 250 - .../Parsers/Dsdt/DsdtParser.c | 48 - .../Parsers/Fadt/FadtParser.c | 289 - .../Parsers/Gtdt/GtdtParser.c | 306 - .../Parsers/Iort/IortParser.c | 723 -- .../Parsers/Madt/MadtParser.c | 324 - .../Parsers/Mcfg/McfgParser.c | 96 - .../Parsers/Pptt/PpttParser.c | 362 - .../Parsers/Rsdp/RsdpParser.c | 181 - .../Parsers/Slit/SlitParser.c | 145 - .../Parsers/Spcr/SpcrParser.c | 180 - .../Parsers/Srat/SratParser.c | 350 - .../Parsers/Ssdt/SsdtParser.c | 48 - .../Parsers/Xsdt/XsdtParser.c | 156 - .../UefiShellAcpiViewCommandLib.c | 174 - .../UefiShellAcpiViewCommandLib.h | 32 - .../UefiShellAcpiViewCommandLib.inf | 78 - .../UefiShellAcpiViewCommandLib.uni | 134 - .../UefiShellBcfgCommandLib.c | 1906 ------ .../UefiShellBcfgCommandLib.inf | 47 - .../UefiShellBcfgCommandLib.uni | 159 - .../UefiShellCEntryLib/UefiShellCEntryLib.c | 99 - .../UefiShellCEntryLib/UefiShellCEntryLib.inf | 44 - .../UefiShellCommandLib/ConsistMapping.c | 1698 ----- .../UefiShellCommandLib/UefiShellCommandLib.c | 1905 ------ .../UefiShellCommandLib/UefiShellCommandLib.h | 71 - .../UefiShellCommandLib.inf | 69 - .../Library/UefiShellDebug1CommandsLib/Comp.c | 378 -- .../UefiShellDebug1CommandsLib/Compress.c | 1388 ---- .../UefiShellDebug1CommandsLib/Compress.h | 39 - .../Library/UefiShellDebug1CommandsLib/Dblk.c | 207 - .../Library/UefiShellDebug1CommandsLib/Dmem.c | 233 - .../UefiShellDebug1CommandsLib/DmpStore.c | 865 --- .../UefiShellDebug1CommandsLib/Edit/Edit.c | 162 - .../Edit/FileBuffer.c | 3325 ---------- .../Edit/FileBuffer.h | 246 - .../Edit/MainTextEditor.c | 1980 ------ .../Edit/MainTextEditor.h | 72 - .../UefiShellDebug1CommandsLib/Edit/Misc.c | 90 - .../UefiShellDebug1CommandsLib/Edit/Misc.h | 50 - .../Edit/TextEditStrings.uni | 75 - .../Edit/TextEditor.h | 32 - .../Edit/TextEditorTypes.h | 103 - .../UefiShellDebug1CommandsLib/EditInputBar.c | 330 - .../UefiShellDebug1CommandsLib/EditInputBar.h | 87 - .../UefiShellDebug1CommandsLib/EditMenuBar.c | 216 - .../UefiShellDebug1CommandsLib/EditMenuBar.h | 119 - .../EditStatusBar.c | 230 - .../EditStatusBar.h | 102 - .../UefiShellDebug1CommandsLib/EditTitleBar.c | 207 - .../UefiShellDebug1CommandsLib/EditTitleBar.h | 74 - .../UefiShellDebug1CommandsLib/EfiCompress.c | 164 - .../EfiDecompress.c | 186 - .../HexEdit/BufferImage.c | 2475 ------- .../HexEdit/BufferImage.h | 273 - .../HexEdit/Clipboard.c | 112 - .../HexEdit/Clipboard.h | 69 - .../HexEdit/DiskImage.c | 417 -- .../HexEdit/DiskImage.h | 95 - .../HexEdit/FileImage.c | 398 -- .../HexEdit/FileImage.h | 83 - .../HexEdit/HexEdit.c | 277 - .../HexEdit/HexEditor.h | 41 - .../HexEdit/HexEditorTypes.h | 126 - .../HexEdit/HexeditStrings.uni | 76 - .../HexEdit/MainHexEditor.c | 2378 ------- .../HexEdit/MainHexEditor.h | 75 - .../HexEdit/MemImage.c | 284 - .../HexEdit/MemImage.h | 92 - .../UefiShellDebug1CommandsLib/HexEdit/Misc.c | 262 - .../UefiShellDebug1CommandsLib/HexEdit/Misc.h | 93 - .../UefiShellDebug1CommandsLib/LoadPciRom.c | 409 -- .../UefiShellDebug1CommandsLib/MemMap.c | 410 -- .../Library/UefiShellDebug1CommandsLib/Mm.c | 637 -- .../Library/UefiShellDebug1CommandsLib/Mode.c | 128 - .../Library/UefiShellDebug1CommandsLib/Pci.c | 5803 ----------------- .../Library/UefiShellDebug1CommandsLib/Pci.h | 64 - .../UefiShellDebug1CommandsLib/SerMode.c | 371 -- .../UefiShellDebug1CommandsLib/SetSize.c | 110 - .../UefiShellDebug1CommandsLib/SetVar.c | 475 -- .../SmbiosView/EventLogInfo.c | 407 -- .../SmbiosView/EventLogInfo.h | 112 - .../SmbiosView/LibSmbiosView.c | 373 -- .../SmbiosView/LibSmbiosView.h | 159 - .../SmbiosView/PrintInfo.c | 3427 ---------- .../SmbiosView/PrintInfo.h | 436 -- .../SmbiosView/QueryTable.c | 4723 -------------- .../SmbiosView/QueryTable.h | 818 --- .../SmbiosView/SmbiosView.c | 1005 --- .../SmbiosView/SmbiosView.h | 129 - .../SmbiosView/SmbiosViewStrings.uni | 506 -- .../UefiShellDebug1CommandsLib.c | 427 -- .../UefiShellDebug1CommandsLib.h | 383 -- .../UefiShellDebug1CommandsLib.inf | 137 - .../UefiShellDebug1CommandsLib.uni | 1178 ---- .../UefiShellDriver1CommandsLib/Connect.c | 549 -- .../UefiShellDriver1CommandsLib/DevTree.c | 277 - .../UefiShellDriver1CommandsLib/Devices.c | 269 - .../Library/UefiShellDriver1CommandsLib/Dh.c | 1197 ---- .../UefiShellDriver1CommandsLib/Disconnect.c | 204 - .../UefiShellDriver1CommandsLib/Drivers.c | 429 -- .../UefiShellDriver1CommandsLib/DrvCfg.c | 1412 ---- .../UefiShellDriver1CommandsLib/DrvDiag.c | 463 -- .../UefiShellDriver1CommandsLib/OpenInfo.c | 216 - .../UefiShellDriver1CommandsLib/Reconnect.c | 99 - .../UefiShellDriver1CommandsLib.c | 104 - .../UefiShellDriver1CommandsLib.h | 228 - .../UefiShellDriver1CommandsLib.inf | 73 - .../UefiShellDriver1CommandsLib.uni | 759 --- .../UefiShellDriver1CommandsLib/Unload.c | 148 - .../UefiShellInstall1CommandsLib.c | 59 - .../UefiShellInstall1CommandsLib.inf | 51 - .../Library/UefiShellLevel1CommandsLib/Exit.c | 97 - .../Library/UefiShellLevel1CommandsLib/For.c | 751 --- .../Library/UefiShellLevel1CommandsLib/Goto.c | 105 - .../Library/UefiShellLevel1CommandsLib/If.c | 1111 ---- .../UefiShellLevel1CommandsLib/Shift.c | 64 - .../UefiShellLevel1CommandsLib/Stall.c | 84 - .../UefiShellLevel1CommandsLib.c | 308 - .../UefiShellLevel1CommandsLib.h | 209 - .../UefiShellLevel1CommandsLib.inf | 58 - .../UefiShellLevel1CommandsLib.uni | 504 -- .../UefiShellLevel2CommandsLib/Attrib.c | 277 - .../Library/UefiShellLevel2CommandsLib/Cd.c | 351 - .../Library/UefiShellLevel2CommandsLib/Cp.c | 779 --- .../Library/UefiShellLevel2CommandsLib/Load.c | 279 - .../Library/UefiShellLevel2CommandsLib/Ls.c | 874 --- .../Library/UefiShellLevel2CommandsLib/Map.c | 1302 ---- .../UefiShellLevel2CommandsLib/MkDir.c | 167 - .../Library/UefiShellLevel2CommandsLib/Mv.c | 863 --- .../UefiShellLevel2CommandsLib/Parse.c | 317 - .../UefiShellLevel2CommandsLib/Reset.c | 170 - .../Library/UefiShellLevel2CommandsLib/Rm.c | 380 -- .../Library/UefiShellLevel2CommandsLib/Set.c | 174 - .../UefiShellLevel2CommandsLib/TimeDate.c | 972 --- .../UefiShellLevel2CommandsLib.c | 350 - .../UefiShellLevel2CommandsLib.h | 369 -- .../UefiShellLevel2CommandsLib.inf | 84 - .../UefiShellLevel2CommandsLib.uni | 1085 --- .../Library/UefiShellLevel2CommandsLib/Vol.c | 313 - .../UefiShellLevel3CommandsLib/Alias.c | 286 - .../Library/UefiShellLevel3CommandsLib/Cls.c | 230 - .../Library/UefiShellLevel3CommandsLib/Echo.c | 121 - .../UefiShellLevel3CommandsLib/GetMtc.c | 97 - .../Library/UefiShellLevel3CommandsLib/Help.c | 474 -- .../UefiShellLevel3CommandsLib/Pause.c | 107 - .../UefiShellLevel3CommandsLib/Touch.c | 292 - .../Library/UefiShellLevel3CommandsLib/Type.c | 327 - .../UefiShellLevel3CommandsLib.c | 101 - .../UefiShellLevel3CommandsLib.h | 161 - .../UefiShellLevel3CommandsLib.inf | 74 - .../UefiShellLevel3CommandsLib.uni | 545 -- .../Library/UefiShellLevel3CommandsLib/Ver.c | 153 - .../Library/UefiShellLib/UefiShellLib.c | 4375 ------------- .../Library/UefiShellLib/UefiShellLib.h | 96 - .../Library/UefiShellLib/UefiShellLib.inf | 70 - .../UefiShellNetwork1CommandsLib/Ifconfig.c | 1447 ---- .../UefiShellNetwork1CommandsLib/Ping.c | 1713 ----- .../UefiShellNetwork1CommandsLib.c | 90 - .../UefiShellNetwork1CommandsLib.h | 76 - .../UefiShellNetwork1CommandsLib.inf | 68 - .../UefiShellNetwork1CommandsLib.uni | 182 - .../UefiShellNetwork2CommandsLib/Ifconfig6.c | 1912 ------ .../UefiShellNetwork2CommandsLib/Ping6.c | 1373 ---- .../UefiShellNetwork2CommandsLib.c | 91 - .../UefiShellNetwork2CommandsLib.h | 72 - .../UefiShellNetwork2CommandsLib.inf | 64 - .../UefiShellNetwork2CommandsLib.uni | 167 - Voyager/Voyager/edk2/ShellPkg/ShellPkg.dec | 140 - Voyager/Voyager/edk2/ShellPkg/ShellPkg.dsc | 136 - 1551 files changed, 1559 insertions(+), 310072 deletions(-) create mode 100644 Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.user create mode 100644 Voyager/PayLoad (AMD)/pg_table.h create mode 100644 Voyager/PayLoad (Intel)/pg_table.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dec delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dsc delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/CryptoPkgExtra.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAesNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdesNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPemNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticodeNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExtNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandNull.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/CrtLibSupport.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/assert.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/ctype.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/errno.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/internal/dso_conf.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/limits.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/memory.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/openssl/opensslconf.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdarg.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/stddef.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdio.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdlib.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/string.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/strings.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/time.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/types.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/syslog.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/time.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/Include/unistd.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/CopyMem.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/buildinf.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/process_files.pl delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/InternalTlsLib.h delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsConfig.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsInit.c delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.inf delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.uni delete mode 100644 Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsProcess.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ARShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuPause.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Math64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Unaligned.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BitField.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CheckSum.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ChkStkGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Cpu.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CpuDeadLoop.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivS64x64Remainder.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32Remainder.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x64Remainder.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SwitchStack.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/FilePaths.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/GccInline.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Lfence.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Non-existing.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteTr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LinkedList.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LongJump.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Math64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ModU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultS64x64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RShiftU64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SafeString.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SetJump.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/String.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes16.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwitchStack.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Unaligned.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuPause.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxRestore.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxSave.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/GccInline.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Invd.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Lfence.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Monitor.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Mwait.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Non-existing.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadFs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadSs.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteTr.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxRestore.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxSave.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86GetInterruptState.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86MemoryFence.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Msr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86PatchInstruction.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86RdRand.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadGdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadIdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86SpeculationBarrier.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Thunk.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteGdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteIdtr.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMem.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/IsZeroBuffer.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/PciExpressLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/PostCode.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRng.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/S3IoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/S3PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.S delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.asm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Synchronization.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/HobLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/HobLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiAip.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/Allocate.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/X64/Allocate.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/SmbusLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/HobLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Acpi.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Console.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiDriverModel.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiNotTiano.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/IsZeroBufferWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGuid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibInternals.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/Hid.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h delete mode 100644 Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UsbDxeLib.c delete mode 100644 Voyager/Voyager/edk2/MdePkg/MdePkg.dec delete mode 100644 Voyager/Voyager/edk2/MdePkg/MdePkg.dsc delete mode 100644 Voyager/Voyager/edk2/MdePkg/MdePkg.uni delete mode 100644 Voyager/Voyager/edk2/MdePkg/MdePkgExtra.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleInternal.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/README.txt delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.nsh delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditStrings.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexeditStrings.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf delete mode 100644 Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni delete mode 100644 Voyager/Voyager/edk2/ShellPkg/ShellPkg.dec delete mode 100644 Voyager/Voyager/edk2/ShellPkg/ShellPkg.dsc diff --git a/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj index ce42402..3e2e1f4 100644 --- a/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj +++ b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj @@ -1,37 +1,45 @@  - - Debug - Win32 + + 1507 + x64 - - Release - Win32 + + 1511 + x64 - - Debug + + 1607 x64 - - Release + + 1703 x64 - - Debug - ARM + + 1709 + x64 - - Release - ARM + + 1803 + x64 - - Debug - ARM64 + + 1809 + x64 - - Release - ARM64 + + 1903 + x64 + + + 1909 + x64 + + + 2004 + x64 @@ -45,32 +53,43 @@ $(LatestTargetPlatformVersion) - + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 - true + false WindowsKernelModeDriver10.0 DynamicLibrary KMDF Universal false - + Windows10 false WindowsKernelModeDriver10.0 @@ -79,37 +98,50 @@ Universal false - + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false @@ -119,49 +151,161 @@ - + DbgengKernelDebugger + false - + DbgengKernelDebugger + false + + + DbgengKernelDebugger + false - + DbgengKernelDebugger false - + DbgengKernelDebugger false - + DbgengKernelDebugger + false - + DbgengKernelDebugger + false - + DbgengKernelDebugger + false - + DbgengKernelDebugger + false - + + DbgengKernelDebugger + false + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1909; + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1903; + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1809; + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1803; + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1709 + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1703 + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1607 + + + vmexit_handler + + + + + stdcpp17 + false + false + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1511; + + + vmexit_handler + + + stdcpp17 false false false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1903; vmexit_handler - + stdcpp17 false false false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=2004; vmexit_handler @@ -171,6 +315,7 @@ + diff --git a/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.filters b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.filters index af9a042..664077a 100644 --- a/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.filters +++ b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.filters @@ -14,6 +14,9 @@ Header Files + + Header Files + diff --git a/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.user b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Voyager/PayLoad (AMD)/PayLoad (AMD).vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Voyager/PayLoad (AMD)/pg_table.h b/Voyager/PayLoad (AMD)/pg_table.h new file mode 100644 index 0000000..5326cab --- /dev/null +++ b/Voyager/PayLoad (AMD)/pg_table.h @@ -0,0 +1,113 @@ +#pragma once +#include "types.h" + +#pragma section(".pdpt", read, write) +#pragma section(".pd", read, write) +#pragma section(".pt", read, write) + +typedef union _virt_addr_t +{ + void* value; + struct + { + u64 offset : 12; + u64 pt_index : 9; + u64 pd_index : 9; + u64 pdpt_index : 9; + u64 pml4_index : 9; + u64 reserved : 16; + }; +} virt_addr_t, * pvirt_addr_t; + +typedef union _pml4e +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 ReadWrite : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PDPT. + u64 page_cache : 1; // Determines the memory type used to access PDPT. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // Must be 0 for PML4E. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PDPT of this PML4E. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pml4e, * ppml4e; + +typedef union _pdpte +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PD. + u64 page_cache : 1; // Determines the memory type used to access PD. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // If 1, this entry maps a 1GB page. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PD of this PDPTE. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pdpte, * ppdpte; + +typedef union _pde +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PT. + u64 page_cache : 1; // Determines the memory type used to access PT. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // If 1, this entry maps a 2MB page. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PT of this PDE. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pde, * ppde; + +typedef union _pte +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access the memory. + u64 page_cache : 1; // Determines the memory type used to access the memory. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Dirty : 1; // If 0, the memory backing this page has not been written to. + u64 PageAccessType : 1; // Determines the memory type used to access the memory. + u64 Global : 1; // If 1 and the PGE bit of CR4 is set, translations are global. + u64 Ignored2 : 3; + u64 pfn : 36; // The page frame number of the backing physical page. + u64 reserved : 4; + u64 Ignored3 : 7; + u64 ProtectionKey : 4; // If the PKE bit of CR4 is set, determines the protection key. + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pte, * ppte; + +namespace pg_table +{ + __declspec(allocate(".pdpt")) inline pdpte pdpt[512]; + __declspec(allocate(".pd")) inline pde pd[512]; + __declspec(allocate(".pt")) inline pte pt[512]; +} \ No newline at end of file diff --git a/Voyager/PayLoad (AMD)/types.h b/Voyager/PayLoad (AMD)/types.h index d715d67..d9abdc2 100644 --- a/Voyager/PayLoad (AMD)/types.h +++ b/Voyager/PayLoad (AMD)/types.h @@ -5,9 +5,7 @@ #include #include -#define WINVER 1507 #define VMEXIT_KEY 0xDEADBEEFDEADBEEF - #define PORT_NUM 0x2F8 #define DBG_PRINT(arg) \ __outbytestring(PORT_NUM, (unsigned char*)arg, sizeof arg); diff --git a/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj b/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj index d2b3fc5..92ebb40 100644 --- a/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj +++ b/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj @@ -1,37 +1,45 @@  - - Debug - Win32 + + 1507 + x64 + + + 1511 + x64 - - Release - Win32 + + 1607 + x64 - - Debug + + 1703 x64 - - Release + + 1709 x64 - - Debug - ARM + + 1803 + x64 - - Release - ARM + + 1809 + x64 - - Debug - ARM64 + + 1903 + x64 - - Release - ARM64 + + 1909 + x64 + + + 2004 + x64 @@ -46,31 +54,88 @@ PayLoad (Intel) - + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false + + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 @@ -79,37 +144,50 @@ Universal false - + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false - + Windows10 - true + false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false + + + Windows10 + false + WindowsKernelModeDriver10.0 + DynamicLibrary + KMDF + Universal + false - + Windows10 false WindowsKernelModeDriver10.0 - Driver + DynamicLibrary KMDF Universal + false @@ -119,32 +197,441 @@ - + + DbgengKernelDebugger + .dll + + DbgengKernelDebugger + .dll - + DbgengKernelDebugger + .dll - + DbgengKernelDebugger + .dll - + DbgengKernelDebugger .dll - + DbgengKernelDebugger + .dll - + DbgengKernelDebugger + .dll - + DbgengKernelDebugger + .dll - + DbgengKernelDebugger + .dll - + + DbgengKernelDebugger + .dll + + + DbgengKernelDebugger + .dll + + + DbgengKernelDebugger + .dll + + + DbgengKernelDebugger + .dll + + + DbgengKernelDebugger + .dll + + + DbgengKernelDebugger + .dll + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + %(PreprocessorDefinitions);WINVER=1909; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1903; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1803; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1709; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1703; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1607; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1507; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1607; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);WINVER=1607; + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + + + true + + + + + vmexit_handler + true + Default + false + libcmt.lib;libucrt.lib;libvcruntime.lib;%(AdditionalDependencies) + true + + + TurnOffAllWarnings + false + false + stdcpp17 + Disabled + Neither + false + MultiThreaded + false + true + false + %(PreprocessorDefinitions);WINVER=2004; + + + true + + + vmexit_handler true @@ -165,6 +652,7 @@ false true false + %(PreprocessorDefinitions);WINVER=2004; true @@ -178,6 +666,7 @@ + diff --git a/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj.filters b/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj.filters index f4c1334..2773064 100644 --- a/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj.filters +++ b/Voyager/PayLoad (Intel)/PayLoad (Intel).vcxproj.filters @@ -22,5 +22,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/Voyager/PayLoad (Intel)/pg_table.h b/Voyager/PayLoad (Intel)/pg_table.h new file mode 100644 index 0000000..5326cab --- /dev/null +++ b/Voyager/PayLoad (Intel)/pg_table.h @@ -0,0 +1,113 @@ +#pragma once +#include "types.h" + +#pragma section(".pdpt", read, write) +#pragma section(".pd", read, write) +#pragma section(".pt", read, write) + +typedef union _virt_addr_t +{ + void* value; + struct + { + u64 offset : 12; + u64 pt_index : 9; + u64 pd_index : 9; + u64 pdpt_index : 9; + u64 pml4_index : 9; + u64 reserved : 16; + }; +} virt_addr_t, * pvirt_addr_t; + +typedef union _pml4e +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 ReadWrite : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PDPT. + u64 page_cache : 1; // Determines the memory type used to access PDPT. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // Must be 0 for PML4E. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PDPT of this PML4E. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pml4e, * ppml4e; + +typedef union _pdpte +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PD. + u64 page_cache : 1; // Determines the memory type used to access PD. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // If 1, this entry maps a 1GB page. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PD of this PDPTE. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pdpte, * ppdpte; + +typedef union _pde +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access PT. + u64 page_cache : 1; // Determines the memory type used to access PT. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Ignored1 : 1; + u64 page_size : 1; // If 1, this entry maps a 2MB page. + u64 Ignored2 : 4; + u64 pfn : 36; // The page frame number of the PT of this PDE. + u64 Reserved : 4; + u64 Ignored3 : 11; + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pde, * ppde; + +typedef union _pte +{ + u64 value; + struct + { + u64 present : 1; // Must be 1, region invalid if 0. + u64 rw : 1; // If 0, writes not allowed. + u64 user_supervisor : 1; // If 0, user-mode accesses not allowed. + u64 PageWriteThrough : 1; // Determines the memory type used to access the memory. + u64 page_cache : 1; // Determines the memory type used to access the memory. + u64 accessed : 1; // If 0, this entry has not been used for translation. + u64 Dirty : 1; // If 0, the memory backing this page has not been written to. + u64 PageAccessType : 1; // Determines the memory type used to access the memory. + u64 Global : 1; // If 1 and the PGE bit of CR4 is set, translations are global. + u64 Ignored2 : 3; + u64 pfn : 36; // The page frame number of the backing physical page. + u64 reserved : 4; + u64 Ignored3 : 7; + u64 ProtectionKey : 4; // If the PKE bit of CR4 is set, determines the protection key. + u64 nx : 1; // If 1, instruction fetches not allowed. + }; +} pte, * ppte; + +namespace pg_table +{ + __declspec(allocate(".pdpt")) inline pdpte pdpt[512]; + __declspec(allocate(".pd")) inline pde pd[512]; + __declspec(allocate(".pt")) inline pte pt[512]; +} \ No newline at end of file diff --git a/Voyager/PayLoad (Intel)/types.h b/Voyager/PayLoad (Intel)/types.h index 551e4f4..d3a2a4b 100644 --- a/Voyager/PayLoad (Intel)/types.h +++ b/Voyager/PayLoad (Intel)/types.h @@ -4,7 +4,6 @@ #include #define PORT_NUM 0x2F8 -#define WINVER 1507 #define DBG_PRINT(arg) \ __outbytestring(PORT_NUM, (unsigned char*)arg, sizeof arg); diff --git a/Voyager/Voyager.sln b/Voyager/Voyager.sln index 4a1c8c9..1458968 100644 --- a/Voyager/Voyager.sln +++ b/Voyager/Voyager.sln @@ -11,76 +11,79 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PayLoad (AMD)", "PayLoad (A EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 + 1507|x64 = 1507|x64 + 1511|x64 = 1511|x64 + 1607|x64 = 1607|x64 + 1703|x64 = 1703|x64 + 1709|x64 = 1709|x64 + 1803|x64 = 1803|x64 + 1809|x64 = 1809|x64 + 1903|x64 = 1903|x64 + 1909|x64 = 1909|x64 + 2004|x64 = 2004|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|ARM.ActiveCfg = Debug|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|ARM64.ActiveCfg = Debug|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|x64.ActiveCfg = Debug|x64 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|x64.Build.0 = Debug|x64 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|x86.ActiveCfg = Debug|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Debug|x86.Build.0 = Debug|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|ARM.ActiveCfg = Release|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|ARM64.ActiveCfg = Release|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|x64.ActiveCfg = Release|x64 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|x64.Build.0 = Release|x64 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|x86.ActiveCfg = Release|Win32 - {540D433F-C2DF-49A6-895C-F5C74B014777}.Release|x86.Build.0 = Release|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM.ActiveCfg = Debug|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM.Build.0 = Debug|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM.Deploy.0 = Debug|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM64.Build.0 = Debug|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x64.ActiveCfg = Debug|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x64.Build.0 = Debug|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x64.Deploy.0 = Debug|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x86.ActiveCfg = Debug|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x86.Build.0 = Debug|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Debug|x86.Deploy.0 = Debug|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM.ActiveCfg = Release|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM.Build.0 = Release|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM.Deploy.0 = Release|ARM - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM64.ActiveCfg = Release|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM64.Build.0 = Release|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|ARM64.Deploy.0 = Release|ARM64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x64.ActiveCfg = Release|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x64.Build.0 = Release|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x64.Deploy.0 = Release|x64 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x86.ActiveCfg = Release|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x86.Build.0 = Release|Win32 - {223D1FDE-331E-4028-9083-1673A5161C99}.Release|x86.Deploy.0 = Release|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM.ActiveCfg = Debug|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM.Build.0 = Debug|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM.Deploy.0 = Debug|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM64.Build.0 = Debug|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x64.ActiveCfg = Debug|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x64.Build.0 = Debug|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x64.Deploy.0 = Debug|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x86.ActiveCfg = Debug|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x86.Build.0 = Debug|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Debug|x86.Deploy.0 = Debug|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM.ActiveCfg = Release|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM.Build.0 = Release|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM.Deploy.0 = Release|ARM - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM64.ActiveCfg = Release|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM64.Build.0 = Release|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|ARM64.Deploy.0 = Release|ARM64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x64.ActiveCfg = Release|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x64.Build.0 = Release|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x64.Deploy.0 = Release|x64 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x86.ActiveCfg = Release|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x86.Build.0 = Release|Win32 - {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.Release|x86.Deploy.0 = Release|Win32 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1507|x64.ActiveCfg = 1507|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1507|x64.Build.0 = 1507|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1511|x64.ActiveCfg = 1511|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1511|x64.Build.0 = 1511|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1607|x64.ActiveCfg = 1607|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1607|x64.Build.0 = 1607|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1703|x64.ActiveCfg = 1703|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1703|x64.Build.0 = 1703|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1709|x64.ActiveCfg = 1709|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1709|x64.Build.0 = 1709|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1803|x64.ActiveCfg = 1803|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1803|x64.Build.0 = 1803|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1809|x64.ActiveCfg = 1809|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1809|x64.Build.0 = 1809|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1903|x64.ActiveCfg = 1903|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1903|x64.Build.0 = 1903|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1909|x64.ActiveCfg = 1909|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.1909|x64.Build.0 = 1909|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.2004|x64.ActiveCfg = 2004|x64 + {540D433F-C2DF-49A6-895C-F5C74B014777}.2004|x64.Build.0 = 2004|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1507|x64.ActiveCfg = 1507|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1507|x64.Build.0 = 1507|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1511|x64.ActiveCfg = 1607|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1511|x64.Build.0 = 1607|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1511|x64.Deploy.0 = 1607|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1607|x64.ActiveCfg = 1607|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1607|x64.Build.0 = 1607|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1703|x64.ActiveCfg = 1703|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1703|x64.Build.0 = 1703|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1709|x64.ActiveCfg = 1709|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1709|x64.Build.0 = 1709|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1803|x64.ActiveCfg = 1803|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1803|x64.Build.0 = 1803|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1809|x64.ActiveCfg = 1909|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1809|x64.Build.0 = 1909|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1903|x64.ActiveCfg = 1903|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1903|x64.Build.0 = 1903|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1909|x64.ActiveCfg = 1909|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.1909|x64.Build.0 = 1909|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.2004|x64.ActiveCfg = 2004|x64 + {223D1FDE-331E-4028-9083-1673A5161C99}.2004|x64.Build.0 = 2004|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1507|x64.ActiveCfg = 1507|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1507|x64.Build.0 = 1507|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1511|x64.ActiveCfg = 1511|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1511|x64.Build.0 = 1511|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1607|x64.ActiveCfg = 1607|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1607|x64.Build.0 = 1607|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1703|x64.ActiveCfg = 1703|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1703|x64.Build.0 = 1703|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1709|x64.ActiveCfg = 1709|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1709|x64.Build.0 = 1709|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1803|x64.ActiveCfg = 1803|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1803|x64.Build.0 = 1803|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1809|x64.ActiveCfg = 1809|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1809|x64.Build.0 = 1809|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1903|x64.ActiveCfg = 1903|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1903|x64.Build.0 = 1903|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1909|x64.ActiveCfg = 1909|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.1909|x64.Build.0 = 1909|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.2004|x64.ActiveCfg = 2004|x64 + {C5122D8B-DEC8-458F-9342-3A4AC3152BEF}.2004|x64.Build.0 = 2004|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Voyager/Voyager/BootMgfw.c b/Voyager/Voyager/BootMgfw.c index f22d2e2..51db205 100644 --- a/Voyager/Voyager/BootMgfw.c +++ b/Voyager/Voyager/BootMgfw.c @@ -216,6 +216,14 @@ EFI_STATUS EFIAPI ArchStartBootApplicationHook(VOID* AppEntry, VOID* ImageBase, // on 1703 and below, winload does not export any functions if (!GetExport(ImageBase, "BlLdrLoadImage")) { + VOID* HvlpTransferToHypervisor = + FindPattern( + ImageBase, + ImageSize, + TRANS_TO_HV_SIG, + TRANS_TO_HV_MASK + ); + VOID* ImgLoadPEImageEx = FindPattern( ImageBase, @@ -224,17 +232,30 @@ EFI_STATUS EFIAPI ArchStartBootApplicationHook(VOID* AppEntry, VOID* ImageBase, LOAD_PE_IMG_MASK ); + MmMapPhysicalMemory = RESOLVE_RVA( + FindPattern( + ImageBase, + ImageSize, + MAP_PHYSICAL_SIG, + MAP_PHYSICAL_MASK + ), 5, 1); + gST->ConOut->ClearScreen(gST->ConOut); gST->ConOut->OutputString(gST->ConOut, AsciiArt); Print(L"\n"); Print(L"Hyper-V PayLoad Size -> 0x%x\n", PayLoadSize()); Print(L"winload.BlImgLoadPEImageEx -> 0x%p\n", RESOLVE_RVA(ImgLoadPEImageEx, 10, 6)); + Print(L"winload.HvlpTransferToHypervisor -> 0x%p\n", RESOLVE_RVA(HvlpTransferToHypervisor, 13, 9)); + + MakeShitHook(&TransferControlShitHook, RESOLVE_RVA(HvlpTransferToHypervisor, 13, 9), &TransferToHyperV, TRUE); MakeShitHook(&WinLoadImageShitHook, RESOLVE_RVA(ImgLoadPEImageEx, 10, 6), &BlImgLoadPEImageEx, TRUE); } else // else the installed windows version is between 2004 and 1709 { VOID* LdrLoadImage = GetExport(ImageBase, "BlLdrLoadImage"); + MmMapPhysicalMemory = GetExport(ImageBase, "BlMmMapPhysicalAddressEx"); + VOID* ImgAllocateImageBuffer = FindPattern( ImageBase, diff --git a/Voyager/Voyager/HvLoader.c b/Voyager/Voyager/HvLoader.c index f0fcd06..8fac85c 100644 --- a/Voyager/Voyager/HvLoader.c +++ b/Voyager/Voyager/HvLoader.c @@ -3,7 +3,9 @@ SHITHOOK HvLoadImageHook; SHITHOOK HvLoadImageBufferHook; SHITHOOK HvLoadAllocImageHook; +SHITHOOK TransferControlShitHook; +MAP_PHYSICAL MmMapPhysicalMemory; BOOLEAN HvExtendedAllocation = FALSE; BOOLEAN HvHookedHyperV = FALSE; @@ -225,4 +227,22 @@ UINT64 EFIAPI HvBlImgAllocateImageBuffer EnableShitHook(&HvLoadAllocImageHook); return Result; +} + +VOID TransferToHyperV(VOID* Pml4PhysicalAddress, VOID* Unknown, VOID* AssemblyStub, VOID* Unknown2) +{ + // TODO setup paging tables for the payload... + VOID* Pml4VirtualAddress = NULL; + MmMapPhysicalMemory(&Pml4VirtualAddress, Pml4PhysicalAddress, 0x1000, NULL, NULL); + DBG_PRINT("Hyper-V Pml4PhysicalAddress -> 0x%p\n", Pml4PhysicalAddress); + DBG_PRINT("Hyper-V Pml4VirtualAddress -> 0x%p\n", Pml4VirtualAddress); + + DisableShitHook(&TransferControlShitHook); + ((VOID(__fastcall*)(VOID*, VOID*, VOID*, VOID*))TransferControlShitHook.Address) + ( + Pml4PhysicalAddress, + Unknown, + AssemblyStub, + Unknown2 + ); } \ No newline at end of file diff --git a/Voyager/Voyager/HvLoader.h b/Voyager/Voyager/HvLoader.h index 8534444..b7981ee 100644 --- a/Voyager/Voyager/HvLoader.h +++ b/Voyager/Voyager/HvLoader.h @@ -1,6 +1,12 @@ #pragma once #include "PayLoad.h" #include "Hv.h" +#include "ShitHook.h" + +extern SHITHOOK HvLoadImageHook; +extern SHITHOOK HvLoadAllocImageHook; +extern SHITHOOK HvLoadImageBufferHook; +extern SHITHOOK TransferControlShitHook; #define HV_ALLOCATE_IMAGE_BUFFER_SIG "\xE8\x00\x00\x00\x00\x8B\xF8\x85\xC0\x79\x0A" #define HV_ALLOCATE_IMAGE_BUFFER_MASK "x????xxxxxx" @@ -14,6 +20,22 @@ static_assert(sizeof(HV_LOAD_PE_IMG_FROM_BUFFER_SIG) == sizeof(HV_LOAD_PE_IMG_FR #define HV_LOAD_PE_IMG_MASK "xxxx?x????xxxxxxx????xxx" static_assert(sizeof(HV_LOAD_PE_IMG_SIG) == sizeof(HV_LOAD_PE_IMG_MASK), "signature and mask do not match size..."); +#define MAP_PHYSICAL_SIG "\xE8\x00\x00\x00\x00\x85\xC0\x0F\x88\x00\x00\x00\x00\x48\x8B\xBC\x24" +#define MAP_PHYSICAL_MASK "x????xxxx????xxxx" +static_assert(sizeof(MAP_PHYSICAL_SIG) == sizeof(MAP_PHYSICAL_MASK), "signature and mask do not patch sizes...\n"); + +// 1703-1511 +// +// winload.HvlpTransferToHypervisor is used to transfer control to hyper-v... +// on 2004-1709, this function is going to be inside of hvloader.dll... +#define TRANS_TO_HV_SIG "\x48\x8B\x51\x10\x48\x8B\x49\x18\xE8" +#define TRANS_TO_HV_MASK "xxxxxxxxx" +static_assert(sizeof(TRANS_TO_HV_SIG) == sizeof(TRANS_TO_HV_MASK), "signature and mask do not match size..."); + +typedef EFI_STATUS(EFIAPI* MAP_PHYSICAL)(VOID** VirtualAddress, VOID* PhysicalAddress, UINTN Size, + VOID* Unknown1, VOID* Unknown2); + +extern MAP_PHYSICAL MmMapPhysicalMemory; typedef EFI_STATUS(EFIAPI* ALLOCATE_IMAGE_BUFFER)(VOID** imageBuffer, UINTN imageSize, UINT32 memoryType, UINT32 attributes, VOID* unused, UINT32 flags); @@ -119,6 +141,16 @@ EFI_STATUS EFIAPI HvBlImgLoadPEImageFromSourceBuffer VOID* a15 ); -extern SHITHOOK HvLoadImageHook; -extern SHITHOOK HvLoadAllocImageHook; -extern SHITHOOK HvLoadImageBufferHook; \ No newline at end of file +/// +/// called when the hypervisor is started... +/// +/// the physical address of hyper-v's pml4... +/// +/// assembly stub to set CR3... +VOID TransferToHyperV +( + VOID* Pml4PhysicalAddress, + VOID* Unknown, + VOID* AssemblyStub, + VOID* Unknown2 +); \ No newline at end of file diff --git a/Voyager/Voyager/ShitHook.c b/Voyager/Voyager/ShitHook.c index 5b3546b..6d1ff4c 100644 --- a/Voyager/Voyager/ShitHook.c +++ b/Voyager/Voyager/ShitHook.c @@ -14,20 +14,20 @@ VOID MakeShitHook(PSHITHOOK Hook, VOID* HookFrom, VOID* HookTo, BOOLEAN Install) // save original bytes, and hook related addresses.... Hook->Address = HookFrom; Hook->HookAddress = HookTo; - gBS->CopyMem(Hook->Code, HookFrom, sizeof Hook->Code); + MemCopy(Hook->Code, HookFrom, sizeof Hook->Code); // setup hook... - gBS->CopyMem(JmpCode + 6, &HookTo, sizeof HookTo); - gBS->CopyMem(Hook->JmpCode, JmpCode, sizeof JmpCode); + MemCopy(JmpCode + 6, &HookTo, sizeof HookTo); + MemCopy(Hook->JmpCode, JmpCode, sizeof JmpCode); if (Install) EnableShitHook(Hook); } VOID EnableShitHook(PSHITHOOK Hook) { - gBS->CopyMem(Hook->Address, Hook->JmpCode, sizeof Hook->JmpCode); + MemCopy(Hook->Address, Hook->JmpCode, sizeof Hook->JmpCode); } VOID DisableShitHook(PSHITHOOK Hook) { - gBS->CopyMem(Hook->Address, Hook->Code, sizeof Hook->Code); + MemCopy(Hook->Address, Hook->Code, sizeof Hook->Code); } \ No newline at end of file diff --git a/Voyager/Voyager/ShitHook.h b/Voyager/Voyager/ShitHook.h index 20fc34e..2ae77e2 100644 --- a/Voyager/Voyager/ShitHook.h +++ b/Voyager/Voyager/ShitHook.h @@ -1,16 +1,5 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Utils.h" typedef struct _SHITHOOK { diff --git a/Voyager/Voyager/Utils.h b/Voyager/Voyager/Utils.h index 9037f58..969cee6 100644 --- a/Voyager/Voyager/Utils.h +++ b/Voyager/Voyager/Utils.h @@ -1,7 +1,17 @@ #pragma once -#include "ShitHook.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#define WINVER 1507 #define PORT_NUM 0x2F8 #define BL_MEMORY_ATTRIBUTE_RWX 0x424000 #define SEC_TO_MS(seconds) seconds * 1000000 diff --git a/Voyager/Voyager/Voyager.vcxproj b/Voyager/Voyager/Voyager.vcxproj index b2f7854..1c7a014 100644 --- a/Voyager/Voyager/Voyager.vcxproj +++ b/Voyager/Voyager/Voyager.vcxproj @@ -1,20 +1,44 @@ - - Debug - Win32 + + 1507 + x64 + + + 1511 + x64 - - Release - Win32 + + 1607 + x64 + + + 1703 + x64 - - Debug + + 1709 x64 - - Release + + 1803 + x64 + + + 1809 + x64 + + + 1903 + x64 + + + 1909 + x64 + + + 2004 x64 @@ -27,27 +51,79 @@ Voyager - + + Application + false + v142 + true + Unicode + x86 + + + Application + false + v142 + true + Unicode + x86 + + + Application + false + v142 + true + Unicode + x86 + + + Application + false + v142 + true + Unicode + x86 + + Application - true + false v142 + true Unicode + x86 - + Application false v142 true Unicode + x86 - + Application false v142 + true Unicode x86 - + + Application + false + v142 + true + Unicode + x86 + + + Application + false + v142 + true + Unicode + x86 + + Application false v142 @@ -60,34 +136,70 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + - - true + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) - + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) - - true - $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) $(ProjectDir)edk2 false .efi $(ProjectDir) - + false $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) $(ProjectDir)edk2 @@ -95,39 +207,111 @@ .efi $(ProjectDir) - + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + + false + $(ProjectDir)edk2\CryptoPkg\Include;$(ProjectDir)edk2\ShellPkg\Include;$(ProjectDir)edk2\MdePkg\Include\X64;$(ProjectDir)edk2\MdePkg\Include;$(ProjectDir)edk2\StdLib\Include;$(ProjectDir) + $(ProjectDir)edk2 + false + .efi + $(ProjectDir) + + Level3 + true + false true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;WINVER=1909;%(PreprocessorDefinitions) true + true + SyncCThrow + false + Disabled + Disabled EFI Application + true + true true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + true + - + Level3 true - true + false true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;WINVER=1903;%(PreprocessorDefinitions) true + true + SyncCThrow + false + Disabled + Disabled EFI Application true true true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + true + - + Level3 + true + false true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;WINVER=1809;%(PreprocessorDefinitions) true true SyncCThrow @@ -137,6 +321,182 @@ EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1803;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1709;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1703;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1607;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1511;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true + true + false + false + UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib + true + EfiMain + + + true + + + + + Level3 + true + false + true + NDEBUG;_CONSOLE;WINVER=1507;%(PreprocessorDefinitions) + true + true + SyncCThrow + false + Disabled + Disabled + + + EFI Application + true + true true false false @@ -148,13 +508,13 @@ true - + Level3 true false true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;WINVER=2004;%(PreprocessorDefinitions) true true SyncCThrow diff --git a/Voyager/Voyager/WinLoad.c b/Voyager/Voyager/WinLoad.c index b419f71..8217419 100644 --- a/Voyager/Voyager/WinLoad.c +++ b/Voyager/Voyager/WinLoad.c @@ -59,6 +59,26 @@ EFI_STATUS EFIAPI BlLdrLoadImage if (!HookedHyperV) EnableShitHook(&WinLoadImageShitHook); + if (StrStr(ModulePath, L"hvloader.dll")) + { + PLDR_DATA_TABLE_ENTRY TableEntry = *lplpTableEntry; + VOID* HvlpTransferToHypervisor = + FindPattern( + TableEntry->ModuleBase, + TableEntry->SizeOfImage, + TRANS_TO_HV_SIG, + TRANS_TO_HV_MASK + ); + + MakeShitHook + ( + &TransferControlShitHook, + RESOLVE_RVA(HvlpTransferToHypervisor, 13, 9), + &TransferToHyperV, + TRUE + ); + } + if (!StrCmp(ModuleName, L"hv.exe")) { HookedHyperV = TRUE; @@ -161,6 +181,7 @@ EFI_STATUS EFIAPI BlImgLoadPEImageEx HV_LOAD_PE_IMG_FROM_BUFFER_SIG, HV_LOAD_PE_IMG_FROM_BUFFER_MASK ); + #elif WINVER <= 1607 VOID* LoadImage = FindPattern( @@ -169,6 +190,7 @@ EFI_STATUS EFIAPI BlImgLoadPEImageEx HV_LOAD_PE_IMG_SIG, HV_LOAD_PE_IMG_MASK ); + #endif VOID* AllocImage = FindPattern( diff --git a/Voyager/Voyager/WinLoad.h b/Voyager/Voyager/WinLoad.h index 2bdb695..81f9f37 100644 --- a/Voyager/Voyager/WinLoad.h +++ b/Voyager/Voyager/WinLoad.h @@ -16,7 +16,14 @@ extern SHITHOOK WinLoadAllocateImageHook; #define LOAD_PE_IMG_SIG "\x48\x89\x44\x24\x00\xE8\x00\x00\x00\x00\x44\x8B\xF0\x85\xC0\x79\x11" #define LOAD_PE_IMG_MASK "xxxx?x????xxxxxxx" +// 1703-1511 +// +// winload.HvlpTransferToHypervisor is used to transfer control to hyper-v... +// on 2004-1709, this function is going to be inside of hvloader.dll... +#define TRANS_TO_HV_SIG "\x48\x8B\x51\x10\x48\x8B\x49\x18\xE8" +#define TRANS_TO_HV_MASK "xxxxxxxxx" static_assert(sizeof(ALLOCATE_IMAGE_BUFFER_SIG) == sizeof(ALLOCATE_IMAGE_BUFFER_MASK), "signature and mask do not match size!"); + typedef UINT64 (EFIAPI* ALLOCATE_IMAGE_BUFFER)(VOID** imageBuffer, UINTN imageSize, UINT32 memoryType, UINT32 attributes, VOID* unused, UINT32 flags); diff --git a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dec b/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dec deleted file mode 100644 index 2fa8f26..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dec +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# Package for cryptography modules. -# -# This Package provides cryptographic-related libraries for UEFI security modules. -# It also provides a test application to test libraries. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = CryptoPkg - PACKAGE_UNI_FILE = CryptoPkg.uni - PACKAGE_GUID = 36470E80-36F2-4ba0-8CC8-937C7D9FF888 - PACKAGE_VERSION = 0.98 - -[Includes] - Include - -[Includes.Common.Private] - Library/Include - Library/OpensslLib/openssl/include - Library/OpensslLib/openssl/crypto/include - -[LibraryClasses] - ## @libraryclass Provides basic library functions for cryptographic primitives. - ## - BaseCryptLib|Include/Library/BaseCryptLib.h - - ## @libraryclass Provides TLS library functions for EFI TLS protocol. - ## - TlsLib|Include/Library/TlsLib.h - -[UserExtensions.TianoCore."ExtraFiles"] - CryptoPkgExtra.uni diff --git a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dsc b/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dsc deleted file mode 100644 index 0142f64..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.dsc +++ /dev/null @@ -1,130 +0,0 @@ -## @file -# Cryptographic Library Package for UEFI Security Implementation. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -################################################################################ -# -# Defines Section - statements that will be processed to create a Makefile. -# -################################################################################ -[Defines] - PLATFORM_NAME = CryptoPkg - PLATFORM_GUID = E1063286-6C8C-4c25-AEF0-67A9A5B6E6B6 - PLATFORM_VERSION = 0.98 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/CryptoPkg - SUPPORTED_ARCHITECTURES = IA32|X64|ARM|AARCH64 - BUILD_TARGETS = DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER = DEFAULT - -################################################################################ -# -# Library Class section - list of all Library Classes needed by this Platform. -# -################################################################################ -[LibraryClasses] - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf - - IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf - OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf - -[LibraryClasses.ARM, LibraryClasses.AARCH64] - # - # It is not possible to prevent the ARM compiler for generic intrinsic functions. - # This library provides the instrinsic functions generate by a given compiler. - # [LibraryClasses.ARM, LibraryClasses.AARCH64] and NULL mean link this library - # into all ARM and AARCH64 images. - # - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - - # Add support for stack protector - NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf - -[LibraryClasses.ARM] - ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf - -[LibraryClasses.common.PEIM] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf - -[LibraryClasses.common.DXE_DRIVER] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf - -[LibraryClasses.common.DXE_RUNTIME_DRIVER] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf - -[LibraryClasses.common.DXE_SMM_DRIVER] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf - -[LibraryClasses.common.UEFI_DRIVER] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf - -[LibraryClasses.common.UEFI_APPLICATION] - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf - -################################################################################ -# -# Pcd Section - list of all EDK II PCD Entries defined by this Platform -# -################################################################################ -[PcdsFeatureFlag] - gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE - -[PcdsFixedAtBuild] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 - gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x06 - -################################################################################################### -# -# Components Section - list of the modules and components that will be processed by compilation -# tools and the EDK II tools to generate PE32/PE32+/Coff image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary images get placed -# into firmware volume images. This section is just a list of modules to compile from -# source into UEFI-compliant binaries. -# It is the FDF file that contains information on combining binary files into firmware -# volume images, whose concept is beyond UEFI and is described in PI specification. -# Binary modules do not need to be listed in this section, as they should be -# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not required in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be -# generated for it, but the binary will not be put into any firmware volume. -# -################################################################################################### -[Components] - CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf - CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf - CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf - CryptoPkg/Library/TlsLib/TlsLib.inf - CryptoPkg/Library/OpensslLib/OpensslLib.inf - -[Components.IA32, Components.X64] - CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf - -[BuildOptions] - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.uni b/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.uni deleted file mode 100644 index 67bb1b4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkg.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// Package for cryptography modules. -// -// This Package provides cryptographic-related libraries for UEFI security modules. -// It also provides a test application to test libraries. -// -// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_PACKAGE_ABSTRACT #language en-US "Provides cryptographic-related libraries for UEFI security modules" - -#string STR_PACKAGE_DESCRIPTION #language en-US "This Package provides cryptographic-related libraries for UEFI security modules." - - - diff --git a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkgExtra.uni b/Voyager/Voyager/edk2/CryptoPkg/CryptoPkgExtra.uni deleted file mode 100644 index 30694d3..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/CryptoPkgExtra.uni +++ /dev/null @@ -1,20 +0,0 @@ -// /** @file -// Crypto Package Localized Strings and Content. -// -// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - -#string STR_PROPERTIES_PACKAGE_NAME -#language en-US -"Crypto package" - - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf deleted file mode 100644 index 45b94d0..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +++ /dev/null @@ -1,102 +0,0 @@ -## @file -# Cryptographic Library Instance for DXE_DRIVER. -# -# Caution: This module requires additional review when modified. -# This library will have external input - signature. -# This external input must be validated carefully to avoid security issues such as -# buffer overflow or integer overflow. -# -# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseCryptLib - MODULE_UNI_FILE = BaseCryptLib.uni - FILE_GUID = be3bb803-91b6-4da0-bd91-a8b21c18ca5d - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseCryptLib|DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - InternalCryptLib.h - Hash/CryptMd4.c - Hash/CryptMd5.c - Hash/CryptSha1.c - Hash/CryptSha256.c - Hash/CryptSha512.c - Hmac/CryptHmacMd5.c - Hmac/CryptHmacSha1.c - Hmac/CryptHmacSha256.c - Cipher/CryptAes.c - Cipher/CryptTdes.c - Cipher/CryptArc4.c - Pk/CryptRsaBasic.c - Pk/CryptRsaExt.c - Pk/CryptPkcs5Pbkdf2.c - Pk/CryptPkcs7Sign.c - Pk/CryptPkcs7VerifyCommon.c - Pk/CryptPkcs7VerifyBase.c - Pk/CryptDh.c - Pk/CryptX509.c - Pk/CryptAuthenticode.c - Pk/CryptTs.c - Pem/CryptPem.c - - SysCall/CrtWrapper.c - SysCall/TimerWrapper.c - SysCall/BaseMemAllocation.c - -[Sources.Ia32] - Rand/CryptRandTsc.c - -[Sources.X64] - Rand/CryptRandTsc.c - -[Sources.ARM] - Rand/CryptRand.c - -[Sources.AARCH64] - Rand/CryptRand.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - MemoryAllocationLib - UefiRuntimeServicesTableLib - DebugLib - OpensslLib - IntrinsicLib - PrintLib - -# -# Remove these [BuildOptions] after this library is cleaned up -# -[BuildOptions] - # - # suppress the following warnings so we do not break the build with warnings-as-errors: - # C4090: 'function' : different 'const' qualifiers - # - MSFT:*_*_*_CC_FLAGS = /wd4090 - - # -JCryptoPkg/Include : To disable the use of the system includes provided by RVCT - # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends without a newline" - RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1 diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.uni deleted file mode 100644 index 33819b3..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// Cryptographic Library Instance for DXE_DRIVER. -// -// Caution: This module requires additional review when modified. -// This library will have external input - signature. -// This external input must be validated carefully to avoid security issues such as -// buffer overflow or integer overflow. -// -// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for DXE_DRIVER" - -#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c deleted file mode 100644 index 88eca0a..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c +++ /dev/null @@ -1,323 +0,0 @@ -/** @file - AES Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for AES operations. - - @return The size, in bytes, of the context buffer required for AES operations. - -**/ -UINTN -EFIAPI -AesGetContextSize ( - VOID - ) -{ - // - // AES uses different key contexts for encryption and decryption, so here memory - // for 2 copies of AES_KEY is allocated. - // - return (UINTN) (2 * sizeof (AES_KEY)); -} - -/** - Initializes user-supplied memory as AES context for subsequent use. - - This function initializes user-supplied memory pointed by AesContext as AES context. - In addition, it sets up all AES key materials for subsequent encryption and decryption - operations. - There are 3 options for key length, 128 bits, 192 bits, and 256 bits. - - If AesContext is NULL, then return FALSE. - If Key is NULL, then return FALSE. - If KeyLength is not valid, then return FALSE. - - @param[out] AesContext Pointer to AES context being initialized. - @param[in] Key Pointer to the user-supplied AES key. - @param[in] KeyLength Length of AES key in bits. - - @retval TRUE AES context initialization succeeded. - @retval FALSE AES context initialization failed. - -**/ -BOOLEAN -EFIAPI -AesInit ( - OUT VOID *AesContext, - IN CONST UINT8 *Key, - IN UINTN KeyLength - ) -{ - AES_KEY *AesKey; - - // - // Check input parameters. - // - if (AesContext == NULL || Key == NULL || (KeyLength != 128 && KeyLength != 192 && KeyLength != 256)) { - return FALSE; - } - - // - // Initialize AES encryption & decryption key schedule. - // - AesKey = (AES_KEY *) AesContext; - if (AES_set_encrypt_key (Key, (UINT32) KeyLength, AesKey) != 0) { - return FALSE; - } - if (AES_set_decrypt_key (Key, (UINT32) KeyLength, AesKey + 1) != 0) { - return FALSE; - } - return TRUE; -} - -/** - Performs AES encryption on a data buffer of the specified size in ECB mode. - - This function performs AES encryption on data buffer pointed by Input, of specified - size of InputSize, in ECB mode. - InputSize must be multiple of block size (16 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - AesContext should be already correctly initialized by AesInit(). Behavior with - invalid AES context is undefined. - - If AesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (16 bytes), then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval TRUE AES encryption succeeded. - @retval FALSE AES encryption failed. - -**/ -BOOLEAN -EFIAPI -AesEcbEncrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - AES_KEY *AesKey; - - // - // Check input parameters. - // - if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Output == NULL) { - return FALSE; - } - - AesKey = (AES_KEY *) AesContext; - - // - // Perform AES data encryption with ECB mode (block-by-block) - // - while (InputSize > 0) { - AES_ecb_encrypt (Input, Output, AesKey, AES_ENCRYPT); - Input += AES_BLOCK_SIZE; - Output += AES_BLOCK_SIZE; - InputSize -= AES_BLOCK_SIZE; - } - - return TRUE; -} - -/** - Performs AES decryption on a data buffer of the specified size in ECB mode. - - This function performs AES decryption on data buffer pointed by Input, of specified - size of InputSize, in ECB mode. - InputSize must be multiple of block size (16 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - AesContext should be already correctly initialized by AesInit(). Behavior with - invalid AES context is undefined. - - If AesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (16 bytes), then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the AES decryption output. - - @retval TRUE AES decryption succeeded. - @retval FALSE AES decryption failed. - -**/ -BOOLEAN -EFIAPI -AesEcbDecrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - AES_KEY *AesKey; - - // - // Check input parameters. - // - if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Output == NULL) { - return FALSE; - } - - AesKey = (AES_KEY *) AesContext; - - // - // Perform AES data decryption with ECB mode (block-by-block) - // - while (InputSize > 0) { - AES_ecb_encrypt (Input, Output, AesKey + 1, AES_DECRYPT); - Input += AES_BLOCK_SIZE; - Output += AES_BLOCK_SIZE; - InputSize -= AES_BLOCK_SIZE; - } - - return TRUE; -} - -/** - Performs AES encryption on a data buffer of the specified size in CBC mode. - - This function performs AES encryption on data buffer pointed by Input, of specified - size of InputSize, in CBC mode. - InputSize must be multiple of block size (16 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - Initialization vector should be one block size (16 bytes). - AesContext should be already correctly initialized by AesInit(). Behavior with - invalid AES context is undefined. - - If AesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (16 bytes), then return FALSE. - If Ivec is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval TRUE AES encryption succeeded. - @retval FALSE AES encryption failed. - -**/ -BOOLEAN -EFIAPI -AesCbcEncrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - AES_KEY *AesKey; - UINT8 IvecBuffer[AES_BLOCK_SIZE]; - - // - // Check input parameters. - // - if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) { - return FALSE; - } - - if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - AesKey = (AES_KEY *) AesContext; - CopyMem (IvecBuffer, Ivec, AES_BLOCK_SIZE); - - // - // Perform AES data encryption with CBC mode - // - AES_cbc_encrypt (Input, Output, (UINT32) InputSize, AesKey, IvecBuffer, AES_ENCRYPT); - - return TRUE; -} - -/** - Performs AES decryption on a data buffer of the specified size in CBC mode. - - This function performs AES decryption on data buffer pointed by Input, of specified - size of InputSize, in CBC mode. - InputSize must be multiple of block size (16 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - Initialization vector should be one block size (16 bytes). - AesContext should be already correctly initialized by AesInit(). Behavior with - invalid AES context is undefined. - - If AesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (16 bytes), then return FALSE. - If Ivec is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval TRUE AES decryption succeeded. - @retval FALSE AES decryption failed. - -**/ -BOOLEAN -EFIAPI -AesCbcDecrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - AES_KEY *AesKey; - UINT8 IvecBuffer[AES_BLOCK_SIZE]; - - // - // Check input parameters. - // - if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) { - return FALSE; - } - - if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - AesKey = (AES_KEY *) AesContext; - CopyMem (IvecBuffer, Ivec, AES_BLOCK_SIZE); - - // - // Perform AES data decryption with CBC mode - // - AES_cbc_encrypt (Input, Output, (UINT32) InputSize, AesKey + 1, IvecBuffer, AES_DECRYPT); - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAesNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAesNull.c deleted file mode 100644 index 66d014b..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAesNull.c +++ /dev/null @@ -1,165 +0,0 @@ -/** @file - AES Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for AES operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -AesGetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory as AES context for subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] AesContext Pointer to AES context being initialized. - @param[in] Key Pointer to the user-supplied AES key. - @param[in] KeyLength Length of AES key in bits. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AesInit ( - OUT VOID *AesContext, - IN CONST UINT8 *Key, - IN UINTN KeyLength - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs AES encryption on a data buffer of the specified size in ECB mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AesEcbEncrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs AES decryption on a data buffer of the specified size in ECB mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the AES decryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AesEcbDecrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs AES encryption on a data buffer of the specified size in CBC mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AesCbcEncrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs AES decryption on a data buffer of the specified size in CBC mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] AesContext Pointer to the AES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the AES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AesCbcDecrypt ( - IN VOID *AesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c deleted file mode 100644 index cceede8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c +++ /dev/null @@ -1,211 +0,0 @@ -/** @file - ARC4 Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for ARC4 operations. - - @return The size, in bytes, of the context buffer required for ARC4 operations. - -**/ -UINTN -EFIAPI -Arc4GetContextSize ( - VOID - ) -{ - // - // Memory for 2 copies of RC4_KEY is allocated, one for working copy, and the other - // for backup copy. When Arc4Reset() is called, we can use the backup copy to restore - // the working copy to the initial state. - // - return (UINTN) (2 * sizeof (RC4_KEY)); -} - -/** - Initializes user-supplied memory as ARC4 context for subsequent use. - - This function initializes user-supplied memory pointed by Arc4Context as ARC4 context. - In addition, it sets up all ARC4 key materials for subsequent encryption and decryption - operations. - - If Arc4Context is NULL, then return FALSE. - If Key is NULL, then return FALSE. - If KeySize does not in the range of [5, 256] bytes, then return FALSE. - - @param[out] Arc4Context Pointer to ARC4 context being initialized. - @param[in] Key Pointer to the user-supplied ARC4 key. - @param[in] KeySize Size of ARC4 key in bytes. - - @retval TRUE ARC4 context initialization succeeded. - @retval FALSE ARC4 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Arc4Init ( - OUT VOID *Arc4Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - RC4_KEY *Rc4Key; - - // - // Check input parameters. - // - if (Arc4Context == NULL || Key == NULL || (KeySize < 5 || KeySize > 256)) { - return FALSE; - } - - Rc4Key = (RC4_KEY *) Arc4Context; - - RC4_set_key (Rc4Key, (UINT32) KeySize, Key); - - CopyMem (Rc4Key + 1, Rc4Key, sizeof (RC4_KEY)); - - return TRUE; -} - -/** - Performs ARC4 encryption on a data buffer of the specified size. - - This function performs ARC4 encryption on data buffer pointed by Input, of specified - size of InputSize. - Arc4Context should be already correctly initialized by Arc4Init(). Behavior with - invalid ARC4 context is undefined. - - If Arc4Context is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the ARC4 encryption output. - - @retval TRUE ARC4 encryption succeeded. - @retval FALSE ARC4 encryption failed. - -**/ -BOOLEAN -EFIAPI -Arc4Encrypt ( - IN OUT VOID *Arc4Context, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - RC4_KEY *Rc4Key; - - // - // Check input parameters. - // - if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - Rc4Key = (RC4_KEY *) Arc4Context; - - RC4 (Rc4Key, (UINT32) InputSize, Input, Output); - - return TRUE; -} - -/** - Performs ARC4 decryption on a data buffer of the specified size. - - This function performs ARC4 decryption on data buffer pointed by Input, of specified - size of InputSize. - Arc4Context should be already correctly initialized by Arc4Init(). Behavior with - invalid ARC4 context is undefined. - - If Arc4Context is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the ARC4 decryption output. - - @retval TRUE ARC4 decryption succeeded. - @retval FALSE ARC4 decryption failed. - -**/ -BOOLEAN -EFIAPI -Arc4Decrypt ( - IN OUT VOID *Arc4Context, - IN UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - RC4_KEY *Rc4Key; - - // - // Check input parameters. - // - if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - Rc4Key = (RC4_KEY *) Arc4Context; - - RC4 (Rc4Key, (UINT32) InputSize, Input, Output); - - return TRUE; -} - -/** - Resets the ARC4 context to the initial state. - - The function resets the ARC4 context to the state it had immediately after the - ARC4Init() function call. - Contrary to ARC4Init(), Arc4Reset() requires no secret key as input, but ARC4 context - should be already correctly initialized by ARC4Init(). - - If Arc4Context is NULL, then return FALSE. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - - @retval TRUE ARC4 reset succeeded. - @retval FALSE ARC4 reset failed. - -**/ -BOOLEAN -EFIAPI -Arc4Reset ( - IN OUT VOID *Arc4Context - ) -{ - RC4_KEY *Rc4Key; - - // - // Check input parameters. - // - if (Arc4Context == NULL) { - return FALSE; - } - - Rc4Key = (RC4_KEY *) Arc4Context; - - CopyMem (Rc4Key, Rc4Key + 1, sizeof (RC4_KEY)); - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4Null.c deleted file mode 100644 index 6e100e2..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4Null.c +++ /dev/null @@ -1,130 +0,0 @@ -/** @file - ARC4 Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for ARC4 operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - - -**/ -UINTN -EFIAPI -Arc4GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory as ARC4 context for subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] Arc4Context Pointer to ARC4 context being initialized. - @param[in] Key Pointer to the user-supplied ARC4 key. - @param[in] KeySize Size of ARC4 key in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Arc4Init ( - OUT VOID *Arc4Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs ARC4 encryption on a data buffer of the specified size. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the ARC4 encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Arc4Encrypt ( - IN OUT VOID *Arc4Context, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs ARC4 decryption on a data buffer of the specified size. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the ARC4 decryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Arc4Decrypt ( - IN OUT VOID *Arc4Context, - IN UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Resets the ARC4 context to the initial state. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Arc4Context Pointer to the ARC4 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Arc4Reset ( - IN OUT VOID *Arc4Context - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c deleted file mode 100644 index 68c57d3..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c +++ /dev/null @@ -1,370 +0,0 @@ -/** @file - TDES Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for TDES operations. - - @return The size, in bytes, of the context buffer required for TDES operations. - -**/ -UINTN -EFIAPI -TdesGetContextSize ( - VOID - ) -{ - // - // Memory for 3 copies of DES_key_schedule is allocated, for K1, K2 and K3 each. - // - return (UINTN) (3 * sizeof (DES_key_schedule)); -} - -/** - Initializes user-supplied memory as TDES context for subsequent use. - - This function initializes user-supplied memory pointed by TdesContext as TDES context. - In addition, it sets up all TDES key materials for subsequent encryption and decryption - operations. - There are 3 key options as follows: - KeyLength = 64, Keying option 1: K1 == K2 == K3 (Backward compatibility with DES) - KeyLength = 128, Keying option 2: K1 != K2 and K3 = K1 (Less Security) - KeyLength = 192 Keying option 3: K1 != K2 != K3 (Strongest) - - If TdesContext is NULL, then return FALSE. - If Key is NULL, then return FALSE. - If KeyLength is not valid, then return FALSE. - - @param[out] TdesContext Pointer to TDES context being initialized. - @param[in] Key Pointer to the user-supplied TDES key. - @param[in] KeyLength Length of TDES key in bits. - - @retval TRUE TDES context initialization succeeded. - @retval FALSE TDES context initialization failed. - -**/ -BOOLEAN -EFIAPI -TdesInit ( - OUT VOID *TdesContext, - IN CONST UINT8 *Key, - IN UINTN KeyLength - ) -{ - DES_key_schedule *KeySchedule; - - // - // Check input parameters. - // - if (TdesContext == NULL || Key == NULL || (KeyLength != 64 && KeyLength != 128 && KeyLength != 192)) { - return FALSE; - } - - KeySchedule = (DES_key_schedule *) TdesContext; - - // - // If input Key is a weak key, return error. - // - if (DES_is_weak_key ((const_DES_cblock *) Key) == 1) { - return FALSE; - } - - DES_set_key_unchecked ((const_DES_cblock *) Key, KeySchedule); - - if (KeyLength == 64) { - CopyMem (KeySchedule + 1, KeySchedule, sizeof (DES_key_schedule)); - CopyMem (KeySchedule + 2, KeySchedule, sizeof (DES_key_schedule)); - return TRUE; - } - - if (DES_is_weak_key ((const_DES_cblock *) (Key + 8)) == 1) { - return FALSE; - } - - DES_set_key_unchecked ((const_DES_cblock *) (Key + 8), KeySchedule + 1); - - if (KeyLength == 128) { - CopyMem (KeySchedule + 2, KeySchedule, sizeof (DES_key_schedule)); - return TRUE; - } - - if (DES_is_weak_key ((const_DES_cblock *) (Key + 16)) == 1) { - return FALSE; - } - - DES_set_key_unchecked ((const_DES_cblock *) (Key + 16), KeySchedule + 2); - - return TRUE; -} - -/** - Performs TDES encryption on a data buffer of the specified size in ECB mode. - - This function performs TDES encryption on data buffer pointed by Input, of specified - size of InputSize, in ECB mode. - InputSize must be multiple of block size (8 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - TdesContext should be already correctly initialized by TdesInit(). Behavior with - invalid TDES context is undefined. - - If TdesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (8 bytes), then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval TRUE TDES encryption succeeded. - @retval FALSE TDES encryption failed. - -**/ -BOOLEAN -EFIAPI -TdesEcbEncrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - DES_key_schedule *KeySchedule; - - // - // Check input parameters. - // - if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Output == NULL) { - return FALSE; - } - - KeySchedule = (DES_key_schedule *) TdesContext; - - while (InputSize > 0) { - DES_ecb3_encrypt ( - (const_DES_cblock *) Input, - (DES_cblock *) Output, - KeySchedule, - KeySchedule + 1, - KeySchedule + 2, - DES_ENCRYPT - ); - Input += TDES_BLOCK_SIZE; - Output += TDES_BLOCK_SIZE; - InputSize -= TDES_BLOCK_SIZE; - } - - return TRUE; -} - -/** - Performs TDES decryption on a data buffer of the specified size in ECB mode. - - This function performs TDES decryption on data buffer pointed by Input, of specified - size of InputSize, in ECB mode. - InputSize must be multiple of block size (8 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - TdesContext should be already correctly initialized by TdesInit(). Behavior with - invalid TDES context is undefined. - - If TdesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (8 bytes), then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the TDES decryption output. - - @retval TRUE TDES decryption succeeded. - @retval FALSE TDES decryption failed. - -**/ -BOOLEAN -EFIAPI -TdesEcbDecrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - DES_key_schedule *KeySchedule; - - // - // Check input parameters. - // - if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Output == NULL) { - return FALSE; - } - - KeySchedule = (DES_key_schedule *) TdesContext; - - while (InputSize > 0) { - DES_ecb3_encrypt ( - (const_DES_cblock *) Input, - (DES_cblock *) Output, - KeySchedule, - KeySchedule + 1, - KeySchedule + 2, - DES_DECRYPT - ); - Input += TDES_BLOCK_SIZE; - Output += TDES_BLOCK_SIZE; - InputSize -= TDES_BLOCK_SIZE; - } - - return TRUE; -} - -/** - Performs TDES encryption on a data buffer of the specified size in CBC mode. - - This function performs TDES encryption on data buffer pointed by Input, of specified - size of InputSize, in CBC mode. - InputSize must be multiple of block size (8 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - Initialization vector should be one block size (8 bytes). - TdesContext should be already correctly initialized by TdesInit(). Behavior with - invalid TDES context is undefined. - - If TdesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (8 bytes), then return FALSE. - If Ivec is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval TRUE TDES encryption succeeded. - @retval FALSE TDES encryption failed. - -**/ -BOOLEAN -EFIAPI -TdesCbcEncrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - DES_key_schedule *KeySchedule; - UINT8 IvecBuffer[TDES_BLOCK_SIZE]; - - // - // Check input parameters. - // - if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) { - return FALSE; - } - - if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - KeySchedule = (DES_key_schedule *) TdesContext; - CopyMem (IvecBuffer, Ivec, TDES_BLOCK_SIZE); - - DES_ede3_cbc_encrypt ( - Input, - Output, - (UINT32) InputSize, - KeySchedule, - KeySchedule + 1, - KeySchedule + 2, - (DES_cblock *) IvecBuffer, - DES_ENCRYPT - ); - - return TRUE; -} - -/** - Performs TDES decryption on a data buffer of the specified size in CBC mode. - - This function performs TDES decryption on data buffer pointed by Input, of specified - size of InputSize, in CBC mode. - InputSize must be multiple of block size (8 bytes). This function does not perform - padding. Caller must perform padding, if necessary, to ensure valid input data size. - Initialization vector should be one block size (8 bytes). - TdesContext should be already correctly initialized by TdesInit(). Behavior with - invalid TDES context is undefined. - - If TdesContext is NULL, then return FALSE. - If Input is NULL, then return FALSE. - If InputSize is not multiple of block size (8 bytes), then return FALSE. - If Ivec is NULL, then return FALSE. - If Output is NULL, then return FALSE. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval TRUE TDES decryption succeeded. - @retval FALSE TDES decryption failed. - -**/ -BOOLEAN -EFIAPI -TdesCbcDecrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - DES_key_schedule *KeySchedule; - UINT8 IvecBuffer[TDES_BLOCK_SIZE]; - - // - // Check input parameters. - // - if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) { - return FALSE; - } - - if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) { - return FALSE; - } - - KeySchedule = (DES_key_schedule *) TdesContext; - CopyMem (IvecBuffer, Ivec, TDES_BLOCK_SIZE); - - DES_ede3_cbc_encrypt ( - Input, - Output, - (UINT32) InputSize, - KeySchedule, - KeySchedule + 1, - KeySchedule + 2, - (DES_cblock *) IvecBuffer, - DES_DECRYPT - ); - - return TRUE; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdesNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdesNull.c deleted file mode 100644 index 06ba4cf..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdesNull.c +++ /dev/null @@ -1,166 +0,0 @@ -/** @file - TDES Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for TDES operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -TdesGetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory as TDES context for subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] TdesContext Pointer to TDES context being initialized. - @param[in] Key Pointer to the user-supplied TDES key. - @param[in] KeyLength Length of TDES key in bits. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -TdesInit ( - OUT VOID *TdesContext, - IN CONST UINT8 *Key, - IN UINTN KeyLength - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs TDES encryption on a data buffer of the specified size in ECB mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -TdesEcbEncrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs TDES decryption on a data buffer of the specified size in ECB mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be decrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[out] Output Pointer to a buffer that receives the TDES decryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -TdesEcbDecrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs TDES encryption on a data buffer of the specified size in CBC mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -TdesCbcEncrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Performs TDES decryption on a data buffer of the specified size in CBC mode. - - Return FALSE to indicate this interface is not supported. - - @param[in] TdesContext Pointer to the TDES context. - @param[in] Input Pointer to the buffer containing the data to be encrypted. - @param[in] InputSize Size of the Input buffer in bytes. - @param[in] Ivec Pointer to initialization vector. - @param[out] Output Pointer to a buffer that receives the TDES encryption output. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -TdesCbcDecrypt ( - IN VOID *TdesContext, - IN CONST UINT8 *Input, - IN UINTN InputSize, - IN CONST UINT8 *Ivec, - OUT UINT8 *Output - ) -{ - ASSERT (FALSE); - return FALSE; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c deleted file mode 100644 index 518bee4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c +++ /dev/null @@ -1,229 +0,0 @@ -/** @file - MD4 Digest Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for MD4 hash operations. - - @return The size, in bytes, of the context buffer required for MD4 hash operations. - -**/ -UINTN -EFIAPI -Md4GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL MD4 Context Size - // - return (UINTN) (sizeof (MD4_CTX)); -} - -/** - Initializes user-supplied memory pointed by Md4Context as MD4 hash context for - subsequent use. - - If Md4Context is NULL, then return FALSE. - - @param[out] Md4Context Pointer to MD4 context being initialized. - - @retval TRUE MD4 context initialization succeeded. - @retval FALSE MD4 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Md4Init ( - OUT VOID *Md4Context - ) -{ - // - // Check input parameters. - // - if (Md4Context == NULL) { - return FALSE; - } - - // - // OpenSSL MD4 Context Initialization - // - return (BOOLEAN) (MD4_Init ((MD4_CTX *) Md4Context)); -} - -/** - Makes a copy of an existing MD4 context. - - If Md4Context is NULL, then return FALSE. - If NewMd4Context is NULL, then return FALSE. - - @param[in] Md4Context Pointer to MD4 context being copied. - @param[out] NewMd4Context Pointer to new MD4 context. - - @retval TRUE MD4 context copy succeeded. - @retval FALSE MD4 context copy failed. - -**/ -BOOLEAN -EFIAPI -Md4Duplicate ( - IN CONST VOID *Md4Context, - OUT VOID *NewMd4Context - ) -{ - // - // Check input parameters. - // - if (Md4Context == NULL || NewMd4Context == NULL) { - return FALSE; - } - - CopyMem (NewMd4Context, Md4Context, sizeof (MD4_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates MD4 context. - - This function performs MD4 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - MD4 context should be already correctly initialized by Md4Init(), and should not be finalized - by Md4Final(). Behavior with invalid context is undefined. - - If Md4Context is NULL, then return FALSE. - - @param[in, out] Md4Context Pointer to the MD4 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE MD4 data digest succeeded. - @retval FALSE MD4 data digest failed. - -**/ -BOOLEAN -EFIAPI -Md4Update ( - IN OUT VOID *Md4Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Md4Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL MD4 Hash Update - // - return (BOOLEAN) (MD4_Update ((MD4_CTX *) Md4Context, Data, DataSize)); -} - -/** - Completes computation of the MD4 digest value. - - This function completes MD4 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the MD4 context cannot - be used again. - MD4 context should be already correctly initialized by Md4Init(), and should not be - finalized by Md4Final(). Behavior with invalid MD4 context is undefined. - - If Md4Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Md4Context Pointer to the MD4 context. - @param[out] HashValue Pointer to a buffer that receives the MD4 digest - value (16 bytes). - - @retval TRUE MD4 digest computation succeeded. - @retval FALSE MD4 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Md4Final ( - IN OUT VOID *Md4Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Md4Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL MD4 Hash Finalization - // - return (BOOLEAN) (MD4_Final (HashValue, (MD4_CTX *) Md4Context)); -} - -/** - Computes the MD4 message digest of a input data buffer. - - This function performs the MD4 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the MD4 digest - value (16 bytes). - - @retval TRUE MD4 digest computation succeeded. - @retval FALSE MD4 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL MD4 Hash Computation. - // - if (MD4 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4Null.c deleted file mode 100644 index b8435b0..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4Null.c +++ /dev/null @@ -1,149 +0,0 @@ -/** @file - MD4 Digest Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for MD4 hash - operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -Md4GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory pointed by Md4Context as MD4 hash context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] Md4Context Pointer to MD4 context being initialized. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4Init ( - OUT VOID *Md4Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing MD4 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] Md4Context Pointer to MD4 context being copied. - @param[out] NewMd4Context Pointer to new MD4 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4Duplicate ( - IN CONST VOID *Md4Context, - OUT VOID *NewMd4Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates MD4 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Md4Context Pointer to the MD4 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4Update ( - IN OUT VOID *Md4Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the MD4 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Md4Context Pointer to the MD4 context. - @param[out] HashValue Pointer to a buffer that receives the MD4 digest - value (16 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4Final ( - IN OUT VOID *Md4Context, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Computes the MD4 message digest of a input data buffer. - - Return FALSE to indicate this interface is not supported. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the MD4 digest - value (16 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md4HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c deleted file mode 100644 index 837ee3c..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c +++ /dev/null @@ -1,231 +0,0 @@ -/** @file - MD5 Digest Wrapper Implementation over OpenSSL. - -Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - - -/** - Retrieves the size, in bytes, of the context buffer required for MD5 hash operations. - - @return The size, in bytes, of the context buffer required for MD5 hash operations. - -**/ -UINTN -EFIAPI -Md5GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL MD5 Context Size - // - return (UINTN) (sizeof (MD5_CTX)); -} - - -/** - Initializes user-supplied memory pointed by Md5Context as MD5 hash context for - subsequent use. - - If Md5Context is NULL, then return FALSE. - - @param[out] Md5Context Pointer to MD5 context being initialized. - - @retval TRUE MD5 context initialization succeeded. - @retval FALSE MD5 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Md5Init ( - OUT VOID *Md5Context - ) -{ - // - // Check input parameters. - // - if (Md5Context == NULL) { - return FALSE; - } - - // - // OpenSSL MD5 Context Initialization - // - return (BOOLEAN) (MD5_Init ((MD5_CTX *) Md5Context)); -} - -/** - Makes a copy of an existing MD5 context. - - If Md5Context is NULL, then return FALSE. - If NewMd5Context is NULL, then return FALSE. - - @param[in] Md5Context Pointer to MD5 context being copied. - @param[out] NewMd5Context Pointer to new MD5 context. - - @retval TRUE MD5 context copy succeeded. - @retval FALSE MD5 context copy failed. - -**/ -BOOLEAN -EFIAPI -Md5Duplicate ( - IN CONST VOID *Md5Context, - OUT VOID *NewMd5Context - ) -{ - // - // Check input parameters. - // - if (Md5Context == NULL || NewMd5Context == NULL) { - return FALSE; - } - - CopyMem (NewMd5Context, Md5Context, sizeof (MD5_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates MD5 context. - - This function performs MD5 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - MD5 context should be already correctly initialized by Md5Init(), and should not be finalized - by Md5Final(). Behavior with invalid context is undefined. - - If Md5Context is NULL, then return FALSE. - - @param[in, out] Md5Context Pointer to the MD5 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE MD5 data digest succeeded. - @retval FALSE MD5 data digest failed. - -**/ -BOOLEAN -EFIAPI -Md5Update ( - IN OUT VOID *Md5Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Md5Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && (DataSize != 0)) { - return FALSE; - } - - // - // OpenSSL MD5 Hash Update - // - return (BOOLEAN) (MD5_Update ((MD5_CTX *) Md5Context, Data, DataSize)); -} - -/** - Completes computation of the MD5 digest value. - - This function completes MD5 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the MD5 context cannot - be used again. - MD5 context should be already correctly initialized by Md5Init(), and should not be - finalized by Md5Final(). Behavior with invalid MD5 context is undefined. - - If Md5Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Md5Context Pointer to the MD5 context. - @param[out] HashValue Pointer to a buffer that receives the MD5 digest - value (16 bytes). - - @retval TRUE MD5 digest computation succeeded. - @retval FALSE MD5 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Md5Final ( - IN OUT VOID *Md5Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Md5Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL MD5 Hash Finalization - // - return (BOOLEAN) (MD5_Final (HashValue, (MD5_CTX *) Md5Context)); -} - -/** - Computes the MD5 message digest of a input data buffer. - - This function performs the MD5 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the MD5 digest - value (16 bytes). - - @retval TRUE MD5 digest computation succeeded. - @retval FALSE MD5 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Md5HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && (DataSize != 0)) { - return FALSE; - } - - // - // OpenSSL MD5 Hash Computation. - // - if (MD5 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c deleted file mode 100644 index 9fea08f..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c +++ /dev/null @@ -1,230 +0,0 @@ -/** @file - SHA-1 Digest Wrapper Implementation over OpenSSL. - -Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations. - - @return The size, in bytes, of the context buffer required for SHA-1 hash operations. - -**/ -UINTN -EFIAPI -Sha1GetContextSize ( - VOID - ) -{ - // - // Retrieves OpenSSL SHA Context Size - // - return (UINTN) (sizeof (SHA_CTX)); -} - -/** - Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for - subsequent use. - - If Sha1Context is NULL, then return FALSE. - - @param[out] Sha1Context Pointer to SHA-1 context being initialized. - - @retval TRUE SHA-1 context initialization succeeded. - @retval FALSE SHA-1 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Sha1Init ( - OUT VOID *Sha1Context - ) -{ - // - // Check input parameters. - // - if (Sha1Context == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-1 Context Initialization - // - return (BOOLEAN) (SHA1_Init ((SHA_CTX *) Sha1Context)); -} - -/** - Makes a copy of an existing SHA-1 context. - - If Sha1Context is NULL, then return FALSE. - If NewSha1Context is NULL, then return FALSE. - - @param[in] Sha1Context Pointer to SHA-1 context being copied. - @param[out] NewSha1Context Pointer to new SHA-1 context. - - @retval TRUE SHA-1 context copy succeeded. - @retval FALSE SHA-1 context copy failed. - -**/ -BOOLEAN -EFIAPI -Sha1Duplicate ( - IN CONST VOID *Sha1Context, - OUT VOID *NewSha1Context - ) -{ - // - // Check input parameters. - // - if (Sha1Context == NULL || NewSha1Context == NULL) { - return FALSE; - } - - CopyMem (NewSha1Context, Sha1Context, sizeof (SHA_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates SHA-1 context. - - This function performs SHA-1 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized - by Sha1Final(). Behavior with invalid context is undefined. - - If Sha1Context is NULL, then return FALSE. - - @param[in, out] Sha1Context Pointer to the SHA-1 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE SHA-1 data digest succeeded. - @retval FALSE SHA-1 data digest failed. - -**/ -BOOLEAN -EFIAPI -Sha1Update ( - IN OUT VOID *Sha1Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Sha1Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-1 Hash Update - // - return (BOOLEAN) (SHA1_Update ((SHA_CTX *) Sha1Context, Data, DataSize)); -} - -/** - Completes computation of the SHA-1 digest value. - - This function completes SHA-1 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the SHA-1 context cannot - be used again. - SHA-1 context should be already correctly initialized by Sha1Init(), and should not be - finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined. - - If Sha1Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Sha1Context Pointer to the SHA-1 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest - value (20 bytes). - - @retval TRUE SHA-1 digest computation succeeded. - @retval FALSE SHA-1 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Sha1Final ( - IN OUT VOID *Sha1Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Sha1Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-1 Hash Finalization - // - return (BOOLEAN) (SHA1_Final (HashValue, (SHA_CTX *) Sha1Context)); -} - -/** - Computes the SHA-1 message digest of a input data buffer. - - This function performs the SHA-1 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest - value (20 bytes). - - @retval TRUE SHA-1 digest computation succeeded. - @retval FALSE SHA-1 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha1HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-1 Hash Computation. - // - if (SHA1 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c deleted file mode 100644 index 3a04291..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c +++ /dev/null @@ -1,229 +0,0 @@ -/** @file - SHA-256 Digest Wrapper Implementation over OpenSSL. - -Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. - - @return The size, in bytes, of the context buffer required for SHA-256 hash operations. - -**/ -UINTN -EFIAPI -Sha256GetContextSize ( - VOID - ) -{ - // - // Retrieves OpenSSL SHA-256 Context Size - // - return (UINTN) (sizeof (SHA256_CTX)); -} - -/** - Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for - subsequent use. - - If Sha256Context is NULL, then return FALSE. - - @param[out] Sha256Context Pointer to SHA-256 context being initialized. - - @retval TRUE SHA-256 context initialization succeeded. - @retval FALSE SHA-256 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Sha256Init ( - OUT VOID *Sha256Context - ) -{ - // - // Check input parameters. - // - if (Sha256Context == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-256 Context Initialization - // - return (BOOLEAN) (SHA256_Init ((SHA256_CTX *) Sha256Context)); -} - -/** - Makes a copy of an existing SHA-256 context. - - If Sha256Context is NULL, then return FALSE. - If NewSha256Context is NULL, then return FALSE. - - @param[in] Sha256Context Pointer to SHA-256 context being copied. - @param[out] NewSha256Context Pointer to new SHA-256 context. - - @retval TRUE SHA-256 context copy succeeded. - @retval FALSE SHA-256 context copy failed. - -**/ -BOOLEAN -EFIAPI -Sha256Duplicate ( - IN CONST VOID *Sha256Context, - OUT VOID *NewSha256Context - ) -{ - // - // Check input parameters. - // - if (Sha256Context == NULL || NewSha256Context == NULL) { - return FALSE; - } - - CopyMem (NewSha256Context, Sha256Context, sizeof (SHA256_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates SHA-256 context. - - This function performs SHA-256 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized - by Sha256Final(). Behavior with invalid context is undefined. - - If Sha256Context is NULL, then return FALSE. - - @param[in, out] Sha256Context Pointer to the SHA-256 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE SHA-256 data digest succeeded. - @retval FALSE SHA-256 data digest failed. - -**/ -BOOLEAN -EFIAPI -Sha256Update ( - IN OUT VOID *Sha256Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Sha256Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-256 Hash Update - // - return (BOOLEAN) (SHA256_Update ((SHA256_CTX *) Sha256Context, Data, DataSize)); -} - -/** - Completes computation of the SHA-256 digest value. - - This function completes SHA-256 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the SHA-256 context cannot - be used again. - SHA-256 context should be already correctly initialized by Sha256Init(), and should not be - finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined. - - If Sha256Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Sha256Context Pointer to the SHA-256 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest - value (32 bytes). - - @retval TRUE SHA-256 digest computation succeeded. - @retval FALSE SHA-256 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Sha256Final ( - IN OUT VOID *Sha256Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Sha256Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-256 Hash Finalization - // - return (BOOLEAN) (SHA256_Final (HashValue, (SHA256_CTX *) Sha256Context)); -} - -/** - Computes the SHA-256 message digest of a input data buffer. - - This function performs the SHA-256 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest - value (32 bytes). - - @retval TRUE SHA-256 digest computation succeeded. - @retval FALSE SHA-256 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha256HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-256 Hash Computation. - // - if (SHA256 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c deleted file mode 100644 index b1843e8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c +++ /dev/null @@ -1,446 +0,0 @@ -/** @file - SHA-384 and SHA-512 Digest Wrapper Implementations over OpenSSL. - -Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations. - - @return The size, in bytes, of the context buffer required for SHA-384 hash operations. - -**/ -UINTN -EFIAPI -Sha384GetContextSize ( - VOID - ) -{ - // - // Retrieves OpenSSL SHA-384 Context Size - // - return (UINTN) (sizeof (SHA512_CTX)); -} - -/** - Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for - subsequent use. - - If Sha384Context is NULL, then return FALSE. - - @param[out] Sha384Context Pointer to SHA-384 context being initialized. - - @retval TRUE SHA-384 context initialization succeeded. - @retval FALSE SHA-384 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Sha384Init ( - OUT VOID *Sha384Context - ) -{ - // - // Check input parameters. - // - if (Sha384Context == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-384 Context Initialization - // - return (BOOLEAN) (SHA384_Init ((SHA512_CTX *) Sha384Context)); -} - -/** - Makes a copy of an existing SHA-384 context. - - If Sha384Context is NULL, then return FALSE. - If NewSha384Context is NULL, then return FALSE. - If this interface is not supported, then return FALSE. - - @param[in] Sha384Context Pointer to SHA-384 context being copied. - @param[out] NewSha384Context Pointer to new SHA-384 context. - - @retval TRUE SHA-384 context copy succeeded. - @retval FALSE SHA-384 context copy failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384Duplicate ( - IN CONST VOID *Sha384Context, - OUT VOID *NewSha384Context - ) -{ - // - // Check input parameters. - // - if (Sha384Context == NULL || NewSha384Context == NULL) { - return FALSE; - } - - CopyMem (NewSha384Context, Sha384Context, sizeof (SHA512_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates SHA-384 context. - - This function performs SHA-384 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized - by Sha384Final(). Behavior with invalid context is undefined. - - If Sha384Context is NULL, then return FALSE. - - @param[in, out] Sha384Context Pointer to the SHA-384 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE SHA-384 data digest succeeded. - @retval FALSE SHA-384 data digest failed. - -**/ -BOOLEAN -EFIAPI -Sha384Update ( - IN OUT VOID *Sha384Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Sha384Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-384 Hash Update - // - return (BOOLEAN) (SHA384_Update ((SHA512_CTX *) Sha384Context, Data, DataSize)); -} - -/** - Completes computation of the SHA-384 digest value. - - This function completes SHA-384 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the SHA-384 context cannot - be used again. - SHA-384 context should be already correctly initialized by Sha384Init(), and should not be - finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined. - - If Sha384Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Sha384Context Pointer to the SHA-384 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest - value (48 bytes). - - @retval TRUE SHA-384 digest computation succeeded. - @retval FALSE SHA-384 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Sha384Final ( - IN OUT VOID *Sha384Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Sha384Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-384 Hash Finalization - // - return (BOOLEAN) (SHA384_Final (HashValue, (SHA512_CTX *) Sha384Context)); -} - -/** - Computes the SHA-384 message digest of a input data buffer. - - This function performs the SHA-384 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest - value (48 bytes). - - @retval TRUE SHA-384 digest computation succeeded. - @retval FALSE SHA-384 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-384 Hash Computation. - // - if (SHA384 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations. - - @return The size, in bytes, of the context buffer required for SHA-512 hash operations. - -**/ -UINTN -EFIAPI -Sha512GetContextSize ( - VOID - ) -{ - // - // Retrieves OpenSSL SHA-512 Context Size - // - return (UINTN) (sizeof (SHA512_CTX)); -} - -/** - Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for - subsequent use. - - If Sha512Context is NULL, then return FALSE. - - @param[out] Sha512Context Pointer to SHA-512 context being initialized. - - @retval TRUE SHA-512 context initialization succeeded. - @retval FALSE SHA-512 context initialization failed. - -**/ -BOOLEAN -EFIAPI -Sha512Init ( - OUT VOID *Sha512Context - ) -{ - // - // Check input parameters. - // - if (Sha512Context == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-512 Context Initialization - // - return (BOOLEAN) (SHA512_Init ((SHA512_CTX *) Sha512Context)); -} - -/** - Makes a copy of an existing SHA-512 context. - - If Sha512Context is NULL, then return FALSE. - If NewSha512Context is NULL, then return FALSE. - If this interface is not supported, then return FALSE. - - @param[in] Sha512Context Pointer to SHA-512 context being copied. - @param[out] NewSha512Context Pointer to new SHA-512 context. - - @retval TRUE SHA-512 context copy succeeded. - @retval FALSE SHA-512 context copy failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512Duplicate ( - IN CONST VOID *Sha512Context, - OUT VOID *NewSha512Context - ) -{ - // - // Check input parameters. - // - if (Sha512Context == NULL || NewSha512Context == NULL) { - return FALSE; - } - - CopyMem (NewSha512Context, Sha512Context, sizeof (SHA512_CTX)); - - return TRUE; -} - -/** - Digests the input data and updates SHA-512 context. - - This function performs SHA-512 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized - by Sha512Final(). Behavior with invalid context is undefined. - - If Sha512Context is NULL, then return FALSE. - - @param[in, out] Sha512Context Pointer to the SHA-512 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE SHA-512 data digest succeeded. - @retval FALSE SHA-512 data digest failed. - -**/ -BOOLEAN -EFIAPI -Sha512Update ( - IN OUT VOID *Sha512Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (Sha512Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-512 Hash Update - // - return (BOOLEAN) (SHA512_Update ((SHA512_CTX *) Sha512Context, Data, DataSize)); -} - -/** - Completes computation of the SHA-512 digest value. - - This function completes SHA-512 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the SHA-512 context cannot - be used again. - SHA-512 context should be already correctly initialized by Sha512Init(), and should not be - finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined. - - If Sha512Context is NULL, then return FALSE. - If HashValue is NULL, then return FALSE. - - @param[in, out] Sha512Context Pointer to the SHA-512 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest - value (64 bytes). - - @retval TRUE SHA-512 digest computation succeeded. - @retval FALSE SHA-512 digest computation failed. - -**/ -BOOLEAN -EFIAPI -Sha512Final ( - IN OUT VOID *Sha512Context, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (Sha512Context == NULL || HashValue == NULL) { - return FALSE; - } - - // - // OpenSSL SHA-512 Hash Finalization - // - return (BOOLEAN) (SHA384_Final (HashValue, (SHA512_CTX *) Sha512Context)); -} - -/** - Computes the SHA-512 message digest of a input data buffer. - - This function performs the SHA-512 message digest of a given data buffer, and places - the digest value into the specified memory. - - If this interface is not supported, then return FALSE. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest - value (64 bytes). - - @retval TRUE SHA-512 digest computation succeeded. - @retval FALSE SHA-512 digest computation failed. - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - // - // Check input parameters. - // - if (HashValue == NULL) { - return FALSE; - } - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL SHA-512 Hash Computation. - // - if (SHA512 (Data, DataSize, HashValue) == NULL) { - return FALSE; - } else { - return TRUE; - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c deleted file mode 100644 index 4a3bcfc..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c +++ /dev/null @@ -1,281 +0,0 @@ -/** @file - SHA-384 and SHA-512 Digest Wrapper Implementations which does not provide real capabilities. - -Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -Sha384GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] Sha384Context Pointer to SHA-384 context being initialized. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384Init ( - OUT VOID *Sha384Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing SHA-384 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] Sha384Context Pointer to SHA-384 context being copied. - @param[out] NewSha384Context Pointer to new SHA-384 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384Duplicate ( - IN CONST VOID *Sha384Context, - OUT VOID *NewSha384Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates SHA-384 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Sha384Context Pointer to the SHA-384 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384Update ( - IN OUT VOID *Sha384Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the SHA-384 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Sha384Context Pointer to the SHA-384 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest - value (48 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384Final ( - IN OUT VOID *Sha384Context, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Computes the SHA-384 message digest of a input data buffer. - - Return FALSE to indicate this interface is not supported. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest - value (48 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha384HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations. - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -Sha512GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] Sha512Context Pointer to SHA-512 context being initialized. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512Init ( - OUT VOID *Sha512Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing SHA-512 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] Sha512Context Pointer to SHA-512 context being copied. - @param[out] NewSha512Context Pointer to new SHA-512 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512Duplicate ( - IN CONST VOID *Sha512Context, - OUT VOID *NewSha512Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates SHA-512 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Sha512Context Pointer to the SHA-512 context. - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512Update ( - IN OUT VOID *Sha512Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the SHA-512 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] Sha512Context Pointer to the SHA-512 context. - @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest - value (64 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512Final ( - IN OUT VOID *Sha512Context, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Computes the SHA-512 message digest of a input data buffer. - - Return FALSE to indicate this interface is not supported. - - @param[in] Data Pointer to the buffer containing the data to be hashed. - @param[in] DataSize Size of Data buffer in bytes. - @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest - value (64 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Sha512HashAll ( - IN CONST VOID *Data, - IN UINTN DataSize, - OUT UINT8 *HashValue - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c deleted file mode 100644 index 9688cd5..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c +++ /dev/null @@ -1,256 +0,0 @@ -/** @file - HMAC-MD5 Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -#define HMAC_MD5_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \ - sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations. - (NOTE: This API is deprecated. - Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.) - - @return The size, in bytes, of the context buffer required for HMAC-MD5 operations. - -**/ -UINTN -EFIAPI -HmacMd5GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL HMAC-MD5 Context Size - // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the - // fixed size as a workaround to make this API work for compatibility. - // We should retire HmacMd5GetContextSize() in future, and use HmacMd5New() - // and HmacMd5Free() for context allocation and release. - // - return (UINTN) HMAC_MD5_CTX_SIZE; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use. - - @return Pointer to the HMAC_CTX context that has been initialized. - If the allocations fails, HmacMd5New() returns NULL. - -**/ -VOID * -EFIAPI -HmacMd5New ( - VOID - ) -{ - // - // Allocates & Initializes HMAC_CTX Context by OpenSSL HMAC_CTX_new() - // - return (VOID *) HMAC_CTX_new (); -} - -/** - Release the specified HMAC_CTX context. - - @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacMd5Free ( - IN VOID *HmacMd5Ctx - ) -{ - // - // Free OpenSSL HMAC_CTX Context - // - HMAC_CTX_free ((HMAC_CTX *)HmacMd5Ctx); -} - -/** - Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for - subsequent use. - - If HmacMd5Context is NULL, then return FALSE. - - @param[out] HmacMd5Context Pointer to HMAC-MD5 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval TRUE HMAC-MD5 context initialization succeeded. - @retval FALSE HMAC-MD5 context initialization failed. - -**/ -BOOLEAN -EFIAPI -HmacMd5Init ( - OUT VOID *HmacMd5Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - // - // Check input parameters. - // - if (HmacMd5Context == NULL || KeySize > INT_MAX) { - return FALSE; - } - - // - // OpenSSL HMAC-MD5 Context Initialization - // - memset(HmacMd5Context, 0, HMAC_MD5_CTX_SIZE); - if (HMAC_CTX_reset ((HMAC_CTX *)HmacMd5Context) != 1) { - return FALSE; - } - if (HMAC_Init_ex ((HMAC_CTX *)HmacMd5Context, Key, (UINT32) KeySize, EVP_md5(), NULL) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Makes a copy of an existing HMAC-MD5 context. - - If HmacMd5Context is NULL, then return FALSE. - If NewHmacMd5Context is NULL, then return FALSE. - - @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied. - @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context. - - @retval TRUE HMAC-MD5 context copy succeeded. - @retval FALSE HMAC-MD5 context copy failed. - -**/ -BOOLEAN -EFIAPI -HmacMd5Duplicate ( - IN CONST VOID *HmacMd5Context, - OUT VOID *NewHmacMd5Context - ) -{ - // - // Check input parameters. - // - if (HmacMd5Context == NULL || NewHmacMd5Context == NULL) { - return FALSE; - } - - if (HMAC_CTX_copy ((HMAC_CTX *)NewHmacMd5Context, (HMAC_CTX *)HmacMd5Context) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Digests the input data and updates HMAC-MD5 context. - - This function performs HMAC-MD5 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be - finalized by HmacMd5Final(). Behavior with invalid context is undefined. - - If HmacMd5Context is NULL, then return FALSE. - - @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE HMAC-MD5 data digest succeeded. - @retval FALSE HMAC-MD5 data digest failed. - -**/ -BOOLEAN -EFIAPI -HmacMd5Update ( - IN OUT VOID *HmacMd5Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (HmacMd5Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL HMAC-MD5 digest update - // - if (HMAC_Update ((HMAC_CTX *)HmacMd5Context, Data, DataSize) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Completes computation of the HMAC-MD5 digest value. - - This function completes HMAC-MD5 digest computation and retrieves the digest value into - the specified memory. After this function has been called, the HMAC-MD5 context cannot - be used again. - HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be - finalized by HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined. - - If HmacMd5Context is NULL, then return FALSE. - If HmacValue is NULL, then return FALSE. - - @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest - value (16 bytes). - - @retval TRUE HMAC-MD5 digest computation succeeded. - @retval FALSE HMAC-MD5 digest computation failed. - -**/ -BOOLEAN -EFIAPI -HmacMd5Final ( - IN OUT VOID *HmacMd5Context, - OUT UINT8 *HmacValue - ) -{ - UINT32 Length; - - // - // Check input parameters. - // - if (HmacMd5Context == NULL || HmacValue == NULL) { - return FALSE; - } - - // - // OpenSSL HMAC-MD5 digest finalization - // - if (HMAC_Final ((HMAC_CTX *)HmacMd5Context, HmacValue, &Length) != 1) { - return FALSE; - } - if (HMAC_CTX_reset ((HMAC_CTX *)HmacMd5Context) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c deleted file mode 100644 index 8e94e1a..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c +++ /dev/null @@ -1,165 +0,0 @@ -/** @file - HMAC-MD5 Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations. - (NOTE: This API is deprecated. - Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.) - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -HmacMd5GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use. - - Return NULL to indicate this interface is not supported. - - @retval NULL This interface is not supported. - -**/ -VOID * -EFIAPI -HmacMd5New ( - VOID - ) -{ - ASSERT (FALSE); - return NULL; -} - -/** - Release the specified HMAC_CTX context. - - This function will do nothing. - - @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacMd5Free ( - IN VOID *HmacMd5Ctx - ) -{ - ASSERT (FALSE); - return; -} - -/** - Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] HmacMd5Context Pointer to HMAC-MD5 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacMd5Init ( - OUT VOID *HmacMd5Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing HMAC-MD5 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied. - @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacMd5Duplicate ( - IN CONST VOID *HmacMd5Context, - OUT VOID *NewHmacMd5Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates HMAC-MD5 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacMd5Update ( - IN OUT VOID *HmacMd5Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the HMAC-MD5 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest - value (16 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacMd5Final ( - IN OUT VOID *HmacMd5Context, - OUT UINT8 *HmacValue - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c deleted file mode 100644 index d82e648..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c +++ /dev/null @@ -1,256 +0,0 @@ -/** @file - HMAC-SHA1 Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -#define HMAC_SHA1_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \ - sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations. - (NOTE: This API is deprecated. - Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.) - - @return The size, in bytes, of the context buffer required for HMAC-SHA1 operations. - -**/ -UINTN -EFIAPI -HmacSha1GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL HMAC-SHA1 Context Size - // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the - // fixed size as a workaround to make this API work for compatibility. - // We should retire HmacSha15GetContextSize() in future, and use HmacSha1New() - // and HmacSha1Free() for context allocation and release. - // - return (UINTN) HMAC_SHA1_CTX_SIZE; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use. - - @return Pointer to the HMAC_CTX context that has been initialized. - If the allocations fails, HmacSha1New() returns NULL. - -**/ -VOID * -EFIAPI -HmacSha1New ( - VOID - ) -{ - // - // Allocates & Initializes HMAC_CTX Context by OpenSSL HMAC_CTX_new() - // - return (VOID *) HMAC_CTX_new (); -} - -/** - Release the specified HMAC_CTX context. - - @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacSha1Free ( - IN VOID *HmacSha1Ctx - ) -{ - // - // Free OpenSSL HMAC_CTX Context - // - HMAC_CTX_free ((HMAC_CTX *)HmacSha1Ctx); -} - -/** - Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for - subsequent use. - - If HmacSha1Context is NULL, then return FALSE. - - @param[out] HmacSha1Context Pointer to HMAC-SHA1 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval TRUE HMAC-SHA1 context initialization succeeded. - @retval FALSE HMAC-SHA1 context initialization failed. - -**/ -BOOLEAN -EFIAPI -HmacSha1Init ( - OUT VOID *HmacSha1Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - // - // Check input parameters. - // - if (HmacSha1Context == NULL || KeySize > INT_MAX) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 Context Initialization - // - memset(HmacSha1Context, 0, HMAC_SHA1_CTX_SIZE); - if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha1Context) != 1) { - return FALSE; - } - if (HMAC_Init_ex ((HMAC_CTX *)HmacSha1Context, Key, (UINT32) KeySize, EVP_sha1(), NULL) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Makes a copy of an existing HMAC-SHA1 context. - - If HmacSha1Context is NULL, then return FALSE. - If NewHmacSha1Context is NULL, then return FALSE. - - @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied. - @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context. - - @retval TRUE HMAC-SHA1 context copy succeeded. - @retval FALSE HMAC-SHA1 context copy failed. - -**/ -BOOLEAN -EFIAPI -HmacSha1Duplicate ( - IN CONST VOID *HmacSha1Context, - OUT VOID *NewHmacSha1Context - ) -{ - // - // Check input parameters. - // - if (HmacSha1Context == NULL || NewHmacSha1Context == NULL) { - return FALSE; - } - - if (HMAC_CTX_copy ((HMAC_CTX *)NewHmacSha1Context, (HMAC_CTX *)HmacSha1Context) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Digests the input data and updates HMAC-SHA1 context. - - This function performs HMAC-SHA1 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should not - be finalized by HmacSha1Final(). Behavior with invalid context is undefined. - - If HmacSha1Context is NULL, then return FALSE. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE HMAC-SHA1 data digest succeeded. - @retval FALSE HMAC-SHA1 data digest failed. - -**/ -BOOLEAN -EFIAPI -HmacSha1Update ( - IN OUT VOID *HmacSha1Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (HmacSha1Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 digest update - // - if (HMAC_Update ((HMAC_CTX *)HmacSha1Context, Data, DataSize) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Completes computation of the HMAC-SHA1 digest value. - - This function completes HMAC-SHA1 digest computation and retrieves the digest value into - the specified memory. After this function has been called, the HMAC-SHA1 context cannot - be used again. - HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should - not be finalized by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined. - - If HmacSha1Context is NULL, then return FALSE. - If HmacValue is NULL, then return FALSE. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest - value (20 bytes). - - @retval TRUE HMAC-SHA1 digest computation succeeded. - @retval FALSE HMAC-SHA1 digest computation failed. - -**/ -BOOLEAN -EFIAPI -HmacSha1Final ( - IN OUT VOID *HmacSha1Context, - OUT UINT8 *HmacValue - ) -{ - UINT32 Length; - - // - // Check input parameters. - // - if (HmacSha1Context == NULL || HmacValue == NULL) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 digest finalization - // - if (HMAC_Final ((HMAC_CTX *)HmacSha1Context, HmacValue, &Length) != 1) { - return FALSE; - } - if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha1Context) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c deleted file mode 100644 index f3dcda4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c +++ /dev/null @@ -1,165 +0,0 @@ -/** @file - HMAC-SHA1 Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations. - (NOTE: This API is deprecated. - Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.) - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -HmacSha1GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use. - - Return NULL to indicate this interface is not supported. - - @return NULL This interface is not supported.. - -**/ -VOID * -EFIAPI -HmacSha1New ( - VOID - ) -{ - ASSERT (FALSE); - return NULL; -} - -/** - Release the specified HMAC_CTX context. - - This function will do nothing. - - @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacSha1Free ( - IN VOID *HmacSha1Ctx - ) -{ - ASSERT (FALSE); - return; -} - -/** - Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] HmacSha1Context Pointer to HMAC-SHA1 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha1Init ( - OUT VOID *HmacSha1Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing HMAC-SHA1 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied. - @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha1Duplicate ( - IN CONST VOID *HmacSha1Context, - OUT VOID *NewHmacSha1Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates HMAC-SHA1 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha1Update ( - IN OUT VOID *HmacSha1Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the HMAC-SHA1 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest - value (20 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha1Final ( - IN OUT VOID *HmacSha1Context, - OUT UINT8 *HmacValue - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c deleted file mode 100644 index 03d550e..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c +++ /dev/null @@ -1,256 +0,0 @@ -/** @file - HMAC-SHA256 Wrapper Implementation over OpenSSL. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -#define HMAC_SHA256_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \ - sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations. - (NOTE: This API is deprecated. - Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.) - - @return The size, in bytes, of the context buffer required for HMAC-SHA256 operations. - -**/ -UINTN -EFIAPI -HmacSha256GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL HMAC-SHA256 Context Size - // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the - // fixed size as a workaround to make this API work for compatibility. - // We should retire HmacSha256GetContextSize() in future, and use HmacSha256New() - // and HmacSha256Free() for context allocation and release. - // - return (UINTN)HMAC_SHA256_CTX_SIZE; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use. - - @return Pointer to the HMAC_CTX context that has been initialized. - If the allocations fails, HmacSha256New() returns NULL. - -**/ -VOID * -EFIAPI -HmacSha256New ( - VOID - ) -{ - // - // Allocates & Initializes HMAC_CTX Context by OpenSSL HMAC_CTX_new() - // - return (VOID *) HMAC_CTX_new (); -} - -/** - Release the specified HMAC_CTX context. - - @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacSha256Free ( - IN VOID *HmacSha256Ctx - ) -{ - // - // Free OpenSSL HMAC_CTX Context - // - HMAC_CTX_free ((HMAC_CTX *)HmacSha256Ctx); -} - -/** - Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for - subsequent use. - - If HmacSha256Context is NULL, then return FALSE. - - @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval TRUE HMAC-SHA256 context initialization succeeded. - @retval FALSE HMAC-SHA256 context initialization failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Init ( - OUT VOID *HmacSha256Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL || KeySize > INT_MAX) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA256 Context Initialization - // - memset(HmacSha256Context, 0, HMAC_SHA256_CTX_SIZE); - if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha256Context) != 1) { - return FALSE; - } - if (HMAC_Init_ex ((HMAC_CTX *)HmacSha256Context, Key, (UINT32) KeySize, EVP_sha256(), NULL) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Makes a copy of an existing HMAC-SHA256 context. - - If HmacSha256Context is NULL, then return FALSE. - If NewHmacSha256Context is NULL, then return FALSE. - - @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied. - @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context. - - @retval TRUE HMAC-SHA256 context copy succeeded. - @retval FALSE HMAC-SHA256 context copy failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Duplicate ( - IN CONST VOID *HmacSha256Context, - OUT VOID *NewHmacSha256Context - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL || NewHmacSha256Context == NULL) { - return FALSE; - } - - if (HMAC_CTX_copy ((HMAC_CTX *)NewHmacSha256Context, (HMAC_CTX *)HmacSha256Context) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Digests the input data and updates HMAC-SHA256 context. - - This function performs HMAC-SHA256 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should not - be finalized by HmacSha256Final(). Behavior with invalid context is undefined. - - If HmacSha256Context is NULL, then return FALSE. - - @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE HMAC-SHA256 data digest succeeded. - @retval FALSE HMAC-SHA256 data digest failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Update ( - IN OUT VOID *HmacSha256Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA256 digest update - // - if (HMAC_Update ((HMAC_CTX *)HmacSha256Context, Data, DataSize) != 1) { - return FALSE; - } - - return TRUE; -} - -/** - Completes computation of the HMAC-SHA256 digest value. - - This function completes HMAC-SHA256 hash computation and retrieves the digest value into - the specified memory. After this function has been called, the HMAC-SHA256 context cannot - be used again. - HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should - not be finalized by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined. - - If HmacSha256Context is NULL, then return FALSE. - If HmacValue is NULL, then return FALSE. - - @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest - value (32 bytes). - - @retval TRUE HMAC-SHA256 digest computation succeeded. - @retval FALSE HMAC-SHA256 digest computation failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Final ( - IN OUT VOID *HmacSha256Context, - OUT UINT8 *HmacValue - ) -{ - UINT32 Length; - - // - // Check input parameters. - // - if (HmacSha256Context == NULL || HmacValue == NULL) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA256 digest finalization - // - if (HMAC_Final ((HMAC_CTX *)HmacSha256Context, HmacValue, &Length) != 1) { - return FALSE; - } - if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha256Context) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c deleted file mode 100644 index fcc45b7..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c +++ /dev/null @@ -1,165 +0,0 @@ -/** @file - HMAC-SHA256 Wrapper Implementation which does not provide real capabilities. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations. - (NOTE: This API is deprecated. - Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.) - - Return zero to indicate this interface is not supported. - - @retval 0 This interface is not supported. - -**/ -UINTN -EFIAPI -HmacSha256GetContextSize ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use. - - Return NULL to indicate this interface is not supported. - - @return NULL This interface is not supported.. - -**/ -VOID * -EFIAPI -HmacSha256New ( - VOID - ) -{ - ASSERT (FALSE); - return NULL; -} - -/** - Release the specified HMAC_CTX context. - - This function will do nothing. - - @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released. - -**/ -VOID -EFIAPI -HmacSha256Free ( - IN VOID *HmacSha256Ctx - ) -{ - ASSERT (FALSE); - return; -} - -/** - Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for - subsequent use. - - Return FALSE to indicate this interface is not supported. - - @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha256Init ( - OUT VOID *HmacSha256Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Makes a copy of an existing HMAC-SHA256 context. - - Return FALSE to indicate this interface is not supported. - - @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied. - @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha256Duplicate ( - IN CONST VOID *HmacSha256Context, - OUT VOID *NewHmacSha256Context - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Digests the input data and updates HMAC-SHA256 context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha256Update ( - IN OUT VOID *HmacSha256Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Completes computation of the HMAC-SHA256 digest value. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest - value (32 bytes). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -HmacSha256Final ( - IN OUT VOID *HmacSha256Context, - OUT UINT8 *HmacValue - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h deleted file mode 100644 index b34b052..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h +++ /dev/null @@ -1,68 +0,0 @@ -/** @file - Internal include file for BaseCryptLib. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __INTERNAL_CRYPT_LIB_H__ -#define __INTERNAL_CRYPT_LIB_H__ - -#undef _WIN32 -#undef _WIN64 - -#include -#include -#include -#include -#include - -#include "CrtLibSupport.h" - -#include - -#if OPENSSL_VERSION_NUMBER < 0x10100000L -#define OBJ_get0_data(o) ((o)->data) -#define OBJ_length(o) ((o)->length) -#endif - -/** - Check input P7Data is a wrapped ContentInfo structure or not. If not construct - a new structure to wrap P7Data. - - Caution: This function may receive untrusted input. - UEFI Authenticated Variable is external input, so this function will do basic - check for PKCS#7 data structure. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] WrapFlag If TRUE P7Data is a ContentInfo structure, otherwise - return FALSE. - @param[out] WrapData If return status of this function is TRUE: - 1) when WrapFlag is TRUE, pointer to P7Data. - 2) when WrapFlag is FALSE, pointer to a new ContentInfo - structure. It's caller's responsibility to free this - buffer. - @param[out] WrapDataSize Length of ContentInfo structure in bytes. - - @retval TRUE The operation is finished successfully. - @retval FALSE The operation is failed due to lack of resources. - -**/ -BOOLEAN -WrapPkcs7Data ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT BOOLEAN *WrapFlag, - OUT UINT8 **WrapData, - OUT UINTN *WrapDataSize - ); - -#endif diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf deleted file mode 100644 index e918fad..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf +++ /dev/null @@ -1,99 +0,0 @@ -## @file -# Cryptographic Library Instance for PEIM. -# -# Caution: This module requires additional review when modified. -# This library will have external input - signature. -# This external input must be validated carefully to avoid security issues such as -# buffer overflow or integer overflow. -# -# Note: MD4 Digest functions, -# HMAC-MD5 functions, HMAC-SHA1/SHA256 functions, AES/TDES/ARC4 functions, RSA external -# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509 -# certificate handler functions, authenticode signature verification functions, -# PEM handler functions, and pseudorandom number generator functions are not -# supported in this instance. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiCryptLib - MODULE_UNI_FILE = PeiCryptLib.uni - FILE_GUID = 9a2a4375-194c-4e97-9f67-547ec98d96ca - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseCryptLib|PEIM PEI_CORE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - Hash/CryptMd4Null.c - Hash/CryptMd5.c - Hash/CryptSha1.c - Hash/CryptSha256.c - Hash/CryptSha512.c - Hmac/CryptHmacMd5Null.c - Hmac/CryptHmacSha1Null.c - Hmac/CryptHmacSha256Null.c - Cipher/CryptAesNull.c - Cipher/CryptTdesNull.c - Cipher/CryptArc4Null.c - - Pk/CryptRsaBasic.c - Pk/CryptRsaExtNull.c - Pk/CryptPkcs5Pbkdf2Null.c - Pk/CryptPkcs7SignNull.c - Pk/CryptPkcs7VerifyCommon.c - Pk/CryptPkcs7VerifyBase.c - - Pk/CryptDhNull.c - Pk/CryptX509Null.c - Pk/CryptAuthenticodeNull.c - Pk/CryptTsNull.c - Pem/CryptPemNull.c - - Rand/CryptRandNull.c - - SysCall/CrtWrapper.c - SysCall/ConstantTimeClock.c - SysCall/BaseMemAllocation.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - MemoryAllocationLib - DebugLib - OpensslLib - IntrinsicLib - -# -# Remove these [BuildOptions] after this library is cleaned up -# -[BuildOptions] - # - # suppress the following warnings so we do not break the build with warnings-as-errors: - # C4090: 'function' : different 'const' qualifiers - # C4718: 'function call' : recursive call has no side effects, deleting - # - MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4718 - - # -JCryptoPkg/Include : To disable the use of the system includes provided by RVCT - # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends without a newline" - RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1 diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.uni deleted file mode 100644 index b8b09b6..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.uni +++ /dev/null @@ -1,31 +0,0 @@ -// /** @file -// Cryptographic Library Instance for PEIM. -// -// Caution: This module requires additional review when modified. -// This library will have external input - signature. -// This external input must be validated carefully to avoid security issues such as -// buffer overflow or integer overflow. -// -// Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ -// TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, -// Diffie-Hellman functions, X.509 certificate handler functions, authenticode -// signature verification functions, PEM handler functions, and pseudorandom number -// generator functions are not supported in this instance. -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for PEIM" - -#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow. Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509 certificate handler functions, authenticode signature verification functions, PEM handler functions, and pseudorandom number generator functions are not supported in this instance." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c deleted file mode 100644 index e3edc34..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c +++ /dev/null @@ -1,135 +0,0 @@ -/** @file - PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include - -/** - Callback function for password phrase conversion used for retrieving the encrypted PEM. - - @param[out] Buf Pointer to the buffer to write the passphrase to. - @param[in] Size Maximum length of the passphrase (i.e. the size of Buf). - @param[in] Flag A flag which is set to 0 when reading and 1 when writing. - @param[in] Key Key data to be passed to the callback routine. - - @retval The number of characters in the passphrase or 0 if an error occurred. - -**/ -INTN -PasswordCallback ( - OUT CHAR8 *Buf, - IN INTN Size, - IN INTN Flag, - IN VOID *Key - ) -{ - INTN KeyLength; - - ZeroMem ((VOID *) Buf, (UINTN) Size); - if (Key != NULL) { - // - // Duplicate key phrase directly. - // - KeyLength = (INTN) AsciiStrLen ((CHAR8 *)Key); - KeyLength = (KeyLength > Size ) ? Size : KeyLength; - CopyMem (Buf, Key, (UINTN) KeyLength); - return KeyLength; - } else { - return 0; - } -} - -/** - Retrieve the RSA Private Key from the password-protected PEM key data. - - @param[in] PemData Pointer to the PEM-encoded key data to be retrieved. - @param[in] PemSize Size of the PEM key data in bytes. - @param[in] Password NULL-terminated passphrase used for encrypted PEM key data. - @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved - RSA private key component. Use RsaFree() function to free the - resource. - - If PemData is NULL, then return FALSE. - If RsaContext is NULL, then return FALSE. - - @retval TRUE RSA Private Key was retrieved successfully. - @retval FALSE Invalid PEM key data or incorrect password. - -**/ -BOOLEAN -EFIAPI -RsaGetPrivateKeyFromPem ( - IN CONST UINT8 *PemData, - IN UINTN PemSize, - IN CONST CHAR8 *Password, - OUT VOID **RsaContext - ) -{ - BOOLEAN Status; - BIO *PemBio; - - // - // Check input parameters. - // - if (PemData == NULL || RsaContext == NULL || PemSize > INT_MAX) { - return FALSE; - } - - // - // Add possible block-cipher descriptor for PEM data decryption. - // NOTE: Only support most popular ciphers (3DES, AES) for the encrypted PEM. - // - if (EVP_add_cipher (EVP_des_ede3_cbc ()) == 0) { - return FALSE; - } - if (EVP_add_cipher (EVP_aes_128_cbc ()) == 0) { - return FALSE; - } - if (EVP_add_cipher (EVP_aes_192_cbc ()) == 0) { - return FALSE; - } - if (EVP_add_cipher (EVP_aes_256_cbc ()) == 0) { - return FALSE; - } - - Status = FALSE; - - // - // Read encrypted PEM Data. - // - PemBio = BIO_new (BIO_s_mem ()); - if (PemBio == NULL) { - goto _Exit; - } - - if (BIO_write (PemBio, PemData, (int) PemSize) <= 0) { - goto _Exit; - } - - // - // Retrieve RSA Private Key from encrypted PEM data. - // - *RsaContext = PEM_read_bio_RSAPrivateKey (PemBio, NULL, (pem_password_cb *) &PasswordCallback, (void *) Password); - if (*RsaContext != NULL) { - Status = TRUE; - } - -_Exit: - // - // Release Resources. - // - BIO_free (PemBio); - - return Status; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPemNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPemNull.c deleted file mode 100644 index db8f43e..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pem/CryptPemNull.c +++ /dev/null @@ -1,44 +0,0 @@ -/** @file - PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation which does - not provide real capabilities. - -Copyright (c) 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Retrieve the RSA Private Key from the password-protected PEM key data. - - Return FALSE to indicate this interface is not supported. - - @param[in] PemData Pointer to the PEM-encoded key data to be retrieved. - @param[in] PemSize Size of the PEM key data in bytes. - @param[in] Password NULL-terminated passphrase used for encrypted PEM key data. - @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved - RSA private key component. Use RsaFree() function to free the - resource. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaGetPrivateKeyFromPem ( - IN CONST UINT8 *PemData, - IN UINTN PemSize, - IN CONST CHAR8 *Password, - OUT VOID **RsaContext - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c deleted file mode 100644 index a451f32..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c +++ /dev/null @@ -1,198 +0,0 @@ -/** @file - Authenticode Portable Executable Signature Verification over OpenSSL. - - Caution: This module requires additional review when modified. - This library will have external input - signature (e.g. PE/COFF Authenticode). - This external input must be validated carefully to avoid security issue like - buffer overflow, integer overflow. - - AuthenticodeVerify() will get PE/COFF Authenticode and will do basic check for - data structure. - -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include - -// -// OID ASN.1 Value for SPC_INDIRECT_DATA_OBJID -// -UINT8 mSpcIndirectOidValue[] = { - 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04 - }; - -/** - Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows - Authenticode Portable Executable Signature Format". - - If AuthData is NULL, then return FALSE. - If ImageHash is NULL, then return FALSE. - - Caution: This function may receive untrusted input. - PE/COFF Authenticode is external input, so this function will do basic check for - Authenticode data structure. - - @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed - PE/COFF image to be verified. - @param[in] DataSize Size of the Authenticode Signature in bytes. - @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which - is used for certificate chain verification. - @param[in] CertSize Size of the trusted certificate in bytes. - @param[in] ImageHash Pointer to the original image file hash value. The procedure - for calculating the image hash value is described in Authenticode - specification. - @param[in] HashSize Size of Image hash value in bytes. - - @retval TRUE The specified Authenticode Signature is valid. - @retval FALSE Invalid Authenticode Signature. - -**/ -BOOLEAN -EFIAPI -AuthenticodeVerify ( - IN CONST UINT8 *AuthData, - IN UINTN DataSize, - IN CONST UINT8 *TrustedCert, - IN UINTN CertSize, - IN CONST UINT8 *ImageHash, - IN UINTN HashSize - ) -{ - BOOLEAN Status; - PKCS7 *Pkcs7; - CONST UINT8 *Temp; - CONST UINT8 *OrigAuthData; - UINT8 *SpcIndirectDataContent; - UINT8 Asn1Byte; - UINTN ContentSize; - CONST UINT8 *SpcIndirectDataOid; - - // - // Check input parameters. - // - if ((AuthData == NULL) || (TrustedCert == NULL) || (ImageHash == NULL)) { - return FALSE; - } - - if ((DataSize > INT_MAX) || (CertSize > INT_MAX) || (HashSize > INT_MAX)) { - return FALSE; - } - - Status = FALSE; - Pkcs7 = NULL; - OrigAuthData = AuthData; - - // - // Retrieve & Parse PKCS#7 Data (DER encoding) from Authenticode Signature - // - Temp = AuthData; - Pkcs7 = d2i_PKCS7 (NULL, &Temp, (int)DataSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // Check if it's PKCS#7 Signed Data (for Authenticode Scenario) - // - if (!PKCS7_type_is_signed (Pkcs7)) { - goto _Exit; - } - - // - // NOTE: OpenSSL PKCS7 Decoder didn't work for Authenticode-format signed data due to - // some authenticode-specific structure. Use opaque ASN.1 string to retrieve - // PKCS#7 ContentInfo here. - // - SpcIndirectDataOid = OBJ_get0_data(Pkcs7->d.sign->contents->type); - if (OBJ_length(Pkcs7->d.sign->contents->type) != sizeof(mSpcIndirectOidValue) || - CompareMem ( - SpcIndirectDataOid, - mSpcIndirectOidValue, - sizeof (mSpcIndirectOidValue) - ) != 0) { - // - // Un-matched SPC_INDIRECT_DATA_OBJID. - // - goto _Exit; - } - - - SpcIndirectDataContent = (UINT8 *)(Pkcs7->d.sign->contents->d.other->value.asn1_string->data); - - // - // Retrieve the SEQUENCE data size from ASN.1-encoded SpcIndirectDataContent. - // - Asn1Byte = *(SpcIndirectDataContent + 1); - - if ((Asn1Byte & 0x80) == 0) { - // - // Short Form of Length Encoding (Length < 128) - // - ContentSize = (UINTN) (Asn1Byte & 0x7F); - // - // Skip the SEQUENCE Tag; - // - SpcIndirectDataContent += 2; - - } else if ((Asn1Byte & 0x81) == 0x81) { - // - // Long Form of Length Encoding (128 <= Length < 255, Single Octet) - // - ContentSize = (UINTN) (*(UINT8 *)(SpcIndirectDataContent + 2)); - // - // Skip the SEQUENCE Tag; - // - SpcIndirectDataContent += 3; - - } else if ((Asn1Byte & 0x82) == 0x82) { - // - // Long Form of Length Encoding (Length > 255, Two Octet) - // - ContentSize = (UINTN) (*(UINT8 *)(SpcIndirectDataContent + 2)); - ContentSize = (ContentSize << 8) + (UINTN)(*(UINT8 *)(SpcIndirectDataContent + 3)); - // - // Skip the SEQUENCE Tag; - // - SpcIndirectDataContent += 4; - - } else { - goto _Exit; - } - - // - // Compare the original file hash value to the digest retrieve from SpcIndirectDataContent - // defined in Authenticode - // NOTE: Need to double-check HashLength here! - // - if (CompareMem (SpcIndirectDataContent + ContentSize - HashSize, ImageHash, HashSize) != 0) { - // - // Un-matched PE/COFF Hash Value - // - goto _Exit; - } - - // - // Verifies the PKCS#7 Signed Data in PE/COFF Authenticode Signature - // - Status = (BOOLEAN) Pkcs7Verify (OrigAuthData, DataSize, TrustedCert, CertSize, SpcIndirectDataContent, ContentSize); - -_Exit: - // - // Release Resources - // - PKCS7_free (Pkcs7); - - return Status; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticodeNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticodeNull.c deleted file mode 100644 index d0f3440..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticodeNull.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - Authenticode Portable Executable Signature Verification which does not provide - real capabilities. - -Copyright (c) 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows - Authenticode Portable Executable Signature Format". - - Return FALSE to indicate this interface is not supported. - - @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed - PE/COFF image to be verified. - @param[in] DataSize Size of the Authenticode Signature in bytes. - @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which - is used for certificate chain verification. - @param[in] CertSize Size of the trusted certificate in bytes. - @param[in] ImageHash Pointer to the original image file hash value. The procedure - for calculating the image hash value is described in Authenticode - specification. - @param[in] HashSize Size of Image hash value in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -AuthenticodeVerify ( - IN CONST UINT8 *AuthData, - IN UINTN DataSize, - IN CONST UINT8 *TrustedCert, - IN UINTN CertSize, - IN CONST UINT8 *ImageHash, - IN UINTN HashSize - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c deleted file mode 100644 index 7f17388..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c +++ /dev/null @@ -1,312 +0,0 @@ -/** @file - Diffie-Hellman Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include - -/** - Allocates and Initializes one Diffie-Hellman Context for subsequent use. - - @return Pointer to the Diffie-Hellman Context that has been initialized. - If the allocations fails, DhNew() returns NULL. - -**/ -VOID * -EFIAPI -DhNew ( - VOID - ) -{ - // - // Allocates & Initializes DH Context by OpenSSL DH_new() - // - return (VOID *) DH_new (); -} - -/** - Release the specified DH context. - - If DhContext is NULL, then return FALSE. - - @param[in] DhContext Pointer to the DH context to be released. - -**/ -VOID -EFIAPI -DhFree ( - IN VOID *DhContext - ) -{ - // - // Free OpenSSL DH Context - // - DH_free ((DH *) DhContext); -} - -/** - Generates DH parameter. - - Given generator g, and length of prime number p in bits, this function generates p, - and sets DH context according to value of g and p. - - Before this function can be invoked, pseudorandom number generator must be correctly - initialized by RandomSeed(). - - If DhContext is NULL, then return FALSE. - If Prime is NULL, then return FALSE. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] Generator Value of generator. - @param[in] PrimeLength Length in bits of prime to be generated. - @param[out] Prime Pointer to the buffer to receive the generated prime number. - - @retval TRUE DH parameter generation succeeded. - @retval FALSE Value of Generator is not supported. - @retval FALSE PRNG fails to generate random prime number with PrimeLength. - -**/ -BOOLEAN -EFIAPI -DhGenerateParameter ( - IN OUT VOID *DhContext, - IN UINTN Generator, - IN UINTN PrimeLength, - OUT UINT8 *Prime - ) -{ - BOOLEAN RetVal; - BIGNUM *BnP; - - // - // Check input parameters. - // - if (DhContext == NULL || Prime == NULL || PrimeLength > INT_MAX) { - return FALSE; - } - - if (Generator != DH_GENERATOR_2 && Generator != DH_GENERATOR_5) { - return FALSE; - } - - RetVal = (BOOLEAN) DH_generate_parameters_ex (DhContext, (UINT32) PrimeLength, (UINT32) Generator, NULL); - if (!RetVal) { - return FALSE; - } - - DH_get0_pqg (DhContext, (const BIGNUM **)&BnP, NULL, NULL); - BN_bn2bin (BnP, Prime); - - return TRUE; -} - -/** - Sets generator and prime parameters for DH. - - Given generator g, and prime number p, this function and sets DH - context accordingly. - - If DhContext is NULL, then return FALSE. - If Prime is NULL, then return FALSE. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] Generator Value of generator. - @param[in] PrimeLength Length in bits of prime to be generated. - @param[in] Prime Pointer to the prime number. - - @retval TRUE DH parameter setting succeeded. - @retval FALSE Value of Generator is not supported. - @retval FALSE Value of Generator is not suitable for the Prime. - @retval FALSE Value of Prime is not a prime number. - @retval FALSE Value of Prime is not a safe prime number. - -**/ -BOOLEAN -EFIAPI -DhSetParameter ( - IN OUT VOID *DhContext, - IN UINTN Generator, - IN UINTN PrimeLength, - IN CONST UINT8 *Prime - ) -{ - DH *Dh; - BIGNUM *BnP; - BIGNUM *BnG; - - // - // Check input parameters. - // - if (DhContext == NULL || Prime == NULL || PrimeLength > INT_MAX) { - return FALSE; - } - - if (Generator != DH_GENERATOR_2 && Generator != DH_GENERATOR_5) { - return FALSE; - } - - // - // Set the generator and prime parameters for DH object. - // - Dh = (DH *)DhContext; - BnP = BN_bin2bn ((const unsigned char *)Prime, (int)(PrimeLength / 8), NULL); - BnG = BN_bin2bn ((const unsigned char *)&Generator, 1, NULL); - if ((BnP == NULL) || (BnG == NULL) || !DH_set0_pqg (Dh, BnP, NULL, BnG)) { - goto Error; - } - - return TRUE; - -Error: - BN_free (BnP); - BN_free (BnG); - - return FALSE; -} - -/** - Generates DH public key. - - This function generates random secret exponent, and computes the public key, which is - returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly. - If the PublicKey buffer is too small to hold the public key, FALSE is returned and - PublicKeySize is set to the required buffer size to obtain the public key. - - If DhContext is NULL, then return FALSE. - If PublicKeySize is NULL, then return FALSE. - If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. - - @param[in, out] DhContext Pointer to the DH context. - @param[out] PublicKey Pointer to the buffer to receive generated public key. - @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes. - On output, the size of data returned in PublicKey buffer in bytes. - - @retval TRUE DH public key generation succeeded. - @retval FALSE DH public key generation failed. - @retval FALSE PublicKeySize is not large enough. - -**/ -BOOLEAN -EFIAPI -DhGenerateKey ( - IN OUT VOID *DhContext, - OUT UINT8 *PublicKey, - IN OUT UINTN *PublicKeySize - ) -{ - BOOLEAN RetVal; - DH *Dh; - BIGNUM *DhPubKey; - INTN Size; - - // - // Check input parameters. - // - if (DhContext == NULL || PublicKeySize == NULL) { - return FALSE; - } - - if (PublicKey == NULL && *PublicKeySize != 0) { - return FALSE; - } - - Dh = (DH *) DhContext; - - RetVal = (BOOLEAN) DH_generate_key (DhContext); - if (RetVal) { - DH_get0_key (Dh, (const BIGNUM **)&DhPubKey, NULL); - Size = BN_num_bytes (DhPubKey); - if ((Size > 0) && (*PublicKeySize < (UINTN) Size)) { - *PublicKeySize = Size; - return FALSE; - } - - if (PublicKey != NULL) { - BN_bn2bin (DhPubKey, PublicKey); - } - *PublicKeySize = Size; - } - - return RetVal; -} - -/** - Computes exchanged common key. - - Given peer's public key, this function computes the exchanged common key, based on its own - context including value of prime modulus and random secret exponent. - - If DhContext is NULL, then return FALSE. - If PeerPublicKey is NULL, then return FALSE. - If KeySize is NULL, then return FALSE. - If Key is NULL, then return FALSE. - If KeySize is not large enough, then return FALSE. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] PeerPublicKey Pointer to the peer's public key. - @param[in] PeerPublicKeySize Size of peer's public key in bytes. - @param[out] Key Pointer to the buffer to receive generated key. - @param[in, out] KeySize On input, the size of Key buffer in bytes. - On output, the size of data returned in Key buffer in bytes. - - @retval TRUE DH exchanged key generation succeeded. - @retval FALSE DH exchanged key generation failed. - @retval FALSE KeySize is not large enough. - -**/ -BOOLEAN -EFIAPI -DhComputeKey ( - IN OUT VOID *DhContext, - IN CONST UINT8 *PeerPublicKey, - IN UINTN PeerPublicKeySize, - OUT UINT8 *Key, - IN OUT UINTN *KeySize - ) -{ - BIGNUM *Bn; - INTN Size; - - // - // Check input parameters. - // - if (DhContext == NULL || PeerPublicKey == NULL || KeySize == NULL || Key == NULL) { - return FALSE; - } - - if (PeerPublicKeySize > INT_MAX) { - return FALSE; - } - - Bn = BN_bin2bn (PeerPublicKey, (UINT32) PeerPublicKeySize, NULL); - if (Bn == NULL) { - return FALSE; - } - - Size = DH_compute_key (Key, Bn, DhContext); - if (Size < 0) { - BN_free (Bn); - return FALSE; - } - - if (*KeySize < (UINTN) Size) { - *KeySize = Size; - BN_free (Bn); - return FALSE; - } - - *KeySize = Size; - BN_free (Bn); - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c deleted file mode 100644 index d577cca..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c +++ /dev/null @@ -1,156 +0,0 @@ -/** @file - Diffie-Hellman Wrapper Implementation which does not provide - real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Allocates and Initializes one Diffie-Hellman Context for subsequent use. - - @return Pointer to the Diffie-Hellman Context that has been initialized. - If the interface is not supported, DhNew() returns NULL. - -**/ -VOID * -EFIAPI -DhNew ( - VOID - ) -{ - ASSERT (FALSE); - return NULL; -} - -/** - Release the specified DH context. - - If the interface is not supported, then ASSERT(). - - @param[in] DhContext Pointer to the DH context to be released. - -**/ -VOID -EFIAPI -DhFree ( - IN VOID *DhContext - ) -{ - ASSERT (FALSE); -} - -/** - Generates DH parameter. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] Generator Value of generator. - @param[in] PrimeLength Length in bits of prime to be generated. - @param[out] Prime Pointer to the buffer to receive the generated prime number. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -DhGenerateParameter ( - IN OUT VOID *DhContext, - IN UINTN Generator, - IN UINTN PrimeLength, - OUT UINT8 *Prime - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Sets generator and prime parameters for DH. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] Generator Value of generator. - @param[in] PrimeLength Length in bits of prime to be generated. - @param[in] Prime Pointer to the prime number. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -DhSetParameter ( - IN OUT VOID *DhContext, - IN UINTN Generator, - IN UINTN PrimeLength, - IN CONST UINT8 *Prime - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Generates DH public key. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] DhContext Pointer to the DH context. - @param[out] PublicKey Pointer to the buffer to receive generated public key. - @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes. - On output, the size of data returned in PublicKey buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -DhGenerateKey ( - IN OUT VOID *DhContext, - OUT UINT8 *PublicKey, - IN OUT UINTN *PublicKeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Computes exchanged common key. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] DhContext Pointer to the DH context. - @param[in] PeerPublicKey Pointer to the peer's public key. - @param[in] PeerPublicKeySize Size of peer's public key in bytes. - @param[out] Key Pointer to the buffer to receive generated key. - @param[in, out] KeySize On input, the size of Key buffer in bytes. - On output, the size of data returned in Key buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -DhComputeKey ( - IN OUT VOID *DhContext, - IN CONST UINT8 *PeerPublicKey, - IN UINTN PeerPublicKeySize, - OUT UINT8 *Key, - IN OUT UINTN *KeySize - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2.c deleted file mode 100644 index ffe0cea..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - PBKDF2 Key Derivation Function Wrapper Implementation over OpenSSL. - -Copyright (c) 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include - -/** - Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0 - password based encryption key derivation function PBKDF2, as specified in RFC 2898. - - If Password or Salt or OutKey is NULL, then return FALSE. - If the hash algorithm could not be determined, then return FALSE. - - @param[in] PasswordLength Length of input password in bytes. - @param[in] Password Pointer to the array for the password. - @param[in] SaltLength Size of the Salt in bytes. - @param[in] Salt Pointer to the Salt. - @param[in] IterationCount Number of iterations to perform. Its value should be - greater than or equal to 1. - @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE). - NOTE: DigestSize will be used to determine the hash algorithm. - Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported. - @param[in] KeyLength Size of the derived key buffer in bytes. - @param[out] OutKey Pointer to the output derived key buffer. - - @retval TRUE A key was derived successfully. - @retval FALSE One of the pointers was NULL or one of the sizes was too large. - @retval FALSE The hash algorithm could not be determined from the digest size. - @retval FALSE The key derivation operation failed. - -**/ -BOOLEAN -EFIAPI -Pkcs5HashPassword ( - IN UINTN PasswordLength, - IN CONST CHAR8 *Password, - IN UINTN SaltLength, - IN CONST UINT8 *Salt, - IN UINTN IterationCount, - IN UINTN DigestSize, - IN UINTN KeyLength, - OUT UINT8 *OutKey - ) -{ - CONST EVP_MD *HashAlg; - - HashAlg = NULL; - - // - // Parameter Checking. - // - if ((Password == NULL) || (Salt == NULL) || (OutKey == NULL)) { - return FALSE; - } - if ((PasswordLength == 0) || (PasswordLength > INT_MAX) || - (SaltLength == 0) || (SaltLength > INT_MAX) || - (KeyLength == 0) || (KeyLength > INT_MAX) || - (IterationCount < 1) || (IterationCount > INT_MAX)) { - return FALSE; - } - // - // Make sure the digest algorithm is supported. - // - switch (DigestSize) { - case SHA1_DIGEST_SIZE: - HashAlg = EVP_sha1(); - break; - case SHA256_DIGEST_SIZE: - HashAlg = EVP_sha256(); - break; - default: - return FALSE; - break; - } - - // - // Perform password-based key derivation routines. - // - return (BOOLEAN)PKCS5_PBKDF2_HMAC ( - (const char *)Password, - (int)PasswordLength, - (const unsigned char *)Salt, - (int)SaltLength, - (int)IterationCount, - HashAlg, - (int)KeyLength, - (unsigned char *)OutKey - ); -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2Null.c deleted file mode 100644 index 502dd3c..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs5Pbkdf2Null.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - PBKDF2 Key Derivation Function Wrapper Implementation which does not provide real - capabilities. - -Copyright (c) 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include - -/** - Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0 - password based encryption key derivation function PBKDF2, as specified in RFC 2898. - - Return FALSE to indicate this interface is not supported. - - @param[in] PasswordLength Length of input password in bytes. - @param[in] Password Pointer to the array for the password. - @param[in] SaltLength Size of the Salt in bytes. - @param[in] Salt Pointer to the Salt. - @param[in] IterationCount Number of iterations to perform. Its value should be - greater than or equal to 1. - @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE). - NOTE: DigestSize will be used to determine the hash algorithm. - Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported. - @param[in] KeyLength Size of the derived key buffer in bytes. - @param[out] OutKey Pointer to the output derived key buffer. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Pkcs5HashPassword ( - IN UINTN PasswordLength, - IN CONST CHAR8 *Password, - IN UINTN SaltLength, - IN CONST UINT8 *Salt, - IN UINTN IterationCount, - IN UINTN DigestSize, - IN UINTN KeyLength, - OUT UINT8 *OutKey - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c deleted file mode 100644 index 11becdd..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c +++ /dev/null @@ -1,200 +0,0 @@ -/** @file - PKCS#7 SignedData Sign Wrapper Implementation over OpenSSL. - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include - -/** - Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message - Syntax Standard, version 1.5". This interface is only intended to be used for - application to perform PKCS#7 functionality validation. - - @param[in] PrivateKey Pointer to the PEM-formatted private key data for - data signing. - @param[in] PrivateKeySize Size of the PEM private key data in bytes. - @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM - key data. - @param[in] InData Pointer to the content to be signed. - @param[in] InDataSize Size of InData in bytes. - @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with. - @param[in] OtherCerts Pointer to an optional additional set of certificates to - include in the PKCS#7 signedData (e.g. any intermediate - CAs in the chain). - @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's - responsibility to free the buffer with FreePool(). - @param[out] SignedDataSize Size of SignedData in bytes. - - @retval TRUE PKCS#7 data signing succeeded. - @retval FALSE PKCS#7 data signing failed. - -**/ -BOOLEAN -EFIAPI -Pkcs7Sign ( - IN CONST UINT8 *PrivateKey, - IN UINTN PrivateKeySize, - IN CONST UINT8 *KeyPassword, - IN UINT8 *InData, - IN UINTN InDataSize, - IN UINT8 *SignCert, - IN UINT8 *OtherCerts OPTIONAL, - OUT UINT8 **SignedData, - OUT UINTN *SignedDataSize - ) -{ - BOOLEAN Status; - EVP_PKEY *Key; - BIO *DataBio; - PKCS7 *Pkcs7; - UINT8 *RsaContext; - UINT8 *P7Data; - UINTN P7DataSize; - UINT8 *Tmp; - - // - // Check input parameters. - // - if (PrivateKey == NULL || KeyPassword == NULL || InData == NULL || - SignCert == NULL || SignedData == NULL || SignedDataSize == NULL || InDataSize > INT_MAX) { - return FALSE; - } - - RsaContext = NULL; - Key = NULL; - Pkcs7 = NULL; - DataBio = NULL; - Status = FALSE; - - // - // Retrieve RSA private key from PEM data. - // - Status = RsaGetPrivateKeyFromPem ( - PrivateKey, - PrivateKeySize, - (CONST CHAR8 *) KeyPassword, - (VOID **) &RsaContext - ); - if (!Status) { - return Status; - } - - Status = FALSE; - - // - // Register & Initialize necessary digest algorithms and PRNG for PKCS#7 Handling - // - if (EVP_add_digest (EVP_md5 ()) == 0) { - goto _Exit; - } - if (EVP_add_digest (EVP_sha1 ()) == 0) { - goto _Exit; - } - if (EVP_add_digest (EVP_sha256 ()) == 0) { - goto _Exit; - } - - RandomSeed (NULL, 0); - - // - // Construct OpenSSL EVP_PKEY for private key. - // - Key = EVP_PKEY_new (); - if (Key == NULL) { - goto _Exit; - } - if (EVP_PKEY_assign_RSA (Key, (RSA *) RsaContext) == 0) { - goto _Exit; - } - - // - // Convert the data to be signed to BIO format. - // - DataBio = BIO_new (BIO_s_mem ()); - if (DataBio == NULL) { - goto _Exit; - } - - if (BIO_write (DataBio, InData, (int) InDataSize) <= 0) { - goto _Exit; - } - - // - // Create the PKCS#7 signedData structure. - // - Pkcs7 = PKCS7_sign ( - (X509 *) SignCert, - Key, - (STACK_OF(X509) *) OtherCerts, - DataBio, - PKCS7_BINARY | PKCS7_NOATTR | PKCS7_DETACHED - ); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // Convert PKCS#7 signedData structure into DER-encoded buffer. - // - P7DataSize = i2d_PKCS7 (Pkcs7, NULL); - if (P7DataSize <= 19) { - goto _Exit; - } - - P7Data = malloc (P7DataSize); - if (P7Data == NULL) { - goto _Exit; - } - - Tmp = P7Data; - P7DataSize = i2d_PKCS7 (Pkcs7, (unsigned char **) &Tmp); - ASSERT (P7DataSize > 19); - - // - // Strip ContentInfo to content only for signeddata. The data be trimmed off - // is totally 19 bytes. - // - *SignedDataSize = P7DataSize - 19; - *SignedData = AllocatePool (*SignedDataSize); - if (*SignedData == NULL) { - OPENSSL_free (P7Data); - goto _Exit; - } - - CopyMem (*SignedData, P7Data + 19, *SignedDataSize); - - OPENSSL_free (P7Data); - - Status = TRUE; - -_Exit: - // - // Release Resources - // - if (Key != NULL) { - EVP_PKEY_free (Key); - } - - if (DataBio != NULL) { - BIO_free (DataBio); - } - - if (Pkcs7 != NULL) { - PKCS7_free (Pkcs7); - } - - return Status; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c deleted file mode 100644 index 830dbb4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c +++ /dev/null @@ -1,60 +0,0 @@ -/** @file - PKCS#7 SignedData Sign Wrapper Implementation which does not provide real - capabilities. - -Copyright (c) 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message - Syntax Standard, version 1.5". This interface is only intended to be used for - application to perform PKCS#7 functionality validation. - - Return FALSE to indicate this interface is not supported. - - @param[in] PrivateKey Pointer to the PEM-formatted private key data for - data signing. - @param[in] PrivateKeySize Size of the PEM private key data in bytes. - @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM - key data. - @param[in] InData Pointer to the content to be signed. - @param[in] InDataSize Size of InData in bytes. - @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with. - @param[in] OtherCerts Pointer to an optional additional set of certificates to - include in the PKCS#7 signedData (e.g. any intermediate - CAs in the chain). - @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's - responsibility to free the buffer with FreePool(). - @param[out] SignedDataSize Size of SignedData in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Pkcs7Sign ( - IN CONST UINT8 *PrivateKey, - IN UINTN PrivateKeySize, - IN CONST UINT8 *KeyPassword, - IN UINT8 *InData, - IN UINTN InDataSize, - IN UINT8 *SignCert, - IN UINT8 *OtherCerts OPTIONAL, - OUT UINT8 **SignedData, - OUT UINTN *SignedDataSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c deleted file mode 100644 index ce2b49f..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c +++ /dev/null @@ -1,131 +0,0 @@ -/** @file - Non-runtime specific implementation of PKCS#7 SignedData Verification Wrapper. - -Copyright (c) 2019, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include -#include - -/** - Extracts the attached content from a PKCS#7 signed data if existed. The input signed - data could be wrapped in a ContentInfo structure. - - If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow, - then return FALSE. If the P7Data is not correctly formatted, then return FALSE. - - Caution: This function may receive untrusted input. So this function will do - basic check for PKCS#7 data structure. - - @param[in] P7Data Pointer to the PKCS#7 signed data to process. - @param[in] P7Length Length of the PKCS#7 signed data in bytes. - @param[out] Content Pointer to the extracted content from the PKCS#7 signedData. - It's caller's responsibility to free the buffer with FreePool(). - @param[out] ContentSize The size of the extracted content in bytes. - - @retval TRUE The P7Data was correctly formatted for processing. - @retval FALSE The P7Data was not correctly formatted for processing. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetAttachedContent ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT VOID **Content, - OUT UINTN *ContentSize - ) -{ - BOOLEAN Status; - PKCS7 *Pkcs7; - UINT8 *SignedData; - UINTN SignedDataSize; - BOOLEAN Wrapped; - CONST UINT8 *Temp; - ASN1_OCTET_STRING *OctStr; - - // - // Check input parameter. - // - if ((P7Data == NULL) || (P7Length > INT_MAX) || (Content == NULL) || (ContentSize == NULL)) { - return FALSE; - } - - *Content = NULL; - Pkcs7 = NULL; - SignedData = NULL; - OctStr = NULL; - - Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize); - if (!Status || (SignedDataSize > INT_MAX)) { - goto _Exit; - } - - Status = FALSE; - - // - // Decoding PKCS#7 SignedData - // - Temp = SignedData; - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **)&Temp, (int)SignedDataSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // The type of Pkcs7 must be signedData - // - if (!PKCS7_type_is_signed (Pkcs7)) { - goto _Exit; - } - - // - // Check for detached or attached content - // - if (PKCS7_get_detached (Pkcs7)) { - // - // No Content supplied for PKCS7 detached signedData - // - *Content = NULL; - *ContentSize = 0; - } else { - // - // Retrieve the attached content in PKCS7 signedData - // - OctStr = Pkcs7->d.sign->contents->d.data; - if ((OctStr->length > 0) && (OctStr->data != NULL)) { - *ContentSize = OctStr->length; - *Content = AllocatePool (*ContentSize); - if (*Content == NULL) { - *ContentSize = 0; - goto _Exit; - } - CopyMem (*Content, OctStr->data, *ContentSize); - } - } - Status = TRUE; - -_Exit: - // - // Release Resources - // - PKCS7_free (Pkcs7); - - if (!Wrapped) { - OPENSSL_free (SignedData); - } - - return Status; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c deleted file mode 100644 index 0fb3107..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c +++ /dev/null @@ -1,916 +0,0 @@ -/** @file - PKCS#7 SignedData Verification Wrapper Implementation over OpenSSL. - - Caution: This module requires additional review when modified. - This library will have external input - signature (e.g. UEFI Authenticated - Variable). It may by input in SMM mode. - This external input must be validated carefully to avoid security issue like - buffer overflow, integer overflow. - - WrapPkcs7Data(), Pkcs7GetSigners(), Pkcs7Verify() will get UEFI Authenticated - Variable and will do basic check for data structure. - -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include -#include - -UINT8 mOidValue[9] = { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02 }; - -/** - Check input P7Data is a wrapped ContentInfo structure or not. If not construct - a new structure to wrap P7Data. - - Caution: This function may receive untrusted input. - UEFI Authenticated Variable is external input, so this function will do basic - check for PKCS#7 data structure. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] WrapFlag If TRUE P7Data is a ContentInfo structure, otherwise - return FALSE. - @param[out] WrapData If return status of this function is TRUE: - 1) when WrapFlag is TRUE, pointer to P7Data. - 2) when WrapFlag is FALSE, pointer to a new ContentInfo - structure. It's caller's responsibility to free this - buffer. - @param[out] WrapDataSize Length of ContentInfo structure in bytes. - - @retval TRUE The operation is finished successfully. - @retval FALSE The operation is failed due to lack of resources. - -**/ -BOOLEAN -WrapPkcs7Data ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT BOOLEAN *WrapFlag, - OUT UINT8 **WrapData, - OUT UINTN *WrapDataSize - ) -{ - BOOLEAN Wrapped; - UINT8 *SignedData; - - // - // Check whether input P7Data is a wrapped ContentInfo structure or not. - // - Wrapped = FALSE; - if ((P7Data[4] == 0x06) && (P7Data[5] == 0x09)) { - if (CompareMem (P7Data + 6, mOidValue, sizeof (mOidValue)) == 0) { - if ((P7Data[15] == 0xA0) && (P7Data[16] == 0x82)) { - Wrapped = TRUE; - } - } - } - - if (Wrapped) { - *WrapData = (UINT8 *) P7Data; - *WrapDataSize = P7Length; - } else { - // - // Wrap PKCS#7 signeddata to a ContentInfo structure - add a header in 19 bytes. - // - *WrapDataSize = P7Length + 19; - *WrapData = malloc (*WrapDataSize); - if (*WrapData == NULL) { - *WrapFlag = Wrapped; - return FALSE; - } - - SignedData = *WrapData; - - // - // Part1: 0x30, 0x82. - // - SignedData[0] = 0x30; - SignedData[1] = 0x82; - - // - // Part2: Length1 = P7Length + 19 - 4, in big endian. - // - SignedData[2] = (UINT8) (((UINT16) (*WrapDataSize - 4)) >> 8); - SignedData[3] = (UINT8) (((UINT16) (*WrapDataSize - 4)) & 0xff); - - // - // Part3: 0x06, 0x09. - // - SignedData[4] = 0x06; - SignedData[5] = 0x09; - - // - // Part4: OID value -- 0x2A 0x86 0x48 0x86 0xF7 0x0D 0x01 0x07 0x02. - // - CopyMem (SignedData + 6, mOidValue, sizeof (mOidValue)); - - // - // Part5: 0xA0, 0x82. - // - SignedData[15] = 0xA0; - SignedData[16] = 0x82; - - // - // Part6: Length2 = P7Length, in big endian. - // - SignedData[17] = (UINT8) (((UINT16) P7Length) >> 8); - SignedData[18] = (UINT8) (((UINT16) P7Length) & 0xff); - - // - // Part7: P7Data. - // - CopyMem (SignedData + 19, P7Data, P7Length); - } - - *WrapFlag = Wrapped; - return TRUE; -} - -/** - Pop single certificate from STACK_OF(X509). - - If X509Stack, Cert, or CertSize is NULL, then return FALSE. - - @param[in] X509Stack Pointer to a X509 stack object. - @param[out] Cert Pointer to a X509 certificate. - @param[out] CertSize Length of output X509 certificate in bytes. - - @retval TRUE The X509 stack pop succeeded. - @retval FALSE The pop operation failed. - -**/ -BOOLEAN -X509PopCertificate ( - IN VOID *X509Stack, - OUT UINT8 **Cert, - OUT UINTN *CertSize - ) -{ - BIO *CertBio; - X509 *X509Cert; - STACK_OF(X509) *CertStack; - BOOLEAN Status; - INT32 Result; - BUF_MEM *Ptr; - INT32 Length; - VOID *Buffer; - - Status = FALSE; - - if ((X509Stack == NULL) || (Cert == NULL) || (CertSize == NULL)) { - return Status; - } - - CertStack = (STACK_OF(X509) *) X509Stack; - - X509Cert = sk_X509_pop (CertStack); - - if (X509Cert == NULL) { - return Status; - } - - Buffer = NULL; - - CertBio = BIO_new (BIO_s_mem ()); - if (CertBio == NULL) { - return Status; - } - - Result = i2d_X509_bio (CertBio, X509Cert); - if (Result == 0) { - goto _Exit; - } - - BIO_get_mem_ptr (CertBio, &Ptr); - Length = (INT32)(Ptr->length); - if (Length <= 0) { - goto _Exit; - } - - Buffer = malloc (Length); - if (Buffer == NULL) { - goto _Exit; - } - - Result = BIO_read (CertBio, Buffer, Length); - if (Result != Length) { - goto _Exit; - } - - *Cert = Buffer; - *CertSize = Length; - - Status = TRUE; - -_Exit: - - BIO_free (CertBio); - - if (!Status && (Buffer != NULL)) { - free (Buffer); - } - - return Status; -} - -/** - Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard". The input signed data could be wrapped - in a ContentInfo structure. - - If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then - return FALSE. If P7Length overflow, then return FALSE. - - Caution: This function may receive untrusted input. - UEFI Authenticated Variable is external input, so this function will do basic - check for PKCS#7 data structure. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data. - It's caller's responsibility to free the buffer with - Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] StackLength Length of signer's certificates in bytes. - @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates. - It's caller's responsibility to free the buffer with - Pkcs7FreeSigners(). - @param[out] CertLength Length of the trusted certificate in bytes. - - @retval TRUE The operation is finished successfully. - @retval FALSE Error occurs during the operation. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetSigners ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT UINT8 **CertStack, - OUT UINTN *StackLength, - OUT UINT8 **TrustedCert, - OUT UINTN *CertLength - ) -{ - PKCS7 *Pkcs7; - BOOLEAN Status; - UINT8 *SignedData; - CONST UINT8 *Temp; - UINTN SignedDataSize; - BOOLEAN Wrapped; - STACK_OF(X509) *Stack; - UINT8 Index; - UINT8 *CertBuf; - UINT8 *OldBuf; - UINTN BufferSize; - UINTN OldSize; - UINT8 *SingleCert; - UINTN SingleCertSize; - - if ((P7Data == NULL) || (CertStack == NULL) || (StackLength == NULL) || - (TrustedCert == NULL) || (CertLength == NULL) || (P7Length > INT_MAX)) { - return FALSE; - } - - Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize); - if (!Status) { - return Status; - } - - Status = FALSE; - Pkcs7 = NULL; - Stack = NULL; - CertBuf = NULL; - OldBuf = NULL; - SingleCert = NULL; - - // - // Retrieve PKCS#7 Data (DER encoding) - // - if (SignedDataSize > INT_MAX) { - goto _Exit; - } - - Temp = SignedData; - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &Temp, (int) SignedDataSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // Check if it's PKCS#7 Signed Data (for Authenticode Scenario) - // - if (!PKCS7_type_is_signed (Pkcs7)) { - goto _Exit; - } - - Stack = PKCS7_get0_signers(Pkcs7, NULL, PKCS7_BINARY); - if (Stack == NULL) { - goto _Exit; - } - - // - // Convert CertStack to buffer in following format: - // UINT8 CertNumber; - // UINT32 Cert1Length; - // UINT8 Cert1[]; - // UINT32 Cert2Length; - // UINT8 Cert2[]; - // ... - // UINT32 CertnLength; - // UINT8 Certn[]; - // - BufferSize = sizeof (UINT8); - OldSize = BufferSize; - - for (Index = 0; ; Index++) { - Status = X509PopCertificate (Stack, &SingleCert, &SingleCertSize); - if (!Status) { - break; - } - - OldSize = BufferSize; - OldBuf = CertBuf; - BufferSize = OldSize + SingleCertSize + sizeof (UINT32); - CertBuf = malloc (BufferSize); - - if (CertBuf == NULL) { - goto _Exit; - } - - if (OldBuf != NULL) { - CopyMem (CertBuf, OldBuf, OldSize); - free (OldBuf); - OldBuf = NULL; - } - - WriteUnaligned32 ((UINT32 *) (CertBuf + OldSize), (UINT32) SingleCertSize); - CopyMem (CertBuf + OldSize + sizeof (UINT32), SingleCert, SingleCertSize); - - free (SingleCert); - SingleCert = NULL; - } - - if (CertBuf != NULL) { - // - // Update CertNumber. - // - CertBuf[0] = Index; - - *CertLength = BufferSize - OldSize - sizeof (UINT32); - *TrustedCert = malloc (*CertLength); - if (*TrustedCert == NULL) { - goto _Exit; - } - - CopyMem (*TrustedCert, CertBuf + OldSize + sizeof (UINT32), *CertLength); - *CertStack = CertBuf; - *StackLength = BufferSize; - Status = TRUE; - } - -_Exit: - // - // Release Resources - // - if (!Wrapped) { - free (SignedData); - } - - if (Pkcs7 != NULL) { - PKCS7_free (Pkcs7); - } - - if (Stack != NULL) { - sk_X509_pop_free(Stack, X509_free); - } - - if (SingleCert != NULL) { - free (SingleCert); - } - - if (!Status && (CertBuf != NULL)) { - free (CertBuf); - *CertStack = NULL; - } - - if (OldBuf != NULL) { - free (OldBuf); - } - - return Status; -} - -/** - Wrap function to use free() to free allocated memory for certificates. - - @param[in] Certs Pointer to the certificates to be freed. - -**/ -VOID -EFIAPI -Pkcs7FreeSigners ( - IN UINT8 *Certs - ) -{ - if (Certs == NULL) { - return; - } - - free (Certs); -} - -/** - Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard", and outputs two certificate lists chained and - unchained to the signer's certificates. - The input signed data could be wrapped in a ContentInfo structure. - - @param[in] P7Data Pointer to the PKCS#7 message. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] SignerChainCerts Pointer to the certificates list chained to signer's - certificate. It's caller's responsibility to free the buffer - with Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] ChainLength Length of the chained certificates list buffer in bytes. - @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's - responsibility to free the buffer with Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] UnchainLength Length of the unchained certificates list buffer in bytes. - - @retval TRUE The operation is finished successfully. - @retval FALSE Error occurs during the operation. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetCertificatesList ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT UINT8 **SignerChainCerts, - OUT UINTN *ChainLength, - OUT UINT8 **UnchainCerts, - OUT UINTN *UnchainLength - ) -{ - BOOLEAN Status; - UINT8 *NewP7Data; - UINTN NewP7Length; - BOOLEAN Wrapped; - UINT8 Index; - PKCS7 *Pkcs7; - X509_STORE_CTX *CertCtx; - STACK_OF(X509) *CtxChain; - STACK_OF(X509) *CtxUntrusted; - X509 *CtxCert; - STACK_OF(X509) *Signers; - X509 *Signer; - X509 *Cert; - X509 *Issuer; - X509_NAME *IssuerName; - UINT8 *CertBuf; - UINT8 *OldBuf; - UINTN BufferSize; - UINTN OldSize; - UINT8 *SingleCert; - UINTN CertSize; - - // - // Initializations - // - Status = FALSE; - NewP7Data = NULL; - Pkcs7 = NULL; - CertCtx = NULL; - CtxChain = NULL; - CtxCert = NULL; - CtxUntrusted = NULL; - Cert = NULL; - SingleCert = NULL; - CertBuf = NULL; - OldBuf = NULL; - Signers = NULL; - - ZeroMem (&CertCtx, sizeof (CertCtx)); - - // - // Parameter Checking - // - if ((P7Data == NULL) || (SignerChainCerts == NULL) || (ChainLength == NULL) || - (UnchainCerts == NULL) || (UnchainLength == NULL) || (P7Length > INT_MAX)) { - return Status; - } - - *SignerChainCerts = NULL; - *ChainLength = 0; - *UnchainCerts = NULL; - *UnchainLength = 0; - - // - // Construct a new PKCS#7 data wrapping with ContentInfo structure if needed. - // - Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &NewP7Data, &NewP7Length); - if (!Status || (NewP7Length > INT_MAX)) { - goto _Error; - } - - // - // Decodes PKCS#7 SignedData - // - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &NewP7Data, (int) NewP7Length); - if ((Pkcs7 == NULL) || (!PKCS7_type_is_signed (Pkcs7))) { - goto _Error; - } - - // - // Obtains Signer's Certificate from PKCS#7 data - // NOTE: Only one signer case will be handled in this function, which means SignerInfos - // should include only one signer's certificate. - // - Signers = PKCS7_get0_signers (Pkcs7, NULL, PKCS7_BINARY); - if ((Signers == NULL) || (sk_X509_num (Signers) != 1)) { - goto _Error; - } - Signer = sk_X509_value (Signers, 0); - - CertCtx = X509_STORE_CTX_new (); - if (CertCtx == NULL) { - goto _Error; - } - if (!X509_STORE_CTX_init (CertCtx, NULL, Signer, Pkcs7->d.sign->cert)) { - goto _Error; - } - // - // Initialize Chained & Untrusted stack - // - CtxChain = X509_STORE_CTX_get0_chain (CertCtx); - CtxCert = X509_STORE_CTX_get0_cert (CertCtx); - if (CtxChain == NULL) { - if (((CtxChain = sk_X509_new_null ()) == NULL) || - (!sk_X509_push (CtxChain, CtxCert))) { - goto _Error; - } - } - CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx); - if (CtxUntrusted != NULL) { - (VOID)sk_X509_delete_ptr (CtxUntrusted, Signer); - } - - // - // Build certificates stack chained from Signer's certificate. - // - Cert = Signer; - for (; ;) { - // - // Self-Issue checking - // - Issuer = NULL; - if (X509_STORE_CTX_get1_issuer (&Issuer, CertCtx, Cert) == 1) { - if (X509_cmp (Issuer, Cert) == 0) { - break; - } - } - - // - // Found the issuer of the current certificate - // - if (CtxUntrusted != NULL) { - Issuer = NULL; - IssuerName = X509_get_issuer_name (Cert); - Issuer = X509_find_by_subject (CtxUntrusted, IssuerName); - if (Issuer != NULL) { - if (!sk_X509_push (CtxChain, Issuer)) { - goto _Error; - } - (VOID)sk_X509_delete_ptr (CtxUntrusted, Issuer); - - Cert = Issuer; - continue; - } - } - - break; - } - - // - // Converts Chained and Untrusted Certificate to Certificate Buffer in following format: - // UINT8 CertNumber; - // UINT32 Cert1Length; - // UINT8 Cert1[]; - // UINT32 Cert2Length; - // UINT8 Cert2[]; - // ... - // UINT32 CertnLength; - // UINT8 Certn[]; - // - - if (CtxChain != NULL) { - BufferSize = sizeof (UINT8); - CertBuf = NULL; - - for (Index = 0; ; Index++) { - Status = X509PopCertificate (CtxChain, &SingleCert, &CertSize); - if (!Status) { - break; - } - - OldSize = BufferSize; - OldBuf = CertBuf; - BufferSize = OldSize + CertSize + sizeof (UINT32); - CertBuf = malloc (BufferSize); - - if (CertBuf == NULL) { - Status = FALSE; - goto _Error; - } - if (OldBuf != NULL) { - CopyMem (CertBuf, OldBuf, OldSize); - free (OldBuf); - OldBuf = NULL; - } - - WriteUnaligned32 ((UINT32 *) (CertBuf + OldSize), (UINT32) CertSize); - CopyMem (CertBuf + OldSize + sizeof (UINT32), SingleCert, CertSize); - - free (SingleCert); - SingleCert = NULL; - } - - if (CertBuf != NULL) { - // - // Update CertNumber. - // - CertBuf[0] = Index; - - *SignerChainCerts = CertBuf; - *ChainLength = BufferSize; - } - } - - if (CtxUntrusted != NULL) { - BufferSize = sizeof (UINT8); - CertBuf = NULL; - - for (Index = 0; ; Index++) { - Status = X509PopCertificate (CtxUntrusted, &SingleCert, &CertSize); - if (!Status) { - break; - } - - OldSize = BufferSize; - OldBuf = CertBuf; - BufferSize = OldSize + CertSize + sizeof (UINT32); - CertBuf = malloc (BufferSize); - - if (CertBuf == NULL) { - Status = FALSE; - goto _Error; - } - if (OldBuf != NULL) { - CopyMem (CertBuf, OldBuf, OldSize); - free (OldBuf); - OldBuf = NULL; - } - - WriteUnaligned32 ((UINT32 *) (CertBuf + OldSize), (UINT32) CertSize); - CopyMem (CertBuf + OldSize + sizeof (UINT32), SingleCert, CertSize); - - free (SingleCert); - SingleCert = NULL; - } - - if (CertBuf != NULL) { - // - // Update CertNumber. - // - CertBuf[0] = Index; - - *UnchainCerts = CertBuf; - *UnchainLength = BufferSize; - } - } - - Status = TRUE; - -_Error: - // - // Release Resources. - // - if (!Wrapped && (NewP7Data != NULL)) { - free (NewP7Data); - } - - if (Pkcs7 != NULL) { - PKCS7_free (Pkcs7); - } - sk_X509_free (Signers); - - if (CertCtx != NULL) { - X509_STORE_CTX_cleanup (CertCtx); - X509_STORE_CTX_free (CertCtx); - } - - if (SingleCert != NULL) { - free (SingleCert); - } - - if (OldBuf != NULL) { - free (OldBuf); - } - - if (!Status && (CertBuf != NULL)) { - free (CertBuf); - *SignerChainCerts = NULL; - *UnchainCerts = NULL; - } - - return Status; -} - -/** - Verifies the validity of a PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard". The input signed data could be wrapped - in a ContentInfo structure. - - If P7Data, TrustedCert or InData is NULL, then return FALSE. - If P7Length, CertLength or DataLength overflow, then return FALSE. - - Caution: This function may receive untrusted input. - UEFI Authenticated Variable is external input, so this function will do basic - check for PKCS#7 data structure. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which - is used for certificate chain verification. - @param[in] CertLength Length of the trusted certificate in bytes. - @param[in] InData Pointer to the content to be verified. - @param[in] DataLength Length of InData in bytes. - - @retval TRUE The specified PKCS#7 signed data is valid. - @retval FALSE Invalid PKCS#7 signed data. - -**/ -BOOLEAN -EFIAPI -Pkcs7Verify ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - IN CONST UINT8 *TrustedCert, - IN UINTN CertLength, - IN CONST UINT8 *InData, - IN UINTN DataLength - ) -{ - PKCS7 *Pkcs7; - BIO *DataBio; - BOOLEAN Status; - X509 *Cert; - X509_STORE *CertStore; - UINT8 *SignedData; - CONST UINT8 *Temp; - UINTN SignedDataSize; - BOOLEAN Wrapped; - - // - // Check input parameters. - // - if (P7Data == NULL || TrustedCert == NULL || InData == NULL || - P7Length > INT_MAX || CertLength > INT_MAX || DataLength > INT_MAX) { - return FALSE; - } - - Pkcs7 = NULL; - DataBio = NULL; - Cert = NULL; - CertStore = NULL; - - // - // Register & Initialize necessary digest algorithms for PKCS#7 Handling - // - if (EVP_add_digest (EVP_md5 ()) == 0) { - return FALSE; - } - if (EVP_add_digest (EVP_sha1 ()) == 0) { - return FALSE; - } - if (EVP_add_digest (EVP_sha256 ()) == 0) { - return FALSE; - } - if (EVP_add_digest (EVP_sha384 ()) == 0) { - return FALSE; - } - if (EVP_add_digest (EVP_sha512 ()) == 0) { - return FALSE; - } - if (EVP_add_digest_alias (SN_sha1WithRSAEncryption, SN_sha1WithRSA) == 0) { - return FALSE; - } - - Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize); - if (!Status) { - return Status; - } - - Status = FALSE; - - // - // Retrieve PKCS#7 Data (DER encoding) - // - if (SignedDataSize > INT_MAX) { - goto _Exit; - } - - Temp = SignedData; - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &Temp, (int) SignedDataSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // Check if it's PKCS#7 Signed Data (for Authenticode Scenario) - // - if (!PKCS7_type_is_signed (Pkcs7)) { - goto _Exit; - } - - // - // Read DER-encoded root certificate and Construct X509 Certificate - // - Temp = TrustedCert; - Cert = d2i_X509 (NULL, &Temp, (long) CertLength); - if (Cert == NULL) { - goto _Exit; - } - - // - // Setup X509 Store for trusted certificate - // - CertStore = X509_STORE_new (); - if (CertStore == NULL) { - goto _Exit; - } - if (!(X509_STORE_add_cert (CertStore, Cert))) { - goto _Exit; - } - - // - // For generic PKCS#7 handling, InData may be NULL if the content is present - // in PKCS#7 structure. So ignore NULL checking here. - // - DataBio = BIO_new (BIO_s_mem ()); - if (DataBio == NULL) { - goto _Exit; - } - - if (BIO_write (DataBio, InData, (int) DataLength) <= 0) { - goto _Exit; - } - - // - // Allow partial certificate chains, terminated by a non-self-signed but - // still trusted intermediate certificate. Also disable time checks. - // - X509_STORE_set_flags (CertStore, - X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME); - - // - // OpenSSL PKCS7 Verification by default checks for SMIME (email signing) and - // doesn't support the extended key usage for Authenticode Code Signing. - // Bypass the certificate purpose checking by enabling any purposes setting. - // - X509_STORE_set_purpose (CertStore, X509_PURPOSE_ANY); - - // - // Verifies the PKCS#7 signedData structure - // - Status = (BOOLEAN) PKCS7_verify (Pkcs7, NULL, CertStore, DataBio, NULL, PKCS7_BINARY); - -_Exit: - // - // Release Resources - // - BIO_free (DataBio); - X509_free (Cert); - X509_STORE_free (CertStore); - PKCS7_free (Pkcs7); - - if (!Wrapped) { - OPENSSL_free (SignedData); - } - - return Status; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c deleted file mode 100644 index bb32131..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c +++ /dev/null @@ -1,169 +0,0 @@ -/** @file - PKCS#7 SignedData Verification Wrapper Implementation which does not provide - real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard". The input signed data could be wrapped - in a ContentInfo structure. - - Return FALSE to indicate this interface is not supported. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data. - It's caller's responsibility to free the buffer with - Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] StackLength Length of signer's certificates in bytes. - @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates. - It's caller's responsibility to free the buffer with - Pkcs7FreeSigners(). - @param[out] CertLength Length of the trusted certificate in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetSigners ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT UINT8 **CertStack, - OUT UINTN *StackLength, - OUT UINT8 **TrustedCert, - OUT UINTN *CertLength - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Wrap function to use free() to free allocated memory for certificates. - - If the interface is not supported, then ASSERT(). - - @param[in] Certs Pointer to the certificates to be freed. - -**/ -VOID -EFIAPI -Pkcs7FreeSigners ( - IN UINT8 *Certs - ) -{ - ASSERT (FALSE); -} - -/** - Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard", and outputs two certificate lists chained and - unchained to the signer's certificates. - The input signed data could be wrapped in a ContentInfo structure. - - @param[in] P7Data Pointer to the PKCS#7 message. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] SignerChainCerts Pointer to the certificates list chained to signer's - certificate. It's caller's responsibility to free the buffer - with Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] ChainLength Length of the chained certificates list buffer in bytes. - @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's - responsibility to free the buffer with Pkcs7FreeSigners(). - This data structure is EFI_CERT_STACK type. - @param[out] UnchainLength Length of the unchained certificates list buffer in bytes. - - @retval TRUE The operation is finished successfully. - @retval FALSE Error occurs during the operation. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetCertificatesList ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT UINT8 **SignerChainCerts, - OUT UINTN *ChainLength, - OUT UINT8 **UnchainCerts, - OUT UINTN *UnchainLength - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Verifies the validity of a PKCS#7 signed data as described in "PKCS #7: - Cryptographic Message Syntax Standard". The input signed data could be wrapped - in a ContentInfo structure. - - Return FALSE to indicate this interface is not supported. - - @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which - is used for certificate chain verification. - @param[in] CertLength Length of the trusted certificate in bytes. - @param[in] InData Pointer to the content to be verified. - @param[in] DataLength Length of InData in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -Pkcs7Verify ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - IN CONST UINT8 *TrustedCert, - IN UINTN CertLength, - IN CONST UINT8 *InData, - IN UINTN DataLength - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Extracts the attached content from a PKCS#7 signed data if existed. The input signed - data could be wrapped in a ContentInfo structure. - - Return FALSE to indicate this interface is not supported. - - @param[in] P7Data Pointer to the PKCS#7 signed data to process. - @param[in] P7Length Length of the PKCS#7 signed data in bytes. - @param[out] Content Pointer to the extracted content from the PKCS#7 signedData. - It's caller's responsibility to free the buffer with FreePool(). - @param[out] ContentSize The size of the extracted content in bytes. - - @retval TRUE The P7Data was correctly formatted for processing. - @retval FALSE The P7Data was not correctly formatted for processing. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetAttachedContent ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT VOID **Content, - OUT UINTN *ContentSize - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c deleted file mode 100644 index 857a40b..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - Runtime specific implementation of PKCS#7 SignedData Verification Wrapper. - -Copyright (c) 2019, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Extracts the attached content from a PKCS#7 signed data if existed. The input signed - data could be wrapped in a ContentInfo structure. - - Return FALSE to indicate this interface is not supported. - - @param[in] P7Data Pointer to the PKCS#7 signed data to process. - @param[in] P7Length Length of the PKCS#7 signed data in bytes. - @param[out] Content Pointer to the extracted content from the PKCS#7 signedData. - It's caller's responsibility to free the buffer with FreePool(). - @param[out] ContentSize The size of the extracted content in bytes. - - @retval TRUE The P7Data was correctly formatted for processing. - @retval FALSE The P7Data was not correctly formatted for processing. - -**/ -BOOLEAN -EFIAPI -Pkcs7GetAttachedContent ( - IN CONST UINT8 *P7Data, - IN UINTN P7Length, - OUT VOID **Content, - OUT UINTN *ContentSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c deleted file mode 100644 index f0d2bb5..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c +++ /dev/null @@ -1,325 +0,0 @@ -/** @file - RSA Asymmetric Cipher Wrapper Implementation over OpenSSL. - - This file implements following APIs which provide basic capabilities for RSA: - 1) RsaNew - 2) RsaFree - 3) RsaSetKey - 4) RsaPkcs1Verify - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include - -/** - Allocates and initializes one RSA context for subsequent use. - - @return Pointer to the RSA context that has been initialized. - If the allocations fails, RsaNew() returns NULL. - -**/ -VOID * -EFIAPI -RsaNew ( - VOID - ) -{ - // - // Allocates & Initializes RSA Context by OpenSSL RSA_new() - // - return (VOID *) RSA_new (); -} - -/** - Release the specified RSA context. - - @param[in] RsaContext Pointer to the RSA context to be released. - -**/ -VOID -EFIAPI -RsaFree ( - IN VOID *RsaContext - ) -{ - // - // Free OpenSSL RSA Context - // - RSA_free ((RSA *) RsaContext); -} - -/** - Sets the tag-designated key component into the established RSA context. - - This function sets the tag-designated RSA key component into the established - RSA context from the user-specified non-negative integer (octet string format - represented in RSA PKCS#1). - If BigNumber is NULL, then the specified key component in RSA context is cleared. - - If RsaContext is NULL, then return FALSE. - - @param[in, out] RsaContext Pointer to RSA context being set. - @param[in] KeyTag Tag of RSA key component being set. - @param[in] BigNumber Pointer to octet integer buffer. - If NULL, then the specified key component in RSA - context is cleared. - @param[in] BnSize Size of big number buffer in bytes. - If BigNumber is NULL, then it is ignored. - - @retval TRUE RSA key component was set successfully. - @retval FALSE Invalid RSA key component tag. - -**/ -BOOLEAN -EFIAPI -RsaSetKey ( - IN OUT VOID *RsaContext, - IN RSA_KEY_TAG KeyTag, - IN CONST UINT8 *BigNumber, - IN UINTN BnSize - ) -{ - RSA *RsaKey; - BIGNUM *BnN; - BIGNUM *BnE; - BIGNUM *BnD; - BIGNUM *BnP; - BIGNUM *BnQ; - BIGNUM *BnDp; - BIGNUM *BnDq; - BIGNUM *BnQInv; - - // - // Check input parameters. - // - if (RsaContext == NULL || BnSize > INT_MAX) { - return FALSE; - } - - BnN = NULL; - BnE = NULL; - BnD = NULL; - BnP = NULL; - BnQ = NULL; - BnDp = NULL; - BnDq = NULL; - BnQInv = NULL; - - // - // Retrieve the components from RSA object. - // - RsaKey = (RSA *) RsaContext; - RSA_get0_key (RsaKey, (const BIGNUM **)&BnN, (const BIGNUM **)&BnE, (const BIGNUM **)&BnD); - RSA_get0_factors (RsaKey, (const BIGNUM **)&BnP, (const BIGNUM **)&BnQ); - RSA_get0_crt_params (RsaKey, (const BIGNUM **)&BnDp, (const BIGNUM **)&BnDq, (const BIGNUM **)&BnQInv); - - // - // Set RSA Key Components by converting octet string to OpenSSL BN representation. - // NOTE: For RSA public key (used in signature verification), only public components - // (N, e) are needed. - // - switch (KeyTag) { - - // - // RSA Public Modulus (N), Public Exponent (e) and Private Exponent (d) - // - case RsaKeyN: - case RsaKeyE: - case RsaKeyD: - if (BnN == NULL) { - BnN = BN_new (); - } - if (BnE == NULL) { - BnE = BN_new (); - } - if (BnD == NULL) { - BnD = BN_new (); - } - - if ((BnN == NULL) || (BnE == NULL) || (BnD == NULL)) { - return FALSE; - } - - switch (KeyTag) { - case RsaKeyN: - BnN = BN_bin2bn (BigNumber, (UINT32)BnSize, BnN); - break; - case RsaKeyE: - BnE = BN_bin2bn (BigNumber, (UINT32)BnSize, BnE); - break; - case RsaKeyD: - BnD = BN_bin2bn (BigNumber, (UINT32)BnSize, BnD); - break; - default: - return FALSE; - } - if (RSA_set0_key (RsaKey, BN_dup(BnN), BN_dup(BnE), BN_dup(BnD)) == 0) { - return FALSE; - } - - break; - - // - // RSA Secret Prime Factor of Modulus (p and q) - // - case RsaKeyP: - case RsaKeyQ: - if (BnP == NULL) { - BnP = BN_new (); - } - if (BnQ == NULL) { - BnQ = BN_new (); - } - if ((BnP == NULL) || (BnQ == NULL)) { - return FALSE; - } - - switch (KeyTag) { - case RsaKeyP: - BnP = BN_bin2bn (BigNumber, (UINT32)BnSize, BnP); - break; - case RsaKeyQ: - BnQ = BN_bin2bn (BigNumber, (UINT32)BnSize, BnQ); - break; - default: - return FALSE; - } - if (RSA_set0_factors (RsaKey, BN_dup(BnP), BN_dup(BnQ)) == 0) { - return FALSE; - } - - break; - - // - // p's CRT Exponent (== d mod (p - 1)), q's CRT Exponent (== d mod (q - 1)), - // and CRT Coefficient (== 1/q mod p) - // - case RsaKeyDp: - case RsaKeyDq: - case RsaKeyQInv: - if (BnDp == NULL) { - BnDp = BN_new (); - } - if (BnDq == NULL) { - BnDq = BN_new (); - } - if (BnQInv == NULL) { - BnQInv = BN_new (); - } - if ((BnDp == NULL) || (BnDq == NULL) || (BnQInv == NULL)) { - return FALSE; - } - - switch (KeyTag) { - case RsaKeyDp: - BnDp = BN_bin2bn (BigNumber, (UINT32)BnSize, BnDp); - break; - case RsaKeyDq: - BnDq = BN_bin2bn (BigNumber, (UINT32)BnSize, BnDq); - break; - case RsaKeyQInv: - BnQInv = BN_bin2bn (BigNumber, (UINT32)BnSize, BnQInv); - break; - default: - return FALSE; - } - if (RSA_set0_crt_params (RsaKey, BN_dup(BnDp), BN_dup(BnDq), BN_dup(BnQInv)) == 0) { - return FALSE; - } - - break; - - default: - return FALSE; - } - - return TRUE; -} - -/** - Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in - RSA PKCS#1. - - If RsaContext is NULL, then return FALSE. - If MessageHash is NULL, then return FALSE. - If Signature is NULL, then return FALSE. - If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. - - @param[in] RsaContext Pointer to RSA context for signature verification. - @param[in] MessageHash Pointer to octet message hash to be checked. - @param[in] HashSize Size of the message hash in bytes. - @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified. - @param[in] SigSize Size of signature in bytes. - - @retval TRUE Valid signature encoded in PKCS1-v1_5. - @retval FALSE Invalid signature or invalid RSA context. - -**/ -BOOLEAN -EFIAPI -RsaPkcs1Verify ( - IN VOID *RsaContext, - IN CONST UINT8 *MessageHash, - IN UINTN HashSize, - IN CONST UINT8 *Signature, - IN UINTN SigSize - ) -{ - INT32 DigestType; - UINT8 *SigBuf; - - // - // Check input parameters. - // - if (RsaContext == NULL || MessageHash == NULL || Signature == NULL) { - return FALSE; - } - - if (SigSize > INT_MAX || SigSize == 0) { - return FALSE; - } - - // - // Determine the message digest algorithm according to digest size. - // Only MD5, SHA-1 or SHA-256 algorithm is supported. - // - switch (HashSize) { - case MD5_DIGEST_SIZE: - DigestType = NID_md5; - break; - - case SHA1_DIGEST_SIZE: - DigestType = NID_sha1; - break; - - case SHA256_DIGEST_SIZE: - DigestType = NID_sha256; - break; - - default: - return FALSE; - } - - SigBuf = (UINT8 *) Signature; - return (BOOLEAN) RSA_verify ( - DigestType, - MessageHash, - (UINT32) HashSize, - SigBuf, - (UINT32) SigSize, - (RSA *) RsaContext - ); -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c deleted file mode 100644 index 8bf0c01..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c +++ /dev/null @@ -1,362 +0,0 @@ -/** @file - RSA Asymmetric Cipher Wrapper Implementation over OpenSSL. - - This file implements following APIs which provide more capabilities for RSA: - 1) RsaGetKey - 2) RsaGenerateKey - 3) RsaCheckKey - 4) RsaPkcs1Sign - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include -#include - -/** - Gets the tag-designated RSA key component from the established RSA context. - - This function retrieves the tag-designated RSA key component from the - established RSA context as a non-negative integer (octet string format - represented in RSA PKCS#1). - If specified key component has not been set or has been cleared, then returned - BnSize is set to 0. - If the BigNumber buffer is too small to hold the contents of the key, FALSE - is returned and BnSize is set to the required buffer size to obtain the key. - - If RsaContext is NULL, then return FALSE. - If BnSize is NULL, then return FALSE. - If BnSize is large enough but BigNumber is NULL, then return FALSE. - - @param[in, out] RsaContext Pointer to RSA context being set. - @param[in] KeyTag Tag of RSA key component being set. - @param[out] BigNumber Pointer to octet integer buffer. - @param[in, out] BnSize On input, the size of big number buffer in bytes. - On output, the size of data returned in big number buffer in bytes. - - @retval TRUE RSA key component was retrieved successfully. - @retval FALSE Invalid RSA key component tag. - @retval FALSE BnSize is too small. - -**/ -BOOLEAN -EFIAPI -RsaGetKey ( - IN OUT VOID *RsaContext, - IN RSA_KEY_TAG KeyTag, - OUT UINT8 *BigNumber, - IN OUT UINTN *BnSize - ) -{ - RSA *RsaKey; - BIGNUM *BnKey; - UINTN Size; - - // - // Check input parameters. - // - if (RsaContext == NULL || BnSize == NULL) { - return FALSE; - } - - RsaKey = (RSA *) RsaContext; - Size = *BnSize; - *BnSize = 0; - BnKey = NULL; - - switch (KeyTag) { - - // - // RSA Public Modulus (N) - // - case RsaKeyN: - RSA_get0_key (RsaKey, (const BIGNUM **)&BnKey, NULL, NULL); - break; - - // - // RSA Public Exponent (e) - // - case RsaKeyE: - RSA_get0_key (RsaKey, NULL, (const BIGNUM **)&BnKey, NULL); - break; - - // - // RSA Private Exponent (d) - // - case RsaKeyD: - RSA_get0_key (RsaKey, NULL, NULL, (const BIGNUM **)&BnKey); - break; - - // - // RSA Secret Prime Factor of Modulus (p) - // - case RsaKeyP: - RSA_get0_factors (RsaKey, (const BIGNUM **)&BnKey, NULL); - break; - - // - // RSA Secret Prime Factor of Modules (q) - // - case RsaKeyQ: - RSA_get0_factors (RsaKey, NULL, (const BIGNUM **)&BnKey); - break; - - // - // p's CRT Exponent (== d mod (p - 1)) - // - case RsaKeyDp: - RSA_get0_crt_params (RsaKey, (const BIGNUM **)&BnKey, NULL, NULL); - break; - - // - // q's CRT Exponent (== d mod (q - 1)) - // - case RsaKeyDq: - RSA_get0_crt_params (RsaKey, NULL, (const BIGNUM **)&BnKey, NULL); - break; - - // - // The CRT Coefficient (== 1/q mod p) - // - case RsaKeyQInv: - RSA_get0_crt_params (RsaKey, NULL, NULL, (const BIGNUM **)&BnKey); - break; - - default: - return FALSE; - } - - if (BnKey == NULL) { - return FALSE; - } - - *BnSize = Size; - Size = BN_num_bytes (BnKey); - - if (*BnSize < Size) { - *BnSize = Size; - return FALSE; - } - - if (BigNumber == NULL) { - *BnSize = Size; - return TRUE; - } - *BnSize = BN_bn2bin (BnKey, BigNumber) ; - - return TRUE; -} - -/** - Generates RSA key components. - - This function generates RSA key components. It takes RSA public exponent E and - length in bits of RSA modulus N as input, and generates all key components. - If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used. - - Before this function can be invoked, pseudorandom number generator must be correctly - initialized by RandomSeed(). - - If RsaContext is NULL, then return FALSE. - - @param[in, out] RsaContext Pointer to RSA context being set. - @param[in] ModulusLength Length of RSA modulus N in bits. - @param[in] PublicExponent Pointer to RSA public exponent. - @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes. - - @retval TRUE RSA key component was generated successfully. - @retval FALSE Invalid RSA key component tag. - -**/ -BOOLEAN -EFIAPI -RsaGenerateKey ( - IN OUT VOID *RsaContext, - IN UINTN ModulusLength, - IN CONST UINT8 *PublicExponent, - IN UINTN PublicExponentSize - ) -{ - BIGNUM *KeyE; - BOOLEAN RetVal; - - // - // Check input parameters. - // - if (RsaContext == NULL || ModulusLength > INT_MAX || PublicExponentSize > INT_MAX) { - return FALSE; - } - - KeyE = BN_new (); - if (KeyE == NULL) { - return FALSE; - } - - RetVal = FALSE; - - if (PublicExponent == NULL) { - if (BN_set_word (KeyE, 0x10001) == 0) { - goto _Exit; - } - } else { - if (BN_bin2bn (PublicExponent, (UINT32) PublicExponentSize, KeyE) == NULL) { - goto _Exit; - } - } - - if (RSA_generate_key_ex ((RSA *) RsaContext, (UINT32) ModulusLength, KeyE, NULL) == 1) { - RetVal = TRUE; - } - -_Exit: - BN_free (KeyE); - return RetVal; -} - -/** - Validates key components of RSA context. - NOTE: This function performs integrity checks on all the RSA key material, so - the RSA key structure must contain all the private key data. - - This function validates key components of RSA context in following aspects: - - Whether p is a prime - - Whether q is a prime - - Whether n = p * q - - Whether d*e = 1 mod lcm(p-1,q-1) - - If RsaContext is NULL, then return FALSE. - - @param[in] RsaContext Pointer to RSA context to check. - - @retval TRUE RSA key components are valid. - @retval FALSE RSA key components are not valid. - -**/ -BOOLEAN -EFIAPI -RsaCheckKey ( - IN VOID *RsaContext - ) -{ - UINTN Reason; - - // - // Check input parameters. - // - if (RsaContext == NULL) { - return FALSE; - } - - if (RSA_check_key ((RSA *) RsaContext) != 1) { - Reason = ERR_GET_REASON (ERR_peek_last_error ()); - if (Reason == RSA_R_P_NOT_PRIME || - Reason == RSA_R_Q_NOT_PRIME || - Reason == RSA_R_N_DOES_NOT_EQUAL_P_Q || - Reason == RSA_R_D_E_NOT_CONGRUENT_TO_1) { - return FALSE; - } - } - - return TRUE; -} - -/** - Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme. - - This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in - RSA PKCS#1. - If the Signature buffer is too small to hold the contents of signature, FALSE - is returned and SigSize is set to the required buffer size to obtain the signature. - - If RsaContext is NULL, then return FALSE. - If MessageHash is NULL, then return FALSE. - If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. - If SigSize is large enough but Signature is NULL, then return FALSE. - - @param[in] RsaContext Pointer to RSA context for signature generation. - @param[in] MessageHash Pointer to octet message hash to be signed. - @param[in] HashSize Size of the message hash in bytes. - @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature. - @param[in, out] SigSize On input, the size of Signature buffer in bytes. - On output, the size of data returned in Signature buffer in bytes. - - @retval TRUE Signature successfully generated in PKCS1-v1_5. - @retval FALSE Signature generation failed. - @retval FALSE SigSize is too small. - -**/ -BOOLEAN -EFIAPI -RsaPkcs1Sign ( - IN VOID *RsaContext, - IN CONST UINT8 *MessageHash, - IN UINTN HashSize, - OUT UINT8 *Signature, - IN OUT UINTN *SigSize - ) -{ - RSA *Rsa; - UINTN Size; - INT32 DigestType; - - // - // Check input parameters. - // - if (RsaContext == NULL || MessageHash == NULL) { - return FALSE; - } - - Rsa = (RSA *) RsaContext; - Size = RSA_size (Rsa); - - if (*SigSize < Size) { - *SigSize = Size; - return FALSE; - } - - if (Signature == NULL) { - return FALSE; - } - - // - // Determine the message digest algorithm according to digest size. - // Only MD5, SHA-1 or SHA-256 algorithm is supported. - // - switch (HashSize) { - case MD5_DIGEST_SIZE: - DigestType = NID_md5; - break; - - case SHA1_DIGEST_SIZE: - DigestType = NID_sha1; - break; - - case SHA256_DIGEST_SIZE: - DigestType = NID_sha256; - break; - - default: - return FALSE; - } - - return (BOOLEAN) RSA_sign ( - DigestType, - MessageHash, - (UINT32) HashSize, - Signature, - (UINT32 *) SigSize, - (RSA *) RsaContext - ); -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExtNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExtNull.c deleted file mode 100644 index 0d1b204..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExtNull.c +++ /dev/null @@ -1,125 +0,0 @@ -/** @file - RSA Asymmetric Cipher Wrapper Implementation over OpenSSL. - - This file does not provide real capabilities for following APIs in RSA handling: - 1) RsaGetKey - 2) RsaGenerateKey - 3) RsaCheckKey - 4) RsaPkcs1Sign - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Gets the tag-designated RSA key component from the established RSA context. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] RsaContext Pointer to RSA context being set. - @param[in] KeyTag Tag of RSA key component being set. - @param[out] BigNumber Pointer to octet integer buffer. - @param[in, out] BnSize On input, the size of big number buffer in bytes. - On output, the size of data returned in big number buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaGetKey ( - IN OUT VOID *RsaContext, - IN RSA_KEY_TAG KeyTag, - OUT UINT8 *BigNumber, - IN OUT UINTN *BnSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Generates RSA key components. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] RsaContext Pointer to RSA context being set. - @param[in] ModulusLength Length of RSA modulus N in bits. - @param[in] PublicExponent Pointer to RSA public exponent. - @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaGenerateKey ( - IN OUT VOID *RsaContext, - IN UINTN ModulusLength, - IN CONST UINT8 *PublicExponent, - IN UINTN PublicExponentSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Validates key components of RSA context. - - Return FALSE to indicate this interface is not supported. - - @param[in] RsaContext Pointer to RSA context to check. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaCheckKey ( - IN VOID *RsaContext - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme. - - Return FALSE to indicate this interface is not supported. - - @param[in] RsaContext Pointer to RSA context for signature generation. - @param[in] MessageHash Pointer to octet message hash to be signed. - @param[in] HashSize Size of the message hash in bytes. - @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature. - @param[in, out] SigSize On input, the size of Signature buffer in bytes. - On output, the size of data returned in Signature buffer in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaPkcs1Sign ( - IN VOID *RsaContext, - IN CONST UINT8 *MessageHash, - IN UINTN HashSize, - OUT UINT8 *Signature, - IN OUT UINTN *SigSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c deleted file mode 100644 index 10715bd..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c +++ /dev/null @@ -1,665 +0,0 @@ -/** @file - RFC3161 Timestamp Countersignature Verification over OpenSSL. - The timestamp is generated by a TimeStamping Authority (TSA) and asserts that a - publisher's signature existed before the specified time. The timestamp extends - the lifetime of the signature when a signing certificate expires or is later - revoked. - -Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -#include -#include -#include -#include -#include - -// -// OID ASN.1 Value for SPC_RFC3161_OBJID ("1.3.6.1.4.1.311.3.3.1") -// -UINT8 mSpcRFC3161OidValue[] = { - 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x03, 0x03, 0x01 - }; - -/// -/// The messageImprint field SHOULD contain the hash of the datum to be -/// time-stamped. The hash is represented as an OCTET STRING. Its -/// length MUST match the length of the hash value for that algorithm -/// (e.g., 20 bytes for SHA-1 or 16 bytes for MD5). -/// -/// MessageImprint ::= SEQUENCE { -/// hashAlgorithm AlgorithmIdentifier, -/// hashedMessage OCTET STRING } -/// -typedef struct { - X509_ALGOR *HashAlgorithm; - ASN1_OCTET_STRING *HashedMessage; -} TS_MESSAGE_IMPRINT; - -// -// ASN.1 Functions for TS_MESSAGE_IMPRINT -// -DECLARE_ASN1_FUNCTIONS (TS_MESSAGE_IMPRINT) -ASN1_SEQUENCE (TS_MESSAGE_IMPRINT) = { - ASN1_SIMPLE (TS_MESSAGE_IMPRINT, HashAlgorithm, X509_ALGOR), - ASN1_SIMPLE (TS_MESSAGE_IMPRINT, HashedMessage, ASN1_OCTET_STRING) -} ASN1_SEQUENCE_END (TS_MESSAGE_IMPRINT) -IMPLEMENT_ASN1_FUNCTIONS (TS_MESSAGE_IMPRINT) - -/// -/// Accuracy represents the time deviation around the UTC time contained -/// in GeneralizedTime of time-stamp token. -/// -/// Accuracy ::= SEQUENCE { -/// seconds INTEGER OPTIONAL, -/// millis [0] INTEGER (1..999) OPTIONAL, -/// micros [1] INTEGER (1..999) OPTIONAL } -/// -typedef struct { - ASN1_INTEGER *Seconds; - ASN1_INTEGER *Millis; - ASN1_INTEGER *Micros; -} TS_ACCURACY; - -// -// ASN.1 Functions for TS_ACCURACY -// -DECLARE_ASN1_FUNCTIONS (TS_ACCURACY) -ASN1_SEQUENCE (TS_ACCURACY) = { - ASN1_OPT (TS_ACCURACY, Seconds, ASN1_INTEGER), - ASN1_IMP_OPT (TS_ACCURACY, Millis, ASN1_INTEGER, 0), - ASN1_IMP_OPT (TS_ACCURACY, Micros, ASN1_INTEGER, 1) -} ASN1_SEQUENCE_END (TS_ACCURACY) -IMPLEMENT_ASN1_FUNCTIONS (TS_ACCURACY) - -/// -/// The timestamp token info resulting from a successful timestamp request, -/// as defined in RFC 3161. -/// -/// TSTInfo ::= SEQUENCE { -/// version INTEGER { v1(1) }, -/// policy TSAPolicyId, -/// messageImprint MessageImprint, -/// -- MUST have the same value as the similar field in -/// -- TimeStampReq -/// serialNumber INTEGER, -/// -- Time-Stamping users MUST be ready to accommodate integers -/// -- up to 160 bits. -/// genTime GeneralizedTime, -/// accuracy Accuracy OPTIONAL, -/// ordering BOOLEAN DEFAULT FALSE, -/// nonce INTEGER OPTIONAL, -/// -- MUST be present if the similar field was present -/// -- in TimeStampReq. In that case it MUST have the same value. -/// tsa [0] GeneralName OPTIONAL, -/// extensions [1] IMPLICIT Extensions OPTIONAL } -/// -typedef struct { - ASN1_INTEGER *Version; - ASN1_OBJECT *Policy; - TS_MESSAGE_IMPRINT *MessageImprint; - ASN1_INTEGER *SerialNumber; - ASN1_GENERALIZEDTIME *GenTime; - TS_ACCURACY *Accuracy; - ASN1_BOOLEAN Ordering; - ASN1_INTEGER *Nonce; - GENERAL_NAME *Tsa; - STACK_OF(X509_EXTENSION) *Extensions; -} TS_TST_INFO; - -// -// ASN.1 Functions for TS_TST_INFO -// -DECLARE_ASN1_FUNCTIONS (TS_TST_INFO) -ASN1_SEQUENCE (TS_TST_INFO) = { - ASN1_SIMPLE (TS_TST_INFO, Version, ASN1_INTEGER), - ASN1_SIMPLE (TS_TST_INFO, Policy, ASN1_OBJECT), - ASN1_SIMPLE (TS_TST_INFO, MessageImprint, TS_MESSAGE_IMPRINT), - ASN1_SIMPLE (TS_TST_INFO, SerialNumber, ASN1_INTEGER), - ASN1_SIMPLE (TS_TST_INFO, GenTime, ASN1_GENERALIZEDTIME), - ASN1_OPT (TS_TST_INFO, Accuracy, TS_ACCURACY), - ASN1_OPT (TS_TST_INFO, Ordering, ASN1_FBOOLEAN), - ASN1_OPT (TS_TST_INFO, Nonce, ASN1_INTEGER), - ASN1_EXP_OPT(TS_TST_INFO, Tsa, GENERAL_NAME, 0), - ASN1_IMP_SEQUENCE_OF_OPT (TS_TST_INFO, Extensions, X509_EXTENSION, 1) -} ASN1_SEQUENCE_END (TS_TST_INFO) -IMPLEMENT_ASN1_FUNCTIONS (TS_TST_INFO) - - -/** - Convert ASN.1 GeneralizedTime to EFI Time. - - @param[in] Asn1Time Pointer to the ASN.1 GeneralizedTime to be converted. - @param[out] SigningTime Return the corresponding EFI Time. - - @retval TRUE The time conversion succeeds. - @retval FALSE Invalid parameters. - -**/ -BOOLEAN -EFIAPI -ConvertAsn1TimeToEfiTime ( - IN ASN1_TIME *Asn1Time, - OUT EFI_TIME *EfiTime - ) -{ - CONST CHAR8 *Str; - UINTN Index; - - if ((Asn1Time == NULL) || (EfiTime == NULL)) { - return FALSE; - } - - Str = (CONST CHAR8*)Asn1Time->data; - SetMem (EfiTime, 0, sizeof (EFI_TIME)); - - Index = 0; - if (Asn1Time->type == V_ASN1_UTCTIME) { /* two digit year */ - EfiTime->Year = (Str[Index++] - '0') * 10; - EfiTime->Year += (Str[Index++] - '0'); - if (EfiTime->Year < 70) { - EfiTime->Year += 100; - } - } else if (Asn1Time->type == V_ASN1_GENERALIZEDTIME) { /* four digit year */ - EfiTime->Year = (Str[Index++] - '0') * 1000; - EfiTime->Year += (Str[Index++] - '0') * 100; - EfiTime->Year += (Str[Index++] - '0') * 10; - EfiTime->Year += (Str[Index++] - '0'); - if ((EfiTime->Year < 1900) || (EfiTime->Year > 9999)) { - return FALSE; - } - } - - EfiTime->Month = (Str[Index++] - '0') * 10; - EfiTime->Month += (Str[Index++] - '0'); - if ((EfiTime->Month < 1) || (EfiTime->Month > 12)) { - return FALSE; - } - - EfiTime->Day = (Str[Index++] - '0') * 10; - EfiTime->Day += (Str[Index++] - '0'); - if ((EfiTime->Day < 1) || (EfiTime->Day > 31)) { - return FALSE; - } - - EfiTime->Hour = (Str[Index++] - '0') * 10; - EfiTime->Hour += (Str[Index++] - '0'); - if (EfiTime->Hour > 23) { - return FALSE; - } - - EfiTime->Minute = (Str[Index++] - '0') * 10; - EfiTime->Minute += (Str[Index++] - '0'); - if (EfiTime->Minute > 59) { - return FALSE; - } - - EfiTime->Second = (Str[Index++] - '0') * 10; - EfiTime->Second += (Str[Index++] - '0'); - if (EfiTime->Second > 59) { - return FALSE; - } - - /* Note: we did not adjust the time based on time zone information */ - - return TRUE; -} - -/** - - Check the validity of TimeStamp Token Information. - - @param[in] TstInfo Pointer to the TS_TST_INFO structure. - @param[in] TimestampedData Pointer to the data to be time-stamped. - @param[in] DataSize Size of timestamped data in bytes. - - @retval TRUE The TimeStamp Token Information is valid. - @retval FALSE Invalid TimeStamp Token Information. - -**/ -BOOLEAN -EFIAPI -CheckTSTInfo ( - IN CONST TS_TST_INFO *TstInfo, - IN CONST UINT8 *TimestampedData, - IN UINTN DataSize - ) -{ - BOOLEAN Status; - TS_MESSAGE_IMPRINT *Imprint; - X509_ALGOR *HashAlgo; - CONST EVP_MD *Md; - EVP_MD_CTX *MdCtx; - UINTN MdSize; - UINT8 *HashedMsg; - - // - // Initialization - // - Status = FALSE; - HashAlgo = NULL; - HashedMsg = NULL; - MdCtx = NULL; - - // - // -- Check version number of Timestamp: - // The version field (currently v1) describes the version of the time-stamp token. - // Conforming time-stamping servers MUST be able to provide version 1 time-stamp tokens. - // - if ((ASN1_INTEGER_get (TstInfo->Version)) != 1) { - return FALSE; - } - - // - // -- Check Policies - // The policy field MUST indicate the TSA's policy under which the response was produced. - // - if (TstInfo->Policy == NULL) { - /// NOTE: Need to check if the requested and returned policies. - /// We have no information about the Requested TSA Policy. - return FALSE; - } - - // - // -- Compute & Check Message Imprint - // - Imprint = TstInfo->MessageImprint; - HashAlgo = X509_ALGOR_dup (Imprint->HashAlgorithm); - - Md = EVP_get_digestbyobj (HashAlgo->algorithm); - if (Md == NULL) { - goto _Exit; - } - - MdSize = EVP_MD_size (Md); - HashedMsg = AllocateZeroPool (MdSize); - if (HashedMsg == NULL) { - goto _Exit; - } - MdCtx = EVP_MD_CTX_new (); - if (MdCtx == NULL) { - goto _Exit; - } - if ((EVP_DigestInit_ex (MdCtx, Md, NULL) != 1) || - (EVP_DigestUpdate (MdCtx, TimestampedData, DataSize) != 1) || - (EVP_DigestFinal (MdCtx, HashedMsg, NULL) != 1)) { - goto _Exit; - } - if ((MdSize == (UINTN)ASN1_STRING_length (Imprint->HashedMessage)) && - (CompareMem (HashedMsg, ASN1_STRING_get0_data (Imprint->HashedMessage), MdSize) != 0)) { - goto _Exit; - } - - // - // -- Check Nonces - // - if (TstInfo->Nonce != NULL) { - // - // Nonces is optional, No error if no nonce is returned; - // - } - - // - // -- Check if the TSA name and signer certificate is matched. - // - if (TstInfo->Tsa != NULL) { - // - // Ignored the optional Tsa field checking. - // - } - - Status = TRUE; - -_Exit: - X509_ALGOR_free (HashAlgo); - EVP_MD_CTX_free (MdCtx); - if (HashedMsg != NULL) { - FreePool (HashedMsg); - } - - return Status; -} - -/** - Verifies the validity of a TimeStamp Token as described in RFC 3161 ("Internet - X.509 Public Key Infrastructure Time-Stamp Protocol (TSP)"). - - If TSToken is NULL, then return FALSE. - If TimestampedData is NULL, then return FALSE. - - @param[in] TSToken Pointer to the RFC3161 TimeStamp Token, which is generated - by a TSA and located in the software publisher's SignerInfo - structure. - @param[in] TokenSize Size of the TimeStamp Token in bytes. - @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER. - @param[in] CertSize Size of the trusted TSA certificate in bytes. - @param[in] TimestampedData Pointer to the data to be time-stamped. - @param[in] DataSize Size of timestamped data in bytes. - @param[out] SigningTime Return the time of timestamp generation time if the timestamp - signature is valid. - - @retval TRUE The specified timestamp token is valid. - @retval FALSE Invalid timestamp token. - -**/ -BOOLEAN -EFIAPI -TimestampTokenVerify ( - IN CONST UINT8 *TSToken, - IN UINTN TokenSize, - IN CONST UINT8 *TsaCert, - IN UINTN CertSize, - IN CONST UINT8 *TimestampedData, - IN UINTN DataSize, - OUT EFI_TIME *SigningTime - ) -{ - BOOLEAN Status; - CONST UINT8 *TokenTemp; - PKCS7 *Pkcs7; - X509 *Cert; - CONST UINT8 *CertTemp; - X509_STORE *CertStore; - BIO *OutBio; - UINT8 *TstData; - UINTN TstSize; - CONST UINT8 *TstTemp; - TS_TST_INFO *TstInfo; - - Status = FALSE; - - // - // Check input parameters - // - if ((TSToken == NULL) || (TsaCert == NULL) || (TimestampedData == NULL) || - (TokenSize > INT_MAX) || (CertSize > INT_MAX) || (DataSize > INT_MAX)) { - return FALSE; - } - - // - // Initializations - // - if (SigningTime != NULL) { - SetMem (SigningTime, sizeof (EFI_TIME), 0); - } - Pkcs7 = NULL; - Cert = NULL; - CertStore = NULL; - OutBio = NULL; - TstData = NULL; - TstInfo = NULL; - - // - // TimeStamp Token should contain one valid DER-encoded ASN.1 PKCS#7 structure. - // - TokenTemp = TSToken; - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &TokenTemp, (int) TokenSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // The timestamp signature (TSA's response) will be one PKCS#7 signed data. - // - if (!PKCS7_type_is_signed (Pkcs7)) { - goto _Exit; - } - - // - // Read the trusted TSA certificate (DER-encoded), and Construct X509 Certificate. - // - CertTemp = TsaCert; - Cert = d2i_X509 (NULL, &CertTemp, (long) CertSize); - if (Cert == NULL) { - goto _Exit; - } - - // - // Setup X509 Store for trusted certificate. - // - CertStore = X509_STORE_new (); - if ((CertStore == NULL) || !(X509_STORE_add_cert (CertStore, Cert))) { - goto _Exit; - } - - // - // Allow partial certificate chains, terminated by a non-self-signed but - // still trusted intermediate certificate. Also disable time checks. - // - X509_STORE_set_flags (CertStore, - X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME); - - X509_STORE_set_purpose (CertStore, X509_PURPOSE_ANY); - - // - // Verifies the PKCS#7 signedData structure, and output the signed contents. - // - OutBio = BIO_new (BIO_s_mem ()); - if (OutBio == NULL) { - goto _Exit; - } - if (!PKCS7_verify (Pkcs7, NULL, CertStore, NULL, OutBio, PKCS7_BINARY)) { - goto _Exit; - } - - // - // Read the signed contents detached in timestamp signature. - // - TstData = AllocateZeroPool (2048); - if (TstData == NULL) { - goto _Exit; - } - TstSize = BIO_read (OutBio, (void *) TstData, 2048); - - // - // Construct TS_TST_INFO structure from the signed contents. - // - TstTemp = TstData; - TstInfo = d2i_TS_TST_INFO (NULL, (const unsigned char **) &TstTemp, - (int)TstSize); - if (TstInfo == NULL) { - goto _Exit; - } - - // - // Check TS_TST_INFO structure. - // - Status = CheckTSTInfo (TstInfo, TimestampedData, DataSize); - if (!Status) { - goto _Exit; - } - - // - // Retrieve the signing time from TS_TST_INFO structure. - // - if (SigningTime != NULL) { - SetMem (SigningTime, sizeof (EFI_TIME), 0); - Status = ConvertAsn1TimeToEfiTime (TstInfo->GenTime, SigningTime); - } - -_Exit: - // - // Release Resources - // - PKCS7_free (Pkcs7); - X509_free (Cert); - X509_STORE_free (CertStore); - BIO_free (OutBio); - TS_TST_INFO_free (TstInfo); - - if (TstData != NULL) { - FreePool (TstData); - } - - return Status; -} - -/** - Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode - signature. - - If AuthData is NULL, then return FALSE. - - @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed - PE/COFF image to be verified. - @param[in] DataSize Size of the Authenticode Signature in bytes. - @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which - is used for TSA certificate chain verification. - @param[in] CertSize Size of the trusted certificate in bytes. - @param[out] SigningTime Return the time of timestamp generation time if the timestamp - signature is valid. - - @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature. - @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data. - -**/ -BOOLEAN -EFIAPI -ImageTimestampVerify ( - IN CONST UINT8 *AuthData, - IN UINTN DataSize, - IN CONST UINT8 *TsaCert, - IN UINTN CertSize, - OUT EFI_TIME *SigningTime - ) -{ - BOOLEAN Status; - PKCS7 *Pkcs7; - CONST UINT8 *Temp; - STACK_OF(PKCS7_SIGNER_INFO) *SignerInfos; - PKCS7_SIGNER_INFO *SignInfo; - UINTN Index; - STACK_OF(X509_ATTRIBUTE) *Sk; - X509_ATTRIBUTE *Xa; - ASN1_OBJECT *XaObj; - ASN1_TYPE *Asn1Type; - ASN1_OCTET_STRING *EncDigest; - UINT8 *TSToken; - UINTN TokenSize; - - // - // Input Parameters Checking. - // - if ((AuthData == NULL) || (TsaCert == NULL)) { - return FALSE; - } - - if ((DataSize > INT_MAX) || (CertSize > INT_MAX)) { - return FALSE; - } - - // - // Register & Initialize necessary digest algorithms for PKCS#7 Handling. - // - if ((EVP_add_digest (EVP_md5 ()) == 0) || (EVP_add_digest (EVP_sha1 ()) == 0) || - (EVP_add_digest (EVP_sha256 ()) == 0) || (EVP_add_digest_alias (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0) { - return FALSE; - } - - // - // Initialization. - // - Status = FALSE; - Pkcs7 = NULL; - SignInfo = NULL; - - // - // Decode ASN.1-encoded Authenticode data into PKCS7 structure. - // - Temp = AuthData; - Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &Temp, (int) DataSize); - if (Pkcs7 == NULL) { - goto _Exit; - } - - // - // Check if there is one and only one signer. - // - SignerInfos = PKCS7_get_signer_info (Pkcs7); - if (!SignerInfos || (sk_PKCS7_SIGNER_INFO_num (SignerInfos) != 1)) { - goto _Exit; - } - - // - // Locate the TimeStamp CounterSignature. - // - SignInfo = sk_PKCS7_SIGNER_INFO_value (SignerInfos, 0); - if (SignInfo == NULL) { - goto _Exit; - } - - // - // Locate Message Digest which will be the data to be time-stamped. - // - EncDigest = SignInfo->enc_digest; - if (EncDigest == NULL) { - goto _Exit; - } - - // - // The RFC3161 timestamp counterSignature is contained in unauthenticatedAttributes field - // of SignerInfo. - // - Sk = SignInfo->unauth_attr; - if (Sk == NULL) { // No timestamp counterSignature. - goto _Exit; - } - - Asn1Type = NULL; - for (Index = 0; Index < (UINTN) sk_X509_ATTRIBUTE_num (Sk); Index++) { - // - // Search valid RFC3161 timestamp counterSignature based on OBJID. - // - Xa = sk_X509_ATTRIBUTE_value (Sk, (int)Index); - if (Xa == NULL) { - continue; - } - XaObj = X509_ATTRIBUTE_get0_object(Xa); - if (XaObj == NULL) { - continue; - } - if ((OBJ_length(XaObj) != sizeof (mSpcRFC3161OidValue)) || - (CompareMem (OBJ_get0_data(XaObj), mSpcRFC3161OidValue, sizeof (mSpcRFC3161OidValue)) != 0)) { - continue; - } - Asn1Type = X509_ATTRIBUTE_get0_type(Xa, 0); - } - - if (Asn1Type == NULL) { - Status = FALSE; - goto _Exit; - } - TSToken = Asn1Type->value.octet_string->data; - TokenSize = Asn1Type->value.octet_string->length; - - // - // TimeStamp counterSignature (Token) verification. - // - Status = TimestampTokenVerify ( - TSToken, - TokenSize, - TsaCert, - CertSize, - EncDigest->data, - EncDigest->length, - SigningTime - ); - -_Exit: - // - // Release Resources - // - PKCS7_free (Pkcs7); - - return Status; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c deleted file mode 100644 index 3a9b5f2..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - RFC3161 Timestamp Countersignature Verification Wrapper Implementation which does - not provide real capabilities. - -Copyright (c) 2014, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode - signature. - - Return FALSE to indicate this interface is not supported. - - @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed - PE/COFF image to be verified. - @param[in] DataSize Size of the Authenticode Signature in bytes. - @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which - is used for TSA certificate chain verification. - @param[in] CertSize Size of the trusted certificate in bytes. - @param[out] SigningTime Return the time of timestamp generation time if the timestamp - signature is valid. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -ImageTimestampVerify ( - IN CONST UINT8 *AuthData, - IN UINTN DataSize, - IN CONST UINT8 *TsaCert, - IN UINTN CertSize, - OUT EFI_TIME *SigningTime - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c deleted file mode 100644 index 7424b80..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c +++ /dev/null @@ -1,730 +0,0 @@ -/** @file - X.509 Certificate Handler Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include - -/** - Construct a X509 object from DER-encoded certificate data. - - If Cert is NULL, then return FALSE. - If SingleX509Cert is NULL, then return FALSE. - - @param[in] Cert Pointer to the DER-encoded certificate data. - @param[in] CertSize The size of certificate data in bytes. - @param[out] SingleX509Cert The generated X509 object. - - @retval TRUE The X509 object generation succeeded. - @retval FALSE The operation failed. - -**/ -BOOLEAN -EFIAPI -X509ConstructCertificate ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 **SingleX509Cert - ) -{ - X509 *X509Cert; - CONST UINT8 *Temp; - - // - // Check input parameters. - // - if (Cert == NULL || SingleX509Cert == NULL || CertSize > INT_MAX) { - return FALSE; - } - - // - // Read DER-encoded X509 Certificate and Construct X509 object. - // - Temp = Cert; - X509Cert = d2i_X509 (NULL, &Temp, (long) CertSize); - if (X509Cert == NULL) { - return FALSE; - } - - *SingleX509Cert = (UINT8 *) X509Cert; - - return TRUE; -} - -/** - Construct a X509 stack object from a list of DER-encoded certificate data. - - If X509Stack is NULL, then return FALSE. - - @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. - On output, pointer to the X509 stack object with new - inserted X509 certificate. - @param ... A list of DER-encoded single certificate data followed - by certificate size. A NULL terminates the list. The - pairs are the arguments to X509ConstructCertificate(). - - @retval TRUE The X509 stack construction succeeded. - @retval FALSE The construction operation failed. - -**/ -BOOLEAN -EFIAPI -X509ConstructCertificateStack ( - IN OUT UINT8 **X509Stack, - ... - ) -{ - UINT8 *Cert; - UINTN CertSize; - X509 *X509Cert; - STACK_OF(X509) *CertStack; - BOOLEAN Status; - VA_LIST Args; - UINTN Index; - - // - // Check input parameters. - // - if (X509Stack == NULL) { - return FALSE; - } - - Status = FALSE; - - // - // Initialize X509 stack object. - // - CertStack = (STACK_OF(X509) *) (*X509Stack); - if (CertStack == NULL) { - CertStack = sk_X509_new_null (); - if (CertStack == NULL) { - return Status; - } - } - - VA_START (Args, X509Stack); - - for (Index = 0; ; Index++) { - // - // If Cert is NULL, then it is the end of the list. - // - Cert = VA_ARG (Args, UINT8 *); - if (Cert == NULL) { - break; - } - - CertSize = VA_ARG (Args, UINTN); - if (CertSize == 0) { - break; - } - - // - // Construct X509 Object from the given DER-encoded certificate data. - // - X509Cert = NULL; - Status = X509ConstructCertificate ( - (CONST UINT8 *) Cert, - CertSize, - (UINT8 **) &X509Cert - ); - if (!Status) { - if (X509Cert != NULL) { - X509_free (X509Cert); - } - break; - } - - // - // Insert the new X509 object into X509 stack object. - // - sk_X509_push (CertStack, X509Cert); - } - - VA_END (Args); - - if (!Status) { - sk_X509_pop_free (CertStack, X509_free); - } else { - *X509Stack = (UINT8 *) CertStack; - } - - return Status; -} - -/** - Release the specified X509 object. - - If X509Cert is NULL, then return FALSE. - - @param[in] X509Cert Pointer to the X509 object to be released. - -**/ -VOID -EFIAPI -X509Free ( - IN VOID *X509Cert - ) -{ - // - // Check input parameters. - // - if (X509Cert == NULL) { - return; - } - - // - // Free OpenSSL X509 object. - // - X509_free ((X509 *) X509Cert); -} - -/** - Release the specified X509 stack object. - - If X509Stack is NULL, then return FALSE. - - @param[in] X509Stack Pointer to the X509 stack object to be released. - -**/ -VOID -EFIAPI -X509StackFree ( - IN VOID *X509Stack - ) -{ - // - // Check input parameters. - // - if (X509Stack == NULL) { - return; - } - - // - // Free OpenSSL X509 stack object. - // - sk_X509_pop_free ((STACK_OF(X509) *) X509Stack, X509_free); -} - -/** - Retrieve the subject bytes from one X.509 certificate. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] CertSubject Pointer to the retrieved certificate subject bytes. - @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input, - and the size of buffer returned CertSubject on output. - - If Cert is NULL, then return FALSE. - If SubjectSize is NULL, then return FALSE. - - @retval TRUE The certificate subject retrieved successfully. - @retval FALSE Invalid certificate, or the SubjectSize is too small for the result. - The SubjectSize will be updated with the required size. - -**/ -BOOLEAN -EFIAPI -X509GetSubjectName ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 *CertSubject, - IN OUT UINTN *SubjectSize - ) -{ - BOOLEAN Status; - X509 *X509Cert; - X509_NAME *X509Name; - UINTN X509NameSize; - - // - // Check input parameters. - // - if (Cert == NULL || SubjectSize == NULL) { - return FALSE; - } - - X509Cert = NULL; - - // - // Read DER-encoded X509 Certificate and Construct X509 object. - // - Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert); - if ((X509Cert == NULL) || (!Status)) { - Status = FALSE; - goto _Exit; - } - - Status = FALSE; - - // - // Retrieve subject name from certificate object. - // - X509Name = X509_get_subject_name (X509Cert); - if (X509Name == NULL) { - goto _Exit; - } - - X509NameSize = i2d_X509_NAME(X509Name, NULL); - if (*SubjectSize < X509NameSize) { - *SubjectSize = X509NameSize; - goto _Exit; - } - *SubjectSize = X509NameSize; - if (CertSubject != NULL) { - i2d_X509_NAME(X509Name, &CertSubject); - Status = TRUE; - } - -_Exit: - // - // Release Resources. - // - if (X509Cert != NULL) { - X509_free (X509Cert); - } - - return Status; -} - -/** - Retrieve the common name (CN) string from one X.509 certificate. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] CommonName Buffer to contain the retrieved certificate common - name string (UTF8). At most CommonNameSize bytes will be - written and the string will be null terminated. May be - NULL in order to determine the size buffer needed. - @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input, - and the size of buffer returned CommonName on output. - If CommonName is NULL then the amount of space needed - in buffer (including the final null) is returned. - - @retval RETURN_SUCCESS The certificate CommonName retrieved successfully. - @retval RETURN_INVALID_PARAMETER If Cert is NULL. - If CommonNameSize is NULL. - If CommonName is not NULL and *CommonNameSize is 0. - If Certificate is invalid. - @retval RETURN_NOT_FOUND If no CommonName entry exists. - @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size - (including the final null) is returned in the - CommonNameSize parameter. - @retval RETURN_UNSUPPORTED The operation is not supported. - -**/ -RETURN_STATUS -EFIAPI -X509GetCommonName ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT CHAR8 *CommonName, OPTIONAL - IN OUT UINTN *CommonNameSize - ) -{ - RETURN_STATUS ReturnStatus; - BOOLEAN Status; - X509 *X509Cert; - X509_NAME *X509Name; - INT32 Index; - INTN Length; - X509_NAME_ENTRY *Entry; - ASN1_STRING *EntryData; - UINT8 *UTF8Name; - - ReturnStatus = RETURN_INVALID_PARAMETER; - UTF8Name = NULL; - - // - // Check input parameters. - // - if ((Cert == NULL) || (CertSize > INT_MAX) || (CommonNameSize == NULL)) { - return ReturnStatus; - } - if ((CommonName != NULL) && (*CommonNameSize == 0)) { - return ReturnStatus; - } - - X509Cert = NULL; - // - // Read DER-encoded X509 Certificate and Construct X509 object. - // - Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert); - if ((X509Cert == NULL) || (!Status)) { - // - // Invalid X.509 Certificate - // - goto _Exit; - } - - Status = FALSE; - - // - // Retrieve subject name from certificate object. - // - X509Name = X509_get_subject_name (X509Cert); - if (X509Name == NULL) { - // - // Fail to retrieve subject name content - // - goto _Exit; - } - - // - // Retrieve the CommonName information from X.509 Subject - // - Index = X509_NAME_get_index_by_NID (X509Name, NID_commonName, -1); - if (Index < 0) { - // - // No CommonName entry exists in X509_NAME object - // - *CommonNameSize = 0; - ReturnStatus = RETURN_NOT_FOUND; - goto _Exit; - } - - Entry = X509_NAME_get_entry (X509Name, Index); - if (Entry == NULL) { - // - // Fail to retrieve name entry data - // - *CommonNameSize = 0; - ReturnStatus = RETURN_NOT_FOUND; - goto _Exit; - } - - EntryData = X509_NAME_ENTRY_get_data (Entry); - - Length = ASN1_STRING_to_UTF8 (&UTF8Name, EntryData); - if (Length < 0) { - // - // Fail to convert the commonName string - // - *CommonNameSize = 0; - ReturnStatus = RETURN_INVALID_PARAMETER; - goto _Exit; - } - - if (CommonName == NULL) { - *CommonNameSize = Length + 1; - ReturnStatus = RETURN_BUFFER_TOO_SMALL; - } else { - *CommonNameSize = MIN ((UINTN)Length, *CommonNameSize - 1) + 1; - CopyMem (CommonName, UTF8Name, *CommonNameSize - 1); - CommonName[*CommonNameSize - 1] = '\0'; - ReturnStatus = RETURN_SUCCESS; - } - -_Exit: - // - // Release Resources. - // - if (X509Cert != NULL) { - X509_free (X509Cert); - } - if (UTF8Name != NULL) { - OPENSSL_free (UTF8Name); - } - - return ReturnStatus; -} - -/** - Retrieve the RSA Public Key from one DER-encoded X509 certificate. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved - RSA public key component. Use RsaFree() function to free the - resource. - - If Cert is NULL, then return FALSE. - If RsaContext is NULL, then return FALSE. - - @retval TRUE RSA Public Key was retrieved successfully. - @retval FALSE Fail to retrieve RSA public key from X509 certificate. - -**/ -BOOLEAN -EFIAPI -RsaGetPublicKeyFromX509 ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT VOID **RsaContext - ) -{ - BOOLEAN Status; - EVP_PKEY *Pkey; - X509 *X509Cert; - - // - // Check input parameters. - // - if (Cert == NULL || RsaContext == NULL) { - return FALSE; - } - - Pkey = NULL; - X509Cert = NULL; - - // - // Read DER-encoded X509 Certificate and Construct X509 object. - // - Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert); - if ((X509Cert == NULL) || (!Status)) { - Status = FALSE; - goto _Exit; - } - - Status = FALSE; - - // - // Retrieve and check EVP_PKEY data from X509 Certificate. - // - Pkey = X509_get_pubkey (X509Cert); - if ((Pkey == NULL) || (EVP_PKEY_id (Pkey) != EVP_PKEY_RSA)) { - goto _Exit; - } - - // - // Duplicate RSA Context from the retrieved EVP_PKEY. - // - if ((*RsaContext = RSAPublicKey_dup (EVP_PKEY_get0_RSA (Pkey))) != NULL) { - Status = TRUE; - } - -_Exit: - // - // Release Resources. - // - if (X509Cert != NULL) { - X509_free (X509Cert); - } - - if (Pkey != NULL) { - EVP_PKEY_free (Pkey); - } - - return Status; -} - -/** - Verify one X509 certificate was issued by the trusted CA. - - @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[in] CACert Pointer to the DER-encoded trusted CA certificate. - @param[in] CACertSize Size of the CA Certificate in bytes. - - If Cert is NULL, then return FALSE. - If CACert is NULL, then return FALSE. - - @retval TRUE The certificate was issued by the trusted CA. - @retval FALSE Invalid certificate or the certificate was not issued by the given - trusted CA. - -**/ -BOOLEAN -EFIAPI -X509VerifyCert ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - IN CONST UINT8 *CACert, - IN UINTN CACertSize - ) -{ - BOOLEAN Status; - X509 *X509Cert; - X509 *X509CACert; - X509_STORE *CertStore; - X509_STORE_CTX *CertCtx; - - // - // Check input parameters. - // - if (Cert == NULL || CACert == NULL) { - return FALSE; - } - - Status = FALSE; - X509Cert = NULL; - X509CACert = NULL; - CertStore = NULL; - CertCtx = NULL; - - // - // Register & Initialize necessary digest algorithms for certificate verification. - // - if (EVP_add_digest (EVP_md5 ()) == 0) { - goto _Exit; - } - if (EVP_add_digest (EVP_sha1 ()) == 0) { - goto _Exit; - } - if (EVP_add_digest (EVP_sha256 ()) == 0) { - goto _Exit; - } - - // - // Read DER-encoded certificate to be verified and Construct X509 object. - // - Status = X509ConstructCertificate (Cert, CertSize, (UINT8 **) &X509Cert); - if ((X509Cert == NULL) || (!Status)) { - Status = FALSE; - goto _Exit; - } - - // - // Read DER-encoded root certificate and Construct X509 object. - // - Status = X509ConstructCertificate (CACert, CACertSize, (UINT8 **) &X509CACert); - if ((X509CACert == NULL) || (!Status)) { - Status = FALSE; - goto _Exit; - } - - Status = FALSE; - - // - // Set up X509 Store for trusted certificate. - // - CertStore = X509_STORE_new (); - if (CertStore == NULL) { - goto _Exit; - } - if (!(X509_STORE_add_cert (CertStore, X509CACert))) { - goto _Exit; - } - - // - // Allow partial certificate chains, terminated by a non-self-signed but - // still trusted intermediate certificate. Also disable time checks. - // - X509_STORE_set_flags (CertStore, - X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME); - - // - // Set up X509_STORE_CTX for the subsequent verification operation. - // - CertCtx = X509_STORE_CTX_new (); - if (CertCtx == NULL) { - goto _Exit; - } - if (!X509_STORE_CTX_init (CertCtx, CertStore, X509Cert, NULL)) { - goto _Exit; - } - - // - // X509 Certificate Verification. - // - Status = (BOOLEAN) X509_verify_cert (CertCtx); - X509_STORE_CTX_cleanup (CertCtx); - -_Exit: - // - // Release Resources. - // - if (X509Cert != NULL) { - X509_free (X509Cert); - } - - if (X509CACert != NULL) { - X509_free (X509CACert); - } - - if (CertStore != NULL) { - X509_STORE_free (CertStore); - } - - X509_STORE_CTX_free (CertCtx); - - return Status; -} - -/** - Retrieve the TBSCertificate from one given X.509 certificate. - - @param[in] Cert Pointer to the given DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] TBSCert DER-Encoded To-Be-Signed certificate. - @param[out] TBSCertSize Size of the TBS certificate in bytes. - - If Cert is NULL, then return FALSE. - If TBSCert is NULL, then return FALSE. - If TBSCertSize is NULL, then return FALSE. - - @retval TRUE The TBSCertificate was retrieved successfully. - @retval FALSE Invalid X.509 certificate. - -**/ -BOOLEAN -EFIAPI -X509GetTBSCert ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 **TBSCert, - OUT UINTN *TBSCertSize - ) -{ - CONST UINT8 *Temp; - UINT32 Asn1Tag; - UINT32 ObjClass; - UINTN Length; - - // - // Check input parameters. - // - if ((Cert == NULL) || (TBSCert == NULL) || - (TBSCertSize == NULL) || (CertSize > INT_MAX)) { - return FALSE; - } - - // - // An X.509 Certificate is: (defined in RFC3280) - // Certificate ::= SEQUENCE { - // tbsCertificate TBSCertificate, - // signatureAlgorithm AlgorithmIdentifier, - // signature BIT STRING } - // - // and - // - // TBSCertificate ::= SEQUENCE { - // version [0] Version DEFAULT v1, - // ... - // } - // - // So we can just ASN1-parse the x.509 DER-encoded data. If we strip - // the first SEQUENCE, the second SEQUENCE is the TBSCertificate. - // - Temp = Cert; - Length = 0; - ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjClass, (long)CertSize); - - if (Asn1Tag != V_ASN1_SEQUENCE) { - return FALSE; - } - - *TBSCert = (UINT8 *)Temp; - - ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjClass, (long)Length); - // - // Verify the parsed TBSCertificate is one correct SEQUENCE data. - // - if (Asn1Tag != V_ASN1_SEQUENCE) { - return FALSE; - } - - *TBSCertSize = Length + (Temp - *TBSCert); - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c deleted file mode 100644 index 86b56eb..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c +++ /dev/null @@ -1,238 +0,0 @@ -/** @file - X.509 Certificate Handler Wrapper Implementation which does not provide - real capabilities. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - -/** - Construct a X509 object from DER-encoded certificate data. - - Return FALSE to indicate this interface is not supported. - - @param[in] Cert Pointer to the DER-encoded certificate data. - @param[in] CertSize The size of certificate data in bytes. - @param[out] SingleX509Cert The generated X509 object. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -X509ConstructCertificate ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 **SingleX509Cert - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Construct a X509 stack object from a list of DER-encoded certificate data. - - Return FALSE to indicate this interface is not supported. - - @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. - On output, pointer to the X509 stack object with new - inserted X509 certificate. - @param ... A list of DER-encoded single certificate data followed - by certificate size. A NULL terminates the list. The - pairs are the arguments to X509ConstructCertificate(). - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -X509ConstructCertificateStack ( - IN OUT UINT8 **X509Stack, - ... - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Release the specified X509 object. - - If the interface is not supported, then ASSERT(). - - @param[in] X509Cert Pointer to the X509 object to be released. - -**/ -VOID -EFIAPI -X509Free ( - IN VOID *X509Cert - ) -{ - ASSERT (FALSE); -} - -/** - Release the specified X509 stack object. - - If the interface is not supported, then ASSERT(). - - @param[in] X509Stack Pointer to the X509 stack object to be released. - -**/ -VOID -EFIAPI -X509StackFree ( - IN VOID *X509Stack - ) -{ - ASSERT (FALSE); -} - -/** - Retrieve the subject bytes from one X.509 certificate. - - Return FALSE to indicate this interface is not supported. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] CertSubject Pointer to the retrieved certificate subject bytes. - @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input, - and the size of buffer returned CertSubject on output. - - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -X509GetSubjectName ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 *CertSubject, - IN OUT UINTN *SubjectSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Retrieve the common name (CN) string from one X.509 certificate. - - Return RETURN_UNSUPPORTED to indicate this interface is not supported. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] CommonName Buffer to contain the retrieved certificate common - name string (UTF8). At most CommonNameSize bytes will be - written and the string will be null terminated. May be - NULL in order to determine the size buffer needed. - @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input, - and the size of buffer returned CommonName on output. - If CommonName is NULL then the amount of space needed - in buffer (including the final null) is returned. - - @retval RETURN_UNSUPPORTED The operation is not supported. - -**/ -RETURN_STATUS -EFIAPI -X509GetCommonName ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT CHAR8 *CommonName, OPTIONAL - IN OUT UINTN *CommonNameSize - ) -{ - ASSERT (FALSE); - return RETURN_UNSUPPORTED; -} - -/** - Retrieve the RSA Public Key from one DER-encoded X509 certificate. - - Return FALSE to indicate this interface is not supported. - - @param[in] Cert Pointer to the DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved - RSA public key component. Use RsaFree() function to free the - resource. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RsaGetPublicKeyFromX509 ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT VOID **RsaContext - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Verify one X509 certificate was issued by the trusted CA. - - Return FALSE to indicate this interface is not supported. - - @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[in] CACert Pointer to the DER-encoded trusted CA certificate. - @param[in] CACertSize Size of the CA Certificate in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -X509VerifyCert ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - IN CONST UINT8 *CACert, - IN UINTN CACertSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Retrieve the TBSCertificate from one given X.509 certificate. - - Return FALSE to indicate this interface is not supported. - - @param[in] Cert Pointer to the given DER-encoded X509 certificate. - @param[in] CertSize Size of the X509 certificate in bytes. - @param[out] TBSCert DER-Encoded To-Be-Signed certificate. - @param[out] TBSCertSize Size of the TBS certificate in bytes. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -X509GetTBSCert ( - IN CONST UINT8 *Cert, - IN UINTN CertSize, - OUT UINT8 **TBSCert, - OUT UINTN *TBSCertSize - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c deleted file mode 100644 index e1ee0d0..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c +++ /dev/null @@ -1,110 +0,0 @@ -/** @file - Pseudorandom Number Generator Wrapper Implementation over OpenSSL. - -Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include - -// -// Default seed for UEFI Crypto Library -// -CONST UINT8 DefaultSeed[] = "UEFI Crypto Library default seed"; - -/** - Sets up the seed value for the pseudorandom number generator. - - This function sets up the seed value for the pseudorandom number generator. - If Seed is not NULL, then the seed passed in is used. - If Seed is NULL, then default seed is used. - - @param[in] Seed Pointer to seed value. - If NULL, default seed is used. - @param[in] SeedSize Size of seed value. - If Seed is NULL, this parameter is ignored. - - @retval TRUE Pseudorandom number generator has enough entropy for random generation. - @retval FALSE Pseudorandom number generator does not have enough entropy for random generation. - -**/ -BOOLEAN -EFIAPI -RandomSeed ( - IN CONST UINT8 *Seed OPTIONAL, - IN UINTN SeedSize - ) -{ - if (SeedSize > INT_MAX) { - return FALSE; - } - - // - // The software PRNG implementation built in OpenSSL depends on message digest algorithm. - // Make sure SHA-1 digest algorithm is available here. - // - if (EVP_add_digest (EVP_sha1 ()) == 0) { - return FALSE; - } - - // - // Seed the pseudorandom number generator with user-supplied value. - // NOTE: A cryptographic PRNG must be seeded with unpredictable data. - // - if (Seed != NULL) { - RAND_seed (Seed, (UINT32) SeedSize); - } else { - RAND_seed (DefaultSeed, sizeof (DefaultSeed)); - } - - if (RAND_status () == 1) { - return TRUE; - } - - return FALSE; -} - -/** - Generates a pseudorandom byte stream of the specified size. - - If Output is NULL, then return FALSE. - - @param[out] Output Pointer to buffer to receive random value. - @param[in] Size Size of random bytes to generate. - - @retval TRUE Pseudorandom byte stream generated successfully. - @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy. - -**/ -BOOLEAN -EFIAPI -RandomBytes ( - OUT UINT8 *Output, - IN UINTN Size - ) -{ - // - // Check input parameters. - // - if (Output == NULL || Size > INT_MAX) { - return FALSE; - } - - // - // Generate random data. - // - if (RAND_bytes (Output, (UINT32) Size) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c deleted file mode 100644 index 01227dc..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c +++ /dev/null @@ -1,118 +0,0 @@ -/** @file - Pseudorandom Number Generator Wrapper Implementation over OpenSSL. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include -#include - -/** - Sets up the seed value for the pseudorandom number generator. - - This function sets up the seed value for the pseudorandom number generator. - If Seed is not NULL, then the seed passed in is used. - If Seed is NULL, then default seed is used. - - @param[in] Seed Pointer to seed value. - If NULL, default seed is used. - @param[in] SeedSize Size of seed value. - If Seed is NULL, this parameter is ignored. - - @retval TRUE Pseudorandom number generator has enough entropy for random generation. - @retval FALSE Pseudorandom number generator does not have enough entropy for random generation. - -**/ -BOOLEAN -EFIAPI -RandomSeed ( - IN CONST UINT8 *Seed OPTIONAL, - IN UINTN SeedSize - ) -{ - CHAR8 DefaultSeed[128]; - - if (SeedSize > INT_MAX) { - return FALSE; - } - - // - // The software PRNG implementation built in OpenSSL depends on message digest algorithm. - // Make sure SHA-1 digest algorithm is available here. - // - if (EVP_add_digest (EVP_sha1 ()) == 0) { - return FALSE; - } - - // - // Seed the pseudorandom number generator with user-supplied value. - // NOTE: A cryptographic PRNG must be seeded with unpredictable data. - // - if (Seed != NULL) { - RAND_seed (Seed, (UINT32) SeedSize); - } else { - // - // Retrieve current time. - // - AsciiSPrint ( - DefaultSeed, - sizeof (DefaultSeed), - "UEFI Crypto Library default seed (%ld)", - AsmReadItc () - ); - - RAND_seed (DefaultSeed, sizeof (DefaultSeed)); - } - - if (RAND_status () == 1) { - return TRUE; - } - - return FALSE; -} - -/** - Generates a pseudorandom byte stream of the specified size. - - If Output is NULL, then return FALSE. - - @param[out] Output Pointer to buffer to receive random value. - @param[in] Size Size of random bytes to generate. - - @retval TRUE Pseudorandom byte stream generated successfully. - @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy. - -**/ -BOOLEAN -EFIAPI -RandomBytes ( - OUT UINT8 *Output, - IN UINTN Size - ) -{ - // - // Check input parameters. - // - if (Output == NULL || Size > INT_MAX) { - return FALSE; - } - - // - // Generate random data. - // - if (RAND_bytes (Output, (UINT32) Size) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandNull.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandNull.c deleted file mode 100644 index ef9c5bd..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandNull.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - Pseudorandom Number Generator Wrapper Implementation which does not provide - real capabilities. - -Copyright (c) 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" - - -/** - Sets up the seed value for the pseudorandom number generator. - - Return FALSE to indicate this interface is not supported. - - @param[in] Seed Pointer to seed value. - If NULL, default seed is used. - @param[in] SeedSize Size of seed value. - If Seed is NULL, this parameter is ignored. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RandomSeed ( - IN CONST UINT8 *Seed OPTIONAL, - IN UINTN SeedSize - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Generates a pseudorandom byte stream of the specified size. - - Return FALSE to indicate this interface is not supported. - - @param[out] Output Pointer to buffer to receive random value. - @param[in] Size Size of random bytes to generate. - - @retval FALSE This interface is not supported. - -**/ -BOOLEAN -EFIAPI -RandomBytes ( - OUT UINT8 *Output, - IN UINTN Size - ) -{ - ASSERT (FALSE); - return FALSE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c deleted file mode 100644 index 349d0a2..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c +++ /dev/null @@ -1,118 +0,0 @@ -/** @file - Pseudorandom Number Generator Wrapper Implementation over OpenSSL. - -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalCryptLib.h" -#include -#include -#include - -/** - Sets up the seed value for the pseudorandom number generator. - - This function sets up the seed value for the pseudorandom number generator. - If Seed is not NULL, then the seed passed in is used. - If Seed is NULL, then default seed is used. - - @param[in] Seed Pointer to seed value. - If NULL, default seed is used. - @param[in] SeedSize Size of seed value. - If Seed is NULL, this parameter is ignored. - - @retval TRUE Pseudorandom number generator has enough entropy for random generation. - @retval FALSE Pseudorandom number generator does not have enough entropy for random generation. - -**/ -BOOLEAN -EFIAPI -RandomSeed ( - IN CONST UINT8 *Seed OPTIONAL, - IN UINTN SeedSize - ) -{ - CHAR8 DefaultSeed[128]; - - if (SeedSize > INT_MAX) { - return FALSE; - } - - // - // The software PRNG implementation built in OpenSSL depends on message digest algorithm. - // Make sure SHA-1 digest algorithm is available here. - // - if (EVP_add_digest (EVP_sha1 ()) == 0) { - return FALSE; - } - - // - // Seed the pseudorandom number generator with user-supplied value. - // NOTE: A cryptographic PRNG must be seeded with unpredictable data. - // - if (Seed != NULL) { - RAND_seed (Seed, (UINT32) SeedSize); - } else { - // - // Retrieve current time. - // - AsciiSPrint ( - DefaultSeed, - sizeof (DefaultSeed), - "UEFI Crypto Library default seed (%ld)", - AsmReadTsc () - ); - - RAND_seed (DefaultSeed, sizeof (DefaultSeed)); - } - - if (RAND_status () == 1) { - return TRUE; - } - - return FALSE; -} - -/** - Generates a pseudorandom byte stream of the specified size. - - If Output is NULL, then return FALSE. - - @param[out] Output Pointer to buffer to receive random value. - @param[in] Size Size of random bytes to generate. - - @retval TRUE Pseudorandom byte stream generated successfully. - @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy. - -**/ -BOOLEAN -EFIAPI -RandomBytes ( - OUT UINT8 *Output, - IN UINTN Size - ) -{ - // - // Check input parameters. - // - if (Output == NULL || Size > INT_MAX) { - return FALSE; - } - - // - // Generate random data. - // - if (RAND_bytes (Output, (UINT32) Size) != 1) { - return FALSE; - } - - return TRUE; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf deleted file mode 100644 index 71ba8bf..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +++ /dev/null @@ -1,107 +0,0 @@ -## @file -# Cryptographic Library Instance for DXE_RUNTIME_DRIVER. -# -# Caution: This module requires additional review when modified. -# This library will have external input - signature. -# This external input must be validated carefully to avoid security issues such as -# buffer overflow or integer overflow. -# -# Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions, -# HMAC-MD5 functions, HMAC-SHA1/SHA256 functions, AES/TDES/ARC4 functions, RSA external -# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and -# authenticode signature verification functions are not supported in this instance. -# -# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = RuntimeCryptLib - MODULE_UNI_FILE = RuntimeCryptLib.uni - FILE_GUID = 78189cc0-727d-46a4-84ea-f7dd860de64a - MODULE_TYPE = DXE_RUNTIME_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseCryptLib|DXE_RUNTIME_DRIVER - CONSTRUCTOR = RuntimeCryptLibConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - Hash/CryptMd4Null.c - Hash/CryptMd5.c - Hash/CryptSha1.c - Hash/CryptSha256.c - Hash/CryptSha512Null.c - Hmac/CryptHmacMd5Null.c - Hmac/CryptHmacSha1Null.c - Hmac/CryptHmacSha256Null.c - Cipher/CryptAesNull.c - Cipher/CryptTdesNull.c - Cipher/CryptArc4Null.c - Pk/CryptRsaBasic.c - Pk/CryptRsaExtNull.c - Pk/CryptPkcs5Pbkdf2Null.c - Pk/CryptPkcs7SignNull.c - Pk/CryptPkcs7VerifyCommon.c - Pk/CryptPkcs7VerifyRuntime.c - Pk/CryptDhNull.c - Pk/CryptX509.c - Pk/CryptAuthenticodeNull.c - Pk/CryptTsNull.c - Pem/CryptPem.c - - SysCall/CrtWrapper.c - SysCall/TimerWrapper.c - SysCall/RuntimeMemAllocation.c - -[Sources.Ia32] - Rand/CryptRandTsc.c - -[Sources.X64] - Rand/CryptRandTsc.c - -[Sources.ARM] - Rand/CryptRand.c - -[Sources.AARCH64] - Rand/CryptRand.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - DebugLib - OpensslLib - IntrinsicLib - PrintLib - -# -# Remove these [BuildOptions] after this library is cleaned up -# -[BuildOptions] - # - # suppress the following warnings so we do not break the build with warnings-as-errors: - # C4090: 'function' : different 'const' qualifiers - # - MSFT:*_*_*_CC_FLAGS = /wd4090 - - # -JCryptoPkg/Include : To disable the use of the system includes provided by RVCT - # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends without a newline" - RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1 diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.uni deleted file mode 100644 index 601ed80..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.uni +++ /dev/null @@ -1,30 +0,0 @@ -// /** @file -// Cryptographic Library Instance for DXE_RUNTIME_DRIVER. -// -// Caution: This module requires additional review when modified. -// This library will have external input - signature. -// This external input must be validated carefully to avoid security issues such as -// buffer overflow or integer overflow. -// -// Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ -// TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, -// Diffie-Hellman functions, and authenticode signature verification functions are -// not supported in this instance. -// -// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for DXE_RUNTIME_DRIVER" - -#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow. Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and authenticode signature verification functions are not supported in this instance." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf deleted file mode 100644 index c1b39f9..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf +++ /dev/null @@ -1,104 +0,0 @@ -## @file -# Cryptographic Library Instance for SMM driver. -# -# Caution: This module requires additional review when modified. -# This library will have external input - signature. -# This external input must be validated carefully to avoid security issues such as -# buffer overflow or integer overflow. -# -# Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions, -# HMAC-MD5 functions, HMAC-SHA1 functions, TDES/ARC4 functions, RSA external -# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and -# authenticode signature verification functions are not supported in this instance. -# -# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmCryptLib - MODULE_UNI_FILE = SmmCryptLib.uni - FILE_GUID = 028080a3-8958-4a62-a1a8-0fa1da162007 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x0001000A - LIBRARY_CLASS = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE MM_STANDALONE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - Hash/CryptMd4Null.c - Hash/CryptMd5.c - Hash/CryptSha1.c - Hash/CryptSha256.c - Hash/CryptSha512Null.c - Hmac/CryptHmacMd5Null.c - Hmac/CryptHmacSha1Null.c - Hmac/CryptHmacSha256.c - Cipher/CryptAes.c - Cipher/CryptTdesNull.c - Cipher/CryptArc4Null.c - Pk/CryptRsaBasic.c - Pk/CryptRsaExtNull.c - Pk/CryptPkcs5Pbkdf2.c - Pk/CryptPkcs7SignNull.c - Pk/CryptPkcs7VerifyCommon.c - Pk/CryptPkcs7VerifyBase.c - Pk/CryptDhNull.c - Pk/CryptX509.c - Pk/CryptAuthenticodeNull.c - Pk/CryptTsNull.c - Pem/CryptPem.c - - SysCall/CrtWrapper.c - SysCall/ConstantTimeClock.c - SysCall/BaseMemAllocation.c - -[Sources.Ia32] - Rand/CryptRandTsc.c - -[Sources.X64] - Rand/CryptRandTsc.c - -[Sources.ARM] - Rand/CryptRand.c - -[Sources.AARCH64] - Rand/CryptRand.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - BaseLib - IoLib - BaseMemoryLib - MemoryAllocationLib - OpensslLib - IntrinsicLib - PrintLib - -# -# Remove these [BuildOptions] after this library is cleaned up -# -[BuildOptions] - # - # suppress the following warnings so we do not break the build with warnings-as-errors: - # C4090: 'function' : different 'const' qualifiers - # - MSFT:*_*_*_CC_FLAGS = /wd4090 - - XCODE:*_*_*_CC_FLAGS = -mmmx -msse diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.uni deleted file mode 100644 index 261d0fe..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.uni +++ /dev/null @@ -1,30 +0,0 @@ -// /** @file -// Cryptographic Library Instance for SMM driver. -// -// Caution: This module requires additional review when modified. -// This library will have external input - signature. -// This external input must be validated carefully to avoid security issues such as -// buffer overflow or integer overflow. -// -// Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ -// TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, -// Diffie-Hellman functions, and authenticode signature verification functions are -// not supported in this instance. -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for SMM driver" - -#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow. Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and authenticode signature verification functions are not supported in this instance." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c deleted file mode 100644 index e0c32ca..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c +++ /dev/null @@ -1,118 +0,0 @@ -/** @file - Base Memory Allocation Routines Wrapper for Crypto library over OpenSSL - during PEI & DXE phases. - -Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -// -// Extra header to record the memory buffer size from malloc routine. -// -#define CRYPTMEM_HEAD_SIGNATURE SIGNATURE_32('c','m','h','d') -typedef struct { - UINT32 Signature; - UINT32 Reserved; - UINTN Size; -} CRYPTMEM_HEAD; - -#define CRYPTMEM_OVERHEAD sizeof(CRYPTMEM_HEAD) - -// -// -- Memory-Allocation Routines -- -// - -/* Allocates memory blocks */ -void *malloc (size_t size) -{ - CRYPTMEM_HEAD *PoolHdr; - UINTN NewSize; - VOID *Data; - - // - // Adjust the size by the buffer header overhead - // - NewSize = (UINTN)(size) + CRYPTMEM_OVERHEAD; - - Data = AllocatePool (NewSize); - if (Data != NULL) { - PoolHdr = (CRYPTMEM_HEAD *)Data; - // - // Record the memory brief information - // - PoolHdr->Signature = CRYPTMEM_HEAD_SIGNATURE; - PoolHdr->Size = size; - - return (VOID *)(PoolHdr + 1); - } else { - // - // The buffer allocation failed. - // - return NULL; - } -} - -/* Reallocate memory blocks */ -void *realloc (void *ptr, size_t size) -{ - CRYPTMEM_HEAD *OldPoolHdr; - CRYPTMEM_HEAD *NewPoolHdr; - UINTN OldSize; - UINTN NewSize; - VOID *Data; - - NewSize = (UINTN)size + CRYPTMEM_OVERHEAD; - Data = AllocatePool (NewSize); - if (Data != NULL) { - NewPoolHdr = (CRYPTMEM_HEAD *)Data; - NewPoolHdr->Signature = CRYPTMEM_HEAD_SIGNATURE; - NewPoolHdr->Size = size; - if (ptr != NULL) { - // - // Retrieve the original size from the buffer header. - // - OldPoolHdr = (CRYPTMEM_HEAD *)ptr - 1; - ASSERT (OldPoolHdr->Signature == CRYPTMEM_HEAD_SIGNATURE); - OldSize = OldPoolHdr->Size; - - // - // Duplicate the buffer content. - // - CopyMem ((VOID *)(NewPoolHdr + 1), ptr, MIN (OldSize, size)); - FreePool ((VOID *)OldPoolHdr); - } - - return (VOID *)(NewPoolHdr + 1); - } else { - // - // The buffer allocation failed. - // - return NULL; - } -} - -/* De-allocates or frees a memory block */ -void free (void *ptr) -{ - CRYPTMEM_HEAD *PoolHdr; - - // - // In Standard C, free() handles a null pointer argument transparently. This - // is not true of FreePool() below, so protect it. - // - if (ptr != NULL) { - PoolHdr = (CRYPTMEM_HEAD *)ptr - 1; - ASSERT (PoolHdr->Signature == CRYPTMEM_HEAD_SIGNATURE); - FreePool (PoolHdr); - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c deleted file mode 100644 index 6904a19..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c +++ /dev/null @@ -1,43 +0,0 @@ -/** @file - C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation - for OpenSSL-based Cryptographic Library. - - This C file implements constant time value for time() and NULL for gmtime() - thus should not be used in library instances which require functionality - of following APIs which need system time support: - 1) RsaGenerateKey - 2) RsaCheckKey - 3) RsaPkcs1Sign - 4) Pkcs7Sign - 5) DhGenerateParameter - 6) DhGenerateKey - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -// -// -- Time Management Routines -- -// - -time_t time (time_t *timer) -{ - if (timer != NULL) { - *timer = 0; - } - return 0; -} - -struct tm * gmtime (const time_t *timer) -{ - return NULL; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c deleted file mode 100644 index c98a36e..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ /dev/null @@ -1,474 +0,0 @@ -/** @file - C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based - Cryptographic Library. - -Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -int errno = 0; - -FILE *stderr = NULL; -FILE *stdin = NULL; -FILE *stdout = NULL; - -typedef -int -(*SORT_COMPARE)( - IN VOID *Buffer1, - IN VOID *Buffer2 - ); - -// -// Duplicated from EDKII BaseSortLib for qsort() wrapper -// -STATIC -VOID -QuickSortWorker ( - IN OUT VOID *BufferToSort, - IN CONST UINTN Count, - IN CONST UINTN ElementSize, - IN SORT_COMPARE CompareFunction, - IN VOID *Buffer - ) -{ - VOID *Pivot; - UINTN LoopCount; - UINTN NextSwapLocation; - - ASSERT(BufferToSort != NULL); - ASSERT(CompareFunction != NULL); - ASSERT(Buffer != NULL); - - if (Count < 2 || ElementSize < 1) { - return; - } - - NextSwapLocation = 0; - - // - // Pick a pivot (we choose last element) - // - Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize)); - - // - // Now get the pivot such that all on "left" are below it - // and everything "right" are above it - // - for (LoopCount = 0; LoopCount < Count - 1; LoopCount++) - { - // - // If the element is less than the pivot - // - if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) { - // - // Swap - // - CopyMem (Buffer, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize); - CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize); - CopyMem ((UINT8 *)BufferToSort + ((LoopCount) * ElementSize), Buffer, ElementSize); - - // - // Increment NextSwapLocation - // - NextSwapLocation++; - } - } - // - // Swap pivot to its final position (NextSwapLocation) - // - CopyMem (Buffer, Pivot, ElementSize); - CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize); - CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), Buffer, ElementSize); - - // - // Now recurse on 2 partial lists. Neither of these will have the 'pivot' element. - // IE list is sorted left half, pivot element, sorted right half... - // - QuickSortWorker ( - BufferToSort, - NextSwapLocation, - ElementSize, - CompareFunction, - Buffer - ); - - QuickSortWorker ( - (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize, - Count - NextSwapLocation - 1, - ElementSize, - CompareFunction, - Buffer - ); - - return; -} - -//--------------------------------------------------------- -// Standard C Run-time Library Interface Wrapper -//--------------------------------------------------------- - -// -// -- String Manipulation Routines -- -// - -/* Scan a string for the last occurrence of a character */ -char *strrchr (const char *str, int c) -{ - char * save; - - for (save = NULL; ; ++str) { - if (*str == c) { - save = (char *)str; - } - if (*str == 0) { - return (save); - } - } -} - -/* Compare first n bytes of string s1 with string s2, ignoring case */ -int strncasecmp (const char *s1, const char *s2, size_t n) -{ - int Val; - - ASSERT(s1 != NULL); - ASSERT(s2 != NULL); - - if (n != 0) { - do { - Val = tolower(*s1) - tolower(*s2); - if (Val != 0) { - return Val; - } - ++s1; - ++s2; - if (*s1 == '\0') { - break; - } - } while (--n != 0); - } - return 0; -} - -/* Read formatted data from a string */ -int sscanf (const char *buffer, const char *format, ...) -{ - // - // Null sscanf() function implementation to satisfy the linker, since - // no direct functionality logic dependency in present UEFI cases. - // - return 0; -} - -/* Maps errnum to an error-message string */ -char * strerror (int errnum) -{ - return NULL; -} - -/* Computes the length of the maximum initial segment of the string pointed to by s1 - which consists entirely of characters from the string pointed to by s2. */ -size_t strspn (const char *s1 , const char *s2) -{ - UINT8 Map[32]; - UINT32 Index; - size_t Count; - - for (Index = 0; Index < 32; Index++) { - Map[Index] = 0; - } - - while (*s2) { - Map[*s2 >> 3] |= (1 << (*s2 & 7)); - s2++; - } - - if (*s1) { - Count = 0; - while (Map[*s1 >> 3] & (1 << (*s1 & 7))) { - Count++; - s1++; - } - - return Count; - } - - return 0; -} - -/* Computes the length of the maximum initial segment of the string pointed to by s1 - which consists entirely of characters not from the string pointed to by s2. */ -size_t strcspn (const char *s1, const char *s2) -{ - UINT8 Map[32]; - UINT32 Index; - size_t Count; - - for (Index = 0; Index < 32; Index++) { - Map[Index] = 0; - } - - while (*s2) { - Map[*s2 >> 3] |= (1 << (*s2 & 7)); - s2++; - } - - Map[0] |= 1; - - Count = 0; - while (!(Map[*s1 >> 3] & (1 << (*s1 & 7)))) { - Count ++; - s1++; - } - - return Count; -} - -// -// -- Character Classification Routines -- -// - -/* Determines if a particular character is a decimal-digit character */ -int isdigit (int c) -{ - // - // ::= [0-9] - // - return (('0' <= (c)) && ((c) <= '9')); -} - -/* Determine if an integer represents character that is a hex digit */ -int isxdigit (int c) -{ - // - // ::= [0-9] | [a-f] | [A-F] - // - return ((('0' <= (c)) && ((c) <= '9')) || - (('a' <= (c)) && ((c) <= 'f')) || - (('A' <= (c)) && ((c) <= 'F'))); -} - -/* Determines if a particular character represents a space character */ -int isspace (int c) -{ - // - // ::= [ ] - // - return ((c) == ' '); -} - -/* Determine if a particular character is an alphanumeric character */ -int isalnum (int c) -{ - // - // ::= [0-9] | [a-z] | [A-Z] - // - return ((('0' <= (c)) && ((c) <= '9')) || - (('a' <= (c)) && ((c) <= 'z')) || - (('A' <= (c)) && ((c) <= 'Z'))); -} - -/* Determines if a particular character is in upper case */ -int isupper (int c) -{ - // - // := [A-Z] - // - return (('A' <= (c)) && ((c) <= 'Z')); -} - -// -// -- Data Conversion Routines -- -// - -/* Convert strings to a long-integer value */ -long strtol (const char *nptr, char **endptr, int base) -{ - // - // Null strtol() function implementation to satisfy the linker, since there is - // no direct functionality logic dependency in present UEFI cases. - // - return 0; -} - -/* Convert strings to an unsigned long-integer value */ -unsigned long strtoul (const char *nptr, char **endptr, int base) -{ - // - // Null strtoul() function implementation to satisfy the linker, since there is - // no direct functionality logic dependency in present UEFI cases. - // - return 0; -} - -/* Convert character to lowercase */ -int tolower (int c) -{ - if (('A' <= (c)) && ((c) <= 'Z')) { - return (c - ('A' - 'a')); - } - return (c); -} - -// -// -- Searching and Sorting Routines -- -// - -/* Performs a quick sort */ -void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, const void *)) -{ - VOID *Buffer; - - ASSERT (base != NULL); - ASSERT (compare != NULL); - - // - // Use CRT-style malloc to cover BS and RT memory allocation. - // - Buffer = malloc (width); - ASSERT (Buffer != NULL); - - // - // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib. - // - QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer); - - free (Buffer); - return; -} - -// -// -- Process and Environment Control Routines -- -// - -/* Get a value from the current environment */ -char *getenv (const char *varname) -{ - // - // Null getenv() function implementation to satisfy the linker, since there is - // no direct functionality logic dependency in present UEFI cases. - // - return NULL; -} - -/* Get a value from the current environment */ -char *secure_getenv (const char *varname) -{ - // - // Null secure_getenv() function implementation to satisfy the linker, since - // there is no direct functionality logic dependency in present UEFI cases. - // - // From the secure_getenv() manual: 'just like getenv() except that it - // returns NULL in cases where "secure execution" is required'. - // - return NULL; -} - -// -// -- Stream I/O Routines -- -// - -/* Write data to a stream */ -size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream) -{ - return 0; -} - -// -// -- Dummy OpenSSL Support Routines -- -// - -int BIO_printf (void *bio, const char *format, ...) -{ - return 0; -} - -int BIO_snprintf(char *buf, size_t n, const char *format, ...) -{ - return 0; -} - -#ifdef __GNUC__ - -typedef -VOID -(EFIAPI *NoReturnFuncPtr)( - VOID - ) __attribute__((__noreturn__)); - -STATIC -VOID -EFIAPI -NopFunction ( - VOID - ) -{ -} - -void abort (void) -{ - NoReturnFuncPtr NoReturnFunc; - - NoReturnFunc = (NoReturnFuncPtr) NopFunction; - - NoReturnFunc (); -} - -#else - -void abort (void) -{ - // Do nothing -} - -#endif - -int fclose (FILE *f) -{ - return 0; -} - -FILE *fopen (const char *c, const char *m) -{ - return NULL; -} - -size_t fread (void *b, size_t c, size_t i, FILE *f) -{ - return 0; -} - -uid_t getuid (void) -{ - return 0; -} - -uid_t geteuid (void) -{ - return 0; -} - -gid_t getgid (void) -{ - return 0; -} - -gid_t getegid (void) -{ - return 0; -} - -int printf (char const *fmt, ...) -{ - return 0; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c deleted file mode 100644 index b0142c2..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c +++ /dev/null @@ -1,461 +0,0 @@ -/** @file - Light-weight Memory Management Routines for OpenSSL-based Crypto - Library at Runtime Phase. - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include - -//---------------------------------------------------------------- -// Initial version. Needs further optimizations. -//---------------------------------------------------------------- - -// -// Definitions for Runtime Memory Operations -// -#define RT_PAGE_SIZE 0x200 -#define RT_PAGE_MASK 0x1FF -#define RT_PAGE_SHIFT 9 - -#define RT_SIZE_TO_PAGES(a) (((a) >> RT_PAGE_SHIFT) + (((a) & RT_PAGE_MASK) ? 1 : 0)) -#define RT_PAGES_TO_SIZE(a) ((a) << RT_PAGE_SHIFT) - -// -// Page Flag Definitions -// -#define RT_PAGE_FREE 0x00000000 -#define RT_PAGE_USED 0x00000001 - -#define MIN_REQUIRED_BLOCKS 600 - -// -// Memory Page Table -// -typedef struct { - UINTN StartPageOffset; // Offset of the starting page allocated. - // Only available for USED pages. - UINT32 PageFlag; // Page Attributes. -} RT_MEMORY_PAGE_ENTRY; - -typedef struct { - UINTN PageCount; - UINTN LastEmptyPageOffset; - UINT8 *DataAreaBase; // Pointer to data Area. - RT_MEMORY_PAGE_ENTRY Pages[1]; // Page Table Entries. -} RT_MEMORY_PAGE_TABLE; - -// -// Global Page Table for Runtime Cryptographic Provider. -// -RT_MEMORY_PAGE_TABLE *mRTPageTable = NULL; - -// -// Event for Runtime Address Conversion. -// -STATIC EFI_EVENT mVirtualAddressChangeEvent; - - -/** - Initializes pre-allocated memory pointed by ScratchBuffer for subsequent - runtime use. - - @param[in, out] ScratchBuffer Pointer to user-supplied memory buffer. - @param[in] ScratchBufferSize Size of supplied buffer in bytes. - - @retval EFI_SUCCESS Successful initialization. - -**/ -EFI_STATUS -InitializeScratchMemory ( - IN OUT UINT8 *ScratchBuffer, - IN UINTN ScratchBufferSize - ) -{ - UINTN Index; - UINTN MemorySize; - - // - // Parameters Checking - // - if (ScratchBuffer == NULL) { - return EFI_INVALID_PARAMETER; - } - - if (ScratchBufferSize < MIN_REQUIRED_BLOCKS * 1024) { - return EFI_BUFFER_TOO_SMALL; - } - - mRTPageTable = (RT_MEMORY_PAGE_TABLE *)ScratchBuffer; - - // - // Initialize Internal Page Table for Memory Management - // - SetMem (mRTPageTable, ScratchBufferSize, 0xFF); - MemorySize = ScratchBufferSize - sizeof (RT_MEMORY_PAGE_TABLE) + sizeof (RT_MEMORY_PAGE_ENTRY); - - mRTPageTable->PageCount = MemorySize / (RT_PAGE_SIZE + sizeof (RT_MEMORY_PAGE_ENTRY)); - mRTPageTable->LastEmptyPageOffset = 0x0; - - for (Index = 0; Index < mRTPageTable->PageCount; Index++) { - mRTPageTable->Pages[Index].PageFlag = RT_PAGE_FREE; - mRTPageTable->Pages[Index].StartPageOffset = 0; - } - - mRTPageTable->DataAreaBase = ScratchBuffer + sizeof (RT_MEMORY_PAGE_TABLE) + - (mRTPageTable->PageCount - 1) * sizeof (RT_MEMORY_PAGE_ENTRY); - - return EFI_SUCCESS; -} - - -/** - Look-up Free memory Region for object allocation. - - @param[in] AllocationSize Bytes to be allocated. - - @return Return available page offset for object allocation. - -**/ -UINTN -LookupFreeMemRegion ( - IN UINTN AllocationSize - ) -{ - UINTN StartPageIndex; - UINTN Index; - UINTN SubIndex; - UINTN ReqPages; - - StartPageIndex = RT_SIZE_TO_PAGES (mRTPageTable->LastEmptyPageOffset); - ReqPages = RT_SIZE_TO_PAGES (AllocationSize); - if (ReqPages > mRTPageTable->PageCount) { - // - // No enough region for object allocation. - // - return (UINTN)(-1); - } - - // - // Look up the free memory region with in current memory map table. - // - for (Index = StartPageIndex; Index <= (mRTPageTable->PageCount - ReqPages); ) { - // - // Check consecutive ReqPages pages. - // - for (SubIndex = 0; SubIndex < ReqPages; SubIndex++) { - if ((mRTPageTable->Pages[SubIndex + Index].PageFlag & RT_PAGE_USED) != 0) { - break; - } - } - - if (SubIndex == ReqPages) { - // - // Succeed! Return the Starting Offset. - // - return RT_PAGES_TO_SIZE (Index); - } - - // - // Failed! Skip current free memory pages and adjacent Used pages - // - while ((mRTPageTable->Pages[SubIndex + Index].PageFlag & RT_PAGE_USED) != 0) { - SubIndex++; - } - - Index += SubIndex; - } - - // - // Look up the free memory region from the beginning of the memory table - // until the StartCursorOffset - // - if (ReqPages > StartPageIndex) { - // - // No enough region for object allocation. - // - return (UINTN)(-1); - } - for (Index = 0; Index < (StartPageIndex - ReqPages); ) { - // - // Check Consecutive ReqPages Pages. - // - for (SubIndex = 0; SubIndex < ReqPages; SubIndex++) { - if ((mRTPageTable->Pages[SubIndex + Index].PageFlag & RT_PAGE_USED) != 0) { - break; - } - } - - if (SubIndex == ReqPages) { - // - // Succeed! Return the Starting Offset. - // - return RT_PAGES_TO_SIZE (Index); - } - - // - // Failed! Skip current adjacent Used pages - // - while ((SubIndex < (StartPageIndex - ReqPages)) && - ((mRTPageTable->Pages[SubIndex + Index].PageFlag & RT_PAGE_USED) != 0)) { - SubIndex++; - } - - Index += SubIndex; - } - - // - // No available region for object allocation! - // - return (UINTN)(-1); -} - - -/** - Allocates a buffer at runtime phase. - - @param[in] AllocationSize Bytes to be allocated. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -RuntimeAllocateMem ( - IN UINTN AllocationSize - ) -{ - UINT8 *AllocPtr; - UINTN ReqPages; - UINTN Index; - UINTN StartPage; - UINTN AllocOffset; - - AllocPtr = NULL; - ReqPages = 0; - - // - // Look for available consecutive memory region starting from LastEmptyPageOffset. - // If no proper memory region found, look up from the beginning. - // If still not found, return NULL to indicate failed allocation. - // - AllocOffset = LookupFreeMemRegion (AllocationSize); - if (AllocOffset == (UINTN)(-1)) { - return NULL; - } - - // - // Allocates consecutive memory pages with length of Size. Update the page - // table status. Returns the starting address. - // - ReqPages = RT_SIZE_TO_PAGES (AllocationSize); - AllocPtr = mRTPageTable->DataAreaBase + AllocOffset; - StartPage = RT_SIZE_TO_PAGES (AllocOffset); - Index = 0; - while (Index < ReqPages) { - mRTPageTable->Pages[StartPage + Index].PageFlag |= RT_PAGE_USED; - mRTPageTable->Pages[StartPage + Index].StartPageOffset = AllocOffset; - - Index++; - } - - mRTPageTable->LastEmptyPageOffset = AllocOffset + RT_PAGES_TO_SIZE (ReqPages); - - ZeroMem (AllocPtr, AllocationSize); - - // - // Returns a void pointer to the allocated space - // - return AllocPtr; -} - - -/** - Frees a buffer that was previously allocated at runtime phase. - - @param[in] Buffer Pointer to the buffer to free. - -**/ -VOID -RuntimeFreeMem ( - IN VOID *Buffer - ) -{ - UINTN StartOffset; - UINTN StartPageIndex; - - StartOffset = (UINTN)Buffer - (UINTN)mRTPageTable->DataAreaBase; - StartPageIndex = RT_SIZE_TO_PAGES (mRTPageTable->Pages[RT_SIZE_TO_PAGES(StartOffset)].StartPageOffset); - - while (StartPageIndex < mRTPageTable->PageCount) { - if (((mRTPageTable->Pages[StartPageIndex].PageFlag & RT_PAGE_USED) != 0) && - (mRTPageTable->Pages[StartPageIndex].StartPageOffset == StartOffset)) { - // - // Free this page - // - mRTPageTable->Pages[StartPageIndex].PageFlag &= ~RT_PAGE_USED; - mRTPageTable->Pages[StartPageIndex].PageFlag |= RT_PAGE_FREE; - mRTPageTable->Pages[StartPageIndex].StartPageOffset = 0; - - StartPageIndex++; - } else { - break; - } - } - - return; -} - - -/** - Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. - - This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE - event. It converts a pointer to a new virtual address. - - @param[in] Event The event whose notification function is being invoked. - @param[in] Context The pointer to the notification function's context. - -**/ -VOID -EFIAPI -RuntimeCryptLibAddressChangeEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Converts a pointer for runtime memory management to a new virtual address. - // - EfiConvertPointer (0x0, (VOID **) &mRTPageTable->DataAreaBase); - EfiConvertPointer (0x0, (VOID **) &mRTPageTable); -} - - -/** - Constructor routine for runtime crypt library instance. - - The constructor function pre-allocates space for runtime cryptographic operation. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The construction succeeded. - @retval EFI_OUT_OF_RESOURCE Failed to allocate memory. - -**/ -EFI_STATUS -EFIAPI -RuntimeCryptLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - // - // Pre-allocates runtime space for possible cryptographic operations - // - Buffer = AllocateRuntimePool (MIN_REQUIRED_BLOCKS * 1024); - Status = InitializeScratchMemory (Buffer, MIN_REQUIRED_BLOCKS * 1024); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Create address change event - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - RuntimeCryptLibAddressChangeEvent, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mVirtualAddressChangeEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - - -// -// -- Memory-Allocation Routines Wrapper for UEFI-OpenSSL Library -- -// - -/* Allocates memory blocks */ -void *malloc (size_t size) -{ - return RuntimeAllocateMem ((UINTN) size); -} - -/* Reallocate memory blocks */ -void *realloc (void *ptr, size_t size) -{ - VOID *NewPtr; - UINTN StartOffset; - UINTN StartPageIndex; - UINTN PageCount; - - if (ptr == NULL) { - return malloc (size); - } - - // - // Get Original Size of ptr - // - StartOffset = (UINTN)ptr - (UINTN)mRTPageTable->DataAreaBase; - StartPageIndex = RT_SIZE_TO_PAGES (mRTPageTable->Pages[RT_SIZE_TO_PAGES (StartOffset)].StartPageOffset); - PageCount = 0; - while (StartPageIndex < mRTPageTable->PageCount) { - if (((mRTPageTable->Pages[StartPageIndex].PageFlag & RT_PAGE_USED) != 0) && - (mRTPageTable->Pages[StartPageIndex].StartPageOffset == StartOffset)) { - StartPageIndex++; - PageCount++; - } else { - break; - } - } - - if (size <= RT_PAGES_TO_SIZE (PageCount)) { - // - // Return the original pointer, if Caller try to reduce region size; - // - return ptr; - } - - NewPtr = RuntimeAllocateMem ((UINTN) size); - if (NewPtr == NULL) { - return NULL; - } - - CopyMem (NewPtr, ptr, RT_PAGES_TO_SIZE (PageCount)); - - RuntimeFreeMem (ptr); - - return NewPtr; -} - -/* Deallocates or frees a memory block */ -void free (void *ptr) -{ - // - // In Standard C, free() handles a null pointer argument transparently. This - // is not true of RuntimeFreeMem() below, so protect it. - // - if (ptr != NULL) { - RuntimeFreeMem (ptr); - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c deleted file mode 100644 index dd544a3..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c +++ /dev/null @@ -1,174 +0,0 @@ -/** @file - C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation - for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME). - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -// -// -- Time Management Routines -- -// - -#define IsLeap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) -#define SECSPERMIN (60) -#define SECSPERHOUR (60 * 60) -#define SECSPERDAY (24 * SECSPERHOUR) - -// -// The arrays give the cumulative number of days up to the first of the -// month number used as the index (1 -> 12) for regular and leap years. -// The value at index 13 is for the whole year. -// -UINTN CumulativeDays[2][14] = { - { - 0, - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 - }, - { - 0, - 0, - 31, - 31 + 29, - 31 + 29 + 31, - 31 + 29 + 31 + 30, - 31 + 29 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 - } -}; - -/* Get the system time as seconds elapsed since midnight, January 1, 1970. */ -//INTN time( -// INTN *timer -// ) -time_t time (time_t *timer) -{ - EFI_STATUS Status; - EFI_TIME Time; - time_t CalTime; - UINTN Year; - - // - // Get the current time and date information - // - Status = gRT->GetTime (&Time, NULL); - if (EFI_ERROR (Status) || (Time.Year < 1970)) { - return 0; - } - - // - // Years Handling - // UTime should now be set to 00:00:00 on Jan 1 of the current year. - // - for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) { - CalTime = CalTime + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY); - } - - // - // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment - // - CalTime = CalTime + - (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) + - (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) + - (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + - (time_t)(Time.Hour * SECSPERHOUR) + - (time_t)(Time.Minute * 60) + - (time_t)Time.Second; - - if (timer != NULL) { - *timer = CalTime; - } - - return CalTime; -} - -// -// Convert a time value from type time_t to struct tm. -// -struct tm * gmtime (const time_t *timer) -{ - struct tm *GmTime; - UINT16 DayNo; - UINT16 DayRemainder; - time_t Year; - time_t YearNo; - UINT16 TotalDays; - UINT16 MonthNo; - - if (timer == NULL) { - return NULL; - } - - GmTime = malloc (sizeof (struct tm)); - if (GmTime == NULL) { - return NULL; - } - - ZeroMem ((VOID *) GmTime, (UINTN) sizeof (struct tm)); - - DayNo = (UINT16) (*timer / SECSPERDAY); - DayRemainder = (UINT16) (*timer % SECSPERDAY); - - GmTime->tm_sec = (int) (DayRemainder % SECSPERMIN); - GmTime->tm_min = (int) ((DayRemainder % SECSPERHOUR) / SECSPERMIN); - GmTime->tm_hour = (int) (DayRemainder / SECSPERHOUR); - GmTime->tm_wday = (int) ((DayNo + 4) % 7); - - for (Year = 1970, YearNo = 0; DayNo > 0; Year++) { - TotalDays = (UINT16) (IsLeap (Year) ? 366 : 365); - if (DayNo >= TotalDays) { - DayNo = (UINT16) (DayNo - TotalDays); - YearNo++; - } else { - break; - } - } - - GmTime->tm_year = (int) (YearNo + (1970 - 1900)); - GmTime->tm_yday = (int) DayNo; - - for (MonthNo = 12; MonthNo > 1; MonthNo--) { - if (DayNo >= CumulativeDays[IsLeap(Year)][MonthNo]) { - DayNo = (UINT16) (DayNo - (UINT16) (CumulativeDays[IsLeap(Year)][MonthNo])); - break; - } - } - - GmTime->tm_mon = (int) MonthNo - 1; - GmTime->tm_mday = (int) DayNo + 1; - - GmTime->tm_isdst = 0; - GmTime->tm_gmtoff = 0; - GmTime->tm_zone = NULL; - - return GmTime; -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/CrtLibSupport.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/CrtLibSupport.h deleted file mode 100644 index ab1168b..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/CrtLibSupport.h +++ /dev/null @@ -1,195 +0,0 @@ -/** @file - Root include file of C runtime library to support building the third-party - cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __CRT_LIB_SUPPORT_H__ -#define __CRT_LIB_SUPPORT_H__ - -#include -#include -#include -#include - -#define OPENSSLDIR "" -#define ENGINESDIR "" - -#define MAX_STRING_SIZE 0x1000 - -// -// OpenSSL relies on explicit configuration for word size in crypto/bn, -// but we want it to be automatically inferred from the target. So we -// bypass what's in for OPENSSL_SYS_UEFI, and -// define our own here. -// -#ifdef CONFIG_HEADER_BN_H -#error CONFIG_HEADER_BN_H already defined -#endif - -#define CONFIG_HEADER_BN_H - -#if defined(MDE_CPU_X64) || defined(MDE_CPU_AARCH64) || defined(MDE_CPU_IA64) -// -// With GCC we would normally use SIXTY_FOUR_BIT_LONG, but MSVC needs -// SIXTY_FOUR_BIT, because 'long' is 32-bit and only 'long long' is -// 64-bit. Since using 'long long' works fine on GCC too, just do that. -// -#define SIXTY_FOUR_BIT -#elif defined(MDE_CPU_IA32) || defined(MDE_CPU_ARM) || defined(MDE_CPU_EBC) -#define THIRTY_TWO_BIT -#else -#error Unknown target architecture -#endif - -// -// Map all va_xxxx elements to VA_xxx defined in MdePkg/Include/Base.h -// -#if !defined(__CC_ARM) // if va_list is not already defined -#define va_list VA_LIST -#define va_arg VA_ARG -#define va_start VA_START -#define va_end VA_END -#else // __CC_ARM -#define va_start(Marker, Parameter) __va_start(Marker, Parameter) -#define va_arg(Marker, TYPE) __va_arg(Marker, TYPE) -#define va_end(Marker) ((void)0) -#endif - -// -// Definitions for global constants used by CRT library routines -// -#define EINVAL 22 /* Invalid argument */ -#define INT_MAX 0x7FFFFFFF /* Maximum (signed) int value */ -#define LONG_MAX 0X7FFFFFFFL /* max value for a long */ -#define LONG_MIN (-LONG_MAX-1) /* min value for a long */ -#define ULONG_MAX 0xFFFFFFFF /* Maximum unsigned long value */ -#define CHAR_BIT 8 /* Number of bits in a char */ - -// -// Basic types mapping -// -typedef UINTN size_t; -typedef INTN ssize_t; -typedef INT32 time_t; -typedef UINT8 __uint8_t; -typedef UINT8 sa_family_t; -typedef UINT32 uid_t; -typedef UINT32 gid_t; - -// -// File operations are not required for EFI building, -// so FILE is mapped to VOID * to pass build -// -typedef VOID *FILE; - -// -// Structures Definitions -// -struct tm { - int tm_sec; /* seconds after the minute [0-60] */ - int tm_min; /* minutes after the hour [0-59] */ - int tm_hour; /* hours since midnight [0-23] */ - int tm_mday; /* day of the month [1-31] */ - int tm_mon; /* months since January [0-11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday [0-6] */ - int tm_yday; /* days since January 1 [0-365] */ - int tm_isdst; /* Daylight Savings Time flag */ - long tm_gmtoff; /* offset from CUT in seconds */ - char *tm_zone; /* timezone abbreviation */ -}; - -struct timeval { - long tv_sec; /* time value, in seconds */ - long tv_usec; /* time value, in microseconds */ -}; - -struct sockaddr { - __uint8_t sa_len; /* total length */ - sa_family_t sa_family; /* address family */ - char sa_data[14]; /* actually longer; address value */ -}; - -// -// Global variables -// -extern int errno; -extern FILE *stderr; - -// -// Function prototypes of CRT Library routines -// -void *malloc (size_t); -void *realloc (void *, size_t); -void free (void *); -void *memset (void *, int, size_t); -int memcmp (const void *, const void *, size_t); -int isdigit (int); -int isspace (int); -int isxdigit (int); -int isalnum (int); -int isupper (int); -int tolower (int); -int strcmp (const char *, const char *); -int strncasecmp (const char *, const char *, size_t); -char *strrchr (const char *, int); -unsigned long strtoul (const char *, char **, int); -long strtol (const char *, char **, int); -char *strerror (int); -size_t strspn (const char *, const char *); -size_t strcspn (const char *, const char *); -int printf (const char *, ...); -int sscanf (const char *, const char *, ...); -FILE *fopen (const char *, const char *); -size_t fread (void *, size_t, size_t, FILE *); -size_t fwrite (const void *, size_t, size_t, FILE *); -int fclose (FILE *); -int fprintf (FILE *, const char *, ...); -time_t time (time_t *); -struct tm *gmtime (const time_t *); -uid_t getuid (void); -uid_t geteuid (void); -gid_t getgid (void); -gid_t getegid (void); -void qsort (void *, size_t, size_t, int (*)(const void *, const void *)); -char *getenv (const char *); -char *secure_getenv (const char *); -#if defined(__GNUC__) && (__GNUC__ >= 2) -void abort (void) __attribute__((__noreturn__)); -#else -void abort (void); -#endif - -// -// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions -// -#define memcpy(dest,source,count) CopyMem(dest,source,(UINTN)(count)) -#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch)) -#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch) -#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count))) -#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count)) -#define strlen(str) (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE)) -#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,MAX_STRING_SIZE,strSource) -#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count) -#define strcat(strDest,strSource) AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource) -#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch) -#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count))) -#define strcasecmp(str1,str2) (int)AsciiStriCmp(str1,str2) -#define sprintf(buf,...) AsciiSPrint(buf,MAX_STRING_SIZE,__VA_ARGS__) -#define localtime(timer) NULL -#define assert(expression) -#define offsetof(type,member) OFFSET_OF(type,member) -#define atoi(nptr) AsciiStrDecimalToUintn(nptr) -#define gettimeofday(tvp,tz) do { (tvp)->tv_sec = time(NULL); (tvp)->tv_usec = 0; } while (0) - -#endif diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/assert.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/assert.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/assert.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/ctype.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/ctype.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/ctype.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/errno.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/errno.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/errno.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/internal/dso_conf.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/internal/dso_conf.h deleted file mode 100644 index e69de29..0000000 diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/limits.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/limits.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/limits.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/memory.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/memory.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/memory.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/openssl/opensslconf.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/openssl/opensslconf.h deleted file mode 100644 index 28dd9ab..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/openssl/opensslconf.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * WARNING: do not edit! - * Generated from include/openssl/opensslconf.h.in - * - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -# error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_SYS_UEFI -# define OPENSSL_SYS_UEFI 1 -#endif -#define OPENSSL_MIN_API 0x10100000L -#ifndef OPENSSL_NO_BF -# define OPENSSL_NO_BF -#endif -#ifndef OPENSSL_NO_BLAKE2 -# define OPENSSL_NO_BLAKE2 -#endif -#ifndef OPENSSL_NO_CAMELLIA -# define OPENSSL_NO_CAMELLIA -#endif -#ifndef OPENSSL_NO_CAST -# define OPENSSL_NO_CAST -#endif -#ifndef OPENSSL_NO_CHACHA -# define OPENSSL_NO_CHACHA -#endif -#ifndef OPENSSL_NO_CMS -# define OPENSSL_NO_CMS -#endif -#ifndef OPENSSL_NO_CT -# define OPENSSL_NO_CT -#endif -#ifndef OPENSSL_NO_DSA -# define OPENSSL_NO_DSA -#endif -#ifndef OPENSSL_NO_EC -# define OPENSSL_NO_EC -#endif -#ifndef OPENSSL_NO_IDEA -# define OPENSSL_NO_IDEA -#endif -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_MDC2 -# define OPENSSL_NO_MDC2 -#endif -#ifndef OPENSSL_NO_POLY1305 -# define OPENSSL_NO_POLY1305 -#endif -#ifndef OPENSSL_NO_RC2 -# define OPENSSL_NO_RC2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_NO_RMD160 -# define OPENSSL_NO_RMD160 -#endif -#ifndef OPENSSL_NO_SEED -# define OPENSSL_NO_SEED -#endif -#ifndef OPENSSL_NO_SRP -# define OPENSSL_NO_SRP -#endif -#ifndef OPENSSL_NO_TS -# define OPENSSL_NO_TS -#endif -#ifndef OPENSSL_NO_UI -# define OPENSSL_NO_UI -#endif -#ifndef OPENSSL_NO_WHIRLPOOL -# define OPENSSL_NO_WHIRLPOOL -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif -#ifndef OPENSSL_NO_APPS -# define OPENSSL_NO_APPS -#endif -#ifndef OPENSSL_NO_ASAN -# define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif -#ifndef OPENSSL_NO_ASYNC -# define OPENSSL_NO_ASYNC -#endif -#ifndef OPENSSL_NO_AUTOALGINIT -# define OPENSSL_NO_AUTOALGINIT -#endif -#ifndef OPENSSL_NO_AUTOERRINIT -# define OPENSSL_NO_AUTOERRINIT -#endif -#ifndef OPENSSL_NO_CAPIENG -# define OPENSSL_NO_CAPIENG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEPRECATED -# define OPENSSL_NO_DEPRECATED -#endif -#ifndef OPENSSL_NO_DGRAM -# define OPENSSL_NO_DGRAM -#endif -#ifndef OPENSSL_NO_DTLS -# define OPENSSL_NO_DTLS -#endif -#ifndef OPENSSL_NO_DTLS1 -# define OPENSSL_NO_DTLS1 -#endif -#ifndef OPENSSL_NO_DTLS1_2 -# define OPENSSL_NO_DTLS1_2 -#endif -#ifndef OPENSSL_NO_EC2M -# define OPENSSL_NO_EC2M -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_ECDH -# define OPENSSL_NO_ECDH -#endif -#ifndef OPENSSL_NO_ECDSA -# define OPENSSL_NO_ECDSA -#endif -#ifndef OPENSSL_NO_EGD -# define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_ENGINE -# define OPENSSL_NO_ENGINE -#endif -#ifndef OPENSSL_NO_ERR -# define OPENSSL_NO_ERR -#endif -#ifndef OPENSSL_NO_FILENAMES -# define OPENSSL_NO_FILENAMES -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -# define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -# define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_GOST -# define OPENSSL_NO_GOST -#endif -#ifndef OPENSSL_NO_HEARTBEATS -# define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_HW -# define OPENSSL_NO_HW -#endif -#ifndef OPENSSL_NO_MSAN -# define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_OCB -# define OPENSSL_NO_OCB -#endif -#ifndef OPENSSL_NO_POSIX_IO -# define OPENSSL_NO_POSIX_IO -#endif -#ifndef OPENSSL_NO_RFC3779 -# define OPENSSL_NO_RFC3779 -#endif -#ifndef OPENSSL_NO_SCRYPT -# define OPENSSL_NO_SCRYPT -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SOCK -# define OPENSSL_NO_SOCK -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -# define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_STDIO -# define OPENSSL_NO_STDIO -#endif -#ifndef OPENSSL_NO_TESTS -# define OPENSSL_NO_TESTS -#endif -#ifndef OPENSSL_NO_UBSAN -# define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -# define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif - - -/* - * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers - * don't like that. This will hopefully silence them. - */ -#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; - -/* - * Applications should use -DOPENSSL_API_COMPAT= to suppress the - * declarations of functions deprecated in or before . Otherwise, they - * still won't see them if the library has been built to disable deprecated - * functions. - */ -#ifndef DECLARE_DEPRECATED -# if defined(OPENSSL_NO_DEPRECATED) -# define DECLARE_DEPRECATED(f) -# else -# define DECLARE_DEPRECATED(f) f; -# ifdef __GNUC__ -# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) -# undef DECLARE_DEPRECATED -# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); -# endif -# endif -# endif -#endif - -#ifndef OPENSSL_FILE -# ifdef OPENSSL_NO_FILENAMES -# define OPENSSL_FILE "" -# define OPENSSL_LINE 0 -# else -# define OPENSSL_FILE __FILE__ -# define OPENSSL_LINE __LINE__ -# endif -#endif - -#ifndef OPENSSL_MIN_API -# define OPENSSL_MIN_API 0 -#endif - -#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API -# undef OPENSSL_API_COMPAT -# define OPENSSL_API_COMPAT OPENSSL_MIN_API -#endif - -#if OPENSSL_API_COMPAT < 0x10100000L -# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) -#else -# define DEPRECATEDIN_1_1_0(f) -#endif - -#if OPENSSL_API_COMPAT < 0x10000000L -# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) -#else -# define DEPRECATEDIN_1_0_0(f) -#endif - -#if OPENSSL_API_COMPAT < 0x00908000L -# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) -#else -# define DEPRECATEDIN_0_9_8(f) -#endif - - - -/* Generate 80386 code? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -# undef BN_LLONG -/* Only one for the following should be defined */ -# undef SIXTY_FOUR_BIT_LONG -# undef SIXTY_FOUR_BIT -# define THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned int - -#ifdef __cplusplus -} -#endif diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdarg.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdarg.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdarg.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stddef.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stddef.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stddef.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdio.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdio.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdio.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdlib.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdlib.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/stdlib.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/string.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/string.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/string.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/strings.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/strings.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/strings.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/time.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/time.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/time.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/types.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/types.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/sys/types.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/syslog.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/syslog.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/syslog.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/time.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/time.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/time.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/unistd.h b/Voyager/Voyager/edk2/CryptoPkg/Library/Include/unistd.h deleted file mode 100644 index 6f8b4f8..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/Include/unistd.h +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - Include file to support building the third-party cryptographic library. - -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni deleted file mode 100644 index fbecd7d..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/BaseIntrinsicLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Intrinsic Routines Wrapper Library Instance. -// -// This module is intrinsic routines wrapper library instance. -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Intrinsic Routines Wrapper Library Instance" - -#string STR_MODULE_DESCRIPTION #language en-US "This module is intrinsic routines wrapper library instance." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/CopyMem.c b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/CopyMem.c deleted file mode 100644 index 40aad7f..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/CopyMem.c +++ /dev/null @@ -1,23 +0,0 @@ -/** @file - Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based - Cryptographic Library. - -Copyright (c) 2010, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/* Copies bytes between buffers */ -void * memcpy (void *dest, const void *src, unsigned int count) -{ - return CopyMem (dest, src, (UINTN)count); -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S deleted file mode 100644 index a7342a4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S +++ /dev/null @@ -1,62 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# MathLShiftS64.S -# -# Abstract: -# -# 64-bit Math Worker Function. -# Shifts a 64-bit signed value left by a certain number of bits. -# -#------------------------------------------------------------------------------ - - .686: - .code: - -ASM_GLOBAL ASM_PFX(__ashldi3) - -#------------------------------------------------------------------------------ -# -# void __cdecl __ashldi3 (void) -# -#------------------------------------------------------------------------------ -ASM_PFX(__ashldi3): - # - # Handle shifting of 64 or more bits (return 0) - # - cmpb $64, %cl - jae ReturnZero - - # - # Handle shifting of between 0 and 31 bits - # - cmpb $32, %cl - jae More32 - shld %cl, %eax, %edx - shl %cl, %eax - ret - - # - # Handle shifting of between 32 and 63 bits - # -More32: - movl %eax, %edx - xor %eax, %eax - and $31, %cl - shl %cl, %edx - ret - -ReturnZero: - xor %eax, %eax - xor %edx, %edx - ret diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c deleted file mode 100644 index f5baf0e..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - 64-bit Math Worker Function. - The 32-bit versions of C compiler generate calls to library routines - to handle 64-bit math. These functions use non-standard calling conventions. - -Copyright (c) 2014, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/* - * Shifts a 64-bit signed value left by a particular number of bits. - */ -__declspec(naked) void __cdecl _allshl (void) -{ - _asm { - ; - ; Handle shifting of 64 or more bits (return 0) - ; - cmp cl, 64 - jae short ReturnZero - - ; - ; Handle shifting of between 0 and 31 bits - ; - cmp cl, 32 - jae short More32 - shld edx, eax, cl - shl eax, cl - ret - - ; - ; Handle shifting of between 32 and 63 bits - ; -More32: - mov edx, eax - xor eax, eax - and cl, 31 - shl edx, cl - ret - -ReturnZero: - xor eax,eax - xor edx,edx - ret - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm deleted file mode 100644 index 8855a3d..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; MathLShiftS64.nasm -; -; Abstract: -; -; 64-bit Math Worker Function. -; Shifts a 64-bit signed value left by a certain number of bits. -; -;------------------------------------------------------------------------------ - - SECTION .text - -global ASM_PFX(__ashldi3) -;------------------------------------------------------------------------------ -; -; void __cdecl __ashldi3 (void) -; -;------------------------------------------------------------------------------ -ASM_PFX(__ashldi3): - cmp cl,0x40 - jnc ReturnZero - cmp cl,0x20 - jnc More32 - shld edx,eax,cl - shl eax,cl - ret -More32: - mov edx,eax - xor eax,eax - and cl,0x1f - shl edx,cl - ret -ReturnZero: - xor eax,eax - xor edx,edx - ret diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S deleted file mode 100644 index 2e2d92e..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S +++ /dev/null @@ -1,66 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# MathRShiftU64.S -# -# Abstract: -# -# 64-bit Math Worker Function. -# Shifts a 64-bit unsigned value right by a certain number of bits. -# -#------------------------------------------------------------------------------ - - - .686: - .code: - -ASM_GLOBAL ASM_PFX(__ashrdi3) - -#------------------------------------------------------------------------------ -# -# void __cdecl __ashrdi3 (void) -# -#------------------------------------------------------------------------------ -ASM_PFX(__ashrdi3): - # - # Checking: Only handle 64bit shifting or more - # - cmpb $64, %cl - jae _Exit - - # - # Handle shifting between 0 and 31 bits - # - cmpb $32, %cl - jae More32 - shrd %cl, %edx, %eax - shr %cl, %edx - ret - - # - # Handle shifting of 32-63 bits - # -More32: - movl %edx, %eax - xor %edx, %edx - and $31, %cl - shr %cl, %eax - ret - - # - # Invalid number (less then 32bits), return 0 - # -_Exit: - xor %eax, %eax - xor %edx, %edx - ret diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c deleted file mode 100644 index 2fe4deb..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c +++ /dev/null @@ -1,57 +0,0 @@ -/** @file - 64-bit Math Worker Function. - The 32-bit versions of C compiler generate calls to library routines - to handle 64-bit math. These functions use non-standard calling conventions. - -Copyright (c) 2014, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/* - * Shifts a 64-bit unsigned value right by a certain number of bits. - */ -__declspec(naked) void __cdecl _aullshr (void) -{ - _asm { - ; - ; Checking: Only handle 64bit shifting or more - ; - cmp cl, 64 - jae _Exit - - ; - ; Handle shifting between 0 and 31 bits - ; - cmp cl, 32 - jae More32 - shrd eax, edx, cl - shr edx, cl - ret - - ; - ; Handle shifting of 32-63 bits - ; -More32: - mov eax, edx - xor edx, edx - and cl, 31 - shr eax, cl - ret - - ; - ; Invalid number (less then 32bits), return 0 - ; -_Exit: - xor eax, eax - xor edx, edx - ret - } -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm deleted file mode 100644 index 65a3684..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; MathRShiftU64.nasm -; -; Abstract: -; -; 64-bit Math Worker Function. -; Shifts a 64-bit unsigned value right by a certain number of bits. -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; -; void __cdecl __ashrdi3 (void) -; -;------------------------------------------------------------------------------ -global ASM_PFX(__ashrdi3) -ASM_PFX(__ashrdi3): - cmp cl,0x40 - jnc _Exit - cmp cl,0x20 - jnc More32 - shrd eax,edx,cl - shr edx,cl - ret -More32: - mov eax,edx - xor edx,edx - and cl,0x1f - shr eax,cl - ret -_Exit: - xor eax,eax - xor edx,edx - ret - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf deleted file mode 100644 index f43254b..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +++ /dev/null @@ -1,73 +0,0 @@ -## @file -# Intrinsic Routines Wrapper Library Instance. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseIntrinsicLib - MODULE_UNI_FILE = BaseIntrinsicLib.uni - FILE_GUID = 63850097-3E97-4c4f-A52D-C811A0106105 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IntrinsicLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemoryIntrinsics.c - -[Sources.IA32] - CopyMem.c - - Ia32/MathLShiftS64.c | MSFT - Ia32/MathRShiftU64.c | MSFT - - Ia32/MathLShiftS64.c | INTEL - Ia32/MathRShiftU64.c | INTEL - - Ia32/MathLShiftS64.S | GCC - Ia32/MathRShiftU64.S | GCC - Ia32/MathLShiftS64.nasm | GCC - Ia32/MathRShiftU64.nasm | GCC - -[Sources.X64] - CopyMem.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - -[BuildOptions] - # - # Override MSFT build option to remove /Oi and /GL - # - MSFT:DEBUG_VS2003_IA32_CC_FLAGS == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm - MSFT:RELEASE_VS2003_IA32_CC_FLAGS == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- - MSFT:DEBUG_VS2003xASL_IA32_CC_FLAGS == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm - MSFT:RELEASE_VS2003xASL_IA32_CC_FLAGS == /nologo /c /WX /W4 /Gs32768 /Gy /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- - MSFT:DEBUG_DDK3790_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm - MSFT:RELEASE_DDK3790_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF - MSFT:DEBUG_DDK3790xASL_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm - MSFT:RELEASE_DDK3790xASL_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF - MSFT:DEBUG_*_IA32_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm - MSFT:RELEASE_*_IA32_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF - MSFT:DEBUG_*_X64_CC_FLAGS == /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1b2s /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm - MSFT:RELEASE_*_X64_CC_FLAGS == /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1b2s /Gy /FIAutoGen.h /EHs-c- /GR- /GF - INTEL:*_*_*_CC_FLAGS = /Oi- diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c deleted file mode 100644 index 9a66b37..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c +++ /dev/null @@ -1,60 +0,0 @@ -/** @file - Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based - Cryptographic Library. - -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -typedef UINTN size_t; - -/* OpenSSL will use floating point support, and C compiler produces the _fltused - symbol by default. Simply define this symbol here to satisfy the linker. */ -int _fltused = 1; - -/* Sets buffers to a specified character */ -void * memset (void *dest, int ch, size_t count) -{ - // - // NOTE: Here we use one base implementation for memset, instead of the direct - // optimized SetMem() wrapper. Because the IntrinsicLib has to be built - // without whole program optimization option, and there will be some - // potential register usage errors when calling other optimized codes. - // - - // - // Declare the local variables that actually move the data elements as - // volatile to prevent the optimizer from replacing this function with - // the intrinsic memset() - // - volatile UINT8 *Pointer; - - Pointer = (UINT8 *)dest; - while (count-- != 0) { - *(Pointer++) = (UINT8)ch; - } - - return dest; -} - -/* Compare bytes in two buffers. */ -int memcmp (const void *buf1, const void *buf2, size_t count) -{ - return (int)CompareMem(buf1, buf2, count); -} - -int strcmp (const char *s1, const char *s2) -{ - return (int)AsciiStrCmp(s1, s2); -} diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt deleted file mode 100644 index a062b95..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt +++ /dev/null @@ -1,53 +0,0 @@ - -============================================================================= - Introduction -============================================================================= - OpenSSL is a well-known open source implementation of SSL/TLS protocols. -The core library implements the cryptographic and SSL/TLS functions and -also provides various utility functions. The OpenSSL library is widely used -in variety of security products development as base crypto provider. -(See http://www.openssl.org/ for more information about OpenSSL). - UEFI (Unified Extensible Firmware Interface) is a specification detailing -the interfaces between OS and platform firmware. Several security features -were introduced (e.g. Authenticated Variable Service, Driver Signing, etc) -from UEFI 2.2 (http://www.uefi.org/). These security features highly depend -on the cryptography. - This HOWTO documents OpenSSL building under UEFI/EDKII environment. - -============================================================================= - OpenSSL-Version -============================================================================= - EDKII supports building with the latest release of OpenSSL. - NOTE: Only latest release version was fully validated. - And no guarantees on build & functionality if using other versions. - -============================================================================= - HOW to Install OpenSSL for UEFI Building -============================================================================= - OpenSSL repository was added as one submodule of EDKII project. - - The user can use the following commands to clone both main EDKII repo and -openssl submodule: - 1) Add the "--recursive" flag to the git clone command: - $ git clone --recursive https://github.com/tianocore/edk2 -or - 2) Manually initialize and update the submodules after the clone operation - on main project: - $ git clone https://github.com/tianocore/edk2 - $ git submodule update --init --recursive - - And use the following combined commands to pull the remote submodule updates -(e.g. Updating the new supported OpenSSL release tag): - $ git pull --recurse-submodules && \ - git submodule update --recursive - -============================================================================= - About process_files.pl -============================================================================= - "process_files.pl" is one Perl script which runs the OpenSSL Configure, -then processes the resulting file list into our local OpensslLib.inf and -OpensslLibCrypto.inf. - This only needs to be done once by the maintainer / developer when -updating to a new version of OpenSSL (or changing options, etc.). -Normal users do not need do this, since the results are already stored in -the EDKII git repository for them. diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.inf deleted file mode 100644 index 8a9265a..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.inf +++ /dev/null @@ -1,597 +0,0 @@ -## @file -# This module provides OpenSSL Library implementation. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = OpensslLib - MODULE_UNI_FILE = OpensslLib.uni - FILE_GUID = C873A7D0-9824-409f-9B42-2C158B992E69 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = OpensslLib - DEFINE OPENSSL_PATH = openssl - DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNO_SYSLOG - -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - $(OPENSSL_PATH)/e_os.h -# Autogenerated files list starts here - $(OPENSSL_PATH)/crypto/aes/aes_cbc.c - $(OPENSSL_PATH)/crypto/aes/aes_cfb.c - $(OPENSSL_PATH)/crypto/aes/aes_core.c - $(OPENSSL_PATH)/crypto/aes/aes_ecb.c - $(OPENSSL_PATH)/crypto/aes/aes_ige.c - $(OPENSSL_PATH)/crypto/aes/aes_misc.c - $(OPENSSL_PATH)/crypto/aes/aes_ofb.c - $(OPENSSL_PATH)/crypto/aes/aes_wrap.c - $(OPENSSL_PATH)/crypto/asn1/a_bitstr.c - $(OPENSSL_PATH)/crypto/asn1/a_d2i_fp.c - $(OPENSSL_PATH)/crypto/asn1/a_digest.c - $(OPENSSL_PATH)/crypto/asn1/a_dup.c - $(OPENSSL_PATH)/crypto/asn1/a_gentm.c - $(OPENSSL_PATH)/crypto/asn1/a_i2d_fp.c - $(OPENSSL_PATH)/crypto/asn1/a_int.c - $(OPENSSL_PATH)/crypto/asn1/a_mbstr.c - $(OPENSSL_PATH)/crypto/asn1/a_object.c - $(OPENSSL_PATH)/crypto/asn1/a_octet.c - $(OPENSSL_PATH)/crypto/asn1/a_print.c - $(OPENSSL_PATH)/crypto/asn1/a_sign.c - $(OPENSSL_PATH)/crypto/asn1/a_strex.c - $(OPENSSL_PATH)/crypto/asn1/a_strnid.c - $(OPENSSL_PATH)/crypto/asn1/a_time.c - $(OPENSSL_PATH)/crypto/asn1/a_type.c - $(OPENSSL_PATH)/crypto/asn1/a_utctm.c - $(OPENSSL_PATH)/crypto/asn1/a_utf8.c - $(OPENSSL_PATH)/crypto/asn1/a_verify.c - $(OPENSSL_PATH)/crypto/asn1/ameth_lib.c - $(OPENSSL_PATH)/crypto/asn1/asn1_err.c - $(OPENSSL_PATH)/crypto/asn1/asn1_gen.c - $(OPENSSL_PATH)/crypto/asn1/asn1_lib.c - $(OPENSSL_PATH)/crypto/asn1/asn1_par.c - $(OPENSSL_PATH)/crypto/asn1/asn_mime.c - $(OPENSSL_PATH)/crypto/asn1/asn_moid.c - $(OPENSSL_PATH)/crypto/asn1/asn_mstbl.c - $(OPENSSL_PATH)/crypto/asn1/asn_pack.c - $(OPENSSL_PATH)/crypto/asn1/bio_asn1.c - $(OPENSSL_PATH)/crypto/asn1/bio_ndef.c - $(OPENSSL_PATH)/crypto/asn1/d2i_pr.c - $(OPENSSL_PATH)/crypto/asn1/d2i_pu.c - $(OPENSSL_PATH)/crypto/asn1/evp_asn1.c - $(OPENSSL_PATH)/crypto/asn1/f_int.c - $(OPENSSL_PATH)/crypto/asn1/f_string.c - $(OPENSSL_PATH)/crypto/asn1/i2d_pr.c - $(OPENSSL_PATH)/crypto/asn1/i2d_pu.c - $(OPENSSL_PATH)/crypto/asn1/n_pkey.c - $(OPENSSL_PATH)/crypto/asn1/nsseq.c - $(OPENSSL_PATH)/crypto/asn1/p5_pbe.c - $(OPENSSL_PATH)/crypto/asn1/p5_pbev2.c - $(OPENSSL_PATH)/crypto/asn1/p5_scrypt.c - $(OPENSSL_PATH)/crypto/asn1/p8_pkey.c - $(OPENSSL_PATH)/crypto/asn1/t_bitst.c - $(OPENSSL_PATH)/crypto/asn1/t_pkey.c - $(OPENSSL_PATH)/crypto/asn1/t_spki.c - $(OPENSSL_PATH)/crypto/asn1/tasn_dec.c - $(OPENSSL_PATH)/crypto/asn1/tasn_enc.c - $(OPENSSL_PATH)/crypto/asn1/tasn_fre.c - $(OPENSSL_PATH)/crypto/asn1/tasn_new.c - $(OPENSSL_PATH)/crypto/asn1/tasn_prn.c - $(OPENSSL_PATH)/crypto/asn1/tasn_scn.c - $(OPENSSL_PATH)/crypto/asn1/tasn_typ.c - $(OPENSSL_PATH)/crypto/asn1/tasn_utl.c - $(OPENSSL_PATH)/crypto/asn1/x_algor.c - $(OPENSSL_PATH)/crypto/asn1/x_bignum.c - $(OPENSSL_PATH)/crypto/asn1/x_info.c - $(OPENSSL_PATH)/crypto/asn1/x_int64.c - $(OPENSSL_PATH)/crypto/asn1/x_long.c - $(OPENSSL_PATH)/crypto/asn1/x_pkey.c - $(OPENSSL_PATH)/crypto/asn1/x_sig.c - $(OPENSSL_PATH)/crypto/asn1/x_spki.c - $(OPENSSL_PATH)/crypto/asn1/x_val.c - $(OPENSSL_PATH)/crypto/async/arch/async_null.c - $(OPENSSL_PATH)/crypto/async/arch/async_posix.c - $(OPENSSL_PATH)/crypto/async/arch/async_win.c - $(OPENSSL_PATH)/crypto/async/async.c - $(OPENSSL_PATH)/crypto/async/async_err.c - $(OPENSSL_PATH)/crypto/async/async_wait.c - $(OPENSSL_PATH)/crypto/bio/b_addr.c - $(OPENSSL_PATH)/crypto/bio/b_dump.c - $(OPENSSL_PATH)/crypto/bio/b_sock.c - $(OPENSSL_PATH)/crypto/bio/b_sock2.c - $(OPENSSL_PATH)/crypto/bio/bf_buff.c - $(OPENSSL_PATH)/crypto/bio/bf_lbuf.c - $(OPENSSL_PATH)/crypto/bio/bf_nbio.c - $(OPENSSL_PATH)/crypto/bio/bf_null.c - $(OPENSSL_PATH)/crypto/bio/bio_cb.c - $(OPENSSL_PATH)/crypto/bio/bio_err.c - $(OPENSSL_PATH)/crypto/bio/bio_lib.c - $(OPENSSL_PATH)/crypto/bio/bio_meth.c - $(OPENSSL_PATH)/crypto/bio/bss_acpt.c - $(OPENSSL_PATH)/crypto/bio/bss_bio.c - $(OPENSSL_PATH)/crypto/bio/bss_conn.c - $(OPENSSL_PATH)/crypto/bio/bss_dgram.c - $(OPENSSL_PATH)/crypto/bio/bss_fd.c - $(OPENSSL_PATH)/crypto/bio/bss_file.c - $(OPENSSL_PATH)/crypto/bio/bss_log.c - $(OPENSSL_PATH)/crypto/bio/bss_mem.c - $(OPENSSL_PATH)/crypto/bio/bss_null.c - $(OPENSSL_PATH)/crypto/bio/bss_sock.c - $(OPENSSL_PATH)/crypto/bn/bn_add.c - $(OPENSSL_PATH)/crypto/bn/bn_asm.c - $(OPENSSL_PATH)/crypto/bn/bn_blind.c - $(OPENSSL_PATH)/crypto/bn/bn_const.c - $(OPENSSL_PATH)/crypto/bn/bn_ctx.c - $(OPENSSL_PATH)/crypto/bn/bn_depr.c - $(OPENSSL_PATH)/crypto/bn/bn_dh.c - $(OPENSSL_PATH)/crypto/bn/bn_div.c - $(OPENSSL_PATH)/crypto/bn/bn_err.c - $(OPENSSL_PATH)/crypto/bn/bn_exp.c - $(OPENSSL_PATH)/crypto/bn/bn_exp2.c - $(OPENSSL_PATH)/crypto/bn/bn_gcd.c - $(OPENSSL_PATH)/crypto/bn/bn_gf2m.c - $(OPENSSL_PATH)/crypto/bn/bn_intern.c - $(OPENSSL_PATH)/crypto/bn/bn_kron.c - $(OPENSSL_PATH)/crypto/bn/bn_lib.c - $(OPENSSL_PATH)/crypto/bn/bn_mod.c - $(OPENSSL_PATH)/crypto/bn/bn_mont.c - $(OPENSSL_PATH)/crypto/bn/bn_mpi.c - $(OPENSSL_PATH)/crypto/bn/bn_mul.c - $(OPENSSL_PATH)/crypto/bn/bn_nist.c - $(OPENSSL_PATH)/crypto/bn/bn_prime.c - $(OPENSSL_PATH)/crypto/bn/bn_print.c - $(OPENSSL_PATH)/crypto/bn/bn_rand.c - $(OPENSSL_PATH)/crypto/bn/bn_recp.c - $(OPENSSL_PATH)/crypto/bn/bn_shift.c - $(OPENSSL_PATH)/crypto/bn/bn_sqr.c - $(OPENSSL_PATH)/crypto/bn/bn_sqrt.c - $(OPENSSL_PATH)/crypto/bn/bn_srp.c - $(OPENSSL_PATH)/crypto/bn/bn_word.c - $(OPENSSL_PATH)/crypto/bn/bn_x931p.c - $(OPENSSL_PATH)/crypto/buffer/buf_err.c - $(OPENSSL_PATH)/crypto/buffer/buffer.c - $(OPENSSL_PATH)/crypto/cmac/cm_ameth.c - $(OPENSSL_PATH)/crypto/cmac/cm_pmeth.c - $(OPENSSL_PATH)/crypto/cmac/cmac.c - $(OPENSSL_PATH)/crypto/comp/c_zlib.c - $(OPENSSL_PATH)/crypto/comp/comp_err.c - $(OPENSSL_PATH)/crypto/comp/comp_lib.c - $(OPENSSL_PATH)/crypto/conf/conf_api.c - $(OPENSSL_PATH)/crypto/conf/conf_def.c - $(OPENSSL_PATH)/crypto/conf/conf_err.c - $(OPENSSL_PATH)/crypto/conf/conf_lib.c - $(OPENSSL_PATH)/crypto/conf/conf_mall.c - $(OPENSSL_PATH)/crypto/conf/conf_mod.c - $(OPENSSL_PATH)/crypto/conf/conf_sap.c - $(OPENSSL_PATH)/crypto/conf/conf_ssl.c - $(OPENSSL_PATH)/crypto/cpt_err.c - $(OPENSSL_PATH)/crypto/cryptlib.c - $(OPENSSL_PATH)/crypto/cversion.c - $(OPENSSL_PATH)/crypto/des/cbc_cksm.c - $(OPENSSL_PATH)/crypto/des/cbc_enc.c - $(OPENSSL_PATH)/crypto/des/cfb64ede.c - $(OPENSSL_PATH)/crypto/des/cfb64enc.c - $(OPENSSL_PATH)/crypto/des/cfb_enc.c - $(OPENSSL_PATH)/crypto/des/des_enc.c - $(OPENSSL_PATH)/crypto/des/ecb3_enc.c - $(OPENSSL_PATH)/crypto/des/ecb_enc.c - $(OPENSSL_PATH)/crypto/des/fcrypt.c - $(OPENSSL_PATH)/crypto/des/fcrypt_b.c - $(OPENSSL_PATH)/crypto/des/ofb64ede.c - $(OPENSSL_PATH)/crypto/des/ofb64enc.c - $(OPENSSL_PATH)/crypto/des/ofb_enc.c - $(OPENSSL_PATH)/crypto/des/pcbc_enc.c - $(OPENSSL_PATH)/crypto/des/qud_cksm.c - $(OPENSSL_PATH)/crypto/des/rand_key.c - $(OPENSSL_PATH)/crypto/des/rpc_enc.c - $(OPENSSL_PATH)/crypto/des/set_key.c - $(OPENSSL_PATH)/crypto/des/str2key.c - $(OPENSSL_PATH)/crypto/des/xcbc_enc.c - $(OPENSSL_PATH)/crypto/dh/dh_ameth.c - $(OPENSSL_PATH)/crypto/dh/dh_asn1.c - $(OPENSSL_PATH)/crypto/dh/dh_check.c - $(OPENSSL_PATH)/crypto/dh/dh_depr.c - $(OPENSSL_PATH)/crypto/dh/dh_err.c - $(OPENSSL_PATH)/crypto/dh/dh_gen.c - $(OPENSSL_PATH)/crypto/dh/dh_kdf.c - $(OPENSSL_PATH)/crypto/dh/dh_key.c - $(OPENSSL_PATH)/crypto/dh/dh_lib.c - $(OPENSSL_PATH)/crypto/dh/dh_meth.c - $(OPENSSL_PATH)/crypto/dh/dh_pmeth.c - $(OPENSSL_PATH)/crypto/dh/dh_prn.c - $(OPENSSL_PATH)/crypto/dh/dh_rfc5114.c - $(OPENSSL_PATH)/crypto/dso/dso_dl.c - $(OPENSSL_PATH)/crypto/dso/dso_dlfcn.c - $(OPENSSL_PATH)/crypto/dso/dso_err.c - $(OPENSSL_PATH)/crypto/dso/dso_lib.c - $(OPENSSL_PATH)/crypto/dso/dso_openssl.c - $(OPENSSL_PATH)/crypto/dso/dso_vms.c - $(OPENSSL_PATH)/crypto/dso/dso_win32.c - $(OPENSSL_PATH)/crypto/ebcdic.c - $(OPENSSL_PATH)/crypto/err/err.c - $(OPENSSL_PATH)/crypto/err/err_all.c - $(OPENSSL_PATH)/crypto/err/err_prn.c - $(OPENSSL_PATH)/crypto/evp/bio_b64.c - $(OPENSSL_PATH)/crypto/evp/bio_enc.c - $(OPENSSL_PATH)/crypto/evp/bio_md.c - $(OPENSSL_PATH)/crypto/evp/bio_ok.c - $(OPENSSL_PATH)/crypto/evp/c_allc.c - $(OPENSSL_PATH)/crypto/evp/c_alld.c - $(OPENSSL_PATH)/crypto/evp/cmeth_lib.c - $(OPENSSL_PATH)/crypto/evp/digest.c - $(OPENSSL_PATH)/crypto/evp/e_aes.c - $(OPENSSL_PATH)/crypto/evp/e_aes_cbc_hmac_sha1.c - $(OPENSSL_PATH)/crypto/evp/e_aes_cbc_hmac_sha256.c - $(OPENSSL_PATH)/crypto/evp/e_bf.c - $(OPENSSL_PATH)/crypto/evp/e_camellia.c - $(OPENSSL_PATH)/crypto/evp/e_cast.c - $(OPENSSL_PATH)/crypto/evp/e_chacha20_poly1305.c - $(OPENSSL_PATH)/crypto/evp/e_des.c - $(OPENSSL_PATH)/crypto/evp/e_des3.c - $(OPENSSL_PATH)/crypto/evp/e_idea.c - $(OPENSSL_PATH)/crypto/evp/e_null.c - $(OPENSSL_PATH)/crypto/evp/e_old.c - $(OPENSSL_PATH)/crypto/evp/e_rc2.c - $(OPENSSL_PATH)/crypto/evp/e_rc4.c - $(OPENSSL_PATH)/crypto/evp/e_rc4_hmac_md5.c - $(OPENSSL_PATH)/crypto/evp/e_rc5.c - $(OPENSSL_PATH)/crypto/evp/e_seed.c - $(OPENSSL_PATH)/crypto/evp/e_xcbc_d.c - $(OPENSSL_PATH)/crypto/evp/encode.c - $(OPENSSL_PATH)/crypto/evp/evp_cnf.c - $(OPENSSL_PATH)/crypto/evp/evp_enc.c - $(OPENSSL_PATH)/crypto/evp/evp_err.c - $(OPENSSL_PATH)/crypto/evp/evp_key.c - $(OPENSSL_PATH)/crypto/evp/evp_lib.c - $(OPENSSL_PATH)/crypto/evp/evp_pbe.c - $(OPENSSL_PATH)/crypto/evp/evp_pkey.c - $(OPENSSL_PATH)/crypto/evp/m_md2.c - $(OPENSSL_PATH)/crypto/evp/m_md4.c - $(OPENSSL_PATH)/crypto/evp/m_md5.c - $(OPENSSL_PATH)/crypto/evp/m_md5_sha1.c - $(OPENSSL_PATH)/crypto/evp/m_mdc2.c - $(OPENSSL_PATH)/crypto/evp/m_null.c - $(OPENSSL_PATH)/crypto/evp/m_ripemd.c - $(OPENSSL_PATH)/crypto/evp/m_sha1.c - $(OPENSSL_PATH)/crypto/evp/m_sigver.c - $(OPENSSL_PATH)/crypto/evp/m_wp.c - $(OPENSSL_PATH)/crypto/evp/names.c - $(OPENSSL_PATH)/crypto/evp/p5_crpt.c - $(OPENSSL_PATH)/crypto/evp/p5_crpt2.c - $(OPENSSL_PATH)/crypto/evp/p_dec.c - $(OPENSSL_PATH)/crypto/evp/p_enc.c - $(OPENSSL_PATH)/crypto/evp/p_lib.c - $(OPENSSL_PATH)/crypto/evp/p_open.c - $(OPENSSL_PATH)/crypto/evp/p_seal.c - $(OPENSSL_PATH)/crypto/evp/p_sign.c - $(OPENSSL_PATH)/crypto/evp/p_verify.c - $(OPENSSL_PATH)/crypto/evp/pmeth_fn.c - $(OPENSSL_PATH)/crypto/evp/pmeth_gn.c - $(OPENSSL_PATH)/crypto/evp/pmeth_lib.c - $(OPENSSL_PATH)/crypto/evp/scrypt.c - $(OPENSSL_PATH)/crypto/ex_data.c - $(OPENSSL_PATH)/crypto/getenv.c - $(OPENSSL_PATH)/crypto/hmac/hm_ameth.c - $(OPENSSL_PATH)/crypto/hmac/hm_pmeth.c - $(OPENSSL_PATH)/crypto/hmac/hmac.c - $(OPENSSL_PATH)/crypto/init.c - $(OPENSSL_PATH)/crypto/kdf/hkdf.c - $(OPENSSL_PATH)/crypto/kdf/kdf_err.c - $(OPENSSL_PATH)/crypto/kdf/tls1_prf.c - $(OPENSSL_PATH)/crypto/lhash/lh_stats.c - $(OPENSSL_PATH)/crypto/lhash/lhash.c - $(OPENSSL_PATH)/crypto/md4/md4_dgst.c - $(OPENSSL_PATH)/crypto/md4/md4_one.c - $(OPENSSL_PATH)/crypto/md5/md5_dgst.c - $(OPENSSL_PATH)/crypto/md5/md5_one.c - $(OPENSSL_PATH)/crypto/mem.c - $(OPENSSL_PATH)/crypto/mem_clr.c - $(OPENSSL_PATH)/crypto/mem_dbg.c - $(OPENSSL_PATH)/crypto/mem_sec.c - $(OPENSSL_PATH)/crypto/modes/cbc128.c - $(OPENSSL_PATH)/crypto/modes/ccm128.c - $(OPENSSL_PATH)/crypto/modes/cfb128.c - $(OPENSSL_PATH)/crypto/modes/ctr128.c - $(OPENSSL_PATH)/crypto/modes/cts128.c - $(OPENSSL_PATH)/crypto/modes/gcm128.c - $(OPENSSL_PATH)/crypto/modes/ocb128.c - $(OPENSSL_PATH)/crypto/modes/ofb128.c - $(OPENSSL_PATH)/crypto/modes/wrap128.c - $(OPENSSL_PATH)/crypto/modes/xts128.c - $(OPENSSL_PATH)/crypto/o_dir.c - $(OPENSSL_PATH)/crypto/o_fips.c - $(OPENSSL_PATH)/crypto/o_fopen.c - $(OPENSSL_PATH)/crypto/o_init.c - $(OPENSSL_PATH)/crypto/o_str.c - $(OPENSSL_PATH)/crypto/o_time.c - $(OPENSSL_PATH)/crypto/objects/o_names.c - $(OPENSSL_PATH)/crypto/objects/obj_dat.c - $(OPENSSL_PATH)/crypto/objects/obj_err.c - $(OPENSSL_PATH)/crypto/objects/obj_lib.c - $(OPENSSL_PATH)/crypto/objects/obj_xref.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_asn.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_cl.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_err.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_ext.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_ht.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_lib.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_prn.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_srv.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_vfy.c - $(OPENSSL_PATH)/crypto/ocsp/v3_ocsp.c - $(OPENSSL_PATH)/crypto/pem/pem_all.c - $(OPENSSL_PATH)/crypto/pem/pem_err.c - $(OPENSSL_PATH)/crypto/pem/pem_info.c - $(OPENSSL_PATH)/crypto/pem/pem_lib.c - $(OPENSSL_PATH)/crypto/pem/pem_oth.c - $(OPENSSL_PATH)/crypto/pem/pem_pk8.c - $(OPENSSL_PATH)/crypto/pem/pem_pkey.c - $(OPENSSL_PATH)/crypto/pem/pem_sign.c - $(OPENSSL_PATH)/crypto/pem/pem_x509.c - $(OPENSSL_PATH)/crypto/pem/pem_xaux.c - $(OPENSSL_PATH)/crypto/pem/pvkfmt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_add.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_asn.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_attr.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_crpt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_crt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_decr.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_init.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_key.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_kiss.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_mutl.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_npas.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_p8d.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_p8e.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_sbag.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_utl.c - $(OPENSSL_PATH)/crypto/pkcs12/pk12err.c - $(OPENSSL_PATH)/crypto/pkcs7/bio_pk7.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_asn1.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_attr.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_doit.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_lib.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_mime.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_smime.c - $(OPENSSL_PATH)/crypto/pkcs7/pkcs7err.c - $(OPENSSL_PATH)/crypto/rand/md_rand.c - $(OPENSSL_PATH)/crypto/rand/rand_egd.c - $(OPENSSL_PATH)/crypto/rand/rand_err.c - $(OPENSSL_PATH)/crypto/rand/rand_lib.c - $(OPENSSL_PATH)/crypto/rand/rand_unix.c - $(OPENSSL_PATH)/crypto/rand/rand_vms.c - $(OPENSSL_PATH)/crypto/rand/rand_win.c - $(OPENSSL_PATH)/crypto/rand/randfile.c - $(OPENSSL_PATH)/crypto/rc4/rc4_enc.c - $(OPENSSL_PATH)/crypto/rc4/rc4_skey.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ameth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_asn1.c - $(OPENSSL_PATH)/crypto/rsa/rsa_chk.c - $(OPENSSL_PATH)/crypto/rsa/rsa_crpt.c - $(OPENSSL_PATH)/crypto/rsa/rsa_depr.c - $(OPENSSL_PATH)/crypto/rsa/rsa_err.c - $(OPENSSL_PATH)/crypto/rsa/rsa_gen.c - $(OPENSSL_PATH)/crypto/rsa/rsa_lib.c - $(OPENSSL_PATH)/crypto/rsa/rsa_meth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_none.c - $(OPENSSL_PATH)/crypto/rsa/rsa_null.c - $(OPENSSL_PATH)/crypto/rsa/rsa_oaep.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ossl.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pk1.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pmeth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_prn.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pss.c - $(OPENSSL_PATH)/crypto/rsa/rsa_saos.c - $(OPENSSL_PATH)/crypto/rsa/rsa_sign.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ssl.c - $(OPENSSL_PATH)/crypto/rsa/rsa_x931.c - $(OPENSSL_PATH)/crypto/rsa/rsa_x931g.c - $(OPENSSL_PATH)/crypto/sha/sha1_one.c - $(OPENSSL_PATH)/crypto/sha/sha1dgst.c - $(OPENSSL_PATH)/crypto/sha/sha256.c - $(OPENSSL_PATH)/crypto/sha/sha512.c - $(OPENSSL_PATH)/crypto/stack/stack.c - $(OPENSSL_PATH)/crypto/threads_none.c - $(OPENSSL_PATH)/crypto/threads_pthread.c - $(OPENSSL_PATH)/crypto/threads_win.c - $(OPENSSL_PATH)/crypto/txt_db/txt_db.c - $(OPENSSL_PATH)/crypto/uid.c - $(OPENSSL_PATH)/crypto/x509/by_dir.c - $(OPENSSL_PATH)/crypto/x509/by_file.c - $(OPENSSL_PATH)/crypto/x509/t_crl.c - $(OPENSSL_PATH)/crypto/x509/t_req.c - $(OPENSSL_PATH)/crypto/x509/t_x509.c - $(OPENSSL_PATH)/crypto/x509/x509_att.c - $(OPENSSL_PATH)/crypto/x509/x509_cmp.c - $(OPENSSL_PATH)/crypto/x509/x509_d2.c - $(OPENSSL_PATH)/crypto/x509/x509_def.c - $(OPENSSL_PATH)/crypto/x509/x509_err.c - $(OPENSSL_PATH)/crypto/x509/x509_ext.c - $(OPENSSL_PATH)/crypto/x509/x509_lu.c - $(OPENSSL_PATH)/crypto/x509/x509_meth.c - $(OPENSSL_PATH)/crypto/x509/x509_obj.c - $(OPENSSL_PATH)/crypto/x509/x509_r2x.c - $(OPENSSL_PATH)/crypto/x509/x509_req.c - $(OPENSSL_PATH)/crypto/x509/x509_set.c - $(OPENSSL_PATH)/crypto/x509/x509_trs.c - $(OPENSSL_PATH)/crypto/x509/x509_txt.c - $(OPENSSL_PATH)/crypto/x509/x509_v3.c - $(OPENSSL_PATH)/crypto/x509/x509_vfy.c - $(OPENSSL_PATH)/crypto/x509/x509_vpm.c - $(OPENSSL_PATH)/crypto/x509/x509cset.c - $(OPENSSL_PATH)/crypto/x509/x509name.c - $(OPENSSL_PATH)/crypto/x509/x509rset.c - $(OPENSSL_PATH)/crypto/x509/x509spki.c - $(OPENSSL_PATH)/crypto/x509/x509type.c - $(OPENSSL_PATH)/crypto/x509/x_all.c - $(OPENSSL_PATH)/crypto/x509/x_attrib.c - $(OPENSSL_PATH)/crypto/x509/x_crl.c - $(OPENSSL_PATH)/crypto/x509/x_exten.c - $(OPENSSL_PATH)/crypto/x509/x_name.c - $(OPENSSL_PATH)/crypto/x509/x_pubkey.c - $(OPENSSL_PATH)/crypto/x509/x_req.c - $(OPENSSL_PATH)/crypto/x509/x_x509.c - $(OPENSSL_PATH)/crypto/x509/x_x509a.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_cache.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_data.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_lib.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_map.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_node.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_tree.c - $(OPENSSL_PATH)/crypto/x509v3/v3_addr.c - $(OPENSSL_PATH)/crypto/x509v3/v3_akey.c - $(OPENSSL_PATH)/crypto/x509v3/v3_akeya.c - $(OPENSSL_PATH)/crypto/x509v3/v3_alt.c - $(OPENSSL_PATH)/crypto/x509v3/v3_asid.c - $(OPENSSL_PATH)/crypto/x509v3/v3_bcons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_bitst.c - $(OPENSSL_PATH)/crypto/x509v3/v3_conf.c - $(OPENSSL_PATH)/crypto/x509v3/v3_cpols.c - $(OPENSSL_PATH)/crypto/x509v3/v3_crld.c - $(OPENSSL_PATH)/crypto/x509v3/v3_enum.c - $(OPENSSL_PATH)/crypto/x509v3/v3_extku.c - $(OPENSSL_PATH)/crypto/x509v3/v3_genn.c - $(OPENSSL_PATH)/crypto/x509v3/v3_ia5.c - $(OPENSSL_PATH)/crypto/x509v3/v3_info.c - $(OPENSSL_PATH)/crypto/x509v3/v3_int.c - $(OPENSSL_PATH)/crypto/x509v3/v3_lib.c - $(OPENSSL_PATH)/crypto/x509v3/v3_ncons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pci.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pcia.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pcons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pku.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pmaps.c - $(OPENSSL_PATH)/crypto/x509v3/v3_prn.c - $(OPENSSL_PATH)/crypto/x509v3/v3_purp.c - $(OPENSSL_PATH)/crypto/x509v3/v3_skey.c - $(OPENSSL_PATH)/crypto/x509v3/v3_sxnet.c - $(OPENSSL_PATH)/crypto/x509v3/v3_tlsf.c - $(OPENSSL_PATH)/crypto/x509v3/v3_utl.c - $(OPENSSL_PATH)/crypto/x509v3/v3err.c - $(OPENSSL_PATH)/ssl/bio_ssl.c - $(OPENSSL_PATH)/ssl/d1_lib.c - $(OPENSSL_PATH)/ssl/d1_msg.c - $(OPENSSL_PATH)/ssl/d1_srtp.c - $(OPENSSL_PATH)/ssl/methods.c - $(OPENSSL_PATH)/ssl/pqueue.c - $(OPENSSL_PATH)/ssl/record/dtls1_bitmap.c - $(OPENSSL_PATH)/ssl/record/rec_layer_d1.c - $(OPENSSL_PATH)/ssl/record/rec_layer_s3.c - $(OPENSSL_PATH)/ssl/record/ssl3_buffer.c - $(OPENSSL_PATH)/ssl/record/ssl3_record.c - $(OPENSSL_PATH)/ssl/s3_cbc.c - $(OPENSSL_PATH)/ssl/s3_enc.c - $(OPENSSL_PATH)/ssl/s3_lib.c - $(OPENSSL_PATH)/ssl/s3_msg.c - $(OPENSSL_PATH)/ssl/ssl_asn1.c - $(OPENSSL_PATH)/ssl/ssl_cert.c - $(OPENSSL_PATH)/ssl/ssl_ciph.c - $(OPENSSL_PATH)/ssl/ssl_conf.c - $(OPENSSL_PATH)/ssl/ssl_err.c - $(OPENSSL_PATH)/ssl/ssl_init.c - $(OPENSSL_PATH)/ssl/ssl_lib.c - $(OPENSSL_PATH)/ssl/ssl_mcnf.c - $(OPENSSL_PATH)/ssl/ssl_rsa.c - $(OPENSSL_PATH)/ssl/ssl_sess.c - $(OPENSSL_PATH)/ssl/ssl_stat.c - $(OPENSSL_PATH)/ssl/ssl_txt.c - $(OPENSSL_PATH)/ssl/ssl_utst.c - $(OPENSSL_PATH)/ssl/statem/statem.c - $(OPENSSL_PATH)/ssl/statem/statem_clnt.c - $(OPENSSL_PATH)/ssl/statem/statem_dtls.c - $(OPENSSL_PATH)/ssl/statem/statem_lib.c - $(OPENSSL_PATH)/ssl/statem/statem_srvr.c - $(OPENSSL_PATH)/ssl/t1_enc.c - $(OPENSSL_PATH)/ssl/t1_ext.c - $(OPENSSL_PATH)/ssl/t1_lib.c - $(OPENSSL_PATH)/ssl/t1_reneg.c - $(OPENSSL_PATH)/ssl/t1_trce.c - $(OPENSSL_PATH)/ssl/tls_srp.c -# Autogenerated files list ends here - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - DebugLib - -[LibraryClasses.ARM] - ArmSoftFloatLib - -[BuildOptions] - # - # Disables the following Visual Studio compiler warnings brought by openssl source, - # so we do not break the build with /WX option: - # C4090: 'function' : different 'const' qualifiers - # C4244: conversion from type1 to type2, possible loss of data - # C4245: conversion from type1 to type2, signed/unsigned mismatch - # C4267: conversion from size_t to type, possible loss of data - # C4306: 'identifier' : conversion from 'type1' to 'type2' of greater size - # C4389: 'operator' : signed/unsigned mismatch (xxxx) - # C4702: unreachable code - # C4706: assignment within conditional expression - # C4819: The file contains a character that cannot be represented in the current code page - # - MSFT:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4244 /wd4245 /wd4267 /wd4389 /wd4702 /wd4706 /wd4819 - MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4244 /wd4245 /wd4267 /wd4306 /wd4389 /wd4702 /wd4706 /wd4819 - - INTEL:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w - INTEL:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w - - # - # Suppress the following build warnings in openssl so we don't break the build with -Werror - # -Werror=maybe-uninitialized: there exist some other paths for which the variable is not initialized. - # -Werror=format: Check calls to printf and scanf, etc., to make sure that the arguments supplied have - # types appropriate to the format string specified. - # - GCC:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized - GCC:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -DNO_MSABI_VA_FUNCS - GCC:*_*_ARM_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized - GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format - - # suppress the following warnings in openssl so we don't break the build with warnings-as-errors: - # 1295: Deprecated declaration - give arg types - # 550: was set but never used - # 1293: assignment in condition - # 111: statement is unreachable (invariably "break;" after "return X;" in case statement) - # 68: integer conversion resulted in a change of sign ("if (Status == -1)") - # 177: was declared but never referenced - # 223: function declared implicitly - # 144: a value of type cannot be used to initialize an entity of type - # 513: a value of type cannot be assigned to an entity of type - # 188: enumerated type mixed with another type (i.e. passing an integer as an enum without a cast) - # 1296: Extended constant initialiser used - # 128: loop is not reachable - may be emitted inappropriately if code follows a conditional return - # from the function that evaluates to true at compile time - # 546: transfer of control bypasses initialization - may be emitted inappropriately if the uninitialized - # variable is never referenced after the jump - # 1: ignore "#1-D: last line of file ends without a newline" - # 3017: may be used before being set (NOTE: This was fixed in OpenSSL 1.1 HEAD with - # commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.) - RVCT:*_*_ARM_CC_FLAGS = $(OPENSSL_FLAGS) --library_interface=aeabi_clib99 --diag_suppress=1296,1295,550,1293,111,68,177,223,144,513,188,128,546,1,3017 -JCryptoPkg/Include - XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -w - XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -w - - # - # AARCH64 uses strict alignment and avoids SIMD registers for code that may execute - # with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well as BASE - # libraries, given that they may be included into such modules. - # This library, even though of the BASE type, is never used in such cases, and - # avoiding the SIMD register file (which is shared with the FPU) prevents the - # compiler from successfully building some of the OpenSSL source files that - # use floating point types, so clear the flags here. - # - GCC:*_*_AARCH64_CC_XIPFLAGS == diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.uni deleted file mode 100644 index f91f2ca..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// This module provides openSSL Library implementation. -// -// This module provides OpenSSL Library implementation. -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "OpenSSL Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "This module provides OpenSSL Library implementation." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf deleted file mode 100644 index 9a64c80..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf +++ /dev/null @@ -1,558 +0,0 @@ -## @file -# This module provides OpenSSL Library implementation. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = OpensslLibCrypto - MODULE_UNI_FILE = OpensslLibCrypto.uni - FILE_GUID = E29FC209-8B64-4500-BD20-AF4EAE47EA0E - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = OpensslLib - DEFINE OPENSSL_PATH = openssl - DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNO_SYSLOG - -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - $(OPENSSL_PATH)/e_os.h -# Autogenerated files list starts here - $(OPENSSL_PATH)/crypto/aes/aes_cbc.c - $(OPENSSL_PATH)/crypto/aes/aes_cfb.c - $(OPENSSL_PATH)/crypto/aes/aes_core.c - $(OPENSSL_PATH)/crypto/aes/aes_ecb.c - $(OPENSSL_PATH)/crypto/aes/aes_ige.c - $(OPENSSL_PATH)/crypto/aes/aes_misc.c - $(OPENSSL_PATH)/crypto/aes/aes_ofb.c - $(OPENSSL_PATH)/crypto/aes/aes_wrap.c - $(OPENSSL_PATH)/crypto/asn1/a_bitstr.c - $(OPENSSL_PATH)/crypto/asn1/a_d2i_fp.c - $(OPENSSL_PATH)/crypto/asn1/a_digest.c - $(OPENSSL_PATH)/crypto/asn1/a_dup.c - $(OPENSSL_PATH)/crypto/asn1/a_gentm.c - $(OPENSSL_PATH)/crypto/asn1/a_i2d_fp.c - $(OPENSSL_PATH)/crypto/asn1/a_int.c - $(OPENSSL_PATH)/crypto/asn1/a_mbstr.c - $(OPENSSL_PATH)/crypto/asn1/a_object.c - $(OPENSSL_PATH)/crypto/asn1/a_octet.c - $(OPENSSL_PATH)/crypto/asn1/a_print.c - $(OPENSSL_PATH)/crypto/asn1/a_sign.c - $(OPENSSL_PATH)/crypto/asn1/a_strex.c - $(OPENSSL_PATH)/crypto/asn1/a_strnid.c - $(OPENSSL_PATH)/crypto/asn1/a_time.c - $(OPENSSL_PATH)/crypto/asn1/a_type.c - $(OPENSSL_PATH)/crypto/asn1/a_utctm.c - $(OPENSSL_PATH)/crypto/asn1/a_utf8.c - $(OPENSSL_PATH)/crypto/asn1/a_verify.c - $(OPENSSL_PATH)/crypto/asn1/ameth_lib.c - $(OPENSSL_PATH)/crypto/asn1/asn1_err.c - $(OPENSSL_PATH)/crypto/asn1/asn1_gen.c - $(OPENSSL_PATH)/crypto/asn1/asn1_lib.c - $(OPENSSL_PATH)/crypto/asn1/asn1_par.c - $(OPENSSL_PATH)/crypto/asn1/asn_mime.c - $(OPENSSL_PATH)/crypto/asn1/asn_moid.c - $(OPENSSL_PATH)/crypto/asn1/asn_mstbl.c - $(OPENSSL_PATH)/crypto/asn1/asn_pack.c - $(OPENSSL_PATH)/crypto/asn1/bio_asn1.c - $(OPENSSL_PATH)/crypto/asn1/bio_ndef.c - $(OPENSSL_PATH)/crypto/asn1/d2i_pr.c - $(OPENSSL_PATH)/crypto/asn1/d2i_pu.c - $(OPENSSL_PATH)/crypto/asn1/evp_asn1.c - $(OPENSSL_PATH)/crypto/asn1/f_int.c - $(OPENSSL_PATH)/crypto/asn1/f_string.c - $(OPENSSL_PATH)/crypto/asn1/i2d_pr.c - $(OPENSSL_PATH)/crypto/asn1/i2d_pu.c - $(OPENSSL_PATH)/crypto/asn1/n_pkey.c - $(OPENSSL_PATH)/crypto/asn1/nsseq.c - $(OPENSSL_PATH)/crypto/asn1/p5_pbe.c - $(OPENSSL_PATH)/crypto/asn1/p5_pbev2.c - $(OPENSSL_PATH)/crypto/asn1/p5_scrypt.c - $(OPENSSL_PATH)/crypto/asn1/p8_pkey.c - $(OPENSSL_PATH)/crypto/asn1/t_bitst.c - $(OPENSSL_PATH)/crypto/asn1/t_pkey.c - $(OPENSSL_PATH)/crypto/asn1/t_spki.c - $(OPENSSL_PATH)/crypto/asn1/tasn_dec.c - $(OPENSSL_PATH)/crypto/asn1/tasn_enc.c - $(OPENSSL_PATH)/crypto/asn1/tasn_fre.c - $(OPENSSL_PATH)/crypto/asn1/tasn_new.c - $(OPENSSL_PATH)/crypto/asn1/tasn_prn.c - $(OPENSSL_PATH)/crypto/asn1/tasn_scn.c - $(OPENSSL_PATH)/crypto/asn1/tasn_typ.c - $(OPENSSL_PATH)/crypto/asn1/tasn_utl.c - $(OPENSSL_PATH)/crypto/asn1/x_algor.c - $(OPENSSL_PATH)/crypto/asn1/x_bignum.c - $(OPENSSL_PATH)/crypto/asn1/x_info.c - $(OPENSSL_PATH)/crypto/asn1/x_int64.c - $(OPENSSL_PATH)/crypto/asn1/x_long.c - $(OPENSSL_PATH)/crypto/asn1/x_pkey.c - $(OPENSSL_PATH)/crypto/asn1/x_sig.c - $(OPENSSL_PATH)/crypto/asn1/x_spki.c - $(OPENSSL_PATH)/crypto/asn1/x_val.c - $(OPENSSL_PATH)/crypto/async/arch/async_null.c - $(OPENSSL_PATH)/crypto/async/arch/async_posix.c - $(OPENSSL_PATH)/crypto/async/arch/async_win.c - $(OPENSSL_PATH)/crypto/async/async.c - $(OPENSSL_PATH)/crypto/async/async_err.c - $(OPENSSL_PATH)/crypto/async/async_wait.c - $(OPENSSL_PATH)/crypto/bio/b_addr.c - $(OPENSSL_PATH)/crypto/bio/b_dump.c - $(OPENSSL_PATH)/crypto/bio/b_sock.c - $(OPENSSL_PATH)/crypto/bio/b_sock2.c - $(OPENSSL_PATH)/crypto/bio/bf_buff.c - $(OPENSSL_PATH)/crypto/bio/bf_lbuf.c - $(OPENSSL_PATH)/crypto/bio/bf_nbio.c - $(OPENSSL_PATH)/crypto/bio/bf_null.c - $(OPENSSL_PATH)/crypto/bio/bio_cb.c - $(OPENSSL_PATH)/crypto/bio/bio_err.c - $(OPENSSL_PATH)/crypto/bio/bio_lib.c - $(OPENSSL_PATH)/crypto/bio/bio_meth.c - $(OPENSSL_PATH)/crypto/bio/bss_acpt.c - $(OPENSSL_PATH)/crypto/bio/bss_bio.c - $(OPENSSL_PATH)/crypto/bio/bss_conn.c - $(OPENSSL_PATH)/crypto/bio/bss_dgram.c - $(OPENSSL_PATH)/crypto/bio/bss_fd.c - $(OPENSSL_PATH)/crypto/bio/bss_file.c - $(OPENSSL_PATH)/crypto/bio/bss_log.c - $(OPENSSL_PATH)/crypto/bio/bss_mem.c - $(OPENSSL_PATH)/crypto/bio/bss_null.c - $(OPENSSL_PATH)/crypto/bio/bss_sock.c - $(OPENSSL_PATH)/crypto/bn/bn_add.c - $(OPENSSL_PATH)/crypto/bn/bn_asm.c - $(OPENSSL_PATH)/crypto/bn/bn_blind.c - $(OPENSSL_PATH)/crypto/bn/bn_const.c - $(OPENSSL_PATH)/crypto/bn/bn_ctx.c - $(OPENSSL_PATH)/crypto/bn/bn_depr.c - $(OPENSSL_PATH)/crypto/bn/bn_dh.c - $(OPENSSL_PATH)/crypto/bn/bn_div.c - $(OPENSSL_PATH)/crypto/bn/bn_err.c - $(OPENSSL_PATH)/crypto/bn/bn_exp.c - $(OPENSSL_PATH)/crypto/bn/bn_exp2.c - $(OPENSSL_PATH)/crypto/bn/bn_gcd.c - $(OPENSSL_PATH)/crypto/bn/bn_gf2m.c - $(OPENSSL_PATH)/crypto/bn/bn_intern.c - $(OPENSSL_PATH)/crypto/bn/bn_kron.c - $(OPENSSL_PATH)/crypto/bn/bn_lib.c - $(OPENSSL_PATH)/crypto/bn/bn_mod.c - $(OPENSSL_PATH)/crypto/bn/bn_mont.c - $(OPENSSL_PATH)/crypto/bn/bn_mpi.c - $(OPENSSL_PATH)/crypto/bn/bn_mul.c - $(OPENSSL_PATH)/crypto/bn/bn_nist.c - $(OPENSSL_PATH)/crypto/bn/bn_prime.c - $(OPENSSL_PATH)/crypto/bn/bn_print.c - $(OPENSSL_PATH)/crypto/bn/bn_rand.c - $(OPENSSL_PATH)/crypto/bn/bn_recp.c - $(OPENSSL_PATH)/crypto/bn/bn_shift.c - $(OPENSSL_PATH)/crypto/bn/bn_sqr.c - $(OPENSSL_PATH)/crypto/bn/bn_sqrt.c - $(OPENSSL_PATH)/crypto/bn/bn_srp.c - $(OPENSSL_PATH)/crypto/bn/bn_word.c - $(OPENSSL_PATH)/crypto/bn/bn_x931p.c - $(OPENSSL_PATH)/crypto/buffer/buf_err.c - $(OPENSSL_PATH)/crypto/buffer/buffer.c - $(OPENSSL_PATH)/crypto/cmac/cm_ameth.c - $(OPENSSL_PATH)/crypto/cmac/cm_pmeth.c - $(OPENSSL_PATH)/crypto/cmac/cmac.c - $(OPENSSL_PATH)/crypto/comp/c_zlib.c - $(OPENSSL_PATH)/crypto/comp/comp_err.c - $(OPENSSL_PATH)/crypto/comp/comp_lib.c - $(OPENSSL_PATH)/crypto/conf/conf_api.c - $(OPENSSL_PATH)/crypto/conf/conf_def.c - $(OPENSSL_PATH)/crypto/conf/conf_err.c - $(OPENSSL_PATH)/crypto/conf/conf_lib.c - $(OPENSSL_PATH)/crypto/conf/conf_mall.c - $(OPENSSL_PATH)/crypto/conf/conf_mod.c - $(OPENSSL_PATH)/crypto/conf/conf_sap.c - $(OPENSSL_PATH)/crypto/conf/conf_ssl.c - $(OPENSSL_PATH)/crypto/cpt_err.c - $(OPENSSL_PATH)/crypto/cryptlib.c - $(OPENSSL_PATH)/crypto/cversion.c - $(OPENSSL_PATH)/crypto/des/cbc_cksm.c - $(OPENSSL_PATH)/crypto/des/cbc_enc.c - $(OPENSSL_PATH)/crypto/des/cfb64ede.c - $(OPENSSL_PATH)/crypto/des/cfb64enc.c - $(OPENSSL_PATH)/crypto/des/cfb_enc.c - $(OPENSSL_PATH)/crypto/des/des_enc.c - $(OPENSSL_PATH)/crypto/des/ecb3_enc.c - $(OPENSSL_PATH)/crypto/des/ecb_enc.c - $(OPENSSL_PATH)/crypto/des/fcrypt.c - $(OPENSSL_PATH)/crypto/des/fcrypt_b.c - $(OPENSSL_PATH)/crypto/des/ofb64ede.c - $(OPENSSL_PATH)/crypto/des/ofb64enc.c - $(OPENSSL_PATH)/crypto/des/ofb_enc.c - $(OPENSSL_PATH)/crypto/des/pcbc_enc.c - $(OPENSSL_PATH)/crypto/des/qud_cksm.c - $(OPENSSL_PATH)/crypto/des/rand_key.c - $(OPENSSL_PATH)/crypto/des/rpc_enc.c - $(OPENSSL_PATH)/crypto/des/set_key.c - $(OPENSSL_PATH)/crypto/des/str2key.c - $(OPENSSL_PATH)/crypto/des/xcbc_enc.c - $(OPENSSL_PATH)/crypto/dh/dh_ameth.c - $(OPENSSL_PATH)/crypto/dh/dh_asn1.c - $(OPENSSL_PATH)/crypto/dh/dh_check.c - $(OPENSSL_PATH)/crypto/dh/dh_depr.c - $(OPENSSL_PATH)/crypto/dh/dh_err.c - $(OPENSSL_PATH)/crypto/dh/dh_gen.c - $(OPENSSL_PATH)/crypto/dh/dh_kdf.c - $(OPENSSL_PATH)/crypto/dh/dh_key.c - $(OPENSSL_PATH)/crypto/dh/dh_lib.c - $(OPENSSL_PATH)/crypto/dh/dh_meth.c - $(OPENSSL_PATH)/crypto/dh/dh_pmeth.c - $(OPENSSL_PATH)/crypto/dh/dh_prn.c - $(OPENSSL_PATH)/crypto/dh/dh_rfc5114.c - $(OPENSSL_PATH)/crypto/dso/dso_dl.c - $(OPENSSL_PATH)/crypto/dso/dso_dlfcn.c - $(OPENSSL_PATH)/crypto/dso/dso_err.c - $(OPENSSL_PATH)/crypto/dso/dso_lib.c - $(OPENSSL_PATH)/crypto/dso/dso_openssl.c - $(OPENSSL_PATH)/crypto/dso/dso_vms.c - $(OPENSSL_PATH)/crypto/dso/dso_win32.c - $(OPENSSL_PATH)/crypto/ebcdic.c - $(OPENSSL_PATH)/crypto/err/err.c - $(OPENSSL_PATH)/crypto/err/err_all.c - $(OPENSSL_PATH)/crypto/err/err_prn.c - $(OPENSSL_PATH)/crypto/evp/bio_b64.c - $(OPENSSL_PATH)/crypto/evp/bio_enc.c - $(OPENSSL_PATH)/crypto/evp/bio_md.c - $(OPENSSL_PATH)/crypto/evp/bio_ok.c - $(OPENSSL_PATH)/crypto/evp/c_allc.c - $(OPENSSL_PATH)/crypto/evp/c_alld.c - $(OPENSSL_PATH)/crypto/evp/cmeth_lib.c - $(OPENSSL_PATH)/crypto/evp/digest.c - $(OPENSSL_PATH)/crypto/evp/e_aes.c - $(OPENSSL_PATH)/crypto/evp/e_aes_cbc_hmac_sha1.c - $(OPENSSL_PATH)/crypto/evp/e_aes_cbc_hmac_sha256.c - $(OPENSSL_PATH)/crypto/evp/e_bf.c - $(OPENSSL_PATH)/crypto/evp/e_camellia.c - $(OPENSSL_PATH)/crypto/evp/e_cast.c - $(OPENSSL_PATH)/crypto/evp/e_chacha20_poly1305.c - $(OPENSSL_PATH)/crypto/evp/e_des.c - $(OPENSSL_PATH)/crypto/evp/e_des3.c - $(OPENSSL_PATH)/crypto/evp/e_idea.c - $(OPENSSL_PATH)/crypto/evp/e_null.c - $(OPENSSL_PATH)/crypto/evp/e_old.c - $(OPENSSL_PATH)/crypto/evp/e_rc2.c - $(OPENSSL_PATH)/crypto/evp/e_rc4.c - $(OPENSSL_PATH)/crypto/evp/e_rc4_hmac_md5.c - $(OPENSSL_PATH)/crypto/evp/e_rc5.c - $(OPENSSL_PATH)/crypto/evp/e_seed.c - $(OPENSSL_PATH)/crypto/evp/e_xcbc_d.c - $(OPENSSL_PATH)/crypto/evp/encode.c - $(OPENSSL_PATH)/crypto/evp/evp_cnf.c - $(OPENSSL_PATH)/crypto/evp/evp_enc.c - $(OPENSSL_PATH)/crypto/evp/evp_err.c - $(OPENSSL_PATH)/crypto/evp/evp_key.c - $(OPENSSL_PATH)/crypto/evp/evp_lib.c - $(OPENSSL_PATH)/crypto/evp/evp_pbe.c - $(OPENSSL_PATH)/crypto/evp/evp_pkey.c - $(OPENSSL_PATH)/crypto/evp/m_md2.c - $(OPENSSL_PATH)/crypto/evp/m_md4.c - $(OPENSSL_PATH)/crypto/evp/m_md5.c - $(OPENSSL_PATH)/crypto/evp/m_md5_sha1.c - $(OPENSSL_PATH)/crypto/evp/m_mdc2.c - $(OPENSSL_PATH)/crypto/evp/m_null.c - $(OPENSSL_PATH)/crypto/evp/m_ripemd.c - $(OPENSSL_PATH)/crypto/evp/m_sha1.c - $(OPENSSL_PATH)/crypto/evp/m_sigver.c - $(OPENSSL_PATH)/crypto/evp/m_wp.c - $(OPENSSL_PATH)/crypto/evp/names.c - $(OPENSSL_PATH)/crypto/evp/p5_crpt.c - $(OPENSSL_PATH)/crypto/evp/p5_crpt2.c - $(OPENSSL_PATH)/crypto/evp/p_dec.c - $(OPENSSL_PATH)/crypto/evp/p_enc.c - $(OPENSSL_PATH)/crypto/evp/p_lib.c - $(OPENSSL_PATH)/crypto/evp/p_open.c - $(OPENSSL_PATH)/crypto/evp/p_seal.c - $(OPENSSL_PATH)/crypto/evp/p_sign.c - $(OPENSSL_PATH)/crypto/evp/p_verify.c - $(OPENSSL_PATH)/crypto/evp/pmeth_fn.c - $(OPENSSL_PATH)/crypto/evp/pmeth_gn.c - $(OPENSSL_PATH)/crypto/evp/pmeth_lib.c - $(OPENSSL_PATH)/crypto/evp/scrypt.c - $(OPENSSL_PATH)/crypto/ex_data.c - $(OPENSSL_PATH)/crypto/getenv.c - $(OPENSSL_PATH)/crypto/hmac/hm_ameth.c - $(OPENSSL_PATH)/crypto/hmac/hm_pmeth.c - $(OPENSSL_PATH)/crypto/hmac/hmac.c - $(OPENSSL_PATH)/crypto/init.c - $(OPENSSL_PATH)/crypto/kdf/hkdf.c - $(OPENSSL_PATH)/crypto/kdf/kdf_err.c - $(OPENSSL_PATH)/crypto/kdf/tls1_prf.c - $(OPENSSL_PATH)/crypto/lhash/lh_stats.c - $(OPENSSL_PATH)/crypto/lhash/lhash.c - $(OPENSSL_PATH)/crypto/md4/md4_dgst.c - $(OPENSSL_PATH)/crypto/md4/md4_one.c - $(OPENSSL_PATH)/crypto/md5/md5_dgst.c - $(OPENSSL_PATH)/crypto/md5/md5_one.c - $(OPENSSL_PATH)/crypto/mem.c - $(OPENSSL_PATH)/crypto/mem_clr.c - $(OPENSSL_PATH)/crypto/mem_dbg.c - $(OPENSSL_PATH)/crypto/mem_sec.c - $(OPENSSL_PATH)/crypto/modes/cbc128.c - $(OPENSSL_PATH)/crypto/modes/ccm128.c - $(OPENSSL_PATH)/crypto/modes/cfb128.c - $(OPENSSL_PATH)/crypto/modes/ctr128.c - $(OPENSSL_PATH)/crypto/modes/cts128.c - $(OPENSSL_PATH)/crypto/modes/gcm128.c - $(OPENSSL_PATH)/crypto/modes/ocb128.c - $(OPENSSL_PATH)/crypto/modes/ofb128.c - $(OPENSSL_PATH)/crypto/modes/wrap128.c - $(OPENSSL_PATH)/crypto/modes/xts128.c - $(OPENSSL_PATH)/crypto/o_dir.c - $(OPENSSL_PATH)/crypto/o_fips.c - $(OPENSSL_PATH)/crypto/o_fopen.c - $(OPENSSL_PATH)/crypto/o_init.c - $(OPENSSL_PATH)/crypto/o_str.c - $(OPENSSL_PATH)/crypto/o_time.c - $(OPENSSL_PATH)/crypto/objects/o_names.c - $(OPENSSL_PATH)/crypto/objects/obj_dat.c - $(OPENSSL_PATH)/crypto/objects/obj_err.c - $(OPENSSL_PATH)/crypto/objects/obj_lib.c - $(OPENSSL_PATH)/crypto/objects/obj_xref.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_asn.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_cl.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_err.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_ext.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_ht.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_lib.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_prn.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_srv.c - $(OPENSSL_PATH)/crypto/ocsp/ocsp_vfy.c - $(OPENSSL_PATH)/crypto/ocsp/v3_ocsp.c - $(OPENSSL_PATH)/crypto/pem/pem_all.c - $(OPENSSL_PATH)/crypto/pem/pem_err.c - $(OPENSSL_PATH)/crypto/pem/pem_info.c - $(OPENSSL_PATH)/crypto/pem/pem_lib.c - $(OPENSSL_PATH)/crypto/pem/pem_oth.c - $(OPENSSL_PATH)/crypto/pem/pem_pk8.c - $(OPENSSL_PATH)/crypto/pem/pem_pkey.c - $(OPENSSL_PATH)/crypto/pem/pem_sign.c - $(OPENSSL_PATH)/crypto/pem/pem_x509.c - $(OPENSSL_PATH)/crypto/pem/pem_xaux.c - $(OPENSSL_PATH)/crypto/pem/pvkfmt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_add.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_asn.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_attr.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_crpt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_crt.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_decr.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_init.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_key.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_kiss.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_mutl.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_npas.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_p8d.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_p8e.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_sbag.c - $(OPENSSL_PATH)/crypto/pkcs12/p12_utl.c - $(OPENSSL_PATH)/crypto/pkcs12/pk12err.c - $(OPENSSL_PATH)/crypto/pkcs7/bio_pk7.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_asn1.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_attr.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_doit.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_lib.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_mime.c - $(OPENSSL_PATH)/crypto/pkcs7/pk7_smime.c - $(OPENSSL_PATH)/crypto/pkcs7/pkcs7err.c - $(OPENSSL_PATH)/crypto/rand/md_rand.c - $(OPENSSL_PATH)/crypto/rand/rand_egd.c - $(OPENSSL_PATH)/crypto/rand/rand_err.c - $(OPENSSL_PATH)/crypto/rand/rand_lib.c - $(OPENSSL_PATH)/crypto/rand/rand_unix.c - $(OPENSSL_PATH)/crypto/rand/rand_vms.c - $(OPENSSL_PATH)/crypto/rand/rand_win.c - $(OPENSSL_PATH)/crypto/rand/randfile.c - $(OPENSSL_PATH)/crypto/rc4/rc4_enc.c - $(OPENSSL_PATH)/crypto/rc4/rc4_skey.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ameth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_asn1.c - $(OPENSSL_PATH)/crypto/rsa/rsa_chk.c - $(OPENSSL_PATH)/crypto/rsa/rsa_crpt.c - $(OPENSSL_PATH)/crypto/rsa/rsa_depr.c - $(OPENSSL_PATH)/crypto/rsa/rsa_err.c - $(OPENSSL_PATH)/crypto/rsa/rsa_gen.c - $(OPENSSL_PATH)/crypto/rsa/rsa_lib.c - $(OPENSSL_PATH)/crypto/rsa/rsa_meth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_none.c - $(OPENSSL_PATH)/crypto/rsa/rsa_null.c - $(OPENSSL_PATH)/crypto/rsa/rsa_oaep.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ossl.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pk1.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pmeth.c - $(OPENSSL_PATH)/crypto/rsa/rsa_prn.c - $(OPENSSL_PATH)/crypto/rsa/rsa_pss.c - $(OPENSSL_PATH)/crypto/rsa/rsa_saos.c - $(OPENSSL_PATH)/crypto/rsa/rsa_sign.c - $(OPENSSL_PATH)/crypto/rsa/rsa_ssl.c - $(OPENSSL_PATH)/crypto/rsa/rsa_x931.c - $(OPENSSL_PATH)/crypto/rsa/rsa_x931g.c - $(OPENSSL_PATH)/crypto/sha/sha1_one.c - $(OPENSSL_PATH)/crypto/sha/sha1dgst.c - $(OPENSSL_PATH)/crypto/sha/sha256.c - $(OPENSSL_PATH)/crypto/sha/sha512.c - $(OPENSSL_PATH)/crypto/stack/stack.c - $(OPENSSL_PATH)/crypto/threads_none.c - $(OPENSSL_PATH)/crypto/threads_pthread.c - $(OPENSSL_PATH)/crypto/threads_win.c - $(OPENSSL_PATH)/crypto/txt_db/txt_db.c - $(OPENSSL_PATH)/crypto/uid.c - $(OPENSSL_PATH)/crypto/x509/by_dir.c - $(OPENSSL_PATH)/crypto/x509/by_file.c - $(OPENSSL_PATH)/crypto/x509/t_crl.c - $(OPENSSL_PATH)/crypto/x509/t_req.c - $(OPENSSL_PATH)/crypto/x509/t_x509.c - $(OPENSSL_PATH)/crypto/x509/x509_att.c - $(OPENSSL_PATH)/crypto/x509/x509_cmp.c - $(OPENSSL_PATH)/crypto/x509/x509_d2.c - $(OPENSSL_PATH)/crypto/x509/x509_def.c - $(OPENSSL_PATH)/crypto/x509/x509_err.c - $(OPENSSL_PATH)/crypto/x509/x509_ext.c - $(OPENSSL_PATH)/crypto/x509/x509_lu.c - $(OPENSSL_PATH)/crypto/x509/x509_meth.c - $(OPENSSL_PATH)/crypto/x509/x509_obj.c - $(OPENSSL_PATH)/crypto/x509/x509_r2x.c - $(OPENSSL_PATH)/crypto/x509/x509_req.c - $(OPENSSL_PATH)/crypto/x509/x509_set.c - $(OPENSSL_PATH)/crypto/x509/x509_trs.c - $(OPENSSL_PATH)/crypto/x509/x509_txt.c - $(OPENSSL_PATH)/crypto/x509/x509_v3.c - $(OPENSSL_PATH)/crypto/x509/x509_vfy.c - $(OPENSSL_PATH)/crypto/x509/x509_vpm.c - $(OPENSSL_PATH)/crypto/x509/x509cset.c - $(OPENSSL_PATH)/crypto/x509/x509name.c - $(OPENSSL_PATH)/crypto/x509/x509rset.c - $(OPENSSL_PATH)/crypto/x509/x509spki.c - $(OPENSSL_PATH)/crypto/x509/x509type.c - $(OPENSSL_PATH)/crypto/x509/x_all.c - $(OPENSSL_PATH)/crypto/x509/x_attrib.c - $(OPENSSL_PATH)/crypto/x509/x_crl.c - $(OPENSSL_PATH)/crypto/x509/x_exten.c - $(OPENSSL_PATH)/crypto/x509/x_name.c - $(OPENSSL_PATH)/crypto/x509/x_pubkey.c - $(OPENSSL_PATH)/crypto/x509/x_req.c - $(OPENSSL_PATH)/crypto/x509/x_x509.c - $(OPENSSL_PATH)/crypto/x509/x_x509a.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_cache.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_data.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_lib.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_map.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_node.c - $(OPENSSL_PATH)/crypto/x509v3/pcy_tree.c - $(OPENSSL_PATH)/crypto/x509v3/v3_addr.c - $(OPENSSL_PATH)/crypto/x509v3/v3_akey.c - $(OPENSSL_PATH)/crypto/x509v3/v3_akeya.c - $(OPENSSL_PATH)/crypto/x509v3/v3_alt.c - $(OPENSSL_PATH)/crypto/x509v3/v3_asid.c - $(OPENSSL_PATH)/crypto/x509v3/v3_bcons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_bitst.c - $(OPENSSL_PATH)/crypto/x509v3/v3_conf.c - $(OPENSSL_PATH)/crypto/x509v3/v3_cpols.c - $(OPENSSL_PATH)/crypto/x509v3/v3_crld.c - $(OPENSSL_PATH)/crypto/x509v3/v3_enum.c - $(OPENSSL_PATH)/crypto/x509v3/v3_extku.c - $(OPENSSL_PATH)/crypto/x509v3/v3_genn.c - $(OPENSSL_PATH)/crypto/x509v3/v3_ia5.c - $(OPENSSL_PATH)/crypto/x509v3/v3_info.c - $(OPENSSL_PATH)/crypto/x509v3/v3_int.c - $(OPENSSL_PATH)/crypto/x509v3/v3_lib.c - $(OPENSSL_PATH)/crypto/x509v3/v3_ncons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pci.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pcia.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pcons.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pku.c - $(OPENSSL_PATH)/crypto/x509v3/v3_pmaps.c - $(OPENSSL_PATH)/crypto/x509v3/v3_prn.c - $(OPENSSL_PATH)/crypto/x509v3/v3_purp.c - $(OPENSSL_PATH)/crypto/x509v3/v3_skey.c - $(OPENSSL_PATH)/crypto/x509v3/v3_sxnet.c - $(OPENSSL_PATH)/crypto/x509v3/v3_tlsf.c - $(OPENSSL_PATH)/crypto/x509v3/v3_utl.c - $(OPENSSL_PATH)/crypto/x509v3/v3err.c -# Autogenerated files list ends here - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - DebugLib - -[LibraryClasses.ARM] - ArmSoftFloatLib - -[BuildOptions] - # - # Disables the following Visual Studio compiler warnings brought by openssl source, - # so we do not break the build with /WX option: - # C4090: 'function' : different 'const' qualifiers - # C4244: conversion from type1 to type2, possible loss of data - # C4245: conversion from type1 to type2, signed/unsigned mismatch - # C4267: conversion from size_t to type, possible loss of data - # C4306: 'identifier' : conversion from 'type1' to 'type2' of greater size - # C4389: 'operator' : signed/unsigned mismatch (xxxx) - # C4702: unreachable code - # C4706: assignment within conditional expression - # C4819: The file contains a character that cannot be represented in the current code page - # - MSFT:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4244 /wd4245 /wd4267 /wd4389 /wd4702 /wd4706 /wd4819 - MSFT:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4244 /wd4245 /wd4267 /wd4306 /wd4389 /wd4702 /wd4706 /wd4819 - - INTEL:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w - INTEL:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w - - # - # Suppress the following build warnings in openssl so we don't break the build with -Werror - # -Werror=maybe-uninitialized: there exist some other paths for which the variable is not initialized. - # -Werror=format: Check calls to printf and scanf, etc., to make sure that the arguments supplied have - # types appropriate to the format string specified. - # - GCC:*_*_IA32_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized - GCC:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -DNO_MSABI_VA_FUNCS - GCC:*_*_ARM_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized - GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format - - # suppress the following warnings in openssl so we don't break the build with warnings-as-errors: - # 1295: Deprecated declaration - give arg types - # 550: was set but never used - # 1293: assignment in condition - # 111: statement is unreachable (invariably "break;" after "return X;" in case statement) - # 68: integer conversion resulted in a change of sign ("if (Status == -1)") - # 177: was declared but never referenced - # 223: function declared implicitly - # 144: a value of type cannot be used to initialize an entity of type - # 513: a value of type cannot be assigned to an entity of type - # 188: enumerated type mixed with another type (i.e. passing an integer as an enum without a cast) - # 1296: Extended constant initialiser used - # 128: loop is not reachable - may be emitted inappropriately if code follows a conditional return - # from the function that evaluates to true at compile time - # 546: transfer of control bypasses initialization - may be emitted inappropriately if the uninitialized - # variable is never referenced after the jump - # 1: ignore "#1-D: last line of file ends without a newline" - # 3017: may be used before being set (NOTE: This was fixed in OpenSSL 1.1 HEAD with - # commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.) - RVCT:*_*_ARM_CC_FLAGS = $(OPENSSL_FLAGS) --library_interface=aeabi_clib99 --diag_suppress=1296,1295,550,1293,111,68,177,223,144,513,188,128,546,1,3017 -JCryptoPkg/Include - XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -w - XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -w - - # - # AARCH64 uses strict alignment and avoids SIMD registers for code that may execute - # with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well as BASE - # libraries, given that they may be included into such modules. - # This library, even though of the BASE type, is never used in such cases, and - # avoiding the SIMD register file (which is shared with the FPU) prevents the - # compiler from successfully building some of the OpenSSL source files that - # use floating point types, so clear the flags here. - # - GCC:*_*_AARCH64_CC_XIPFLAGS == diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.uni deleted file mode 100644 index 4defa21..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// This module provides openSSL Library implementation (libcrypto only, no libssl). -// -// This module provides OpenSSL Library implementation (libcrypto only, no libssl). -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "OpenSSL Library implementation (libcrypto only, no libssl)" - -#string STR_MODULE_DESCRIPTION #language en-US "This module provides OpenSSL Library implementation (libcrypto only, no libssl)." - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/buildinf.h b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/buildinf.h deleted file mode 100644 index 80781e7..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/buildinf.h +++ /dev/null @@ -1,2 +0,0 @@ -#define PLATFORM "UEFI" -#define DATE "Fri Dec 22 01:23:45 PDT 2017" diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/process_files.pl b/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/process_files.pl deleted file mode 100644 index 8f10c34..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/OpensslLib/process_files.pl +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/perl -w -# -# This script runs the OpenSSL Configure script, then processes the -# resulting file list into our local OpensslLib[Crypto].inf and also -# takes a copy of opensslconf.h. -# -# This only needs to be done once by a developer when updating to a -# new version of OpenSSL (or changing options, etc.). Normal users -# do not need to do this, since the results are stored in the EDK2 -# git repository for them. -# -use strict; -use Cwd; -use File::Copy; - -# -# Find the openssl directory name for use lib. We have to do this -# inside of BEGIN. The variables we create here, however, don't seem -# to be available to the main script, so we have to repeat the -# exercise. -# -my $inf_file; -my $OPENSSL_PATH; -my @inf; - -BEGIN { - $inf_file = "OpensslLib.inf"; - - # Read the contents of the inf file - open( FD, "<" . $inf_file ) || - die "Cannot open \"" . $inf_file . "\"!"; - @inf = (); - close(FD) || - die "Cannot close \"" . $inf_file . "\"!"; - - foreach (@inf) { - if (/DEFINE\s+OPENSSL_PATH\s*=\s*([a-z]+)/) { - - # We need to run Configure before we can include its result... - $OPENSSL_PATH = $1; - - my $basedir = getcwd(); - - chdir($OPENSSL_PATH) || - die "Cannot change to OpenSSL directory \"" . $OPENSSL_PATH . "\""; - - # Configure UEFI - system( - "./Configure", - "UEFI", - "no-afalgeng", - "no-asm", - "no-async", - "no-autoalginit", - "no-autoerrinit", - "no-bf", - "no-blake2", - "no-camellia", - "no-capieng", - "no-cast", - "no-chacha", - "no-cms", - "no-ct", - "no-deprecated", - "no-dgram", - "no-dsa", - "no-dynamic-engine", - "no-ec", - "no-ec2m", - "no-engine", - "no-err", - "no-filenames", - "no-gost", - "no-hw", - "no-idea", - "no-mdc2", - "no-pic", - "no-ocb", - "no-poly1305", - "no-posix-io", - "no-rc2", - "no-rfc3779", - "no-rmd160", - "no-scrypt", - "no-seed", - "no-sock", - "no-srp", - "no-ssl", - "no-stdio", - "no-threads", - "no-ts", - "no-ui", - "no-whirlpool" - ) == 0 || - die "OpenSSL Configure failed!\n"; - - # Generate opensslconf.h per config data - system( - "perl -I. -Mconfigdata util/dofile.pl " . - "include/openssl/opensslconf.h.in " . - "> include/openssl/opensslconf.h" - ) == 0 || - die "Failed to generate opensslconf.h!\n"; - - chdir($basedir) || - die "Cannot change to base directory \"" . $basedir . "\""; - - push @INC, $1; - last; - } - } -} - -# -# Retrieve file lists from OpenSSL configdata -# -use configdata qw/%unified_info/; - -my @cryptofilelist = (); -my @sslfilelist = (); -foreach my $product ((@{$unified_info{libraries}}, - @{$unified_info{engines}})) { - foreach my $o (@{$unified_info{sources}->{$product}}) { - foreach my $s (@{$unified_info{sources}->{$o}}) { - next if ($unified_info{generate}->{$s}); - next if $s =~ "crypto/bio/b_print.c"; - if ($product =~ "libssl") { - push @sslfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n"; - next; - } - push @cryptofilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n"; - } - } -} - -# -# Update OpensslLib.inf with autogenerated file list -# -my @new_inf = (); -my $subbing = 0; -print "\n--> Updating OpensslLib.inf ... "; -foreach (@inf) { - if ( $_ =~ "# Autogenerated files list starts here" ) { - push @new_inf, $_, @cryptofilelist, @sslfilelist; - $subbing = 1; - next; - } - if ( $_ =~ "# Autogenerated files list ends here" ) { - push @new_inf, $_; - $subbing = 0; - next; - } - - push @new_inf, $_ - unless ($subbing); -} - -my $new_inf_file = $inf_file . ".new"; -open( FD, ">" . $new_inf_file ) || - die $new_inf_file; -print( FD @new_inf ) || - die $new_inf_file; -close(FD) || - die $new_inf_file; -rename( $new_inf_file, $inf_file ) || - die "rename $inf_file"; -print "Done!"; - -# -# Update OpensslLibCrypto.inf with auto-generated file list (no libssl) -# -$inf_file = "OpensslLibCrypto.inf"; - -# Read the contents of the inf file -@inf = (); -@new_inf = (); -open( FD, "<" . $inf_file ) || - die "Cannot open \"" . $inf_file . "\"!"; -@inf = (); -close(FD) || - die "Cannot close \"" . $inf_file . "\"!"; - -$subbing = 0; -print "\n--> Updating OpensslLibCrypto.inf ... "; -foreach (@inf) { - if ( $_ =~ "# Autogenerated files list starts here" ) { - push @new_inf, $_, @cryptofilelist; - $subbing = 1; - next; - } - if ( $_ =~ "# Autogenerated files list ends here" ) { - push @new_inf, $_; - $subbing = 0; - next; - } - - push @new_inf, $_ - unless ($subbing); -} - -$new_inf_file = $inf_file . ".new"; -open( FD, ">" . $new_inf_file ) || - die $new_inf_file; -print( FD @new_inf ) || - die $new_inf_file; -close(FD) || - die $new_inf_file; -rename( $new_inf_file, $inf_file ) || - die "rename $inf_file"; -print "Done!"; - -# -# Copy opensslconf.h generated from OpenSSL Configuration -# -print "\n--> Duplicating opensslconf.h into Include/openssl ... "; -copy($OPENSSL_PATH . "/include/openssl/opensslconf.h", - $OPENSSL_PATH . "/../../Include/openssl/") || - die "Cannot copy opensslconf.h!"; -print "Done!\n"; - -print "\nProcessing Files Done!\n"; - -exit(0); - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/InternalTlsLib.h b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/InternalTlsLib.h deleted file mode 100644 index ffab14f..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/InternalTlsLib.h +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Internal include file for TlsLib. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __INTERNAL_TLS_LIB_H__ -#define __INTERNAL_TLS_LIB_H__ - -#undef _WIN32 -#undef _WIN64 - -#include -#include -#include -#include -#include -#include -#include -#include - -typedef struct { - // - // Main SSL Connection which is created by a server or a client - // per established connection. - // - SSL *Ssl; - // - // Memory BIO for the TLS/SSL Reading operations. - // - BIO *InBio; - // - // Memory BIO for the TLS/SSL Writing operations. - // - BIO *OutBio; -} TLS_CONNECTION; - -#endif - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsConfig.c b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsConfig.c deleted file mode 100644 index 502ce82..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsConfig.c +++ /dev/null @@ -1,1217 +0,0 @@ -/** @file - SSL/TLS Configuration Library Wrapper Implementation over OpenSSL. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalTlsLib.h" - -typedef struct { - // - // IANA/IETF defined Cipher Suite ID - // - UINT16 IanaCipher; - // - // OpenSSL-used Cipher Suite String - // - CONST CHAR8 *OpensslCipher; - // - // Length of OpensslCipher - // - UINTN OpensslCipherLength; -} TLS_CIPHER_MAPPING; - -// -// Create a TLS_CIPHER_MAPPING initializer from IanaCipher and OpensslCipher so -// that OpensslCipherLength is filled in automatically. IanaCipher must be an -// integer constant expression, and OpensslCipher must be a string literal. -// -#define MAP(IanaCipher, OpensslCipher) \ - { (IanaCipher), (OpensslCipher), sizeof (OpensslCipher) - 1 } - -// -// The mapping table between IANA/IETF Cipher Suite definitions and -// OpenSSL-used Cipher Suite name. -// -// Keep the table uniquely sorted by the IanaCipher field, in increasing order. -// -STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = { - MAP ( 0x0001, "NULL-MD5" ), /// TLS_RSA_WITH_NULL_MD5 - MAP ( 0x0002, "NULL-SHA" ), /// TLS_RSA_WITH_NULL_SHA - MAP ( 0x0004, "RC4-MD5" ), /// TLS_RSA_WITH_RC4_128_MD5 - MAP ( 0x0005, "RC4-SHA" ), /// TLS_RSA_WITH_RC4_128_SHA - MAP ( 0x000A, "DES-CBC3-SHA" ), /// TLS_RSA_WITH_3DES_EDE_CBC_SHA, mandatory TLS 1.1 - MAP ( 0x0016, "DHE-RSA-DES-CBC3-SHA" ), /// TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - MAP ( 0x002F, "AES128-SHA" ), /// TLS_RSA_WITH_AES_128_CBC_SHA, mandatory TLS 1.2 - MAP ( 0x0030, "DH-DSS-AES128-SHA" ), /// TLS_DH_DSS_WITH_AES_128_CBC_SHA - MAP ( 0x0031, "DH-RSA-AES128-SHA" ), /// TLS_DH_RSA_WITH_AES_128_CBC_SHA - MAP ( 0x0033, "DHE-RSA-AES128-SHA" ), /// TLS_DHE_RSA_WITH_AES_128_CBC_SHA - MAP ( 0x0035, "AES256-SHA" ), /// TLS_RSA_WITH_AES_256_CBC_SHA - MAP ( 0x0036, "DH-DSS-AES256-SHA" ), /// TLS_DH_DSS_WITH_AES_256_CBC_SHA - MAP ( 0x0037, "DH-RSA-AES256-SHA" ), /// TLS_DH_RSA_WITH_AES_256_CBC_SHA - MAP ( 0x0039, "DHE-RSA-AES256-SHA" ), /// TLS_DHE_RSA_WITH_AES_256_CBC_SHA - MAP ( 0x003B, "NULL-SHA256" ), /// TLS_RSA_WITH_NULL_SHA256 - MAP ( 0x003C, "AES128-SHA256" ), /// TLS_RSA_WITH_AES_128_CBC_SHA256 - MAP ( 0x003D, "AES256-SHA256" ), /// TLS_RSA_WITH_AES_256_CBC_SHA256 - MAP ( 0x003E, "DH-DSS-AES128-SHA256" ), /// TLS_DH_DSS_WITH_AES_128_CBC_SHA256 - MAP ( 0x003F, "DH-RSA-AES128-SHA256" ), /// TLS_DH_RSA_WITH_AES_128_CBC_SHA256 - MAP ( 0x0067, "DHE-RSA-AES128-SHA256" ), /// TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 - MAP ( 0x0068, "DH-DSS-AES256-SHA256" ), /// TLS_DH_DSS_WITH_AES_256_CBC_SHA256 - MAP ( 0x0069, "DH-RSA-AES256-SHA256" ), /// TLS_DH_RSA_WITH_AES_256_CBC_SHA256 - MAP ( 0x006B, "DHE-RSA-AES256-SHA256" ), /// TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 -}; - -/** - Gets the OpenSSL cipher suite mapping for the supplied IANA TLS cipher suite. - - @param[in] CipherId The supplied IANA TLS cipher suite ID. - - @return The corresponding OpenSSL cipher suite mapping if found, - NULL otherwise. - -**/ -STATIC -CONST TLS_CIPHER_MAPPING * -TlsGetCipherMapping ( - IN UINT16 CipherId - ) -{ - INTN Left; - INTN Right; - INTN Middle; - - // - // Binary Search Cipher Mapping Table for IANA-OpenSSL Cipher Translation - // - Left = 0; - Right = ARRAY_SIZE (TlsCipherMappingTable) - 1; - - while (Right >= Left) { - Middle = (Left + Right) / 2; - - if (CipherId == TlsCipherMappingTable[Middle].IanaCipher) { - // - // Translate IANA cipher suite ID to OpenSSL name. - // - return &TlsCipherMappingTable[Middle]; - } - - if (CipherId < TlsCipherMappingTable[Middle].IanaCipher) { - Right = Middle - 1; - } else { - Left = Middle + 1; - } - } - - // - // No Cipher Mapping found, return NULL. - // - return NULL; -} - -/** - Set a new TLS/SSL method for a particular TLS object. - - This function sets a new TLS/SSL method for a particular TLS object. - - @param[in] Tls Pointer to a TLS object. - @param[in] MajorVer Major Version of TLS/SSL Protocol. - @param[in] MinorVer Minor Version of TLS/SSL Protocol. - - @retval EFI_SUCCESS The TLS/SSL method was set successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED Unsupported TLS/SSL method. - -**/ -EFI_STATUS -EFIAPI -TlsSetVersion ( - IN VOID *Tls, - IN UINT8 MajorVer, - IN UINT8 MinorVer - ) -{ - TLS_CONNECTION *TlsConn; - UINT16 ProtoVersion; - - TlsConn = (TLS_CONNECTION *)Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return EFI_INVALID_PARAMETER; - } - - ProtoVersion = (MajorVer << 8) | MinorVer; - - // - // Bound TLS method to the particular specified version. - // - switch (ProtoVersion) { - case TLS1_VERSION: - // - // TLS 1.0 - // - SSL_set_min_proto_version (TlsConn->Ssl, TLS1_VERSION); - SSL_set_max_proto_version (TlsConn->Ssl, TLS1_VERSION); - break; - case TLS1_1_VERSION: - // - // TLS 1.1 - // - SSL_set_min_proto_version (TlsConn->Ssl, TLS1_1_VERSION); - SSL_set_max_proto_version (TlsConn->Ssl, TLS1_1_VERSION); - break; - case TLS1_2_VERSION: - // - // TLS 1.2 - // - SSL_set_min_proto_version (TlsConn->Ssl, TLS1_2_VERSION); - SSL_set_max_proto_version (TlsConn->Ssl, TLS1_2_VERSION); - break; - default: - // - // Unsupported Protocol Version - // - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS;; -} - -/** - Set TLS object to work in client or server mode. - - This function prepares a TLS object to work in client or server mode. - - @param[in] Tls Pointer to a TLS object. - @param[in] IsServer Work in server mode. - - @retval EFI_SUCCESS The TLS/SSL work mode was set successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode. - -**/ -EFI_STATUS -EFIAPI -TlsSetConnectionEnd ( - IN VOID *Tls, - IN BOOLEAN IsServer - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return EFI_INVALID_PARAMETER; - } - - if (!IsServer) { - // - // Set TLS to work in Client mode. - // - SSL_set_connect_state (TlsConn->Ssl); - } else { - // - // Set TLS to work in Server mode. - // It is unsupported for UEFI version currently. - // - //SSL_set_accept_state (TlsConn->Ssl); - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - -/** - Set the ciphers list to be used by the TLS object. - - This function sets the ciphers for use by a specified TLS object. - - @param[in] Tls Pointer to a TLS object. - @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16 - cipher identifier comes from the TLS Cipher Suite - Registry of the IANA, interpreting Byte1 and Byte2 - in network (big endian) byte order. - @param[in] CipherNum The number of cipher in the list. - - @retval EFI_SUCCESS The ciphers list was set successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId. - @retval EFI_OUT_OF_RESOURCES Memory allocation failed. - -**/ -EFI_STATUS -EFIAPI -TlsSetCipherList ( - IN VOID *Tls, - IN UINT16 *CipherId, - IN UINTN CipherNum - ) -{ - TLS_CONNECTION *TlsConn; - EFI_STATUS Status; - CONST TLS_CIPHER_MAPPING **MappedCipher; - UINTN MappedCipherBytes; - UINTN MappedCipherCount; - UINTN CipherStringSize; - UINTN Index; - CONST TLS_CIPHER_MAPPING *Mapping; - CHAR8 *CipherString; - CHAR8 *CipherStringPosition; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL || CipherId == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // Allocate the MappedCipher array for recording the mappings that we find - // for the input IANA identifiers in CipherId. - // - Status = SafeUintnMult (CipherNum, sizeof (*MappedCipher), - &MappedCipherBytes); - if (EFI_ERROR (Status)) { - return EFI_OUT_OF_RESOURCES; - } - MappedCipher = AllocatePool (MappedCipherBytes); - if (MappedCipher == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Map the cipher IDs, and count the number of bytes for the full - // CipherString. - // - MappedCipherCount = 0; - CipherStringSize = 0; - for (Index = 0; Index < CipherNum; Index++) { - // - // Look up the IANA-to-OpenSSL mapping. - // - Mapping = TlsGetCipherMapping (CipherId[Index]); - if (Mapping == NULL) { - DEBUG ((DEBUG_VERBOSE, "%a:%a: skipping CipherId=0x%04x\n", - gEfiCallerBaseName, __FUNCTION__, CipherId[Index])); - // - // Skipping the cipher is valid because CipherId is an ordered - // preference list of ciphers, thus we can filter it as long as we - // don't change the relative order of elements on it. - // - continue; - } - // - // Accumulate Mapping->OpensslCipherLength into CipherStringSize. If this - // is not the first successful mapping, account for a colon (":") prefix - // too. - // - if (MappedCipherCount > 0) { - Status = SafeUintnAdd (CipherStringSize, 1, &CipherStringSize); - if (EFI_ERROR (Status)) { - Status = EFI_OUT_OF_RESOURCES; - goto FreeMappedCipher; - } - } - Status = SafeUintnAdd (CipherStringSize, Mapping->OpensslCipherLength, - &CipherStringSize); - if (EFI_ERROR (Status)) { - Status = EFI_OUT_OF_RESOURCES; - goto FreeMappedCipher; - } - // - // Record the mapping. - // - MappedCipher[MappedCipherCount++] = Mapping; - } - - // - // Verify that at least one IANA cipher ID could be mapped; account for the - // terminating NUL character in CipherStringSize; allocate CipherString. - // - if (MappedCipherCount == 0) { - DEBUG ((DEBUG_ERROR, "%a:%a: no CipherId could be mapped\n", - gEfiCallerBaseName, __FUNCTION__)); - Status = EFI_UNSUPPORTED; - goto FreeMappedCipher; - } - Status = SafeUintnAdd (CipherStringSize, 1, &CipherStringSize); - if (EFI_ERROR (Status)) { - Status = EFI_OUT_OF_RESOURCES; - goto FreeMappedCipher; - } - CipherString = AllocatePool (CipherStringSize); - if (CipherString == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto FreeMappedCipher; - } - - // - // Go over the collected mappings and populate CipherString. - // - CipherStringPosition = CipherString; - for (Index = 0; Index < MappedCipherCount; Index++) { - Mapping = MappedCipher[Index]; - // - // Append the colon (":") prefix except for the first mapping, then append - // Mapping->OpensslCipher. - // - if (Index > 0) { - *(CipherStringPosition++) = ':'; - } - CopyMem (CipherStringPosition, Mapping->OpensslCipher, - Mapping->OpensslCipherLength); - CipherStringPosition += Mapping->OpensslCipherLength; - } - - // - // NUL-terminate CipherString. - // - *(CipherStringPosition++) = '\0'; - ASSERT (CipherStringPosition == CipherString + CipherStringSize); - - // - // Log CipherString for debugging. CipherString can be very long if the - // caller provided a large CipherId array, so log CipherString in segments of - // 79 non-newline characters. (MAX_DEBUG_MESSAGE_LENGTH is usually 0x100 in - // DebugLib instances.) - // - DEBUG_CODE ( - UINTN FullLength; - UINTN SegmentLength; - - FullLength = CipherStringSize - 1; - DEBUG ((DEBUG_VERBOSE, "%a:%a: CipherString={\n", gEfiCallerBaseName, - __FUNCTION__)); - for (CipherStringPosition = CipherString; - CipherStringPosition < CipherString + FullLength; - CipherStringPosition += SegmentLength) { - SegmentLength = FullLength - (CipherStringPosition - CipherString); - if (SegmentLength > 79) { - SegmentLength = 79; - } - DEBUG ((DEBUG_VERBOSE, "%.*a\n", SegmentLength, CipherStringPosition)); - } - DEBUG ((DEBUG_VERBOSE, "}\n")); - // - // Restore the pre-debug value of CipherStringPosition by skipping over the - // trailing NUL. - // - CipherStringPosition++; - ASSERT (CipherStringPosition == CipherString + CipherStringSize); - ); - - // - // Sets the ciphers for use by the Tls object. - // - if (SSL_set_cipher_list (TlsConn->Ssl, CipherString) <= 0) { - Status = EFI_UNSUPPORTED; - goto FreeCipherString; - } - - Status = EFI_SUCCESS; - -FreeCipherString: - FreePool (CipherString); - -FreeMappedCipher: - FreePool (MappedCipher); - - return Status; -} - -/** - Set the compression method for TLS/SSL operations. - - This function handles TLS/SSL integrated compression methods. - - @param[in] CompMethod The compression method ID. - - @retval EFI_SUCCESS The compression method for the communication was - set successfully. - @retval EFI_UNSUPPORTED Unsupported compression method. - -**/ -EFI_STATUS -EFIAPI -TlsSetCompressionMethod ( - IN UINT8 CompMethod - ) -{ - COMP_METHOD *Cm; - INTN Ret; - - Cm = NULL; - Ret = 0; - - if (CompMethod == 0) { - // - // TLS defines one standard compression method, CompressionMethod.null (0), - // which specifies that data exchanged via the record protocol will not be compressed. - // So, return EFI_SUCCESS directly (RFC 3749). - // - return EFI_SUCCESS; - } else if (CompMethod == 1) { - Cm = COMP_zlib(); - } else { - return EFI_UNSUPPORTED; - } - - // - // Adds the compression method to the list of available - // compression methods. - // - Ret = SSL_COMP_add_compression_method (CompMethod, Cm); - if (Ret != 0) { - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - -/** - Set peer certificate verification mode for the TLS connection. - - This function sets the verification mode flags for the TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in] VerifyMode A set of logically or'ed verification mode flags. - -**/ -VOID -EFIAPI -TlsSetVerify ( - IN VOID *Tls, - IN UINT32 VerifyMode - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return; - } - - // - // Set peer certificate verification parameters with NULL callback. - // - SSL_set_verify (TlsConn->Ssl, VerifyMode, NULL); -} - -/** - Sets a TLS/SSL session ID to be used during TLS/SSL connect. - - This function sets a session ID to be used when the TLS/SSL connection is - to be established. - - @param[in] Tls Pointer to the TLS object. - @param[in] SessionId Session ID data used for session resumption. - @param[in] SessionIdLen Length of Session ID in bytes. - - @retval EFI_SUCCESS Session ID was set successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED No available session for ID setting. - -**/ -EFI_STATUS -EFIAPI -TlsSetSessionId ( - IN VOID *Tls, - IN UINT8 *SessionId, - IN UINT16 SessionIdLen - ) -{ - TLS_CONNECTION *TlsConn; - SSL_SESSION *Session; - - TlsConn = (TLS_CONNECTION *) Tls; - Session = NULL; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || SessionId == NULL) { - return EFI_INVALID_PARAMETER; - } - - Session = SSL_get_session (TlsConn->Ssl); - if (Session == NULL) { - return EFI_UNSUPPORTED; - } - - SSL_SESSION_set1_id (Session, (const unsigned char *)SessionId, SessionIdLen); - - return EFI_SUCCESS; -} - -/** - Adds the CA to the cert store when requesting Server or Client authentication. - - This function adds the CA certificate to the list of CAs when requesting - Server or Client authentication for the chosen TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in] Data Pointer to the data buffer of a DER-encoded binary - X.509 certificate or PEM-encoded X.509 certificate. - @param[in] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated. - @retval EFI_ABORTED Invalid X.509 certificate. - -**/ -EFI_STATUS -EFIAPI -TlsSetCaCertificate ( - IN VOID *Tls, - IN VOID *Data, - IN UINTN DataSize - ) -{ - BIO *BioCert; - X509 *Cert; - X509_STORE *X509Store; - EFI_STATUS Status; - TLS_CONNECTION *TlsConn; - SSL_CTX *SslCtx; - INTN Ret; - UINTN ErrorCode; - - BioCert = NULL; - Cert = NULL; - X509Store = NULL; - Status = EFI_SUCCESS; - TlsConn = (TLS_CONNECTION *) Tls; - Ret = 0; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || Data == NULL || DataSize == 0) { - return EFI_INVALID_PARAMETER; - } - - // - // DER-encoded binary X.509 certificate or PEM-encoded X.509 certificate. - // Determine whether certificate is from DER encoding, if so, translate it to X509 structure. - // - Cert = d2i_X509 (NULL, (const unsigned char ** )&Data, (long) DataSize); - if (Cert == NULL) { - // - // Certificate is from PEM encoding. - // - BioCert = BIO_new (BIO_s_mem ()); - if (BioCert == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - if (BIO_write (BioCert, Data, (UINT32) DataSize) <= 0) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - - Cert = PEM_read_bio_X509 (BioCert, NULL, NULL, NULL); - if (Cert == NULL) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - } - - SslCtx = SSL_get_SSL_CTX (TlsConn->Ssl); - X509Store = SSL_CTX_get_cert_store (SslCtx); - if (X509Store == NULL) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - - // - // Add certificate to X509 store - // - Ret = X509_STORE_add_cert (X509Store, Cert); - if (Ret != 1) { - ErrorCode = ERR_peek_last_error (); - // - // Ignore "already in table" errors - // - if (!(ERR_GET_FUNC (ErrorCode) == X509_F_X509_STORE_ADD_CERT && - ERR_GET_REASON (ErrorCode) == X509_R_CERT_ALREADY_IN_HASH_TABLE)) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - } - -ON_EXIT: - if (BioCert != NULL) { - BIO_free (BioCert); - } - - if (Cert != NULL) { - X509_free (Cert); - } - - return Status; -} - -/** - Loads the local public certificate into the specified TLS object. - - This function loads the X.509 certificate into the specified TLS object - for TLS negotiation. - - @param[in] Tls Pointer to the TLS object. - @param[in] Data Pointer to the data buffer of a DER-encoded binary - X.509 certificate or PEM-encoded X.509 certificate. - @param[in] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated. - @retval EFI_ABORTED Invalid X.509 certificate. - -**/ -EFI_STATUS -EFIAPI -TlsSetHostPublicCert ( - IN VOID *Tls, - IN VOID *Data, - IN UINTN DataSize - ) -{ - BIO *BioCert; - X509 *Cert; - EFI_STATUS Status; - TLS_CONNECTION *TlsConn; - - BioCert = NULL; - Cert = NULL; - Status = EFI_SUCCESS; - TlsConn = (TLS_CONNECTION *) Tls; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || Data == NULL || DataSize == 0) { - return EFI_INVALID_PARAMETER; - } - - // - // DER-encoded binary X.509 certificate or PEM-encoded X.509 certificate. - // Determine whether certificate is from DER encoding, if so, translate it to X509 structure. - // - Cert = d2i_X509 (NULL, (const unsigned char ** )&Data, (long) DataSize); - if (Cert == NULL) { - // - // Certificate is from PEM encoding. - // - BioCert = BIO_new (BIO_s_mem ()); - if (BioCert == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - if (BIO_write (BioCert, Data, (UINT32) DataSize) <= 0) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - - Cert = PEM_read_bio_X509 (BioCert, NULL, NULL, NULL); - if (Cert == NULL) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - } - - if (SSL_use_certificate (TlsConn->Ssl, Cert) != 1) { - Status = EFI_ABORTED; - goto ON_EXIT; - } - -ON_EXIT: - if (BioCert != NULL) { - BIO_free (BioCert); - } - - if (Cert != NULL) { - X509_free (Cert); - } - - return Status; -} - -/** - Adds the local private key to the specified TLS object. - - This function adds the local private key (PEM-encoded RSA or PKCS#8 private - key) into the specified TLS object for TLS negotiation. - - @param[in] Tls Pointer to the TLS object. - @param[in] Data Pointer to the data buffer of a PEM-encoded RSA - or PKCS#8 private key. - @param[in] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_UNSUPPORTED This function is not supported. - @retval EFI_ABORTED Invalid private key data. - -**/ -EFI_STATUS -EFIAPI -TlsSetHostPrivateKey ( - IN VOID *Tls, - IN VOID *Data, - IN UINTN DataSize - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Adds the CA-supplied certificate revocation list for certificate validation. - - This function adds the CA-supplied certificate revocation list data for - certificate validity checking. - - @param[in] Data Pointer to the data buffer of a DER-encoded CRL data. - @param[in] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_UNSUPPORTED This function is not supported. - @retval EFI_ABORTED Invalid CRL data. - -**/ -EFI_STATUS -EFIAPI -TlsSetCertRevocationList ( - IN VOID *Data, - IN UINTN DataSize - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Gets the protocol version used by the specified TLS connection. - - This function returns the protocol version used by the specified TLS - connection. - - If Tls is NULL, then ASSERT(). - - @param[in] Tls Pointer to the TLS object. - - @return The protocol version of the specified TLS connection. - -**/ -UINT16 -EFIAPI -TlsGetVersion ( - IN VOID *Tls - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - - ASSERT (TlsConn != NULL); - - return (UINT16)(SSL_version (TlsConn->Ssl)); -} - -/** - Gets the connection end of the specified TLS connection. - - This function returns the connection end (as client or as server) used by - the specified TLS connection. - - If Tls is NULL, then ASSERT(). - - @param[in] Tls Pointer to the TLS object. - - @return The connection end used by the specified TLS connection. - -**/ -UINT8 -EFIAPI -TlsGetConnectionEnd ( - IN VOID *Tls - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - - ASSERT (TlsConn != NULL); - - return (UINT8)SSL_is_server (TlsConn->Ssl); -} - -/** - Gets the cipher suite used by the specified TLS connection. - - This function returns current cipher suite used by the specified - TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] CipherId The cipher suite used by the TLS object. - - @retval EFI_SUCCESS The cipher suite was returned successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED Unsupported cipher suite. - -**/ -EFI_STATUS -EFIAPI -TlsGetCurrentCipher ( - IN VOID *Tls, - IN OUT UINT16 *CipherId - ) -{ - TLS_CONNECTION *TlsConn; - CONST SSL_CIPHER *Cipher; - - TlsConn = (TLS_CONNECTION *) Tls; - Cipher = NULL; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || CipherId == NULL) { - return EFI_INVALID_PARAMETER; - } - - Cipher = SSL_get_current_cipher (TlsConn->Ssl); - if (Cipher == NULL) { - return EFI_UNSUPPORTED; - } - - *CipherId = (SSL_CIPHER_get_id (Cipher)) & 0xFFFF; - - return EFI_SUCCESS; -} - -/** - Gets the compression methods used by the specified TLS connection. - - This function returns current integrated compression methods used by - the specified TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] CompressionId The current compression method used by - the TLS object. - - @retval EFI_SUCCESS The compression method was returned successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_ABORTED Invalid Compression method. - @retval EFI_UNSUPPORTED This function is not supported. - -**/ -EFI_STATUS -EFIAPI -TlsGetCurrentCompressionId ( - IN VOID *Tls, - IN OUT UINT8 *CompressionId - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Gets the verification mode currently set in the TLS connection. - - This function returns the peer verification mode currently set in the - specified TLS connection. - - If Tls is NULL, then ASSERT(). - - @param[in] Tls Pointer to the TLS object. - - @return The verification mode set in the specified TLS connection. - -**/ -UINT32 -EFIAPI -TlsGetVerify ( - IN VOID *Tls - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - - ASSERT (TlsConn != NULL); - - return SSL_get_verify_mode (TlsConn->Ssl); -} - -/** - Gets the session ID used by the specified TLS connection. - - This function returns the TLS/SSL session ID currently used by the - specified TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] SessionId Buffer to contain the returned session ID. - @param[in,out] SessionIdLen The length of Session ID in bytes. - - @retval EFI_SUCCESS The Session ID was returned successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED Invalid TLS/SSL session. - -**/ -EFI_STATUS -EFIAPI -TlsGetSessionId ( - IN VOID *Tls, - IN OUT UINT8 *SessionId, - IN OUT UINT16 *SessionIdLen - ) -{ - TLS_CONNECTION *TlsConn; - SSL_SESSION *Session; - CONST UINT8 *SslSessionId; - - TlsConn = (TLS_CONNECTION *) Tls; - Session = NULL; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || SessionId == NULL || SessionIdLen == NULL) { - return EFI_INVALID_PARAMETER; - } - - Session = SSL_get_session (TlsConn->Ssl); - if (Session == NULL) { - return EFI_UNSUPPORTED; - } - - SslSessionId = SSL_SESSION_get_id (Session, (unsigned int *)SessionIdLen); - CopyMem (SessionId, SslSessionId, *SessionIdLen); - - return EFI_SUCCESS; -} - -/** - Gets the client random data used in the specified TLS connection. - - This function returns the TLS/SSL client random data currently used in - the specified TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] ClientRandom Buffer to contain the returned client - random data (32 bytes). - -**/ -VOID -EFIAPI -TlsGetClientRandom ( - IN VOID *Tls, - IN OUT UINT8 *ClientRandom - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || ClientRandom == NULL) { - return; - } - - SSL_get_client_random (TlsConn->Ssl, ClientRandom, SSL3_RANDOM_SIZE); -} - -/** - Gets the server random data used in the specified TLS connection. - - This function returns the TLS/SSL server random data currently used in - the specified TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] ServerRandom Buffer to contain the returned server - random data (32 bytes). - -**/ -VOID -EFIAPI -TlsGetServerRandom ( - IN VOID *Tls, - IN OUT UINT8 *ServerRandom - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || ServerRandom == NULL) { - return; - } - - SSL_get_server_random (TlsConn->Ssl, ServerRandom, SSL3_RANDOM_SIZE); -} - -/** - Gets the master key data used in the specified TLS connection. - - This function returns the TLS/SSL master key material currently used in - the specified TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] KeyMaterial Buffer to contain the returned key material. - - @retval EFI_SUCCESS Key material was returned successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_UNSUPPORTED Invalid TLS/SSL session. - -**/ -EFI_STATUS -EFIAPI -TlsGetKeyMaterial ( - IN VOID *Tls, - IN OUT UINT8 *KeyMaterial - ) -{ - TLS_CONNECTION *TlsConn; - SSL_SESSION *Session; - - TlsConn = (TLS_CONNECTION *) Tls; - Session = NULL; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || KeyMaterial == NULL) { - return EFI_INVALID_PARAMETER; - } - - Session = SSL_get_session (TlsConn->Ssl); - - if (Session == NULL) { - return EFI_UNSUPPORTED; - } - - SSL_SESSION_get_master_key (Session, KeyMaterial, SSL3_MASTER_SECRET_SIZE); - - return EFI_SUCCESS; -} - -/** - Gets the CA Certificate from the cert store. - - This function returns the CA certificate for the chosen - TLS connection. - - @param[in] Tls Pointer to the TLS object. - @param[out] Data Pointer to the data buffer to receive the CA - certificate data sent to the client. - @param[in,out] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_UNSUPPORTED This function is not supported. - @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data. - -**/ -EFI_STATUS -EFIAPI -TlsGetCaCertificate ( - IN VOID *Tls, - OUT VOID *Data, - IN OUT UINTN *DataSize - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Gets the local public Certificate set in the specified TLS object. - - This function returns the local public certificate which was currently set - in the specified TLS object. - - @param[in] Tls Pointer to the TLS object. - @param[out] Data Pointer to the data buffer to receive the local - public certificate. - @param[in,out] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_NOT_FOUND The certificate is not found. - @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data. - -**/ -EFI_STATUS -EFIAPI -TlsGetHostPublicCert ( - IN VOID *Tls, - OUT VOID *Data, - IN OUT UINTN *DataSize - ) -{ - X509 *Cert; - TLS_CONNECTION *TlsConn; - - Cert = NULL; - TlsConn = (TLS_CONNECTION *) Tls; - - if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL || (*DataSize != 0 && Data == NULL)) { - return EFI_INVALID_PARAMETER; - } - - Cert = SSL_get_certificate(TlsConn->Ssl); - if (Cert == NULL) { - return EFI_NOT_FOUND; - } - - // - // Only DER encoding is supported currently. - // - if (*DataSize < (UINTN) i2d_X509 (Cert, NULL)) { - *DataSize = (UINTN) i2d_X509 (Cert, NULL); - return EFI_BUFFER_TOO_SMALL; - } - - *DataSize = (UINTN) i2d_X509 (Cert, (unsigned char **) &Data); - - return EFI_SUCCESS; -} - -/** - Gets the local private key set in the specified TLS object. - - This function returns the local private key data which was currently set - in the specified TLS object. - - @param[in] Tls Pointer to the TLS object. - @param[out] Data Pointer to the data buffer to receive the local - private key data. - @param[in,out] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_UNSUPPORTED This function is not supported. - @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data. - -**/ -EFI_STATUS -EFIAPI -TlsGetHostPrivateKey ( - IN VOID *Tls, - OUT VOID *Data, - IN OUT UINTN *DataSize - ) -{ - return EFI_UNSUPPORTED; -} - -/** - Gets the CA-supplied certificate revocation list data set in the specified - TLS object. - - This function returns the CA-supplied certificate revocation list data which - was currently set in the specified TLS object. - - @param[out] Data Pointer to the data buffer to receive the CRL data. - @param[in,out] DataSize The size of data buffer in bytes. - - @retval EFI_SUCCESS The operation succeeded. - @retval EFI_UNSUPPORTED This function is not supported. - @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data. - -**/ -EFI_STATUS -EFIAPI -TlsGetCertRevocationList ( - OUT VOID *Data, - IN OUT UINTN *DataSize - ) -{ - return EFI_UNSUPPORTED; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsInit.c b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsInit.c deleted file mode 100644 index d9fe744..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsInit.c +++ /dev/null @@ -1,269 +0,0 @@ -/** @file - SSL/TLS Initialization Library Wrapper Implementation over OpenSSL. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalTlsLib.h" - -/** - Initializes the OpenSSL library. - - This function registers ciphers and digests used directly and indirectly - by SSL/TLS, and initializes the readable error messages. - This function must be called before any other action takes places. - - @retval TRUE The OpenSSL library has been initialized. - @retval FALSE Failed to initialize the OpenSSL library. - -**/ -BOOLEAN -EFIAPI -TlsInitialize ( - VOID - ) -{ - INTN Ret; - - // - // Performs initialization of crypto and ssl library, and loads required - // algorithms. - // - Ret = OPENSSL_init_ssl ( - OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, - NULL - ); - if (Ret != 1) { - return FALSE; - } - - // - // Initialize the pseudorandom number generator. - // - return RandomSeed (NULL, 0); -} - -/** - Free an allocated SSL_CTX object. - - @param[in] TlsCtx Pointer to the SSL_CTX object to be released. - -**/ -VOID -EFIAPI -TlsCtxFree ( - IN VOID *TlsCtx - ) -{ - if (TlsCtx == NULL) { - return; - } - - if (TlsCtx != NULL) { - SSL_CTX_free ((SSL_CTX *) (TlsCtx)); - } -} - -/** - Creates a new SSL_CTX object as framework to establish TLS/SSL enabled - connections. - - @param[in] MajorVer Major Version of TLS/SSL Protocol. - @param[in] MinorVer Minor Version of TLS/SSL Protocol. - - @return Pointer to an allocated SSL_CTX object. - If the creation failed, TlsCtxNew() returns NULL. - -**/ -VOID * -EFIAPI -TlsCtxNew ( - IN UINT8 MajorVer, - IN UINT8 MinorVer - ) -{ - SSL_CTX *TlsCtx; - UINT16 ProtoVersion; - - ProtoVersion = (MajorVer << 8) | MinorVer; - - TlsCtx = SSL_CTX_new (SSLv23_client_method ()); - if (TlsCtx == NULL) { - return NULL; - } - - // - // Ensure SSLv3 is disabled - // - SSL_CTX_set_options (TlsCtx, SSL_OP_NO_SSLv3); - - // - // Treat as minimum accepted versions by setting the minimal bound. - // Client can use higher TLS version if server supports it - // - SSL_CTX_set_min_proto_version (TlsCtx, ProtoVersion); - - return (VOID *) TlsCtx; -} - -/** - Free an allocated TLS object. - - This function removes the TLS object pointed to by Tls and frees up the - allocated memory. If Tls is NULL, nothing is done. - - @param[in] Tls Pointer to the TLS object to be freed. - -**/ -VOID -EFIAPI -TlsFree ( - IN VOID *Tls - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL) { - return; - } - - // - // Free the internal TLS and related BIO objects. - // - if (TlsConn->Ssl != NULL) { - SSL_free (TlsConn->Ssl); - } - - OPENSSL_free (Tls); -} - -/** - Create a new TLS object for a connection. - - This function creates a new TLS object for a connection. The new object - inherits the setting of the underlying context TlsCtx: connection method, - options, verification setting. - - @param[in] TlsCtx Pointer to the SSL_CTX object. - - @return Pointer to an allocated SSL object. - If the creation failed, TlsNew() returns NULL. - -**/ -VOID * -EFIAPI -TlsNew ( - IN VOID *TlsCtx - ) -{ - TLS_CONNECTION *TlsConn; - SSL_CTX *SslCtx; - X509_STORE *X509Store; - - TlsConn = NULL; - - // - // Allocate one new TLS_CONNECTION object - // - TlsConn = (TLS_CONNECTION *) OPENSSL_malloc (sizeof (TLS_CONNECTION)); - if (TlsConn == NULL) { - return NULL; - } - - TlsConn->Ssl = NULL; - - // - // Create a new SSL Object - // - TlsConn->Ssl = SSL_new ((SSL_CTX *) TlsCtx); - if (TlsConn->Ssl == NULL) { - TlsFree ((VOID *) TlsConn); - return NULL; - } - - // - // This retains compatibility with previous version of OpenSSL. - // - SSL_set_security_level (TlsConn->Ssl, 0); - - // - // Initialize the created SSL Object - // - SSL_set_info_callback (TlsConn->Ssl, NULL); - - TlsConn->InBio = NULL; - - // - // Set up Reading BIO for TLS connection - // - TlsConn->InBio = BIO_new (BIO_s_mem ()); - if (TlsConn->InBio == NULL) { - TlsFree ((VOID *) TlsConn); - return NULL; - } - - // - // Sets the behaviour of memory BIO when it is empty. It will set the - // read retry flag. - // - BIO_set_mem_eof_return (TlsConn->InBio, -1); - - TlsConn->OutBio = NULL; - - // - // Set up Writing BIO for TLS connection - // - TlsConn->OutBio = BIO_new (BIO_s_mem ()); - if (TlsConn->OutBio == NULL) { - TlsFree ((VOID *) TlsConn); - return NULL; - } - - // - // Sets the behaviour of memory BIO when it is empty. It will set the - // write retry flag. - // - BIO_set_mem_eof_return (TlsConn->OutBio, -1); - - ASSERT (TlsConn->Ssl != NULL && TlsConn->InBio != NULL && TlsConn->OutBio != NULL); - - // - // Connects the InBio and OutBio for the read and write operations. - // - SSL_set_bio (TlsConn->Ssl, TlsConn->InBio, TlsConn->OutBio); - - // - // Create new X509 store if needed - // - SslCtx = SSL_get_SSL_CTX (TlsConn->Ssl); - X509Store = SSL_CTX_get_cert_store (SslCtx); - if (X509Store == NULL) { - X509Store = X509_STORE_new (); - if (X509Store == NULL) { - TlsFree ((VOID *) TlsConn); - return NULL; - } - SSL_CTX_set1_verify_cert_store (SslCtx, X509Store); - X509_STORE_free (X509Store); - } - - // - // Set X509_STORE flags used in certificate validation - // - X509_STORE_set_flags ( - X509Store, - X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME - ); - return (VOID *) TlsConn; -} - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.inf b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.inf deleted file mode 100644 index 4bc20ab..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.inf +++ /dev/null @@ -1,56 +0,0 @@ -## @file -# SSL/TLS Wrapper Library Instance based on OpenSSL. -# -# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = TlsLib - MODULE_UNI_FILE = TlsLib.uni - FILE_GUID = CC729DC5-4E21-0B36-1A00-3A8E1B86A155 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = TlsLib|DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - InternalTlsLib.h - TlsInit.c - TlsConfig.c - TlsProcess.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - -[LibraryClasses] - BaseCryptLib - BaseMemoryLib - DebugLib - IntrinsicLib - MemoryAllocationLib - OpensslLib - SafeIntLib - -[BuildOptions] - # - # suppress the following warnings so we do not break the build with warnings-as-errors: - # C4090: 'function' : different 'const' qualifiers - # - MSFT:*_*_*_CC_FLAGS = /wd4090 - diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.uni b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.uni deleted file mode 100644 index b418cde..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsLib.uni +++ /dev/null @@ -1,19 +0,0 @@ -// /** @file -// SSL/TLS Wrapper Library Instance based on OpenSSL. -// -// Copyright (c) 2016, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SSL/TLS Wrapper Library Instance" - -#string STR_MODULE_DESCRIPTION #language en-US "This module provides SSL/TLS Wrapper Library Instance." diff --git a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsProcess.c b/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsProcess.c deleted file mode 100644 index 3a79fe4..0000000 --- a/Voyager/Voyager/edk2/CryptoPkg/Library/TlsLib/TlsProcess.c +++ /dev/null @@ -1,463 +0,0 @@ -/** @file - SSL/TLS Process Library Wrapper Implementation over OpenSSL. - The process includes the TLS handshake and packet I/O. - -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalTlsLib.h" - -#define MAX_BUFFER_SIZE 32768 - -/** - Checks if the TLS handshake was done. - - This function will check if the specified TLS handshake was done. - - @param[in] Tls Pointer to the TLS object for handshake state checking. - - @retval TRUE The TLS handshake was done. - @retval FALSE The TLS handshake was not done. - -**/ -BOOLEAN -EFIAPI -TlsInHandshake ( - IN VOID *Tls - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return FALSE; - } - - // - // Return the status which indicates if the TLS handshake was done. - // - return !SSL_is_init_finished (TlsConn->Ssl); -} - -/** - Perform a TLS/SSL handshake. - - This function will perform a TLS/SSL handshake. - - @param[in] Tls Pointer to the TLS object for handshake operation. - @param[in] BufferIn Pointer to the most recently received TLS Handshake packet. - @param[in] BufferInSize Packet size in bytes for the most recently received TLS - Handshake packet. - @param[out] BufferOut Pointer to the buffer to hold the built packet. - @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is - the buffer size provided by the caller. On output, it - is the buffer size in fact needed to contain the - packet. - - @retval EFI_SUCCESS The required TLS packet is built successfully. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - Tls is NULL. - BufferIn is NULL but BufferInSize is NOT 0. - BufferInSize is 0 but BufferIn is NOT NULL. - BufferOutSize is NULL. - BufferOut is NULL if *BufferOutSize is not zero. - @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet. - @retval EFI_ABORTED Something wrong during handshake. - -**/ -EFI_STATUS -EFIAPI -TlsDoHandshake ( - IN VOID *Tls, - IN UINT8 *BufferIn, OPTIONAL - IN UINTN BufferInSize, OPTIONAL - OUT UINT8 *BufferOut, OPTIONAL - IN OUT UINTN *BufferOutSize - ) -{ - TLS_CONNECTION *TlsConn; - UINTN PendingBufferSize; - INTN Ret; - UINTN ErrorCode; - - TlsConn = (TLS_CONNECTION *) Tls; - PendingBufferSize = 0; - Ret = 1; - - if (TlsConn == NULL || \ - TlsConn->Ssl == NULL || TlsConn->InBio == NULL || TlsConn->OutBio == NULL || \ - BufferOutSize == NULL || \ - (BufferIn == NULL && BufferInSize != 0) || \ - (BufferIn != NULL && BufferInSize == 0) || \ - (BufferOut == NULL && *BufferOutSize != 0)) { - return EFI_INVALID_PARAMETER; - } - - if(BufferIn == NULL && BufferInSize == 0) { - // - // If RequestBuffer is NULL and RequestSize is 0, and TLS session - // status is EfiTlsSessionNotStarted, the TLS session will be initiated - // and the response packet needs to be ClientHello. - // - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - if (PendingBufferSize == 0) { - SSL_set_connect_state (TlsConn->Ssl); - Ret = SSL_do_handshake (TlsConn->Ssl); - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - } - } else { - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - if (PendingBufferSize == 0) { - BIO_write (TlsConn->InBio, BufferIn, (UINT32) BufferInSize); - Ret = SSL_do_handshake (TlsConn->Ssl); - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - } - } - - if (Ret < 1) { - Ret = SSL_get_error (TlsConn->Ssl, (int) Ret); - if (Ret == SSL_ERROR_SSL || - Ret == SSL_ERROR_SYSCALL || - Ret == SSL_ERROR_ZERO_RETURN) { - DEBUG (( - DEBUG_ERROR, - "%a SSL_HANDSHAKE_ERROR State=0x%x SSL_ERROR_%a\n", - __FUNCTION__, - SSL_get_state (TlsConn->Ssl), - Ret == SSL_ERROR_SSL ? "SSL" : Ret == SSL_ERROR_SYSCALL ? "SYSCALL" : "ZERO_RETURN" - )); - DEBUG_CODE_BEGIN (); - while (TRUE) { - ErrorCode = ERR_get_error (); - if (ErrorCode == 0) { - break; - } - DEBUG (( - DEBUG_ERROR, - "%a ERROR 0x%x=L%x:F%x:R%x\n", - __FUNCTION__, - ErrorCode, - ERR_GET_LIB (ErrorCode), - ERR_GET_FUNC (ErrorCode), - ERR_GET_REASON (ErrorCode) - )); - } - DEBUG_CODE_END (); - return EFI_ABORTED; - } - } - - if (PendingBufferSize > *BufferOutSize) { - *BufferOutSize = PendingBufferSize; - return EFI_BUFFER_TOO_SMALL; - } - - if (PendingBufferSize > 0) { - *BufferOutSize = BIO_read (TlsConn->OutBio, BufferOut, (UINT32) PendingBufferSize); - } else { - *BufferOutSize = 0; - } - - return EFI_SUCCESS; -} - -/** - Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, - TLS session has errors and the response packet needs to be Alert message based on error type. - - @param[in] Tls Pointer to the TLS object for state checking. - @param[in] BufferIn Pointer to the most recently received TLS Alert packet. - @param[in] BufferInSize Packet size in bytes for the most recently received TLS - Alert packet. - @param[out] BufferOut Pointer to the buffer to hold the built packet. - @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is - the buffer size provided by the caller. On output, it - is the buffer size in fact needed to contain the - packet. - - @retval EFI_SUCCESS The required TLS packet is built successfully. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - Tls is NULL. - BufferIn is NULL but BufferInSize is NOT 0. - BufferInSize is 0 but BufferIn is NOT NULL. - BufferOutSize is NULL. - BufferOut is NULL if *BufferOutSize is not zero. - @retval EFI_ABORTED An error occurred. - @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet. - -**/ -EFI_STATUS -EFIAPI -TlsHandleAlert ( - IN VOID *Tls, - IN UINT8 *BufferIn, OPTIONAL - IN UINTN BufferInSize, OPTIONAL - OUT UINT8 *BufferOut, OPTIONAL - IN OUT UINTN *BufferOutSize - ) -{ - TLS_CONNECTION *TlsConn; - UINTN PendingBufferSize; - UINT8 *TempBuffer; - INTN Ret; - - TlsConn = (TLS_CONNECTION *) Tls; - PendingBufferSize = 0; - TempBuffer = NULL; - Ret = 0; - - if (TlsConn == NULL || \ - TlsConn->Ssl == NULL || TlsConn->InBio == NULL || TlsConn->OutBio == NULL || \ - BufferOutSize == NULL || \ - (BufferIn == NULL && BufferInSize != 0) || \ - (BufferIn != NULL && BufferInSize == 0) || \ - (BufferOut == NULL && *BufferOutSize != 0)) { - return EFI_INVALID_PARAMETER; - } - - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - if (PendingBufferSize == 0 && BufferIn != NULL && BufferInSize != 0) { - Ret = BIO_write (TlsConn->InBio, BufferIn, (UINT32) BufferInSize); - if (Ret != (INTN) BufferInSize) { - return EFI_ABORTED; - } - - TempBuffer = (UINT8 *) OPENSSL_malloc (MAX_BUFFER_SIZE); - - // - // ssl3_send_alert() will be called in ssl3_read_bytes() function. - // TempBuffer is invalid since it's a Alert message, so just ignore it. - // - SSL_read (TlsConn->Ssl, TempBuffer, MAX_BUFFER_SIZE); - - OPENSSL_free (TempBuffer); - - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - } - - if (PendingBufferSize > *BufferOutSize) { - *BufferOutSize = PendingBufferSize; - return EFI_BUFFER_TOO_SMALL; - } - - if (PendingBufferSize > 0) { - *BufferOutSize = BIO_read (TlsConn->OutBio, BufferOut, (UINT32) PendingBufferSize); - } else { - *BufferOutSize = 0; - } - - return EFI_SUCCESS; -} - -/** - Build the CloseNotify packet. - - @param[in] Tls Pointer to the TLS object for state checking. - @param[in, out] Buffer Pointer to the buffer to hold the built packet. - @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is - the buffer size provided by the caller. On output, it - is the buffer size in fact needed to contain the - packet. - - @retval EFI_SUCCESS The required TLS packet is built successfully. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - Tls is NULL. - BufferSize is NULL. - Buffer is NULL if *BufferSize is not zero. - @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet. - -**/ -EFI_STATUS -EFIAPI -TlsCloseNotify ( - IN VOID *Tls, - IN OUT UINT8 *Buffer, - IN OUT UINTN *BufferSize - ) -{ - TLS_CONNECTION *TlsConn; - UINTN PendingBufferSize; - - TlsConn = (TLS_CONNECTION *) Tls; - PendingBufferSize = 0; - - if (TlsConn == NULL || \ - TlsConn->Ssl == NULL || TlsConn->InBio == NULL || TlsConn->OutBio == NULL || \ - BufferSize == NULL || \ - (Buffer == NULL && *BufferSize != 0)) { - return EFI_INVALID_PARAMETER; - } - - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - if (PendingBufferSize == 0) { - // - // ssl3_send_alert() and ssl3_dispatch_alert() function will be called. - // - SSL_shutdown (TlsConn->Ssl); - PendingBufferSize = (UINTN) BIO_ctrl_pending (TlsConn->OutBio); - } - - if (PendingBufferSize > *BufferSize) { - *BufferSize = PendingBufferSize; - return EFI_BUFFER_TOO_SMALL; - } - - if (PendingBufferSize > 0) { - *BufferSize = BIO_read (TlsConn->OutBio, Buffer, (UINT32) PendingBufferSize); - } else { - *BufferSize = 0; - } - - return EFI_SUCCESS; -} - -/** - Attempts to read bytes from one TLS object and places the data in Buffer. - - This function will attempt to read BufferSize bytes from the TLS object - and places the data in Buffer. - - @param[in] Tls Pointer to the TLS object. - @param[in,out] Buffer Pointer to the buffer to store the data. - @param[in] BufferSize The size of Buffer in bytes. - - @retval >0 The amount of data successfully read from the TLS object. - @retval <=0 No data was successfully read. - -**/ -INTN -EFIAPI -TlsCtrlTrafficOut ( - IN VOID *Tls, - IN OUT VOID *Buffer, - IN UINTN BufferSize - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->OutBio == 0) { - return -1; - } - - // - // Read and return the amount of data from the BIO. - // - return BIO_read (TlsConn->OutBio, Buffer, (UINT32) BufferSize); -} - -/** - Attempts to write data from the buffer to TLS object. - - This function will attempt to write BufferSize bytes data from the Buffer - to the TLS object. - - @param[in] Tls Pointer to the TLS object. - @param[in] Buffer Pointer to the data buffer. - @param[in] BufferSize The size of Buffer in bytes. - - @retval >0 The amount of data successfully written to the TLS object. - @retval <=0 No data was successfully written. - -**/ -INTN -EFIAPI -TlsCtrlTrafficIn ( - IN VOID *Tls, - IN VOID *Buffer, - IN UINTN BufferSize - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->InBio == 0) { - return -1; - } - - // - // Write and return the amount of data to the BIO. - // - return BIO_write (TlsConn->InBio, Buffer, (UINT32) BufferSize); -} -/** - Attempts to read bytes from the specified TLS connection into the buffer. - - This function tries to read BufferSize bytes data from the specified TLS - connection into the Buffer. - - @param[in] Tls Pointer to the TLS connection for data reading. - @param[in,out] Buffer Pointer to the data buffer. - @param[in] BufferSize The size of Buffer in bytes. - - @retval >0 The read operation was successful, and return value is the - number of bytes actually read from the TLS connection. - @retval <=0 The read operation was not successful. - -**/ -INTN -EFIAPI -TlsRead ( - IN VOID *Tls, - IN OUT VOID *Buffer, - IN UINTN BufferSize - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return -1; - } - - // - // Read bytes from the specified TLS connection. - // - return SSL_read (TlsConn->Ssl, Buffer, (UINT32) BufferSize); -} - -/** - Attempts to write data to a TLS connection. - - This function tries to write BufferSize bytes data from the Buffer into the - specified TLS connection. - - @param[in] Tls Pointer to the TLS connection for data writing. - @param[in] Buffer Pointer to the data buffer. - @param[in] BufferSize The size of Buffer in bytes. - - @retval >0 The write operation was successful, and return value is the - number of bytes actually written to the TLS connection. - @retval <=0 The write operation was not successful. - -**/ -INTN -EFIAPI -TlsWrite ( - IN VOID *Tls, - IN VOID *Buffer, - IN UINTN BufferSize - ) -{ - TLS_CONNECTION *TlsConn; - - TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL) { - return -1; - } - - // - // Write bytes to the specified TLS connection. - // - return SSL_write (TlsConn->Ssl, Buffer, (UINT32) BufferSize); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c deleted file mode 100644 index 2326047..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/ArmCache.c +++ /dev/null @@ -1,247 +0,0 @@ -/** @file - Cache Maintenance Functions. These functions vary by ARM architecture so the MdePkg - versions are null functions used to make sure things will compile. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -// -// Include common header file for this module. -// -#include -#include - -/** - Invalidates the entire instruction cache in cache coherency domain of the - calling CPU. - - Invalidates the entire instruction cache in cache coherency domain of the - calling CPU. - -**/ -VOID -EFIAPI -InvalidateInstructionCache ( - VOID - ) -{ - ASSERT(FALSE); -} - -/** - Invalidates a range of instruction cache lines in the cache coherency domain - of the calling CPU. - - Invalidates the instruction cache lines specified by Address and Length. If - Address is not aligned on a cache line boundary, then entire instruction - cache line containing Address is invalidated. If Address + Length is not - aligned on a cache line boundary, then the entire instruction cache line - containing Address + Length -1 is invalidated. This function may choose to - invalidate the entire instruction cache if that is more efficient than - invalidating the specified range. If Length is 0, then no instruction cache - lines are invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the instruction cache lines to - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - - @param Length The number of bytes to invalidate from the instruction cache. - - @return Address - -**/ -VOID * -EFIAPI -InvalidateInstructionCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - ASSERT(FALSE); - return Address; -} - -/** - Writes back and invalidates the entire data cache in cache coherency domain - of the calling CPU. - - Writes Back and Invalidates the entire data cache in cache coherency domain - of the calling CPU. This function guarantees that all dirty cache lines are - written back to system memory, and also invalidates all the data cache lines - in the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackInvalidateDataCache ( - VOID - ) -{ - ASSERT(FALSE); -} - -/** - Writes back and invalidates a range of data cache lines in the cache - coherency domain of the calling CPU. - - Writes back and invalidates the data cache lines specified by Address and - Length. If Address is not aligned on a cache line boundary, then entire data - cache line containing Address is written back and invalidated. If Address + - Length is not aligned on a cache line boundary, then the entire data cache - line containing Address + Length -1 is written back and invalidated. This - function may choose to write back and invalidate the entire data cache if - that is more efficient than writing back and invalidating the specified - range. If Length is 0, then no data cache lines are written back and - invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back and - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - @param Length The number of bytes to write back and invalidate from the - data cache. - - @return Address - -**/ -VOID * -EFIAPI -WriteBackInvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - ASSERT(FALSE); - return Address; -} - -/** - Writes back the entire data cache in cache coherency domain of the calling - CPU. - - Writes back the entire data cache in cache coherency domain of the calling - CPU. This function guarantees that all dirty cache lines are written back to - system memory. This function may also invalidate all the data cache lines in - the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackDataCache ( - VOID - ) -{ - ASSERT(FALSE); -} - -/** - Writes back a range of data cache lines in the cache coherency domain of the - calling CPU. - - Writes back the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is written back. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is written back. This function may choose to write back the entire - data cache if that is more efficient than writing back the specified range. - If Length is 0, then no data cache lines are written back. This function may - also invalidate all the data cache lines in the specified range of the cache - coherency domain of the calling CPU. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing - mode, then Address is a virtual address. - @param Length The number of bytes to write back from the data cache. - - @return Address - -**/ -VOID * -EFIAPI -WriteBackDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - ASSERT(FALSE); - return Address; -} - -/** - Invalidates the entire data cache in cache coherency domain of the calling - CPU. - - Invalidates the entire data cache in cache coherency domain of the calling - CPU. This function must be used with care because dirty cache lines are not - written back to system memory. It is typically used for cache diagnostics. If - the CPU does not support invalidation of the entire data cache, then a write - back and invalidate operation should be performed on the entire data cache. - -**/ -VOID -EFIAPI -InvalidateDataCache ( - VOID - ) -{ - ASSERT(FALSE); -} - -/** - Invalidates a range of data cache lines in the cache coherency domain of the - calling CPU. - - Invalidates the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is invalidated. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is invalidated. This function must never invalidate any cache lines - outside the specified range. If Length is 0, then no data cache lines are - invalidated. Address is returned. This function must be used with care - because dirty cache lines are not written back to system memory. It is - typically used for cache diagnostics. If the CPU does not support - invalidation of a data cache range, then a write back and invalidate - operation should be performed on the data cache range. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to invalidate. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing mode, - then Address is a virtual address. - @param Length The number of bytes to invalidate from the data cache. - - @return Address - -**/ -VOID * -EFIAPI -InvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - ASSERT(FALSE); - return Address; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf deleted file mode 100644 index ae16421..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file -# Instance of Cache Maintenance Library using Base Library services. -# -# Cache Maintenance Library that uses Base Library services to maintain caches. -# This library assumes there are no chipset dependencies required to maintain caches. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseCacheMaintenanceLib - MODULE_UNI_FILE = BaseCacheMaintenanceLib.uni - FILE_GUID = 123dd843-57c9-4158-8418-ce68b3944ce7 - MODULE_TYPE = BASE - VERSION_STRING = 1.1 - LIBRARY_CLASS = CacheMaintenanceLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources.IA32] - X86Cache.c - -[Sources.X64] - X86Cache.c - -[Sources.EBC] - EbcCache.c - -[Sources.ARM] - ArmCache.c - -[Sources.AARCH64] - ArmCache.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni deleted file mode 100644 index 9df91be..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of Cache Maintenance Library using Base Library services. -// -// Cache Maintenance Library that uses Base Library services to maintain caches. -// This library assumes there are no chipset dependencies required to maintain caches. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Cache Maintenance Library using Base Library services" - -#string STR_MODULE_DESCRIPTION #language en-US "The Cache Maintenance Library that uses Base Library services to maintain caches. This library assumes there are no chipset dependencies required to maintain caches." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c deleted file mode 100644 index efbb03a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c +++ /dev/null @@ -1,231 +0,0 @@ -/** @file - Cache Maintenance Functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/** - Invalidates the entire instruction cache in cache coherency domain of the - calling CPU. - -**/ -VOID -EFIAPI -InvalidateInstructionCache ( - VOID - ) -{ -} - -/** - Invalidates a range of instruction cache lines in the cache coherency domain - of the calling CPU. - - Invalidates the instruction cache lines specified by Address and Length. If - Address is not aligned on a cache line boundary, then entire instruction - cache line containing Address is invalidated. If Address + Length is not - aligned on a cache line boundary, then the entire instruction cache line - containing Address + Length -1 is invalidated. This function may choose to - invalidate the entire instruction cache if that is more efficient than - invalidating the specified range. If Length is 0, then no instruction cache - lines are invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the instruction cache lines to - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - - @param Length The number of bytes to invalidate from the instruction cache. - - @return Address. - -**/ -VOID * -EFIAPI -InvalidateInstructionCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - return Address; -} - -/** - Writes back and invalidates the entire data cache in cache coherency domain - of the calling CPU. - - Writes back and invalidates the entire data cache in cache coherency domain - of the calling CPU. This function guarantees that all dirty cache lines are - written back to system memory, and also invalidates all the data cache lines - in the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackInvalidateDataCache ( - VOID - ) -{ -} - -/** - Writes back and invalidates a range of data cache lines in the cache - coherency domain of the calling CPU. - - Writes Back and Invalidate the data cache lines specified by Address and - Length. If Address is not aligned on a cache line boundary, then entire data - cache line containing Address is written back and invalidated. If Address + - Length is not aligned on a cache line boundary, then the entire data cache - line containing Address + Length -1 is written back and invalidated. This - function may choose to write back and invalidate the entire data cache if - that is more efficient than writing back and invalidating the specified - range. If Length is 0, then no data cache lines are written back and - invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back and - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - @param Length The number of bytes to write back and invalidate from the - data cache. - - @return Address of cache invalidation. - -**/ -VOID * -EFIAPI -WriteBackInvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - return Address; -} - -/** - Writes back the entire data cache in cache coherency domain of the calling - CPU. - - Writes back the entire data cache in cache coherency domain of the calling - CPU. This function guarantees that all dirty cache lines are written back to - system memory. This function may also invalidate all the data cache lines in - the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackDataCache ( - VOID - ) -{ -} - -/** - Writes back a range of data cache lines in the cache coherency domain of the - calling CPU. - - Writes back the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is written back. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is written back. This function may choose to write back the entire - data cache if that is more efficient than writing back the specified range. - If Length is 0, then no data cache lines are written back. This function may - also invalidate all the data cache lines in the specified range of the cache - coherency domain of the calling CPU. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing - mode, then Address is a virtual address. - @param Length The number of bytes to write back from the data cache. - - @return Address of cache written in main memory. - -**/ -VOID * -EFIAPI -WriteBackDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - return Address; -} - -/** - Invalidates the entire data cache in cache coherency domain of the calling - CPU. - - Invalidates the entire data cache in cache coherency domain of the calling - CPU. This function must be used with care because dirty cache lines are not - written back to system memory. It is typically used for cache diagnostics. If - the CPU does not support invalidation of the entire data cache, then a write - back and invalidate operation should be performed on the entire data cache. - -**/ -VOID -EFIAPI -InvalidateDataCache ( - VOID - ) -{ -} - -/** - Invalidates a range of data cache lines in the cache coherency domain of the - calling CPU. - - Invalidates the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is invalidated. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is invalidated. This function must never invalidate any cache lines - outside the specified range. If Length is 0, then no data cache lines are - invalidated. Address is returned. This function must be used with care - because dirty cache lines are not written back to system memory. It is - typically used for cache diagnostics. If the CPU does not support - invalidation of a data cache range, then a write back and invalidate - operation should be performed on the data cache range. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to invalidate. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing mode, - then Address is a virtual address. - @param Length The number of bytes to invalidate from the data cache. - - @return Address. - -**/ -VOID * -EFIAPI -InvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); - return Address; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c deleted file mode 100644 index 9462bb9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c +++ /dev/null @@ -1,278 +0,0 @@ -/** @file - Cache Maintenance Functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#include -#include -#include - -/** - Invalidates the entire instruction cache in cache coherency domain of the - calling CPU. - -**/ -VOID -EFIAPI -InvalidateInstructionCache ( - VOID - ) -{ -} - -/** - Invalidates a range of instruction cache lines in the cache coherency domain - of the calling CPU. - - Invalidates the instruction cache lines specified by Address and Length. If - Address is not aligned on a cache line boundary, then entire instruction - cache line containing Address is invalidated. If Address + Length is not - aligned on a cache line boundary, then the entire instruction cache line - containing Address + Length -1 is invalidated. This function may choose to - invalidate the entire instruction cache if that is more efficient than - invalidating the specified range. If Length is 0, then no instruction cache - lines are invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the instruction cache lines to - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - - @param Length The number of bytes to invalidate from the instruction cache. - - @return Address. - -**/ -VOID * -EFIAPI -InvalidateInstructionCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - if (Length == 0) { - return Address; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Address)); - return Address; -} - -/** - Writes back and invalidates the entire data cache in cache coherency domain - of the calling CPU. - - Writes back and invalidates the entire data cache in cache coherency domain - of the calling CPU. This function guarantees that all dirty cache lines are - written back to system memory, and also invalidates all the data cache lines - in the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackInvalidateDataCache ( - VOID - ) -{ - AsmWbinvd (); -} - -/** - Writes back and invalidates a range of data cache lines in the cache - coherency domain of the calling CPU. - - Writes back and invalidates the data cache lines specified by Address and - Length. If Address is not aligned on a cache line boundary, then entire data - cache line containing Address is written back and invalidated. If Address + - Length is not aligned on a cache line boundary, then the entire data cache - line containing Address + Length -1 is written back and invalidated. This - function may choose to write back and invalidate the entire data cache if - that is more efficient than writing back and invalidating the specified - range. If Length is 0, then no data cache lines are written back and - invalidated. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back and - invalidate. If the CPU is in a physical addressing mode, then - Address is a physical address. If the CPU is in a virtual - addressing mode, then Address is a virtual address. - @param Length The number of bytes to write back and invalidate from the - data cache. - - @return Address of cache invalidation. - -**/ -VOID * -EFIAPI -WriteBackInvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - UINT32 RegEbx; - UINT32 RegEdx; - UINTN CacheLineSize; - UINTN Start; - UINTN End; - - if (Length == 0) { - return Address; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Address)); - - // - // If the CPU does not support CLFLUSH instruction, - // then promote flush range to flush entire cache. - // - AsmCpuid (0x01, NULL, &RegEbx, NULL, &RegEdx); - if ((RegEdx & BIT19) == 0) { - AsmWbinvd (); - return Address; - } - - // - // Cache line size is 8 * Bits 15-08 of EBX returned from CPUID 01H - // - CacheLineSize = (RegEbx & 0xff00) >> 5; - - Start = (UINTN)Address; - // - // Calculate the cache line alignment - // - End = (Start + Length + (CacheLineSize - 1)) & ~(CacheLineSize - 1); - Start &= ~((UINTN)CacheLineSize - 1); - - do { - Start = (UINTN)AsmFlushCacheLine ((VOID*)Start) + CacheLineSize; - } while (Start != End); - return Address; -} - -/** - Writes back the entire data cache in cache coherency domain of the calling - CPU. - - Writes back the entire data cache in cache coherency domain of the calling - CPU. This function guarantees that all dirty cache lines are written back to - system memory. This function may also invalidate all the data cache lines in - the cache coherency domain of the calling CPU. - -**/ -VOID -EFIAPI -WriteBackDataCache ( - VOID - ) -{ - WriteBackInvalidateDataCache (); -} - -/** - Writes back a range of data cache lines in the cache coherency domain of the - calling CPU. - - Writes back the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is written back. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is written back. This function may choose to write back the entire - data cache if that is more efficient than writing back the specified range. - If Length is 0, then no data cache lines are written back. This function may - also invalidate all the data cache lines in the specified range of the cache - coherency domain of the calling CPU. Address is returned. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to write back. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing - mode, then Address is a virtual address. - @param Length The number of bytes to write back from the data cache. - - @return Address of cache written in main memory. - -**/ -VOID * -EFIAPI -WriteBackDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - return WriteBackInvalidateDataCacheRange (Address, Length); -} - -/** - Invalidates the entire data cache in cache coherency domain of the calling - CPU. - - Invalidates the entire data cache in cache coherency domain of the calling - CPU. This function must be used with care because dirty cache lines are not - written back to system memory. It is typically used for cache diagnostics. If - the CPU does not support invalidation of the entire data cache, then a write - back and invalidate operation should be performed on the entire data cache. - -**/ -VOID -EFIAPI -InvalidateDataCache ( - VOID - ) -{ - AsmInvd (); -} - -/** - Invalidates a range of data cache lines in the cache coherency domain of the - calling CPU. - - Invalidates the data cache lines specified by Address and Length. If Address - is not aligned on a cache line boundary, then entire data cache line - containing Address is invalidated. If Address + Length is not aligned on a - cache line boundary, then the entire data cache line containing Address + - Length -1 is invalidated. This function must never invalidate any cache lines - outside the specified range. If Length is 0, then no data cache lines are - invalidated. Address is returned. This function must be used with care - because dirty cache lines are not written back to system memory. It is - typically used for cache diagnostics. If the CPU does not support - invalidation of a data cache range, then a write back and invalidate - operation should be performed on the data cache range. - - If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - - @param Address The base address of the data cache lines to invalidate. If - the CPU is in a physical addressing mode, then Address is a - physical address. If the CPU is in a virtual addressing mode, - then Address is a virtual address. - @param Length The number of bytes to invalidate from the data cache. - - @return Address. - -**/ -VOID * -EFIAPI -InvalidateDataCacheRange ( - IN VOID *Address, - IN UINTN Length - ) -{ - // - // Invalidation of a data cache range without writing back is not supported on - // x86 architecture, so write back and invalidate operation is performed. - // - return WriteBackInvalidateDataCacheRange (Address, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.S deleted file mode 100644 index 4b9a326..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.S +++ /dev/null @@ -1,38 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuFlushTlb() for ARM -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(CpuFlushTlb) - -#/** -# Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -# -# Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -# -#**/ -#VOID -#EFIAPI -#CpuFlushTlb ( -# VOID -# )# -# -ASM_PFX(CpuFlushTlb): - tlbi vmalle1 // Invalidate Inst TLB and Data TLB - dsb sy - isb - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.asm deleted file mode 100644 index 846d23a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.asm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuFlushTlb() for ARM -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuFlushTlb - AREA BaseCpuLib_LowLevel, CODE, READONLY - -;/** -; Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -; -; Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -; -;**/ -;VOID -;EFIAPI -;CpuFlushTlb ( -; VOID -; ); -; -CpuFlushTlb - tlbi vmalle1 // Invalidate Inst TLB and Data TLB - dsb sy - isb - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.S deleted file mode 100644 index b08bdfb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.S +++ /dev/null @@ -1,39 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuSleep() for AArch64 -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM LTD. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.align 3 -GCC_ASM_EXPORT(CpuSleep) - -#/** -# Places the CPU in a sleep state until an interrupt is received. -# -# Places the CPU in a sleep state until an interrupt is received. If interrupts -# are disabled prior to calling this function, then the CPU will be placed in a -# sleep state indefinitely. -# -#**/ -#VOID -#EFIAPI -#CpuSleep ( -# VOID -# ); -# - -ASM_PFX(CpuSleep): - wfi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.asm deleted file mode 100644 index aca244e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.asm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuSleep() for AArch64 -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM LTD. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuSleep - AREA BaseCpuLib_LowLevel, CODE, READONLY - -;/** -; Places the CPU in a sleep state until an interrupt is received. -; -; Places the CPU in a sleep state until an interrupt is received. If interrupts -; are disabled prior to calling this function, then the CPU will be placed in a -; sleep state indefinitely. -; -;**/ -;VOID -;EFIAPI -;CpuSleep ( -; VOID -; ); -; - -CpuSleep - wfi - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.S deleted file mode 100644 index e014723..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuFlushTlb() for ARM -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(CpuFlushTlb) - -#/** -# Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -# -# Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -# -#**/ -#VOID -#EFIAPI -#CpuFlushTlb ( -# VOID -# )# -# -ASM_PFX(CpuFlushTlb): - mov r0,#0 - mcr p15,0,r0,c8,c5,0 // Invalidate all the unlocked entried in TLB - bx LR diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.asm deleted file mode 100644 index 78ee84b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuFlushTlb.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuFlushTlb() for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuFlushTlb - AREA cpu_flush_tlb, CODE, READONLY - -;/** -; Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -; -; Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. -; -;**/ -;VOID -;EFIAPI -;CpuFlushTlb ( -; VOID -; ); -; -CpuFlushTlb - MOV r0,#0 - MCR p15,0,r0,c8,c5,0 ;Invalidate all the unlocked entried in TLB - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.S deleted file mode 100644 index 001db87..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuSleep() for ARMv7 -# -# ARMv6 versions was: -# MOV r0,#0 -# MCR p15,0,r0,c7,c0,4 ;Wait for Interrupt instruction -# -# But this is a no-op on ARMv7 -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(CpuSleep) - -#/** -# Places the CPU in a sleep state until an interrupt is received. -# -# Places the CPU in a sleep state until an interrupt is received. If interrupts -# are disabled prior to calling this function, then the CPU will be placed in a -# sleep state indefinitely. -# -#**/ -#VOID -#EFIAPI -#CpuSleep ( -# VOID -# ); -# -ASM_PFX(CpuSleep): - wfi - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.asm deleted file mode 100644 index 0bcad14..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Arm/CpuSleep.asm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuSleep() for ARMv7 -; -; ARMv6 versions was: -; MOV r0,#0 -; MCR p15,0,r0,c7,c0,4 ;Wait for Interrupt instruction -; -; But this is a no-op on ARMv7 -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuSleep - AREA cpu_sleep, CODE, READONLY - -;/** -; Places the CPU in a sleep state until an interrupt is received. -; -; Places the CPU in a sleep state until an interrupt is received. If interrupts -; are disabled prior to calling this function, then the CPU will be placed in a -; sleep state indefinitely. -; -;**/ -;VOID -;EFIAPI -;CpuSleep ( -; VOID -; ); -; -CpuSleep - WFI - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf deleted file mode 100644 index 7d82eda..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf +++ /dev/null @@ -1,74 +0,0 @@ -## @file -# Instance of CPU Library for various architecture. -# -# CPU Library implemented using ASM functions for IA32, X64, ARM, AARCH64, -# PAL CALLs for IPF, and empty functions for EBC. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseCpuLib - MODULE_UNI_FILE = BaseCpuLib.uni - FILE_GUID = 4FBD2538-249C-4b50-8F4A-A9E66609CBF6 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = CpuLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources.IA32] - Ia32/CpuSleep.c | MSFT - Ia32/CpuFlushTlb.c | MSFT - - Ia32/CpuSleep.nasm| INTEL - Ia32/CpuFlushTlb.nasm| INTEL - - Ia32/CpuSleepGcc.c | GCC - Ia32/CpuFlushTlbGcc.c | GCC - -[Sources.X64] - X64/CpuFlushTlb.nasm - X64/CpuSleep.nasm - - X64/CpuSleep.nasm| GCC - X64/CpuSleep.S | GCC - X64/CpuFlushTlb.nasm| GCC - X64/CpuFlushTlb.S | GCC - -[Sources.EBC] - Ebc/CpuSleepFlushTlb.c - -[Sources.ARM] - Arm/CpuFlushTlb.asm | RVCT - Arm/CpuSleep.asm | RVCT - Arm/CpuFlushTlb.asm | MSFT - Arm/CpuSleep.asm | MSFT - Arm/CpuFlushTlb.S | GCC - Arm/CpuSleep.S | GCC - -[Sources.AARCH64] - AArch64/CpuFlushTlb.S | GCC - AArch64/CpuSleep.S | GCC - AArch64/CpuFlushTlb.asm | MSFT - AArch64/CpuSleep.asm | MSFT - -[Packages] - MdePkg/MdePkg.dec - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni deleted file mode 100644 index 19510f4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// Instance of CPU Library for various architecture. -// -// CPU Library implemented using ASM functions for IA-32 and X64, -// PAL CALLs for IPF, and empty functions for EBC. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of CPU Library for various architectures" - -#string STR_MODULE_DESCRIPTION #language en-US "CPU Library implemented using ASM functions for IA-32 and X64, PAL CALLs for IPF, and empty functions for EBC." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c deleted file mode 100644 index 81ae029..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c +++ /dev/null @@ -1,46 +0,0 @@ -/** @file - Base Library CPU Functions for EBC - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include -#include - -/** - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - -**/ -VOID -EFIAPI -CpuFlushTlb ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - Places the CPU in a sleep state until an interrupt is received. - - Places the CPU in a sleep state until an interrupt is received. If interrupts - are disabled prior to calling this function, then the CPU will be placed in a - sleep state indefinitely. - -**/ -VOID -EFIAPI -CpuSleep ( - VOID - ) -{ -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c deleted file mode 100644 index 25b16c5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c +++ /dev/null @@ -1,34 +0,0 @@ -/** @file - CpuFlushTlb function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -/** - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - -**/ -VOID -EFIAPI -CpuFlushTlb ( - VOID - ) -{ - _asm { - mov eax, cr3 - mov cr3, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm deleted file mode 100644 index aa34345..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuFlushTlb.Asm -; -; Abstract: -; -; CpuFlushTlb function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuFlushTlb ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuFlushTlb) -ASM_PFX(CpuFlushTlb): - mov eax, cr3 - mov cr3, eax ; moving to CR3 flushes TLB - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c deleted file mode 100644 index 4cff851..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - CpuFlushTlb function for Ia32/X64 GCC. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -/** - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. - -**/ -VOID -EFIAPI -CpuFlushTlb ( - VOID - ) -{ - AsmWriteCr3 (AsmReadCr3 ()); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c deleted file mode 100644 index 40b0453..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.c +++ /dev/null @@ -1,34 +0,0 @@ -/** @file - CpuSleep function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/** - Places the CPU in a sleep state until an interrupt is received. - - Places the CPU in a sleep state until an interrupt is received. If interrupts - are disabled prior to calling this function, then the CPU will be placed in a - sleep state indefinitely. - -**/ -VOID -EFIAPI -CpuSleep ( - VOID - ) -{ - _asm { - hlt - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.nasm deleted file mode 100644 index c808f96..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleep.nasm +++ /dev/null @@ -1,36 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuSleep.Asm -; -; Abstract: -; -; CpuSleep function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuSleep ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuSleep) -ASM_PFX(CpuSleep): - hlt - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c deleted file mode 100644 index b61a61f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/Ia32/CpuSleepGcc.c +++ /dev/null @@ -1,33 +0,0 @@ -/** @file - CpuSleep function for Ia32/X64 GCC. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/** - Places the CPU in a sleep state until an interrupt is received. - - Places the CPU in a sleep state until an interrupt is received. If interrupts - are disabled prior to calling this function, then the CPU will be placed in a - sleep state indefinitely. - -**/ -VOID -EFIAPI -CpuSleep ( - VOID - ) -{ - __asm__ __volatile__ ("hlt"::: "memory"); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S deleted file mode 100644 index 009b280..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuFlushTlb.Asm -# -# Abstract: -# -# CpuFlushTlb function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(CpuFlushTlb) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# CpuFlushTlb ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_PFX(CpuFlushTlb): - mov %cr3, %rax - mov %rax, %cr3 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm deleted file mode 100644 index cdcbbca..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuFlushTlb.Asm -; -; Abstract: -; -; CpuFlushTlb function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuFlushTlb ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuFlushTlb) -ASM_PFX(CpuFlushTlb): - mov rax, cr3 - mov cr3, rax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S deleted file mode 100644 index 44d58e9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S +++ /dev/null @@ -1,34 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuSleep.S -# -# Abstract: -# -# CpuSleep function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# CpuSleep ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(CpuSleep) -ASM_PFX(CpuSleep): - hlt - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.nasm deleted file mode 100644 index 0deed7f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseCpuLib/X64/CpuSleep.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuSleep.Asm -; -; Abstract: -; -; CpuSleep function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuSleep ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuSleep) -ASM_PFX(CpuSleep): - hlt - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf deleted file mode 100644 index b5ada20..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +++ /dev/null @@ -1,36 +0,0 @@ -## @file -# Debug Library with empty functions. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseDebugLibNull - MODULE_UNI_FILE = BaseDebugLibNull.uni - FILE_GUID = 9ba1d976-0624-41a3-8650-28165e8d9ae8 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DebugLib.c - - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.uni deleted file mode 100644 index 3cf6a75..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Debug Library with empty functions. -// -// Debug Library with empty functions. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Debug Library with empty functions" - -#string STR_MODULE_DESCRIPTION #language en-US "Debug Library with empty functions." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/DebugLib.c deleted file mode 100644 index 4056af6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibNull/DebugLib.c +++ /dev/null @@ -1,198 +0,0 @@ -/** @file - Null Base Debug Library instance with empty functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format Format string for the debug message to print. - @param ... Variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated the assert condition. - @param LineNumber The line number in the source file that generated the assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - return Buffer; -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return FALSE; -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return FALSE; -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return FALSE; -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return FALSE; -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return FALSE; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf deleted file mode 100644 index c938553..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +++ /dev/null @@ -1,49 +0,0 @@ -## @file -# Instance of Debug Library based on Serial Port Library. -# It uses Print Library to produce formatted output strings to seiral port device. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseDebugLibSerialPort - MODULE_UNI_FILE = BaseDebugLibSerialPort.uni - FILE_GUID = BB83F95F-EDBC-4884-A520-CD42AF388FAE - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib - CONSTRUCTOR = BaseDebugLibSerialPortConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DebugLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - SerialPortLib - BaseMemoryLib - PcdLib - PrintLib - BaseLib - DebugPrintErrorLevelLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.uni deleted file mode 100644 index 4b90207..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Debug Library based on Serial Port Library. -// -// It uses Print Library to produce formatted output strings to seiral port device. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Library based on Serial Port Library" - -#string STR_MODULE_DESCRIPTION #language en-US "It uses Print Library to produce formatted output strings to a serial port device." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c deleted file mode 100644 index 34b2793..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c +++ /dev/null @@ -1,284 +0,0 @@ -/** @file - Base Debug library instance base on Serial Port library. - It uses PrintLib to send debug messages to serial port device. - - NOTE: If the Serial Port library enables hardware flow control, then a call - to DebugPrint() or DebugAssert() may hang if writes to the serial port are - being blocked. This may occur if a key(s) are pressed in a terminal emulator - used to monitor the DEBUG() and ASSERT() messages. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 - -/** - The constructor function initialize the Serial Port Library - - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. - -**/ -RETURN_STATUS -EFIAPI -BaseDebugLibSerialPortConstructor ( - VOID - ) -{ - return SerialPortInitialize (); -} - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format Format string for the debug message to print. - @param ... Variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Check driver debug mask value and global mask - // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) { - return; - } - - // - // Convert the DEBUG() message to an ASCII String - // - VA_START (Marker, Format); - AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker); - VA_END (Marker); - - // - // Send the print string to a Serial Port - // - SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated the assert condition. - @param LineNumber The line number in the source file that generated the assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Generate the ASSERT() message in Ascii format - // - AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT [%a] %a(%d): %a\n", gEfiCallerBaseName, FileName, LineNumber, Description); - - // - // Send the print string to the Console Output device - // - SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c deleted file mode 100644 index ab26fc1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.c +++ /dev/null @@ -1,59 +0,0 @@ -/** @file - Debug Print Error Level library instance that retrieves the current error - level from PcdDebugPrintErrorLevel. This generic library instance does not - support the setting of the global debug print error level mask for the platform. - - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Returns the debug print error level mask for the current module. - - @return Debug print error level mask for the current module. - -**/ -UINT32 -EFIAPI -GetDebugPrintErrorLevel ( - VOID - ) -{ - // - // Retrieve the current debug print error level mask from PcdDebugPrintErrorLevel. - // - return PcdGet32 (PcdDebugPrintErrorLevel); -} - -/** - Sets the global debug print error level mask fpr the entire platform. - - @param ErrorLevel Global debug print error level. - - @retval TRUE The debug print error level mask was sucessfully set. - @retval FALSE The debug print error level mask could not be set. - -**/ -BOOLEAN -EFIAPI -SetDebugPrintErrorLevel ( - UINT32 ErrorLevel - ) -{ - // - // This library uinstance does not support setting the global debug print error - // level mask. - // - return FALSE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf deleted file mode 100644 index 4d30288..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file -# Debug Print Error Level library instance based on PcdDebugPrintErrorLevel. -# It retrieves the current error level from PcdDebugPrintErrorLevel. -# -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseDebugPrintErrorLevelLib - MODULE_UNI_FILE = BaseDebugPrintErrorLevelLib.uni - FILE_GUID = A2C09E18-E4D2-407e-AFCC-628B79113F72 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugPrintErrorLevelLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseDebugPrintErrorLevelLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PcdLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.uni deleted file mode 100644 index 2b306d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Debug Print Error Level library instance based on PcdDebugPrintErrorLevel. -// -// It retrieves the current error level from PcdDebugPrintErrorLevel. -// -// Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Debug Print Error Level library instance based on PcdDebugPrintErrorLevel" - -#string STR_MODULE_DESCRIPTION #language en-US "It retrieves the current error level from PcdDebugPrintErrorLevel." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c deleted file mode 100644 index a211df0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c +++ /dev/null @@ -1,484 +0,0 @@ -/** @file - Provide generic extract guided section functions. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -#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; -} EXTRACT_GUIDED_SECTION_HANDLER_INFO; - -/** - HandlerInfo table address is set by PcdGuidedExtractHandlerTableAddress, which is used to store - the registered guid and Handler list. When it is initialized, it will be directly returned. - Or, HandlerInfo table will be initialized in this function. - - @param[in, out] InfoPointer The pointer to the handler information structure. - - @retval RETURN_SUCCESS HandlerInfo table can be used to store guid and function tables. - @retval RETURN_OUT_OF_RESOURCES HandlerInfo table address is not writable. -**/ -RETURN_STATUS -GetExtractGuidedSectionHandlerInfo ( - IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer - ) -{ - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - // - // Set the available memory address to handler info. - // - HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress); - if (HandlerInfo == NULL) { - *InfoPointer = NULL; - return EFI_OUT_OF_RESOURCES; - } - - // - // First check whether the handler information structure is initialized. - // - if (HandlerInfo->Signature == EXTRACT_HANDLER_INFO_SIGNATURE) { - // - // The handler information has been initialized and is returned. - // - *InfoPointer = HandlerInfo; - return RETURN_SUCCESS; - } - - // - // Try to initialize the handler information structure - // - HandlerInfo->Signature = EXTRACT_HANDLER_INFO_SIGNATURE; - if (HandlerInfo->Signature != EXTRACT_HANDLER_INFO_SIGNATURE) { - // - // The handler information structure was not writeable because the memory is not ready. - // - *InfoPointer = NULL; - return RETURN_OUT_OF_RESOURCES; - } - - // - // 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) - ); - *InfoPointer = HandlerInfo; - return RETURN_SUCCESS; -} - -/** - Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers(). - - Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs. - The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated - and caller must treat this array of GUIDs as read-only data. - If ExtractHandlerGuidTable is NULL, then ASSERT(). - - @param[out] ExtractHandlerGuidTable A pointer to the array of GUIDs that have been registered through - ExtractGuidedSectionRegisterHandlers(). - - @return The number of the supported extract guided Handler. - -**/ -UINTN -EFIAPI -ExtractGuidedSectionGetGuidList ( - OUT GUID **ExtractHandlerGuidTable - ) -{ - RETURN_STATUS Status; - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - ASSERT (ExtractHandlerGuidTable != NULL); - - // - // Get all registered handler information - // - Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (RETURN_ERROR (Status)) { - *ExtractHandlerGuidTable = NULL; - return 0; - } - - // - // Get GuidTable and Table Number - // - ASSERT (HandlerInfo != NULL); - *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable; - return HandlerInfo->NumberOfExtractHandler; -} - -/** - Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER - for a specific GUID section type. - - Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid. - If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED. - If there are not enough resources available to register the handlers then RETURN_OUT_OF_RESOURCES is returned. - - If SectionGuid is NULL, then ASSERT(). - If GetInfoHandler is NULL, then ASSERT(). - If DecodeHandler is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the the handlers - of the GUIDed section type being registered. - @param[in] GetInfoHandler The pointer to a function that examines a GUIDed section and returns the - size of the decoded buffer and the size of an optional scratch buffer - required to actually decode the data in a GUIDed section. - @param[in] DecodeHandler The pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. - - @retval RETURN_SUCCESS The handlers were registered. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to register the handlers. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionRegisterHandlers ( - IN CONST GUID *SectionGuid, - IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, - IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler - ) -{ - UINT32 Index; - RETURN_STATUS Status; - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - // - // Check input parameter - // - ASSERT (SectionGuid != NULL); - ASSERT (GetInfoHandler != NULL); - ASSERT (DecodeHandler != NULL); - - // - // Get the registered handler information - // - Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (RETURN_ERROR (Status)) { - return Status; - } - - // - // Search the match registered GetInfo handler for the input guided section. - // - ASSERT (HandlerInfo != NULL); - 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; - return RETURN_SUCCESS; - } - } - - // - // Check the global table is enough to contain new Handler. - // - if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) { - return RETURN_OUT_OF_RESOURCES; - } - - // - // Register new Handler and guid value. - // - CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid); - HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler; - HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler; - - return RETURN_SUCCESS; -} - -/** - Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to retrieve and return the size of the decoded buffer and the size of an - optional scratch buffer required to actually decode the data in a GUIDed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of - type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBufferSize is NULL, then ASSERT(). - If ScratchBufferSize is NULL, then ASSERT(). - If SectionAttribute is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required if the buffer - specified by InputSection were decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space if the buffer specified by - InputSection were decoded. - @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes field of - EFI_GUID_DEFINED_SECTION in the PI Specification. - - @retval RETURN_SUCCESS Successfully retrieved the required information. - @retval RETURN_UNSUPPORTED The GUID from the section specified by InputSection does not match any of - the GUIDs registered with ExtractGuidedSectionRegisterHandlers(). - @retval Others The return status from the handler associated with the GUID retrieved from - the section specified by InputSection. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetInfo ( - IN CONST VOID *InputSection, - OUT UINT32 *OutputBufferSize, - OUT UINT32 *ScratchBufferSize, - OUT UINT16 *SectionAttribute - ) -{ - UINT32 Index; - RETURN_STATUS Status; - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - EFI_GUID *SectionDefinitionGuid; - - // - // Check input parameter - // - ASSERT (InputSection != NULL); - ASSERT (OutputBufferSize != NULL); - ASSERT (ScratchBufferSize != NULL); - ASSERT (SectionAttribute != NULL); - - // - // Get all registered handler information. - // - Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (RETURN_ERROR (Status)) { - return Status; - } - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - 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 ++) { - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to decode the data in a GUIDed section and return the result in a caller - allocated output buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this - decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the data in InputSection, - then OutputBuffer is set to point at the data in InputSection. Otherwise, the decoded data will be placed in a caller - allocated buffer specified by OutputBuffer. This function is responsible for computing the EFI_AUTH_STATUS_PLATFORM_OVERRIDE - bit of in AuthenticationStatus. The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBuffer is NULL, then ASSERT(). - If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. - @param[in] ScratchBuffer A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation. - @param[out] AuthenticationStatus - A pointer to the authentication status of the decoded output buffer. See the definition - of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI - Specification. - - @retval RETURN_SUCCESS The buffer specified by InputSection was decoded. - @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionDecode ( - IN CONST VOID *InputSection, - OUT VOID **OutputBuffer, - IN VOID *ScratchBuffer, OPTIONAL - OUT UINT32 *AuthenticationStatus - ) -{ - UINT32 Index; - RETURN_STATUS Status; - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - EFI_GUID *SectionDefinitionGuid; - - // - // Check input parameter - // - ASSERT (InputSection != NULL); - ASSERT (OutputBuffer != NULL); - ASSERT (AuthenticationStatus != NULL); - - // - // Get all registered handler information. - // - Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (RETURN_ERROR (Status)) { - return Status; - } - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - 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 ++) { - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and - EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type. - - Retrieves the handlers associated with SectionGuid and returns them in - GetInfoHandler and DecodeHandler. - - If the GUID value specified by SectionGuid has not been registered, then - return RETURN_NOT_FOUND. - - If SectionGuid is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed - section type being retrieved. - @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns - the size of the decoded buffer and the size of an optional scratch - buffer required to actually decode the data in a GUIDed section. - This is an optional parameter that may be NULL. If it is NULL, then - the previously registered handler is not returned. - @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. This is an optional parameter that may be NULL. - If it is NULL, then the previously registered handler is not returned. - - @retval RETURN_SUCCESS The handlers were retrieved. - @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetHandlers ( - IN CONST GUID *SectionGuid, - OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL - OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL - ) -{ - UINT32 Index; - RETURN_STATUS Status; - EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - // - // Check input parameter - // - ASSERT (SectionGuid != NULL); - - // - // Get the registered handler information - // - Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (RETURN_ERROR (Status)) { - return Status; - } - - // - // Search the match registered GetInfo handler for the input guided section. - // - ASSERT (HandlerInfo != NULL); - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf deleted file mode 100644 index ce015fd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf +++ /dev/null @@ -1,54 +0,0 @@ -## @file -# Base ExtractGuidedSection Library. -# This instance can also be used in SEC phase only when the memory is ready in SEC phase. -# PCD PcdGuidedExtractHandlerTableAddress points to the available pysical memory space -# that is used to store Guided Extract Handlers. -# Note: A driver of type DXE_RUNTIME_DRIVER can use this ExtractGuidedSectionLib -# in their initialization without any issues. They only have to be careful in -# the implementation of runtime services, because this BASE library instance doesn't -# convert the address pointed by PcdGuidedExtractHandlerTableAddress to the virtual address. -# And a driver should use this ExtractGuidedSectionLib to do implementation internally, also -# this ExtractGuidedSectionLib couldn't be used for guided section extraction that is required -# by PEI and DXE core for recovery or capsule image processing, etc. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseExtractGuidedSectionLib - MODULE_UNI_FILE = BaseExtractGuidedSectionLib.uni - FILE_GUID = 4e3236e9-d1c8-4c04-a89f-26f1c44b2592 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ExtractGuidedSectionLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - BaseExtractGuidedSectionLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseMemoryLib - DebugLib - PcdLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.uni deleted file mode 100644 index fcb7d65..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.uni +++ /dev/null @@ -1,27 +0,0 @@ -// /** @file -// Base ExtractGuidedSection Library. -// -// This instance can also be used in SEC phase only when the memory is ready in SEC phase. -// PCD PcdGuidedExtractHandlerTableAddress points to the available pysical memory space -// that is used to store Guided Extract Handlers. -// Note: A driver of type DXE_RUNTIME_DRIVER can use this ExtractGuidedSectionLib -// in their initialization without any issues. They only have to be careful in -// the implementation of runtime services, because this BASE library instance doesn't -// convert the address pointed by PcdGuidedExtractHandlerTableAddress to the virtual address. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Base ExtractGuidedSection Library" - -#string STR_MODULE_DESCRIPTION #language en-US "This instance can also be used in the SEC phase only when the memory is ready in the SEC phase. PCD PcdGuidedExtractHandlerTableAddress points to the available physical memory space that is used to store Guided Extract Handlers. Note: A driver of type DXE_RUNTIME_DRIVER can use this ExtractGuidedSectionLib in its initialization without any issues. Be careful in the implementation of runtime services, because this BASE library instance doesn't convert the address pointed by PcdGuidedExtractHandlerTableAddress to the virtual address." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S deleted file mode 100644 index 85f5932..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S +++ /dev/null @@ -1,148 +0,0 @@ -# -# Copyright (c) 2014-2018, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -.text -.align 3 - -GCC_ASM_EXPORT(MmioRead8Internal) -GCC_ASM_EXPORT(MmioWrite8Internal) -GCC_ASM_EXPORT(MmioRead16Internal) -GCC_ASM_EXPORT(MmioWrite16Internal) -GCC_ASM_EXPORT(MmioRead32Internal) -GCC_ASM_EXPORT(MmioWrite32Internal) -GCC_ASM_EXPORT(MmioRead64Internal) -GCC_ASM_EXPORT(MmioWrite64Internal) - -// -// Reads an 8-bit MMIO register. -// -// Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead8Internal): - ldrb w0, [x0] - dmb ld - ret - -// -// Writes an 8-bit MMIO register. -// -// Writes the 8-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite8Internal): - dmb st - strb w1, [x0] - ret - -// -// Reads a 16-bit MMIO register. -// -// Reads the 16-bit MMIO register specified by Address. The 16-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead16Internal): - ldrh w0, [x0] - dmb ld - ret - -// -// Writes a 16-bit MMIO register. -// -// Writes the 16-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite16Internal): - dmb st - strh w1, [x0] - ret - -// -// Reads a 32-bit MMIO register. -// -// Reads the 32-bit MMIO register specified by Address. The 32-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead32Internal): - ldr w0, [x0] - dmb ld - ret - -// -// Writes a 32-bit MMIO register. -// -// Writes the 32-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite32Internal): - dmb st - str w1, [x0] - ret - -// -// Reads a 64-bit MMIO register. -// -// Reads the 64-bit MMIO register specified by Address. The 64-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead64Internal): - ldr x0, [x0] - dmb ld - ret - -// -// Writes a 64-bit MMIO register. -// -// Writes the 64-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite64Internal): - dmb st - str x1, [x0] - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.asm deleted file mode 100644 index bd235a5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.asm +++ /dev/null @@ -1,149 +0,0 @@ -; -; Copyright (c) 2014-2018, Linaro Limited. All rights reserved. -; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http:;opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; - - -AREA IoLibMmio, CODE, READONLY - -EXPORT MmioRead8Internal -EXPORT MmioWrite8Internal -EXPORT MmioRead16Internal -EXPORT MmioWrite16Internal -EXPORT MmioRead32Internal -EXPORT MmioWrite32Internal -EXPORT MmioRead64Internal -EXPORT MmioWrite64Internal - -; -; Reads an 8-bit MMIO register. -; -; Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead8Internal - ldrb w0, [x0] - dmb ld - ret - -; -; Writes an 8-bit MMIO register. -; -; Writes the 8-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite8Internal - dmb st - strb w1, [x0] - ret - -; -; Reads a 16-bit MMIO register. -; -; Reads the 16-bit MMIO register specified by Address. The 16-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead16Internal - ldrh w0, [x0] - dmb ld - ret - -; -; Writes a 16-bit MMIO register. -; -; Writes the 16-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite16Internal - dmb st - strh w1, [x0] - ret - -; -; Reads a 32-bit MMIO register. -; -; Reads the 32-bit MMIO register specified by Address. The 32-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead32Internal - ldr w0, [x0] - dmb ld - ret - -; -; Writes a 32-bit MMIO register. -; -; Writes the 32-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite32Internal - dmb st - str w1, [x0] - ret - -; -; Reads a 64-bit MMIO register. -; -; Reads the 64-bit MMIO register specified by Address. The 64-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead64Internal - ldr x0, [x0] - dmb ld - ret - -; -; Writes a 64-bit MMIO register. -; -; Writes the 64-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite64Internal - dmb st - str x1, [x0] - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S deleted file mode 100644 index 0fa87fc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright (c) 2014-2018, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -GCC_ASM_EXPORT(MmioRead8Internal) -GCC_ASM_EXPORT(MmioWrite8Internal) -GCC_ASM_EXPORT(MmioRead16Internal) -GCC_ASM_EXPORT(MmioWrite16Internal) -GCC_ASM_EXPORT(MmioRead32Internal) -GCC_ASM_EXPORT(MmioWrite32Internal) -GCC_ASM_EXPORT(MmioRead64Internal) -GCC_ASM_EXPORT(MmioWrite64Internal) - -// -// Reads an 8-bit MMIO register. -// -// Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead8Internal): - ldrb r0, [r0] - dmb - bx lr - -// -// Writes an 8-bit MMIO register. -// -// Writes the 8-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite8Internal): - dmb st - strb r1, [r0] - bx lr - -// -// Reads a 16-bit MMIO register. -// -// Reads the 16-bit MMIO register specified by Address. The 16-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead16Internal): - ldrh r0, [r0] - dmb - bx lr - -// -// Writes a 16-bit MMIO register. -// -// Writes the 16-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite16Internal): - dmb st - strh r1, [r0] - bx lr - -// -// Reads a 32-bit MMIO register. -// -// Reads the 32-bit MMIO register specified by Address. The 32-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead32Internal): - ldr r0, [r0] - dmb - bx lr - -// -// Writes a 32-bit MMIO register. -// -// Writes the 32-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite32Internal): - dmb st - str r1, [r0] - bx lr - -// -// Reads a 64-bit MMIO register. -// -// Reads the 64-bit MMIO register specified by Address. The 64-bit read value is -// returned. This function must guarantee that all MMIO read and write -// operations are serialized. -// -// @param Address The MMIO register to read. -// -// @return The value read. -// -ASM_PFX(MmioRead64Internal): - ldr r1, [r0, #4] - ldr r0, [r0] - dmb - bx lr - -// -// Writes a 64-bit MMIO register. -// -// Writes the 64-bit MMIO register specified by Address with the value specified -// by Value and returns Value. This function must guarantee that all MMIO read -// and write operations are serialized. -// -// @param Address The MMIO register to write. -// @param Value The value to write to the MMIO register. -// -ASM_PFX(MmioWrite64Internal): - dmb st - str r2, [r0] - str r3, [r0, #4] - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm deleted file mode 100644 index c0c06c5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm +++ /dev/null @@ -1,151 +0,0 @@ -; -; Copyright (c) 2014-2018, Linaro Limited. All rights reserved. -; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http:;opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; - - -AREA IoLibMmio, CODE, READONLY - -EXPORT MmioRead8Internal -EXPORT MmioWrite8Internal -EXPORT MmioRead16Internal -EXPORT MmioWrite16Internal -EXPORT MmioRead32Internal -EXPORT MmioWrite32Internal -EXPORT MmioRead64Internal -EXPORT MmioWrite64Internal - -; -; Reads an 8-bit MMIO register. -; -; Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead8Internal - ldrb r0, [r0] - dmb - bx lr - -; -; Writes an 8-bit MMIO register. -; -; Writes the 8-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite8Internal - dmb st - strb r1, [r0] - bx lr - -; -; Reads a 16-bit MMIO register. -; -; Reads the 16-bit MMIO register specified by Address. The 16-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead16Internal - ldrh r0, [r0] - dmb - bx lr - -; -; Writes a 16-bit MMIO register. -; -; Writes the 16-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite16Internal - dmb st - strh r1, [r0] - bx lr - -; -; Reads a 32-bit MMIO register. -; -; Reads the 32-bit MMIO register specified by Address. The 32-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead32Internal - ldr r0, [r0] - dmb - bx lr - -; -; Writes a 32-bit MMIO register. -; -; Writes the 32-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite32Internal - dmb st - str r1, [r0] - bx lr - -; -; Reads a 64-bit MMIO register. -; -; Reads the 64-bit MMIO register specified by Address. The 64-bit read value is -; returned. This function must guarantee that all MMIO read and write -; operations are serialized. -; -; @param Address The MMIO register to read. -; -; @return The value read. -; -MmioRead64Internal - ldr r1, [r0, #4] - ldr r0, [r0] - dmb - bx lr - -; -; Writes a 64-bit MMIO register. -; -; Writes the 64-bit MMIO register specified by Address with the value specified -; by Value and returns Value. This function must guarantee that all MMIO read -; and write operations are serialized. -; -; @param Address The MMIO register to write. -; @param Value The value to write to the MMIO register. -; -MmioWrite64Internal - dmb st - str r2, [r0] - str r3, [r0, #4] - bx lr - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf deleted file mode 100644 index fc51bb2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf +++ /dev/null @@ -1,71 +0,0 @@ -## @file -# Instance of I/O Library using compiler intrinsics. -# -# I/O Library that uses compiler intrinsics to perform IN and OUT instructions -# for IA-32 and x64. On IPF, I/O port requests are translated into MMIO requests. -# MMIO requests are forwarded directly to memory. For EBC, I/O port requests -# ASSERT(). -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2017, AMD Incorporated. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseIoLibIntrinsic - MODULE_UNI_FILE = BaseIoLibIntrinsic.uni - FILE_GUID = 926c9cd0-4bb8-479b-9ac4-8a2a23f85307 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - IoLibMmioBuffer.c - BaseIoLibIntrinsicInternal.h - IoHighLevel.c - -[Sources.IA32] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLibIcc.c | INTEL - IoLib.c - Ia32/IoFifo.nasm - -[Sources.X64] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLibIcc.c | INTEL - IoLib.c - X64/IoFifo.nasm - -[Sources.EBC] - IoLibEbc.c - IoLib.c - -[Sources.ARM] - IoLibArm.c - -[Sources.AARCH64] - IoLibArm.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni deleted file mode 100644 index 3696eda..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// Instance of I/O Library using compiler intrinsics. -// -// I/O Library that uses compiler intrinsics to perform IN and OUT instructions -// for IA-32 and x64. On IPF, I/O port requests are translated into MMIO requests. -// MMIO requests are forwarded directly to memory. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of I/O Library using compiler intrinsics" - -#string STR_MODULE_DESCRIPTION #language en-US "I/O Library that uses compiler intrinsics to perform IN and OUT instructions for IA-32 and x64. On IPF, I/O port requests are translated into MMIO requests. MMIO requests are forwarded directly to memory." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf deleted file mode 100644 index f9060c8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf +++ /dev/null @@ -1,52 +0,0 @@ -## @file -# Instance of I/O Library using KVM/ARM safe assembler routines -# -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2017, AMD Incorporated. All rights reserved.
-# Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x0001001A - BASE_NAME = BaseIoLibIntrinsicArmVirt - MODULE_UNI_FILE = BaseIoLibIntrinsicArmVirt.uni - FILE_GUID = 217102b4-b465-4a1d-a2de-93dd385ec480 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib - -# -# VALID_ARCHITECTURES = ARM AARCH64 -# - -[Sources] - IoLibMmioBuffer.c - BaseIoLibIntrinsicInternal.h - IoHighLevel.c - -[Sources.ARM] - IoLibArmVirt.c - Arm/ArmVirtMmio.S | GCC - Arm/ArmVirtMmio.asm | RVCT - -[Sources.AARCH64] - IoLibArmVirt.c - AArch64/ArmVirtMmio.S | GCC - AArch64/ArmVirtMmio.asm | MSFT - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.uni deleted file mode 100644 index 7e510e6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of I/O Library using KVM/ARM safe assembler routines -// -// Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// Copyright (c) 2017, AMD Incorporated. All rights reserved.
-// Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-// -// This program and the accompanying materials are licensed and made available -// under the terms and conditions of the BSD License which accompanies this -// distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of I/O Library using KVM/ARM safe assembler routines" - -#string STR_MODULE_DESCRIPTION #language en-US "I/O Library that uses assembler routines to perform MMIO accesses, to prevent link time code generation under LTO from emitting instructions that KVM on ARM cannot deal with." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h deleted file mode 100644 index 9b20df0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicInternal.h +++ /dev/null @@ -1,26 +0,0 @@ -/** @file - Common header file shared by all source files. - - This file includes package header files, dependent library classes. - - Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef __BASEIOLIB_INTRINSIC_INTERNAL_H_ -#define __BASEIOLIB_INTRINSIC_INTERNAL_H_ - - - -#include - -#include -#include -#include - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf deleted file mode 100644 index 82f9b4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf +++ /dev/null @@ -1,59 +0,0 @@ -## @file -# Instance of I/O Library using compiler intrinsics. -# -# I/O Library that uses compiler intrinsics to perform IN and OUT instructions -# for IA-32 and x64. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2017, AMD Incorporated. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseIoLibIntrinsicSev - MODULE_UNI_FILE = BaseIoLibIntrinsic.uni - FILE_GUID = 93742f95-6e71-4581-b600-8e1da443f95a - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - IoLibMmioBuffer.c - BaseIoLibIntrinsicInternal.h - IoHighLevel.c - -[Sources.IA32] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLibIcc.c | INTEL - IoLib.c - Ia32/IoFifoSev.nasm - -[Sources.X64] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLibIcc.c | INTEL - IoLib.c - X64/IoFifoSev.nasm - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm deleted file mode 100644 index 102bbb8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm +++ /dev/null @@ -1,137 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insb - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insw - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insd - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsb - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsw - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsd - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm deleted file mode 100644 index 02551b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm +++ /dev/null @@ -1,299 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; Check whether we need to unroll the String I/O under SEV guest -; -; Return // eax (1 - unroll, 0 - no unroll) -;------------------------------------------------------------------------------ -global ASM_PFX(SevNoRepIo) -ASM_PFX(SevNoRepIo): - - ; CPUID clobbers ebx, ecx and edx - push ebx - push ecx - push edx - - ; Check if we are running under hypervisor - ; CPUID(1).ECX Bit 31 - mov eax, 1 - cpuid - bt ecx, 31 - jnc @UseRepIo - - ; Check if we have Memory encryption CPUID leaf - mov eax, 0x80000000 - cpuid - cmp eax, 0x8000001f - jl @UseRepIo - - ; Check for memory encryption feature: - ; CPUID Fn8000_001F[EAX] - Bit 1 - ; - mov eax, 0x8000001f - cpuid - bt eax, 1 - jnc @UseRepIo - - ; Check if memory encryption is enabled - ; MSR_0xC0010131 - Bit 0 (SEV enabled) - ; MSR_0xC0010131 - Bit 1 (SEV-ES enabled) - mov ecx, 0xc0010131 - rdmsr - - ; Check for (SevEsEnabled == 0 && SevEnabled == 1) - and eax, 3 - cmp eax, 1 - je @SevNoRepIo_Done - -@UseRepIo: - xor eax, eax - -@SevNoRepIo_Done: - pop edx - pop ecx - pop ebx - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo8_NoRep - - cld - rep insb - jmp @IoReadFifo8_Done - -@IoReadFifo8_NoRep: - jecxz @IoReadFifo8_Done - -@IoReadFifo8_Loop: - in al, dx - mov byte [edi], al - inc edi - loop @IoReadFifo8_Loop - -@IoReadFifo8_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo16_NoRep - - cld - rep insw - jmp @IoReadFifo16_Done - -@IoReadFifo16_NoRep: - jecxz @IoReadFifo16_Done - -@IoReadFifo16_Loop: - in ax, dx - mov word [edi], ax - add edi, 2 - loop @IoReadFifo16_Loop - -@IoReadFifo16_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo32_NoRep - - cld - rep insd - jmp @IoReadFifo32_Done - -@IoReadFifo32_NoRep: - jecxz @IoReadFifo32_Done - -@IoReadFifo32_Loop: - in eax, dx - mov dword [edi], eax - add edi, 4 - loop @IoReadFifo32_Loop - -@IoReadFifo32_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo8_NoRep - - cld - rep outsb - jmp @IoWriteFifo8_Done - -@IoWriteFifo8_NoRep: - jecxz @IoWriteFifo8_Done - -@IoWriteFifo8_Loop: - mov al, byte [esi] - out dx, al - inc esi - loop @IoWriteFifo8_Loop - -@IoWriteFifo8_Done: - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo16_NoRep - - cld - rep outsw - jmp @IoWriteFifo16_Done - -@IoWriteFifo16_NoRep: - jecxz @IoWriteFifo16_Done - -@IoWriteFifo16_Loop: - mov ax, word [esi] - out dx, ax - add esi, 2 - loop @IoWriteFifo16_Loop - -@IoWriteFifo16_Done: - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo32_NoRep - - cld - rep outsd - jmp @IoWriteFifo32_Done - -@IoWriteFifo32_NoRep: - jecxz @IoWriteFifo32_Done - -@IoWriteFifo32_Loop: - mov eax, dword [esi] - out dx, eax - add esi, 4 - loop @IoWriteFifo32_Loop - -@IoWriteFifo32_Done: - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c deleted file mode 100644 index a5cc891..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c +++ /dev/null @@ -1,2356 +0,0 @@ -/** @file - High-level Io/Mmio functions. - - All assertions for bit field operations are handled bit field functions in the - Base Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - The following IoLib instances contain the same copy of this file: - - BaseIoLibIntrinsic - DxeIoLibCpuIo - PeiIoLibCpuIo - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit I/O port, performs a bitwise OR, and writes the - result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoOr8 ( - IN UINTN Port, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back - to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAnd8 ( - IN UINTN Port, - IN UINT8 AndData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAndThenOr8 ( - IN UINTN Port, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in an 8-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoBitFieldRead8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldWrite8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return IoWrite8 ( - Port, - BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra bits left in OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra bits left in AndData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAnd8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return IoWrite8 ( - Port, - BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 8-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra bits left in both - AndData and OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAndThenOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit I/O port, performs a bitwise OR, and writes the - result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoOr16 ( - IN UINTN Port, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back - to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAnd16 ( - IN UINTN Port, - IN UINT16 AndData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAndThenOr16 ( - IN UINTN Port, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 16-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoBitFieldRead16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - bits left in Value are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldWrite16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return IoWrite16 ( - Port, - BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra bits left in OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra bits left in AndData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAnd16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return IoWrite16 ( - Port, - BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 16-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra bits left in both - AndData and OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAndThenOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit I/O port, performs a bitwise OR, and writes the - result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoOr32 ( - IN UINTN Port, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) | OrData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back - to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAnd32 ( - IN UINTN Port, - IN UINT32 AndData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) & AndData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAndThenOr32 ( - IN UINTN Port, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 32-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoBitFieldRead32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - bits left in Value are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldWrite32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return IoWrite32 ( - Port, - BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra bits left in OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra bits left in AndData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAnd32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return IoWrite32 ( - Port, - BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 32-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra bits left in both - AndData and OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAndThenOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit I/O port, performs a bitwise OR, and writes the - result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoOr64 ( - IN UINTN Port, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) | OrData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back - to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAnd64 ( - IN UINTN Port, - IN UINT64 AndData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) & AndData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAndThenOr64 ( - IN UINTN Port, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 64-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoBitFieldRead64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - bits left in Value are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldWrite64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return IoWrite64 ( - Port, - BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra bits left in OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra bits left in AndData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAnd64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return IoWrite64 ( - Port, - BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra bits left in both - AndData and OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAndThenOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise OR, and writes the - result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result - back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 8-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in an 8-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 8-bit register is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioWrite8 ( - Address, - BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra bits left in OrData - are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra bits left in AndData are - stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 8-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra bits left in both AndData and OrData are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise OR, and writes the - result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result - back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 16-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 16-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 16-bit register is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioWrite16 ( - Address, - BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra bits left in OrData - are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra bits left in AndData are - stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 16-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra bits left in both AndData and OrData are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise OR, and writes the - result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) | OrData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result - back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) & AndData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 32-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 32-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 32-bit register is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioWrite32 ( - Address, - BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra bits left in OrData - are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra bits left in AndData are - stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 32-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra bits left in both AndData and OrData are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise OR, and writes the - result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioOr64 ( - IN UINTN Address, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) | OrData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result - back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAnd64 ( - IN UINTN Address, - IN UINT64 AndData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) & AndData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 64-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAndThenOr64 ( - IN UINTN Address, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 64-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioBitFieldRead64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 64-bit register is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldWrite64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return MmioWrite64 ( - Address, - BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra bits left in OrData - are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra bits left in AndData are - stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAnd64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 64-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra bits left in both AndData and OrData are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAndThenOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData) - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c deleted file mode 100644 index 5091b2b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c +++ /dev/null @@ -1,317 +0,0 @@ -/** @file - Common I/O Library routines. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - return 0; -} - - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - UINT8 Value; - - MemoryFence (); - Value = *(volatile UINT8*)Address; - MemoryFence (); - - return Value; -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - MemoryFence (); - *(volatile UINT8*)Address = Value; - MemoryFence (); - - return Value; -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - UINT16 Value; - - ASSERT ((Address & 1) == 0); - - MemoryFence (); - Value = *(volatile UINT16*)Address; - MemoryFence (); - - return Value; -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT ((Address & 1) == 0); - - MemoryFence (); - *(volatile UINT16*)Address = Value; - MemoryFence (); - - return Value; -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - UINT32 Value; - - ASSERT ((Address & 3) == 0); - - MemoryFence (); - Value = *(volatile UINT32*)Address; - MemoryFence (); - - return Value; -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT ((Address & 3) == 0); - - MemoryFence (); - *(volatile UINT32*)Address = Value; - MemoryFence (); - - return Value; -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - UINT64 Value; - - ASSERT ((Address & 7) == 0); - - MemoryFence (); - Value = *(volatile UINT64*)Address; - MemoryFence (); - - return Value; -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - ASSERT ((Address & 7) == 0); - - MemoryFence (); - *(volatile UINT64*)Address = Value; - MemoryFence (); - - return Value; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c deleted file mode 100644 index 02e2d2a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c +++ /dev/null @@ -1,599 +0,0 @@ -/** @file - I/O Library for ARM. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -// -// Include common header file for this module. -// -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - UINT8 Value; - - Value = *(volatile UINT8*)Address; - return Value; -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - *(volatile UINT8*)Address = Value; - return Value; -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - UINT16 Value; - - ASSERT ((Address & 1) == 0); - Value = *(volatile UINT16*)Address; - return Value; -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT ((Address & 1) == 0); - *(volatile UINT16*)Address = Value; - return Value; -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - UINT32 Value; - - ASSERT ((Address & 3) == 0); - Value = *(volatile UINT32*)Address; - return Value; -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT ((Address & 3) == 0); - *(volatile UINT32*)Address = Value; - return Value; -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - UINT64 Value; - - ASSERT ((Address & 7) == 0); - Value = *(volatile UINT64*)Address; - return Value; -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - ASSERT ((Address & 7) == 0); - *(volatile UINT64*)Address = Value; - return Value; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c deleted file mode 100644 index aff58b4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c +++ /dev/null @@ -1,733 +0,0 @@ -/** @file - I/O Library for ARM. - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8Internal ( - IN UINTN Address - ); - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -VOID -EFIAPI -MmioWrite8Internal ( - IN UINTN Address, - IN UINT8 Value - ); - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16Internal ( - IN UINTN Address - ); - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -VOID -EFIAPI -MmioWrite16Internal ( - IN UINTN Address, - IN UINT16 Value - ); - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32Internal ( - IN UINTN Address - ); - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -VOID -EFIAPI -MmioWrite32Internal ( - IN UINTN Address, - IN UINT32 Value - ); - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64Internal ( - IN UINTN Address - ); - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -VOID -EFIAPI -MmioWrite64Internal ( - IN UINTN Address, - IN UINT64 Value - ); - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - return Value; -} - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - return MmioRead8Internal (Address); -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - MmioWrite8Internal (Address, Value); - return Value; -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 1) == 0); - - return MmioRead16Internal (Address); -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT ((Address & 1) == 0); - - MmioWrite16Internal (Address, Value); - return Value; -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 3) == 0); - - return MmioRead32Internal (Address); -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT ((Address & 3) == 0); - - MmioWrite32Internal (Address, Value); - return Value; -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 7) == 0); - - return MmioRead64Internal (Address); -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - ASSERT ((Address & 7) == 0); - - MmioWrite64Internal (Address, Value); - return Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c deleted file mode 100644 index d000675..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c +++ /dev/null @@ -1,342 +0,0 @@ -/** @file - I/O Library for EBC. - - EBC does not support port I/O. All APIs in this file ASSERT(). - - Copyright (c) 2015, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - ASSERT (FALSE); -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c deleted file mode 100644 index 5132d74..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c +++ /dev/null @@ -1,196 +0,0 @@ -/** @file - I/O Library. This file has compiler specifics for GCC as there is no - ANSI C standard for doing IO. - - GCC - uses EFIAPI assembler. __asm__ calls GAS. __volatile__ makes sure the - compiler puts the assembler in this exact location. The complex GNUC - operations are not optimzed. It would be possible to also write these - with EFIAPI assembler. - - We don't advocate putting compiler specifics in libraries or drivers but there - is no other way to make this work. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -__inline__ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - UINT8 Data; - - __asm__ __volatile__ ("inb %w1,%b0" : "=a" (Data) : "d" ((UINT16)Port)); - return Data; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -__inline__ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - __asm__ __volatile__ ("outb %b0,%w1" : : "a" (Value), "d" ((UINT16)Port)); - return Value;; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -__inline__ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - UINT16 Data; - - ASSERT ((Port & 1) == 0); - __asm__ __volatile__ ("inw %w1,%w0" : "=a" (Data) : "d" ((UINT16)Port)); - return Data; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -__inline__ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT ((Port & 1) == 0); - __asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port)); - return Value;; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -__inline__ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - UINT32 Data; - - ASSERT ((Port & 3) == 0); - __asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port)); - return Data; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -__inline__ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT ((Port & 3) == 0); - __asm__ __volatile__ ("outl %0,%w1" : : "a" (Value), "d" ((UINT16)Port)); - return Value; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c deleted file mode 100644 index 3c92ebc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c +++ /dev/null @@ -1,214 +0,0 @@ -/** @file - I/O Library. This file has compiler specifics for ICC as there - is no ANSI C standard for doing IO. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - UINT8 Data; - - __asm { - mov dx, word ptr [Port] - in al, dx - - mov Data, al - } - return Data; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - __asm { - mov al, byte ptr [Value] - mov dx, word ptr [Port] - out dx, al - } - return Value; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - UINT16 Data; - - ASSERT ((Port & 1) == 0); - - __asm { - mov dx, word ptr [Port] - in ax, dx - mov word ptr [Data], ax - } - - return Data; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT ((Port & 1) == 0); - - __asm { - mov ax, word ptr [Value] - mov dx, word ptr [Port] - out dx, ax - } - - return Value; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - UINT32 Data; - - ASSERT ((Port & 3) == 0); - - __asm { - mov dx, word ptr [Port] - in eax, dx - mov dword ptr [Data], eax - } - - return Data; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT ((Port & 3) == 0); - - __asm { - mov eax, dword ptr [Value] - mov dx, word ptr [Port] - out dx, eax - } - - return Value; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c deleted file mode 100644 index f8de86c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c +++ /dev/null @@ -1,411 +0,0 @@ -/** @file - I/O Library MMIO Buffer Functions. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseIoLibIntrinsicInternal.h" - -/** - Copy data from the MMIO region to system memory by using 8-bit access. - - Copy data from the MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 8-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioReadBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = Buffer; - - while (Length-- != 0) { - *(Buffer++) = MmioRead8 (StartAddress++); - } - - return ReturnBuffer; -} - -/** - Copy data from the MMIO region to system memory by using 16-bit access. - - Copy data from the MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 16-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioReadBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead16 (StartAddress); - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - -/** - Copy data from the MMIO region to system memory by using 32-bit access. - - Copy data from the MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 32-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioReadBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead32 (StartAddress); - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from the MMIO region to system memory by using 64-bit access. - - Copy data from the MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 64-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioReadBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead64 (StartAddress); - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to the MMIO region by using 8-bit access. - - Copy data from system memory specified by Buffer to the MMIO region specified - by starting address StartAddress by using 8-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioWriteBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT8 *Buffer - ) -{ - VOID* ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = (UINT8 *) Buffer; - - while (Length-- != 0) { - MmioWrite8 (StartAddress++, *(Buffer++)); - } - - return ReturnBuffer; - -} - -/** - Copy data from system memory to the MMIO region by using 16-bit access. - - Copy data from system memory specified by Buffer to the MMIO region specified - by starting address StartAddress by using 16-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioWriteBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = (UINT16 *) Buffer; - - while (Length != 0) { - MmioWrite16 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to the MMIO region by using 32-bit access. - - Copy data from system memory specified by Buffer to the MMIO region specified - by starting address StartAddress by using 32-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioWriteBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = (UINT32 *) Buffer; - - while (Length != 0) { - MmioWrite32 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from system memory to the MMIO region by using 64-bit access. - - Copy data from system memory specified by Buffer to the MMIO region specified - by starting address StartAddress by using 64-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioWriteBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = (UINT64 *) Buffer; - - while (Length != 0) { - MmioWrite64 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c deleted file mode 100644 index 156ebbc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c +++ /dev/null @@ -1,228 +0,0 @@ -/** @file - I/O Library. This file has compiler specifics for Microsft C as there is no - ANSI C standard for doing IO. - - MSC - uses intrinsic functions and the optimize will remove the function call - overhead. - - We don't advocate putting compiler specifics in libraries or drivers but there - is no other way to make this work. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -#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); - -#pragma intrinsic(_inp) -#pragma intrinsic(_inpw) -#pragma intrinsic(_inpd) -#pragma intrinsic(_outp) -#pragma intrinsic(_outpw) -#pragma intrinsic(_outpd) -#pragma intrinsic(_ReadWriteBarrier) - -// -// _ReadWriteBarrier() forces memory reads and writes to complete at the point -// in the call. This is only a hint to the compiler and does emit code. -// In past versions of the compiler, _ReadWriteBarrier was enforced only -// locally and did not affect functions up the call tree. In Visual C++ -// 2005, _ReadWriteBarrier is enforced all the way up the call tree. -// - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - UINT8 Value; - - _ReadWriteBarrier (); - Value = (UINT8)_inp ((UINT16)Port); - _ReadWriteBarrier (); - return Value; -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - _ReadWriteBarrier (); - (UINT8)_outp ((UINT16)Port, Value); - _ReadWriteBarrier (); - return Value; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - UINT16 Value; - - ASSERT ((Port & 1) == 0); - _ReadWriteBarrier (); - Value = _inpw ((UINT16)Port); - _ReadWriteBarrier (); - return Value; -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - ASSERT ((Port & 1) == 0); - _ReadWriteBarrier (); - _outpw ((UINT16)Port, Value); - _ReadWriteBarrier (); - return Value; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - UINT32 Value; - - ASSERT ((Port & 3) == 0); - _ReadWriteBarrier (); - Value = _inpd ((UINT16)Port); - _ReadWriteBarrier (); - return Value; -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written to the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - ASSERT ((Port & 3) == 0); - _ReadWriteBarrier (); - _outpd ((UINT16)Port, Value); - _ReadWriteBarrier (); - return Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm deleted file mode 100644 index 27c97d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm +++ /dev/null @@ -1,126 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insb - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insw - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insd - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsb - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsw - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsd - mov rsi, r8 ; restore rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm deleted file mode 100644 index 03337e0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm +++ /dev/null @@ -1,288 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; Check whether we need to unroll the String I/O in SEV guest -; -; Return // eax (1 - unroll, 0 - no unroll) -;------------------------------------------------------------------------------ -global ASM_PFX(SevNoRepIo) -ASM_PFX(SevNoRepIo): - - ; CPUID clobbers ebx, ecx and edx - push rbx - push rcx - push rdx - - ; Check if we are runing under hypervisor - ; CPUID(1).ECX Bit 31 - mov eax, 1 - cpuid - bt ecx, 31 - jnc @UseRepIo - - ; Check if we have Memory encryption CPUID leaf - mov eax, 0x80000000 - cpuid - cmp eax, 0x8000001f - jl @UseRepIo - - ; Check for memory encryption feature: - ; CPUID Fn8000_001F[EAX] - Bit 1 - ; - mov eax, 0x8000001f - cpuid - bt eax, 1 - jnc @UseRepIo - - ; Check if memory encryption is enabled - ; MSR_0xC0010131 - Bit 0 (SEV enabled) - ; MSR_0xC0010131 - Bit 1 (SEV-ES enabled) - mov ecx, 0xc0010131 - rdmsr - - ; Check for (SevEsEnabled == 0 && SevEnabled == 1) - and eax, 3 - cmp eax, 1 - je @SevNoRepIo_Done - -@UseRepIo: - xor eax, eax - -@SevNoRepIo_Done: - pop rdx - pop rcx - pop rbx - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo8_NoRep - - cld - rep insb - jmp @IoReadFifo8_Done - -@IoReadFifo8_NoRep: - jrcxz @IoReadFifo8_Done - -@IoReadFifo8_Loop: - in al, dx - mov byte [rdi], al - inc rdi - loop @IoReadFifo8_Loop - -@IoReadFifo8_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo16_NoRep - - cld - rep insw - jmp @IoReadFifo16_Done - -@IoReadFifo16_NoRep: - jrcxz @IoReadFifo16_Done - -@IoReadFifo16_Loop: - in ax, dx - mov word [rdi], ax - add rdi, 2 - loop @IoReadFifo16_Loop - -@IoReadFifo16_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo32_NoRep - - cld - rep insd - jmp @IoReadFifo32_Done - -@IoReadFifo32_NoRep: - jrcxz @IoReadFifo32_Done - -@IoReadFifo32_Loop: - in eax, dx - mov dword [rdi], eax - add rdi, 4 - loop @IoReadFifo32_Loop - -@IoReadFifo32_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo8_NoRep - - cld - rep outsb - jmp @IoWriteFifo8_Done - -@IoWriteFifo8_NoRep: - jrcxz @IoWriteFifo8_Done - -@IoWriteFifo8_Loop: - mov al, byte [rsi] - out dx, al - inc rsi - loop @IoWriteFifo8_Loop - -@IoWriteFifo8_Done: - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo16_NoRep - - cld - rep outsw - jmp @IoWriteFifo16_Done - -@IoWriteFifo16_NoRep: - jrcxz @IoWriteFifo16_Done - -@IoWriteFifo16_Loop: - mov ax, word [rsi] - out dx, ax - add rsi, 2 - loop @IoWriteFifo16_Loop - -@IoWriteFifo16_Done: - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo32_NoRep - - cld - rep outsd - jmp @IoWriteFifo32_Done - -@IoWriteFifo32_NoRep: - jrcxz @IoWriteFifo32_Done - -@IoWriteFifo32_Loop: - mov eax, dword [rsi] - out dx, eax - add rsi, 4 - loop @IoWriteFifo32_Loop - -@IoWriteFifo32_Done: - mov rsi, r8 ; restore rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.S deleted file mode 100644 index 68bc055..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.S +++ /dev/null @@ -1,37 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuBreakpoint() for AArch64 -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(CpuBreakpoint) - -#/** -# Generates a breakpoint on the CPU. -# -# Generates a breakpoint on the CPU. The breakpoint must be implemented such -# that code can resume normal execution after the breakpoint. -# -#**/ -#VOID -#EFIAPI -#CpuBreakpoint ( -# VOID -# ); -# -ASM_PFX(CpuBreakpoint): - svc 0xdbdb // Superviser exception. Takes 16bit arg -> Armv7 had 'swi' here. - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm deleted file mode 100644 index fc4c720..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuBreakpoint() for AArch64 -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - - EXPORT CpuBreakpoint - AREA BaseLib_LowLevel, CODE, READONLY - -;/** -; Generates a breakpoint on the CPU. -; -; Generates a breakpoint on the CPU. The breakpoint must be implemented such -; that code can resume normal execution after the breakpoint. -; -;**/ -;VOID -;EFIAPI -;CpuBreakpoint ( -; VOID -; ); -; -CpuBreakpoint - svc 0xdbdb // Superviser exception. Takes 16bit arg -> Armv7 had 'swi' here. - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.S deleted file mode 100644 index 9d67d07..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# DisableInterrupts() for AArch64 -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(DisableInterrupts) - -.set DAIF_WR_IRQ_BIT, (1 << 1) - -#/** -# Disables CPU interrupts. -# -#**/ -#VOID -#EFIAPI -#DisableInterrupts ( -# VOID -# ); -# -ASM_PFX(DisableInterrupts): - msr daifset, #DAIF_WR_IRQ_BIT - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm deleted file mode 100644 index 90ddde5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; DisableInterrupts() for AArch64 -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT DisableInterrupts - AREA BaseLib_LowLevel, CODE, READONLY - -DAIF_WR_IRQ_BIT EQU (1 << 1) - -;/** -; Disables CPU interrupts. -; -;**/ -;VOID -;EFIAPI -;DisableInterrupts ( -; VOID -; ); -; -DisableInterrupts - msr daifset, #DAIF_WR_IRQ_BIT - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.S deleted file mode 100644 index 14915ed..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# EnableInterrupts() for AArch64 -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(EnableInterrupts) - -.set DAIF_WR_IRQ_BIT, (1 << 1) - -#/** -# Enables CPU interrupts. -# -#**/ -#VOID -#EFIAPI -#EnableInterrupts ( -# VOID -# ); -# -ASM_PFX(EnableInterrupts): - msr daifclr, #DAIF_WR_IRQ_BIT - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm deleted file mode 100644 index 18b7c92..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; EnableInterrupts() for AArch64 -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT EnableInterrupts - AREA BaseLib_LowLevel, CODE, READONLY - -DAIF_WR_IRQ_BIT EQU (1 << 1) - -;/** -; Enables CPU interrupts. -; -;**/ -;VOID -;EFIAPI -;EnableInterrupts ( -; VOID -; ); -; -EnableInterrupts - msr daifclr, #DAIF_WR_IRQ_BIT - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.S deleted file mode 100644 index 1818c62..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.S +++ /dev/null @@ -1,45 +0,0 @@ -#------------------------------------------------------------------------------ -# -# GetInterruptState() function for AArch64 -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(GetInterruptState) - -.set DAIF_RD_IRQ_BIT, (1 << 7) - -#/** -# Retrieves the current CPU interrupt state. -# -# Returns TRUE is interrupts are currently enabled. Otherwise -# returns FALSE. -# -# @retval TRUE CPU interrupts are enabled. -# @retval FALSE CPU interrupts are disabled. -# -#**/ -# -#BOOLEAN -#EFIAPI -#GetInterruptState ( -# VOID -# ); -# -ASM_PFX(GetInterruptState): - mrs x0, daif - tst x0, #DAIF_RD_IRQ_BIT // Check IRQ mask; set Z=1 if clear/unmasked - cset w0, eq // if Z=1 (eq) return 1, else 0 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm deleted file mode 100644 index eff4036..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; GetInterruptState() function for AArch64 -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT GetInterruptState - AREA BaseLib_LowLevel, CODE, READONLY - -DAIF_RD_IRQ_BIT EQU (1 << 7) - -;/** -; Retrieves the current CPU interrupt state. -; -; Returns TRUE is interrupts are currently enabled. Otherwise -; returns FALSE. -; -; @retval TRUE CPU interrupts are enabled. -; @retval FALSE CPU interrupts are disabled. -; -;**/ -; -;BOOLEAN -;EFIAPI -;GetInterruptState ( -; VOID -; ); -; -GetInterruptState - mrs x0, daif - mov w0, wzr - tst x0, #DAIF_RD_IRQ_BIT // Check IRQ mask; set Z=1 if clear/unmasked - bne exit // if Z=1 (eq) return 1, else 0 - mov w0, #1 -exit - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.S deleted file mode 100644 index 8dbd54a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.S +++ /dev/null @@ -1,39 +0,0 @@ -##------------------------------------------------------------------------------ -# -# MemoryFence() for AArch64 -# -# Copyright (c) 2013, ARM Ltd. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -##------------------------------------------------------------------------------ - -.text -.p2align 2 - -GCC_ASM_EXPORT(MemoryFence) - - -#/** -# Used to serialize load and store operations. -# -# All loads and stores that proceed calls to this function are guaranteed to be -# globally visible when this function returns. -# -#**/ -#VOID -#EFIAPI -#MemoryFence ( -# VOID -# ); -# -ASM_PFX(MemoryFence): - // System wide Data Memory Barrier. - dmb sy - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm deleted file mode 100644 index 91bd0c8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; MemoryFence() for AArch64 -; -; Copyright (c) 2013, ARM Ltd. All rights reserved. -; -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT MemoryFence - AREA BaseLib_LowLevel, CODE, READONLY - -;/** -; Used to serialize load and store operations. -; -; All loads and stores that proceed calls to this function are guaranteed to be -; globally visible when this function returns. -; -;**/ -;VOID -;EFIAPI -;MemoryFence ( -; VOID -; ); -; -MemoryFence - // System wide Data Memory Barrier. - dmb sy - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S deleted file mode 100644 index 9fa096e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S +++ /dev/null @@ -1,97 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2009-2013, ARM Ltd. All rights reserved. -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ -.text -.p2align 3 - -GCC_ASM_EXPORT(SetJump) -GCC_ASM_EXPORT(InternalLongJump) - -#define GPR_LAYOUT \ - REG_PAIR (x19, x20, 0); \ - REG_PAIR (x21, x22, 16); \ - REG_PAIR (x23, x24, 32); \ - REG_PAIR (x25, x26, 48); \ - REG_PAIR (x27, x28, 64); \ - REG_PAIR (x29, x30, 80);/*FP, LR*/ \ - REG_ONE (x16, 96) /*IP0*/ - -#define FPR_LAYOUT \ - REG_PAIR ( d8, d9, 112); \ - REG_PAIR (d10, d11, 128); \ - REG_PAIR (d12, d13, 144); \ - REG_PAIR (d14, d15, 160); - -#/** -# Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# -# -# Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial -# call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero -# value to be returned by SetJump(). -# -# If JumpBuffer is NULL, then ASSERT(). -# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). -# -# @param JumpBuffer A pointer to CPU context buffer. -# -#**/ -# -#UINTN -#EFIAPI -#SetJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // X0 -# ); -# -ASM_PFX(SetJump): - mov x16, sp // use IP0 so save SP -#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] - GPR_LAYOUT - FPR_LAYOUT -#undef REG_PAIR -#undef REG_ONE - mov w0, #0 - ret - -#/** -# Restores the CPU context that was saved with SetJump().# -# -# Restores the CPU context from the buffer specified by JumpBuffer. -# This function never returns to the caller. -# Instead is resumes execution based on the state of JumpBuffer. -# -# @param JumpBuffer A pointer to CPU context buffer. -# @param Value The value to return when the SetJump() context is restored. -# -#**/ -#VOID -#EFIAPI -#InternalLongJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // X0 -# IN UINTN Value // X1 -# ); -# -ASM_PFX(InternalLongJump): -#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] - GPR_LAYOUT - FPR_LAYOUT -#undef REG_PAIR -#undef REG_ONE - mov sp, x16 - cmp w1, #0 - mov w0, #1 - csel w0, w1, w0, ne - // use br not ret, as ret is guaranteed to mispredict - br x30 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm deleted file mode 100644 index eec63e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm +++ /dev/null @@ -1,101 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2009-2013, ARM Ltd. All rights reserved. -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT SetJump - EXPORT InternalLongJump - AREA BaseLib_LowLevel, CODE, READONLY - -#define GPR_LAYOUT \ - REG_PAIR (x19, x20, #0); \ - REG_PAIR (x21, x22, #16); \ - REG_PAIR (x23, x24, #32); \ - REG_PAIR (x25, x26, #48); \ - REG_PAIR (x27, x28, #64); \ - REG_PAIR (x29, x30, #80);/*FP, LR*/ \ - REG_ONE (x16, #96) /*IP0*/ - -#define FPR_LAYOUT \ - REG_PAIR ( d8, d9, #112); \ - REG_PAIR (d10, d11, #128); \ - REG_PAIR (d12, d13, #144); \ - REG_PAIR (d14, d15, #160); - -;/** -; Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# -; -; Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial -; call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero -; value to be returned by SetJump(). -; -; If JumpBuffer is NULL, then ASSERT(). -; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). -; -; @param JumpBuffer A pointer to CPU context buffer. -; -;**/ -; -;UINTN -;EFIAPI -;SetJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // X0 -; ); -; -SetJump - mov x16, sp // use IP0 so save SP -#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] - GPR_LAYOUT - FPR_LAYOUT -#undef REG_PAIR -#undef REG_ONE - mov w0, #0 - ret - -;/** -; Restores the CPU context that was saved with SetJump().# -; -; Restores the CPU context from the buffer specified by JumpBuffer. -; This function never returns to the caller. -; Instead is resumes execution based on the state of JumpBuffer. -; -; @param JumpBuffer A pointer to CPU context buffer. -; @param Value The value to return when the SetJump() context is restored. -; -;**/ -;VOID -;EFIAPI -;InternalLongJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // X0 -; IN UINTN Value // X1 -; ); -; -InternalLongJump -#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] - GPR_LAYOUT - FPR_LAYOUT -#undef REG_PAIR -#undef REG_ONE - mov sp, x16 - cmp w1, #0 - mov w0, #1 - beq exit - mov w0, w1 -exit - // use br not ret, as ret is guaranteed to mispredict - br x30 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED - - END - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.S deleted file mode 100644 index c6e9d4d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.S +++ /dev/null @@ -1,39 +0,0 @@ -##------------------------------------------------------------------------------ -# -# SpeculationBarrier() for AArch64 -# -# Copyright (c) 2019, Linaro Ltd. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -##------------------------------------------------------------------------------ - -.text -.p2align 2 - -GCC_ASM_EXPORT(SpeculationBarrier) - - -#/** -# Uses as a barrier to stop speculative execution. -# -# Ensures that no later instruction will execute speculatively, until all prior -# instructions have completed. -# -#**/ -#VOID -#EFIAPI -#SpeculationBarrier ( -# VOID -# ); -# -ASM_PFX(SpeculationBarrier): - dsb sy - isb - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.asm deleted file mode 100644 index 101bb1c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SpeculationBarrier.asm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; SpeculationBarrier() for AArch64 -; -; Copyright (c) 2019, Linaro Ltd. All rights reserved. -; -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT SpeculationBarrier - AREA BaseLib_LowLevel, CODE, READONLY - -;/** -; Uses as a barrier to stop speculative execution. -; -; Ensures that no later instruction will execute speculatively, until all prior -; instructions have completed. -; -;**/ -;VOID -;EFIAPI -;SpeculationBarrier ( -; VOID -; ); -; -SpeculationBarrier - dsb sy - isb - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.S deleted file mode 100644 index ea22ac9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.S +++ /dev/null @@ -1,71 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.align 5 - -GCC_ASM_EXPORT(InternalSwitchStackAsm) -GCC_ASM_EXPORT(CpuPause) - -#/** -# -# This allows the caller to switch the stack and goes to the new entry point -# -# @param EntryPoint The pointer to the location to enter -# @param Context Parameter to pass in -# @param Context2 Parameter2 to pass in -# @param NewStack New Location of the stack -# -# @return Nothing. Goes to the Entry Point passing in the new parameters -# -#**/ -#VOID -#EFIAPI -#InternalSwitchStackAsm ( -# SWITCH_STACK_ENTRY_POINT EntryPoint, -# VOID *Context, -# VOID *Context2, -# VOID *NewStack -# ); -# -ASM_PFX(InternalSwitchStackAsm): - mov x29, #0 - mov x30, x0 - mov sp, x3 - mov x0, x1 - mov x1, x2 - ret - -#/** -# -# Requests CPU to pause for a short period of time. -# -# Requests CPU to pause for a short period of time. Typically used in MP -# systems to prevent memory starvation while waiting for a spin lock. -# -#**/ -#VOID -#EFIAPI -#CpuPause ( -# VOID -# ) -# -ASM_PFX(CpuPause): - nop - nop - nop - nop - nop - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm deleted file mode 100644 index b97ffae..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm +++ /dev/null @@ -1,71 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; Portions copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT InternalSwitchStackAsm - EXPORT CpuPause - AREA BaseLib_LowLevel, CODE, READONLY - -;/** -; -; This allows the caller to switch the stack and goes to the new entry point -; -; @param EntryPoint The pointer to the location to enter -; @param Context Parameter to pass in -; @param Context2 Parameter2 to pass in -; @param NewStack New Location of the stack -; -; @return Nothing. Goes to the Entry Point passing in the new parameters -; -;**/ -;VOID -;EFIAPI -;InternalSwitchStackAsm ( -; SWITCH_STACK_ENTRY_POINT EntryPoint, -; VOID *Context, -; VOID *Context2, -; VOID *NewStack -; ); -; -InternalSwitchStackAsm - mov x29, #0 - mov x30, x0 - mov sp, x3 - mov x0, x1 - mov x1, x2 - ret - -;/** -; -; Requests CPU to pause for a short period of time. -; -; Requests CPU to pause for a short period of time. Typically used in MP -; systems to prevent memory starvation while waiting for a spin lock. -; -;**/ -;VOID -;EFIAPI -;CpuPause ( -; VOID -; ) -; -CpuPause - nop - nop - nop - nop - nop - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ARShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ARShiftU64.c deleted file mode 100644 index be33df3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ARShiftU64.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled - with the original integer's bit 63. The shifted value is returned. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to bit 63 of Operand. The shifted value is returned. - - If Count is greater than 63, then ASSERT(). - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand >> Count - -**/ -UINT64 -EFIAPI -ARShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 64); - return InternalMathARShiftU64 (Operand, Count); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S deleted file mode 100644 index 977ec98..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CpuBreakpoint() for ARM -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(CpuBreakpoint) - -#/** -# Generates a breakpoint on the CPU. -# -# Generates a breakpoint on the CPU. The breakpoint must be implemented such -# that code can resume normal execution after the breakpoint. -# -#**/ -#VOID -#EFIAPI -#CpuBreakpoint ( -# VOID -# ); -# -ASM_PFX(CpuBreakpoint): - swi 0xdbdbdb - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm deleted file mode 100644 index 9eceea4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuBreakpoint() for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuBreakpoint - -; Force ARM mode for this section, as MSFT assembler defaults to THUMB - AREA Cpu_Breakpoint, CODE, READONLY, ARM - - ARM - -;/** -; Generates a breakpoint on the CPU. -; -; Generates a breakpoint on the CPU. The breakpoint must be implemented such -; that code can resume normal execution after the breakpoint. -; -;**/ -;VOID -;EFIAPI -;CpuBreakpoint ( -; VOID -; ); -; -CpuBreakpoint - swi 0xdbdbdb - bx lr - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuPause.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuPause.asm deleted file mode 100644 index 97c2944..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/CpuPause.asm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CpuPause() for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT CpuPause - AREA cpu_pause, CODE, READONLY - -;/** -; Requests CPU to pause for a short period of time. -; -; Requests CPU to pause for a short period of time. Typically used in MP -; systems to prevent memory starvation while waiting for a spin lock. -; -;**/ -;VOID -;EFIAPI -;CpuPause ( -; VOID -; ); -; -CpuPause - NOP - NOP - NOP - NOP - NOP - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S deleted file mode 100644 index 93e427c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.S +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------------------------------------ -# -# DisableInterrupts() for ARM -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(DisableInterrupts) - -#/** -# Disables CPU interrupts. -# -#**/ -#VOID -#EFIAPI -#DisableInterrupts ( -# VOID -# ); -# -ASM_PFX(DisableInterrupts): - mrs R0,CPSR - orr R0,R0,#0x80 @Disable IRQ interrupts - msr CPSR_c,R0 - bx LR diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm deleted file mode 100644 index 728c98b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/DisableInterrupts.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; DisableInterrupts() for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT DisableInterrupts - - AREA Interrupt_disable, CODE, READONLY - -;/** -; Disables CPU interrupts. -; -;**/ -;VOID -;EFIAPI -;DisableInterrupts ( -; VOID -; ); -; -DisableInterrupts - MRS R0,CPSR - ORR R0,R0,#0x80 ;Disable IRQ interrupts - MSR CPSR_c,R0 - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S deleted file mode 100644 index 56e4f77..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# EnableInterrupts() for ARM -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT(EnableInterrupts) - - -#/** -# Enables CPU interrupts. -# -#**/ -#VOID -#EFIAPI -#EnableInterrupts ( -# VOID -# ); -# -ASM_PFX(EnableInterrupts): - mrs R0,CPSR - bic R0,R0,#0x80 @Enable IRQ interrupts - msr CPSR_c,R0 - bx LR diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm deleted file mode 100644 index e1c3a6f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/EnableInterrupts.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; EnableInterrupts() for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT EnableInterrupts - - AREA Interrupt_enable, CODE, READONLY - -;/** -; Enables CPU interrupts. -; -;**/ -;VOID -;EFIAPI -;EnableInterrupts ( -; VOID -; ); -; -EnableInterrupts - MRS R0,CPSR - BIC R0,R0,#0x80 ;Enable IRQ interrupts - MSR CPSR_c,R0 - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S deleted file mode 100644 index cef88f1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# GetInterruptState() function for ARM -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -.text -.p2align 2 -GCC_ASM_EXPORT (GetInterruptState) - -#/** -# Retrieves the current CPU interrupt state. -# -# Returns TRUE is interrupts are currently enabled. Otherwise -# returns FALSE. -# -# @retval TRUE CPU interrupts are enabled. -# @retval FALSE CPU interrupts are disabled. -# -#**/ -# -#BOOLEAN -#EFIAPI -#GetInterruptState ( -# VOID -# ); -# -ASM_PFX(GetInterruptState): - mrs R0, CPSR - tst R0, #0x80 @Check if IRQ is enabled. - moveq R0, #1 - movne R0, #0 - bx LR diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm deleted file mode 100644 index a9bf83b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/GetInterruptsState.asm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; GetInterruptState() function for ARM -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT GetInterruptState - - AREA Interrupt_enable, CODE, READONLY - -;/** -; Retrieves the current CPU interrupt state. -; -; Returns TRUE is interrupts are currently enabled. Otherwise -; returns FALSE. -; -; @retval TRUE CPU interrupts are enabled. -; @retval FALSE CPU interrupts are disabled. -; -;**/ -; -;BOOLEAN -;EFIAPI -;GetInterruptState ( -; VOID -; ); -; -GetInterruptState - MRS R0, CPSR - TST R0, #0x80 ;Check if IRQ is enabled. - MOVEQ R0, #1 - MOVNE R0, #0 - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c deleted file mode 100644 index c731731..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c +++ /dev/null @@ -1,79 +0,0 @@ -/** @file - SwitchStack() function for ARM. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Transfers control to a function starting with a new stack. - - This internal worker function transfers control to the function - specified by EntryPoint using the new stack specified by NewStack, - and passes in the parameters specified by Context1 and Context2. - Context1 and Context2 are optional and may be NULL. - The function EntryPoint must never return. - - @param EntryPoint The pointer to the function to enter. - @param Context1 The first parameter to pass in. - @param Context2 The second Parameter to pass in - @param NewStack The new Location of the stack - -**/ -VOID -EFIAPI -InternalSwitchStackAsm ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ); - - -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the - new stack specified by NewStack, and passes in the parameters specified - by Context1 and Context2. Context1 and Context2 are optional and may - be NULL. The function EntryPoint must never return. - Marker will be ignored on IA-32, x64, and EBC. - IPF CPUs expect one additional parameter of type VOID * that specifies - the new backing store pointer. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param Marker A VA_LIST marker for the variable argument list. - -**/ -VOID -EFIAPI -InternalSwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VA_LIST Marker - ) - -{ - InternalSwitchStackAsm (EntryPoint, Context1, Context2, NewStack); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Math64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Math64.S deleted file mode 100644 index 632f050..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Math64.S +++ /dev/null @@ -1,269 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Replacement for Math64.c that is coded to use older GCC intrinsics. -# Doing this reduces the number of intrinsics that are required when -# you port to a new version of gcc. -# -# Need to split this into multple files to size optimize the image. -# -# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - - .text - .align 2 - GCC_ASM_EXPORT(InternalMathLShiftU64) - -ASM_PFX(InternalMathLShiftU64): - stmfd sp!, {r4, r5, r6} - mov r6, r1 - rsb ip, r2, #32 - mov r4, r6, asl r2 - subs r1, r2, #32 - orr r4, r4, r0, lsr ip - mov r3, r0, asl r2 - movpl r4, r0, asl r1 - mov r5, r0 - mov r0, r3 - mov r1, r4 - ldmfd sp!, {r4, r5, r6} - bx lr - - .align 2 - GCC_ASM_EXPORT(InternalMathRShiftU64) - -ASM_PFX(InternalMathRShiftU64): - stmfd sp!, {r4, r5, r6} - mov r5, r0 - rsb ip, r2, #32 - mov r3, r5, lsr r2 - subs r0, r2, #32 - orr r3, r3, r1, asl ip - mov r4, r1, lsr r2 - movpl r3, r1, lsr r0 - mov r6, r1 - mov r0, r3 - mov r1, r4 - ldmfd sp!, {r4, r5, r6} - bx lr - - .align 2 - GCC_ASM_EXPORT(InternalMathARShiftU64) - -ASM_PFX(InternalMathARShiftU64): - stmfd sp!, {r4, r5, r6} - mov r5, r0 - rsb ip, r2, #32 - mov r3, r5, lsr r2 - subs r0, r2, #32 - orr r3, r3, r1, asl ip - mov r4, r1, asr r2 - movpl r3, r1, asr r0 - mov r6, r1 - mov r0, r3 - mov r1, r4 - ldmfd sp!, {r4, r5, r6} - bx lr - - .align 2 - GCC_ASM_EXPORT(InternalMathLRotU64) - -ASM_PFX(InternalMathLRotU64): - stmfd sp!, {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r6, r1 - rsb ip, r2, #32 - mov r4, r6, asl r2 - rsb lr, r2, #64 - subs r1, r2, #32 - orr r4, r4, r0, lsr ip - mov r3, r0, asl r2 - movpl r4, r0, asl r1 - sub ip, r2, #32 - mov r5, r0 - mov r0, r0, lsr lr - rsbs r2, r2, #32 - orr r0, r0, r6, asl ip - mov r1, r6, lsr lr - movpl r0, r6, lsr r2 - orr r1, r1, r4 - orr r0, r0, r3 - ldmfd sp!, {r4, r5, r6, r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathRRotU64) - -ASM_PFX(InternalMathRRotU64): - stmfd sp!, {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r5, r0 - rsb ip, r2, #32 - mov r3, r5, lsr r2 - rsb lr, r2, #64 - subs r0, r2, #32 - orr r3, r3, r1, asl ip - mov r4, r1, lsr r2 - movpl r3, r1, lsr r0 - sub ip, r2, #32 - mov r6, r1 - mov r1, r1, asl lr - rsbs r2, r2, #32 - orr r1, r1, r5, lsr ip - mov r0, r5, asl lr - movpl r1, r5, asl r2 - orr r0, r0, r3 - orr r1, r1, r4 - ldmfd sp!, {r4, r5, r6, r7, pc} - - .align 2 - GCC_ASM_EXPORT(InternalMathMultU64x32) - -ASM_PFX(InternalMathMultU64x32): - stmfd sp!, {r7, lr} - add r7, sp, #0 - mov r3, #0 - mov ip, r0 - mov lr, r1 - umull r0, r1, ip, r2 - mla r1, lr, r2, r1 - mla r1, ip, r3, r1 - ldmfd sp!, {r7, pc} - - .align 2 - GCC_ASM_EXPORT(InternalMathMultU64x64) - -ASM_PFX(InternalMathMultU64x64): - stmfd sp!, {r7, lr} - add r7, sp, #0 - mov ip, r0 - mov lr, r1 - umull r0, r1, ip, r2 - mla r1, lr, r2, r1 - mla r1, ip, r3, r1 - ldmfd sp!, {r7, pc} - - .align 2 - GCC_ASM_EXPORT(InternalMathDivU64x32) - -ASM_PFX(InternalMathDivU64x32): - stmfd sp!, {r7, lr} - add r7, sp, #0 - mov r3, #0 - bl ASM_PFX(__udivdi3) - ldmfd sp!, {r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathModU64x32) - -ASM_PFX(InternalMathModU64x32): - stmfd sp!, {r7, lr} - add r7, sp, #0 - mov r3, #0 - bl ASM_PFX(__umoddi3) - ldmfd sp!, {r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathDivRemU64x32) - -ASM_PFX(InternalMathDivRemU64x32): - stmfd sp!, {r4, r5, r6, r7, lr} - add r7, sp, #12 - stmfd sp!, {r10, r11} - subs r6, r3, #0 - mov r10, r0 - mov r11, r1 - moveq r4, r2 - moveq r5, #0 - beq L22 - mov r4, r2 - mov r5, #0 - mov r3, #0 - bl ASM_PFX(__umoddi3) - str r0, [r6, #0] -L22: - mov r0, r10 - mov r1, r11 - mov r2, r4 - mov r3, r5 - bl ASM_PFX(__udivdi3) - ldmfd sp!, {r10, r11} - ldmfd sp!, {r4, r5, r6, r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathDivRemU64x64) - -ASM_PFX(InternalMathDivRemU64x64): - stmfd sp!, {r4, r5, r6, r7, lr} - add r7, sp, #12 - stmfd sp!, {r10, r11} - ldr r6, [sp, #28] - mov r4, r0 - cmp r6, #0 - mov r5, r1 - mov r10, r2 - mov r11, r3 - beq L26 - bl ASM_PFX(__umoddi3) - stmia r6, {r0-r1} -L26: - mov r0, r4 - mov r1, r5 - mov r2, r10 - mov r3, r11 - bl ASM_PFX(__udivdi3) - ldmfd sp!, {r10, r11} - ldmfd sp!, {r4, r5, r6, r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathDivRemS64x64) - -ASM_PFX(InternalMathDivRemS64x64): - stmfd sp!, {r4, r5, r6, r7, lr} - add r7, sp, #12 - stmfd sp!, {r10, r11} - ldr r6, [sp, #28] - mov r4, r0 - cmp r6, #0 - mov r5, r1 - mov r10, r2 - mov r11, r3 - beq L30 - bl ASM_PFX(__moddi3) - stmia r6, {r0-r1} -L30: - mov r0, r4 - mov r1, r5 - mov r2, r10 - mov r3, r11 - bl ASM_PFX(__divdi3) - ldmfd sp!, {r10, r11} - ldmfd sp!, {r4, r5, r6, r7, pc} - - - .align 2 - GCC_ASM_EXPORT(InternalMathSwapBytes64) - -ASM_PFX(InternalMathSwapBytes64): - stmfd sp!, {r4, r5, r7, lr} - mov r5, r1 - bl ASM_PFX(SwapBytes32) - mov r4, r0 - mov r0, r5 - bl ASM_PFX(SwapBytes32) - mov r1, r4 - ldmfd sp!, {r4, r5, r7, pc} - - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.S deleted file mode 100644 index 2208dd3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.S +++ /dev/null @@ -1,39 +0,0 @@ -##------------------------------------------------------------------------------ -# -# MemoryFence() for AArch64 -# -# Copyright (c) 2013, ARM Ltd. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -##------------------------------------------------------------------------------ - -.text -.p2align 2 - -GCC_ASM_EXPORT(MemoryFence) - - -#/** -# Used to serialize load and store operations. -# -# All loads and stores that proceed calls to this function are guaranteed to be -# globally visible when this function returns. -# -#**/ -#VOID -#EFIAPI -#MemoryFence ( -# VOID -# ); -# -ASM_PFX(MemoryFence): - // System wide Data Memory Barrier. - dmb - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.asm deleted file mode 100644 index f1bc4eb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/MemoryFence.asm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; MemoryFence() for AArch64 -; -; Copyright (c) 2013, ARM Ltd. All rights reserved. -; -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT MemoryFence - - AREA MemoryBarriers, CODE, READONLY - -;/** -; Used to serialize load and store operations. -; -; All loads and stores that proceed calls to this function are guaranteed to be -; globally visible when this function returns. -; -;**/ -;VOID -;EFIAPI -;MemoryFence ( -; VOID -; ); -; -MemoryFence FUNCTION - dmb - bx lr - ENDFUNC - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S deleted file mode 100644 index 78f1ec8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ /dev/null @@ -1,70 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ -.text -.p2align 2 - -GCC_ASM_EXPORT(SetJump) -GCC_ASM_EXPORT(InternalLongJump) - -#/** -# Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# -# -# Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial -# call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero -# value to be returned by SetJump(). -# -# If JumpBuffer is NULL, then ASSERT(). -# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). -# -# @param JumpBuffer A pointer to CPU context buffer. -# -#**/ -# -#UINTN -#EFIAPI -#SetJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0 -# ); -# -ASM_PFX(SetJump): - mov r3, r13 - stmia r0, {r3-r12,r14} - eor r0, r0, r0 - bx lr - -#/** -# Restores the CPU context that was saved with SetJump().# -# -# Restores the CPU context from the buffer specified by JumpBuffer. -# This function never returns to the caller. -# Instead is resumes execution based on the state of JumpBuffer. -# -# @param JumpBuffer A pointer to CPU context buffer. -# @param Value The value to return when the SetJump() context is restored. -# -#**/ -#VOID -#EFIAPI -#InternalLongJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0 -# IN UINTN Value // R1 -# ); -# -ASM_PFX(InternalLongJump): - ldmia r0, {r3-r12,r14} - mov r13, r3 - mov r0, r1 - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm deleted file mode 100644 index 74c37be..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ /dev/null @@ -1,70 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT SetJump - EXPORT InternalLongJump - - AREA BaseLib, CODE, READONLY - -;/** -; Saves the current CPU context that can be restored with a call to LongJump() and returns 0.; -; -; Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial -; call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero -; value to be returned by SetJump(). -; -; If JumpBuffer is NULL, then ASSERT(). -; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). -; -; @param JumpBuffer A pointer to CPU context buffer. -; -;**/ -; -;UINTN -;EFIAPI -;SetJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0 -; ) -; -SetJump - MOV R3, R13 - STM R0, {R3-R12,R14} - EOR R0, R0 - BX LR - -;/** -; Restores the CPU context that was saved with SetJump().; -; -; Restores the CPU context from the buffer specified by JumpBuffer. -; This function never returns to the caller. -; Instead is resumes execution based on the state of JumpBuffer. -; -; @param JumpBuffer A pointer to CPU context buffer. -; @param Value The value to return when the SetJump() context is restored. -; -;**/ -;VOID -;EFIAPI -;InternalLongJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0 -; IN UINTN Value // R1 -; ); -; -InternalLongJump - LDM R0, {R3-R12,R14} - MOV R13, R3 - MOV R0, R1 - BX LR - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S deleted file mode 100644 index bebb9ec..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S +++ /dev/null @@ -1,39 +0,0 @@ -##------------------------------------------------------------------------------ -# -# SpeculationBarrier() for AArch64 -# -# Copyright (c) 2019, Linaro Ltd. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -##------------------------------------------------------------------------------ - -.text -.p2align 2 - -GCC_ASM_EXPORT(SpeculationBarrier) - - -#/** -# Uses as a barrier to stop speculative execution. -# -# Ensures that no later instruction will execute speculatively, until all prior -# instructions have completed. -# -#**/ -#VOID -#EFIAPI -#SpeculationBarrier ( -# VOID -# ); -# -ASM_PFX(SpeculationBarrier): - dsb - isb - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm deleted file mode 100644 index 4a4fb90..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; SpeculationBarrier() for AArch64 -; -; Copyright (c) 2019, Linaro Ltd. All rights reserved. -; -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT SpeculationBarrier - - AREA MemoryBarriers, CODE, READONLY - -;/** -; Uses as a barrier to stop speculative execution. -; -; Ensures that no later instruction will execute speculatively, until all prior -; instructions have completed. -; -;**/ -;VOID -;EFIAPI -;SpeculationBarrier ( -; VOID -; ); -; -SpeculationBarrier - dsb - isb - bx lr - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.S deleted file mode 100644 index 71e12b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.S +++ /dev/null @@ -1,68 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// Portions copyright (c) 2011, ARM Limited. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -//------------------------------------------------------------------------------ - -.text -.align 5 - -GCC_ASM_EXPORT(InternalSwitchStackAsm) -GCC_ASM_EXPORT(CpuPause) - -/** -// -// This allows the caller to switch the stack and goes to the new entry point -// -// @param EntryPoint The pointer to the location to enter -// @param Context Parameter to pass in -// @param Context2 Parameter2 to pass in -// @param NewStack New Location of the stack -// -// @return Nothing. Goes to the Entry Point passing in the new parameters -// -VOID -EFIAPI -InternalSwitchStackAsm ( - SWITCH_STACK_ENTRY_POINT EntryPoint, - VOID *Context, - VOID *Context2, - VOID *NewStack - ); -**/ -ASM_PFX(InternalSwitchStackAsm): - MOV LR, R0 - MOV SP, R3 - MOV R0, R1 - MOV R1, R2 - BX LR - -/** -// -// Requests CPU to pause for a short period of time. -// -// Requests CPU to pause for a short period of time. Typically used in MP -// systems to prevent memory starvation while waiting for a spin lock. -// -VOID -EFIAPI -CpuPause ( - VOID - ) -**/ -ASM_PFX(CpuPause): - nop - nop - nop - nop - nop - BX LR diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.asm deleted file mode 100644 index 728a56c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/SwitchStack.asm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT InternalSwitchStackAsm - - AREA Switch_Stack, CODE, READONLY - -;/** -; This allows the caller to switch the stack and goes to the new entry point -; -; @param EntryPoint The pointer to the location to enter -; @param Context Parameter to pass in -; @param Context2 Parameter2 to pass in -; @param NewStack New Location of the stack -; -; @return Nothing. Goes to the Entry Point passing in the new parameters -; -;**/ -;VOID -;EFIAPI -;InternalSwitchStackAsm ( -; SWITCH_STACK_ENTRY_POINT EntryPoint, -; VOID *Context, -; VOID *Context2, -; VOID *NewStack -; ); -; -InternalSwitchStackAsm - MOV LR, R0 - MOV SP, R3 - MOV R0, R1 - MOV R1, R2 - BX LR - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Unaligned.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Unaligned.c deleted file mode 100644 index 2593e08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Arm/Unaligned.c +++ /dev/null @@ -1,252 +0,0 @@ -/** @file - Unaligned access functions of BaseLib for ARM. - - volatile was added to work around optimization issues. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Reads a 16-bit value from memory that may be unaligned. - - This function returns the 16-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 16-bit value that may be unaligned. - - @return The 16-bit value read from Buffer. - -**/ -UINT16 -EFIAPI -ReadUnaligned16 ( - IN CONST UINT16 *Buffer - ) -{ - volatile UINT8 LowerByte; - volatile UINT8 HigherByte; - - ASSERT (Buffer != NULL); - - LowerByte = ((UINT8*)Buffer)[0]; - HigherByte = ((UINT8*)Buffer)[1]; - - return (UINT16)(LowerByte | (HigherByte << 8)); -} - -/** - Writes a 16-bit value to memory that may be unaligned. - - This function writes the 16-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 16-bit value that may be unaligned. - @param Value 16-bit value to write to Buffer. - - @return The 16-bit value to write to Buffer. - -**/ -UINT16 -EFIAPI -WriteUnaligned16 ( - OUT UINT16 *Buffer, - IN UINT16 Value - ) -{ - ASSERT (Buffer != NULL); - - ((volatile UINT8*)Buffer)[0] = (UINT8)Value; - ((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8); - - return Value; -} - -/** - Reads a 24-bit value from memory that may be unaligned. - - This function returns the 24-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 24-bit value that may be unaligned. - - @return The 24-bit value read from Buffer. - -**/ -UINT32 -EFIAPI -ReadUnaligned24 ( - IN CONST UINT32 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return (UINT32)( - ReadUnaligned16 ((UINT16*)Buffer) | - (((UINT8*)Buffer)[2] << 16) - ); -} - -/** - Writes a 24-bit value to memory that may be unaligned. - - This function writes the 24-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 24-bit value that may be unaligned. - @param Value 24-bit value to write to Buffer. - - @return The 24-bit value to write to Buffer. - -**/ -UINT32 -EFIAPI -WriteUnaligned24 ( - OUT UINT32 *Buffer, - IN UINT32 Value - ) -{ - ASSERT (Buffer != NULL); - - WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value); - *(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16); - return Value; -} - -/** - Reads a 32-bit value from memory that may be unaligned. - - This function returns the 32-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 32-bit value that may be unaligned. - - @return The 32-bit value read from Buffer. - -**/ -UINT32 -EFIAPI -ReadUnaligned32 ( - IN CONST UINT32 *Buffer - ) -{ - UINT16 LowerBytes; - UINT16 HigherBytes; - - ASSERT (Buffer != NULL); - - LowerBytes = ReadUnaligned16 ((UINT16*) Buffer); - HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1); - - return (UINT32) (LowerBytes | (HigherBytes << 16)); -} - -/** - Writes a 32-bit value to memory that may be unaligned. - - This function writes the 32-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 32-bit value that may be unaligned. - @param Value 32-bit value to write to Buffer. - - @return The 32-bit value to write to Buffer. - -**/ -UINT32 -EFIAPI -WriteUnaligned32 ( - OUT UINT32 *Buffer, - IN UINT32 Value - ) -{ - ASSERT (Buffer != NULL); - - WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value); - WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16)); - return Value; -} - -/** - Reads a 64-bit value from memory that may be unaligned. - - This function returns the 64-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 64-bit value that may be unaligned. - - @return The 64-bit value read from Buffer. - -**/ -UINT64 -EFIAPI -ReadUnaligned64 ( - IN CONST UINT64 *Buffer - ) -{ - UINT32 LowerBytes; - UINT32 HigherBytes; - - ASSERT (Buffer != NULL); - - LowerBytes = ReadUnaligned32 ((UINT32*) Buffer); - HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1); - - return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32)); -} - -/** - Writes a 64-bit value to memory that may be unaligned. - - This function writes the 64-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer The pointer to a 64-bit value that may be unaligned. - @param Value 64-bit value to write to Buffer. - - @return The 64-bit value to write to Buffer. - -**/ -UINT64 -EFIAPI -WriteUnaligned64 ( - OUT UINT64 *Buffer, - IN UINT64 Value - ) -{ - ASSERT (Buffer != NULL); - - WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value); - WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32)); - return Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.inf deleted file mode 100644 index 0a0d3cd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.inf +++ /dev/null @@ -1,626 +0,0 @@ -## @file -# Base Library implementation. -# -# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseLib - MODULE_UNI_FILE = BaseLib.uni - FILE_GUID = 27d67720-ea68-48ae-93da-a3a074c90e30 - MODULE_TYPE = BASE - VERSION_STRING = 1.1 - LIBRARY_CLASS = BaseLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - CheckSum.c - SwitchStack.c - SwapBytes64.c - SwapBytes32.c - SwapBytes16.c - LongJump.c - SetJump.c - RShiftU64.c - RRotU64.c - RRotU32.c - MultU64x64.c - MultU64x32.c - MultS64x64.c - ModU64x32.c - LShiftU64.c - LRotU64.c - LRotU32.c - LowBitSet64.c - LowBitSet32.c - HighBitSet64.c - HighBitSet32.c - GetPowerOfTwo64.c - GetPowerOfTwo32.c - DivU64x64Remainder.c - DivU64x32Remainder.c - DivU64x32.c - DivS64x64Remainder.c - ARShiftU64.c - BitField.c - CpuDeadLoop.c - Cpu.c - LinkedList.c - SafeString.c - String.c - FilePaths.c - BaseLibInternals.h - -[Sources.Ia32] - Ia32/WriteTr.nasm - Ia32/Lfence.nasm - - Ia32/Wbinvd.c | MSFT - Ia32/WriteMm7.c | MSFT - Ia32/WriteMm6.c | MSFT - Ia32/WriteMm5.c | MSFT - Ia32/WriteMm4.c | MSFT - Ia32/WriteMm3.c | MSFT - Ia32/WriteMm2.c | MSFT - Ia32/WriteMm1.c | MSFT - Ia32/WriteMm0.c | MSFT - Ia32/WriteLdtr.c | MSFT - Ia32/WriteIdtr.c | MSFT - Ia32/WriteGdtr.c | MSFT - Ia32/WriteDr7.c | MSFT - Ia32/WriteDr6.c | MSFT - Ia32/WriteDr5.c | MSFT - Ia32/WriteDr4.c | MSFT - Ia32/WriteDr3.c | MSFT - Ia32/WriteDr2.c | MSFT - Ia32/WriteDr1.c | MSFT - Ia32/WriteDr0.c | MSFT - Ia32/WriteCr4.c | MSFT - Ia32/WriteCr3.c | MSFT - Ia32/WriteCr2.c | MSFT - Ia32/WriteCr0.c | MSFT - Ia32/WriteMsr64.c | MSFT - Ia32/SwapBytes64.c | MSFT - Ia32/SetJump.c | MSFT - Ia32/RRotU64.c | MSFT - Ia32/RShiftU64.c | MSFT - Ia32/ReadPmc.c | MSFT - Ia32/ReadTsc.c | MSFT - Ia32/ReadLdtr.c | MSFT - Ia32/ReadIdtr.c | MSFT - Ia32/ReadGdtr.c | MSFT - Ia32/ReadTr.c | MSFT - Ia32/ReadSs.c | MSFT - Ia32/ReadGs.c | MSFT - Ia32/ReadFs.c | MSFT - Ia32/ReadEs.c | MSFT - Ia32/ReadDs.c | MSFT - Ia32/ReadCs.c | MSFT - Ia32/ReadMsr64.c | MSFT - Ia32/ReadMm7.c | MSFT - Ia32/ReadMm6.c | MSFT - Ia32/ReadMm5.c | MSFT - Ia32/ReadMm4.c | MSFT - Ia32/ReadMm3.c | MSFT - Ia32/ReadMm2.c | MSFT - Ia32/ReadMm1.c | MSFT - Ia32/ReadMm0.c | MSFT - Ia32/ReadEflags.c | MSFT - Ia32/ReadDr7.c | MSFT - Ia32/ReadDr6.c | MSFT - Ia32/ReadDr5.c | MSFT - Ia32/ReadDr4.c | MSFT - Ia32/ReadDr3.c | MSFT - Ia32/ReadDr2.c | MSFT - Ia32/ReadDr1.c | MSFT - Ia32/ReadDr0.c | MSFT - Ia32/ReadCr4.c | MSFT - Ia32/ReadCr3.c | MSFT - Ia32/ReadCr2.c | MSFT - Ia32/ReadCr0.c | MSFT - Ia32/Mwait.c | MSFT - Ia32/Monitor.c | MSFT - Ia32/ModU64x32.c | MSFT - Ia32/MultU64x64.c | MSFT - Ia32/MultU64x32.c | MSFT - Ia32/LShiftU64.c | MSFT - Ia32/LRotU64.c | MSFT - Ia32/LongJump.c | MSFT - Ia32/Invd.c | MSFT - Ia32/FxRestore.c | MSFT - Ia32/FxSave.c | MSFT - Ia32/FlushCacheLine.c | MSFT - Ia32/EnablePaging32.c | MSFT - Ia32/EnableInterrupts.c | MSFT - Ia32/EnableDisableInterrupts.c | MSFT - Ia32/DivU64x64Remainder.nasm| MSFT - Ia32/DivU64x32Remainder.c | MSFT - Ia32/DivU64x32.c | MSFT - Ia32/DisablePaging32.c | MSFT - Ia32/DisableInterrupts.c | MSFT - Ia32/CpuPause.c | MSFT - Ia32/CpuIdEx.c | MSFT - Ia32/CpuId.c | MSFT - Ia32/CpuBreakpoint.c | MSFT - Ia32/ARShiftU64.c | MSFT - Ia32/Thunk16.nasm | MSFT - Ia32/EnablePaging64.nasm| MSFT - Ia32/EnableCache.c | MSFT - Ia32/DisableCache.c | MSFT - Ia32/RdRand.nasm| MSFT - - Ia32/Wbinvd.nasm| INTEL - Ia32/WriteMm7.nasm| INTEL - Ia32/WriteMm6.nasm| INTEL - Ia32/WriteMm5.nasm| INTEL - Ia32/WriteMm4.nasm| INTEL - Ia32/WriteMm3.nasm| INTEL - Ia32/WriteMm2.nasm| INTEL - Ia32/WriteMm1.nasm| INTEL - Ia32/WriteMm0.nasm| INTEL - Ia32/WriteLdtr.nasm| INTEL - Ia32/WriteIdtr.nasm| INTEL - Ia32/WriteGdtr.nasm| INTEL - Ia32/WriteDr7.nasm| INTEL - Ia32/WriteDr6.nasm| INTEL - Ia32/WriteDr5.nasm| INTEL - Ia32/WriteDr4.nasm| INTEL - Ia32/WriteDr3.nasm| INTEL - Ia32/WriteDr2.nasm| INTEL - Ia32/WriteDr1.nasm| INTEL - Ia32/WriteDr0.nasm| INTEL - Ia32/WriteCr4.nasm| INTEL - Ia32/WriteCr3.nasm| INTEL - Ia32/WriteCr2.nasm| INTEL - Ia32/WriteCr0.nasm| INTEL - Ia32/WriteMsr64.nasm| INTEL - Ia32/SwapBytes64.nasm| INTEL - Ia32/SetJump.nasm| INTEL - Ia32/RRotU64.nasm| INTEL - Ia32/RShiftU64.nasm| INTEL - Ia32/ReadPmc.nasm| INTEL - Ia32/ReadTsc.nasm| INTEL - Ia32/ReadLdtr.nasm| INTEL - Ia32/ReadIdtr.nasm| INTEL - Ia32/ReadGdtr.nasm| INTEL - Ia32/ReadTr.nasm| INTEL - Ia32/ReadSs.nasm| INTEL - Ia32/ReadGs.nasm| INTEL - Ia32/ReadFs.nasm| INTEL - Ia32/ReadEs.nasm| INTEL - Ia32/ReadDs.nasm| INTEL - Ia32/ReadCs.nasm| INTEL - Ia32/ReadMsr64.nasm| INTEL - Ia32/ReadMm7.nasm| INTEL - Ia32/ReadMm6.nasm| INTEL - Ia32/ReadMm5.nasm| INTEL - Ia32/ReadMm4.nasm| INTEL - Ia32/ReadMm3.nasm| INTEL - Ia32/ReadMm2.nasm| INTEL - Ia32/ReadMm1.nasm| INTEL - Ia32/ReadMm0.nasm| INTEL - Ia32/ReadEflags.nasm| INTEL - Ia32/ReadDr7.nasm| INTEL - Ia32/ReadDr6.nasm| INTEL - Ia32/ReadDr5.nasm| INTEL - Ia32/ReadDr4.nasm| INTEL - Ia32/ReadDr3.nasm| INTEL - Ia32/ReadDr2.nasm| INTEL - Ia32/ReadDr1.nasm| INTEL - Ia32/ReadDr0.nasm| INTEL - Ia32/ReadCr4.nasm| INTEL - Ia32/ReadCr3.nasm| INTEL - Ia32/ReadCr2.nasm| INTEL - Ia32/ReadCr0.nasm| INTEL - Ia32/Mwait.nasm| INTEL - Ia32/Monitor.nasm| INTEL - Ia32/ModU64x32.nasm| INTEL - Ia32/MultU64x64.nasm| INTEL - Ia32/MultU64x32.nasm| INTEL - Ia32/LShiftU64.nasm| INTEL - Ia32/LRotU64.nasm| INTEL - Ia32/LongJump.nasm| INTEL - Ia32/Invd.nasm| INTEL - Ia32/FxRestore.nasm| INTEL - Ia32/FxSave.nasm| INTEL - Ia32/FlushCacheLine.nasm| INTEL - Ia32/EnablePaging32.nasm| INTEL - Ia32/EnableInterrupts.nasm| INTEL - Ia32/EnableDisableInterrupts.nasm| INTEL - Ia32/DivU64x64Remainder.nasm| INTEL - Ia32/DivU64x32Remainder.nasm| INTEL - Ia32/DivU64x32.nasm| INTEL - Ia32/DisablePaging32.nasm| INTEL - Ia32/DisableInterrupts.nasm| INTEL - Ia32/CpuPause.nasm| INTEL - Ia32/CpuIdEx.nasm| INTEL - Ia32/CpuId.nasm| INTEL - Ia32/CpuBreakpoint.nasm| INTEL - Ia32/ARShiftU64.nasm| INTEL - Ia32/Thunk16.nasm | INTEL - Ia32/EnablePaging64.nasm| INTEL - Ia32/EnableCache.nasm| INTEL - Ia32/DisableCache.nasm| INTEL - Ia32/RdRand.nasm| INTEL - - Ia32/GccInline.c | GCC - Ia32/Thunk16.nasm | GCC - Ia32/Thunk16.S | XCODE - Ia32/EnableDisableInterrupts.nasm| GCC - Ia32/EnableDisableInterrupts.S | GCC - Ia32/EnablePaging64.nasm| GCC - Ia32/EnablePaging64.S | GCC - Ia32/DisablePaging32.nasm| GCC - Ia32/DisablePaging32.S | GCC - Ia32/EnablePaging32.nasm| GCC - Ia32/EnablePaging32.S | GCC - Ia32/Mwait.nasm| GCC - Ia32/Mwait.S | GCC - Ia32/Monitor.nasm| GCC - Ia32/Monitor.S | GCC - Ia32/CpuIdEx.nasm| GCC - Ia32/CpuIdEx.S | GCC - Ia32/CpuId.nasm| GCC - Ia32/CpuId.S | GCC - Ia32/LongJump.nasm| GCC - Ia32/LongJump.S | GCC - Ia32/SetJump.nasm| GCC - Ia32/SetJump.S | GCC - Ia32/SwapBytes64.nasm| GCC - Ia32/SwapBytes64.S | GCC - Ia32/DivU64x64Remainder.nasm| GCC - Ia32/DivU64x64Remainder.S | GCC - Ia32/DivU64x32Remainder.nasm| GCC - Ia32/DivU64x32Remainder.S | GCC - Ia32/ModU64x32.nasm| GCC - Ia32/ModU64x32.S | GCC - Ia32/DivU64x32.nasm| GCC - Ia32/DivU64x32.S | GCC - Ia32/MultU64x64.nasm| GCC - Ia32/MultU64x64.S | GCC - Ia32/MultU64x32.nasm| GCC - Ia32/MultU64x32.S | GCC - Ia32/RRotU64.nasm| GCC - Ia32/RRotU64.S | GCC - Ia32/LRotU64.nasm| GCC - Ia32/LRotU64.S | GCC - Ia32/ARShiftU64.nasm| GCC - Ia32/ARShiftU64.S | GCC - Ia32/RShiftU64.nasm| GCC - Ia32/RShiftU64.S | GCC - Ia32/LShiftU64.nasm| GCC - Ia32/LShiftU64.S | GCC - Ia32/EnableCache.nasm| GCC - Ia32/EnableCache.S | GCC - Ia32/DisableCache.nasm| GCC - Ia32/DisableCache.S | GCC - Ia32/RdRand.nasm| GCC - Ia32/RdRand.S | GCC - - Ia32/DivS64x64Remainder.c - Ia32/InternalSwitchStack.c | MSFT - Ia32/InternalSwitchStack.c | INTEL - Ia32/InternalSwitchStack.S | GCC - Ia32/InternalSwitchStack.nasm | GCC - Ia32/Non-existing.c - Unaligned.c - X86WriteIdtr.c - X86WriteGdtr.c - X86Thunk.c - X86ReadIdtr.c - X86ReadGdtr.c - X86Msr.c - X86MemoryFence.c | MSFT - X86MemoryFence.c | INTEL - X86GetInterruptState.c - X86FxSave.c - X86FxRestore.c - X86EnablePaging64.c - X86EnablePaging32.c - X86DisablePaging64.c - X86DisablePaging32.c - X86RdRand.c - X86PatchInstruction.c - X86SpeculationBarrier.c - -[Sources.X64] - X64/Thunk16.nasm - X64/CpuIdEx.nasm - X64/CpuId.nasm - X64/LongJump.nasm - X64/SetJump.nasm - X64/SwitchStack.nasm - X64/EnableCache.nasm - X64/DisableCache.nasm - X64/WriteTr.nasm - X64/Lfence.nasm - - X64/CpuBreakpoint.c | MSFT - X64/WriteMsr64.c | MSFT - X64/ReadMsr64.c | MSFT - X64/RdRand.nasm| MSFT - X64/CpuPause.nasm| MSFT - X64/EnableDisableInterrupts.nasm| MSFT - X64/DisableInterrupts.nasm| MSFT - X64/EnableInterrupts.nasm| MSFT - X64/FlushCacheLine.nasm| MSFT - X64/Invd.nasm| MSFT - X64/Wbinvd.nasm| MSFT - X64/DisablePaging64.nasm| MSFT - X64/Mwait.nasm| MSFT - X64/Monitor.nasm| MSFT - X64/ReadPmc.nasm| MSFT - X64/ReadTsc.nasm| MSFT - X64/WriteMm7.nasm| MSFT - X64/WriteMm6.nasm| MSFT - X64/WriteMm5.nasm| MSFT - X64/WriteMm4.nasm| MSFT - X64/WriteMm3.nasm| MSFT - X64/WriteMm2.nasm| MSFT - X64/WriteMm1.nasm| MSFT - X64/WriteMm0.nasm| MSFT - X64/ReadMm7.nasm| MSFT - X64/ReadMm6.nasm| MSFT - X64/ReadMm5.nasm| MSFT - X64/ReadMm4.nasm| MSFT - X64/ReadMm3.nasm| MSFT - X64/ReadMm2.nasm| MSFT - X64/ReadMm1.nasm| MSFT - X64/ReadMm0.nasm| MSFT - X64/FxRestore.nasm| MSFT - X64/FxSave.nasm| MSFT - X64/WriteLdtr.nasm| MSFT - X64/ReadLdtr.nasm| MSFT - X64/WriteIdtr.nasm| MSFT - X64/ReadIdtr.nasm| MSFT - X64/WriteGdtr.nasm| MSFT - X64/ReadGdtr.nasm| MSFT - X64/ReadTr.nasm| MSFT - X64/ReadSs.nasm| MSFT - X64/ReadGs.nasm| MSFT - X64/ReadFs.nasm| MSFT - X64/ReadEs.nasm| MSFT - X64/ReadDs.nasm| MSFT - X64/ReadCs.nasm| MSFT - X64/WriteDr7.nasm| MSFT - X64/WriteDr6.nasm| MSFT - X64/WriteDr5.nasm| MSFT - X64/WriteDr4.nasm| MSFT - X64/WriteDr3.nasm| MSFT - X64/WriteDr2.nasm| MSFT - X64/WriteDr1.nasm| MSFT - X64/WriteDr0.nasm| MSFT - X64/ReadDr7.nasm| MSFT - X64/ReadDr6.nasm| MSFT - X64/ReadDr5.nasm| MSFT - X64/ReadDr4.nasm| MSFT - X64/ReadDr3.nasm| MSFT - X64/ReadDr2.nasm| MSFT - X64/ReadDr1.nasm| MSFT - X64/ReadDr0.nasm| MSFT - X64/WriteCr4.nasm| MSFT - X64/WriteCr3.nasm| MSFT - X64/WriteCr2.nasm| MSFT - X64/WriteCr0.nasm| MSFT - X64/ReadCr4.nasm| MSFT - X64/ReadCr3.nasm| MSFT - X64/ReadCr2.nasm| MSFT - X64/ReadCr0.nasm| MSFT - X64/ReadEflags.nasm| MSFT - - X64/CpuBreakpoint.nasm| INTEL - X64/WriteMsr64.nasm| INTEL - X64/ReadMsr64.nasm| INTEL - X64/RdRand.nasm| INTEL - X64/CpuPause.nasm| INTEL - X64/EnableDisableInterrupts.nasm| INTEL - X64/DisableInterrupts.nasm| INTEL - X64/EnableInterrupts.nasm| INTEL - X64/FlushCacheLine.nasm| INTEL - X64/Invd.nasm| INTEL - X64/Wbinvd.nasm| INTEL - X64/DisablePaging64.nasm| INTEL - X64/Mwait.nasm| INTEL - X64/Monitor.nasm| INTEL - X64/ReadPmc.nasm| INTEL - X64/ReadTsc.nasm| INTEL - X64/WriteMm7.nasm| INTEL - X64/WriteMm6.nasm| INTEL - X64/WriteMm5.nasm| INTEL - X64/WriteMm4.nasm| INTEL - X64/WriteMm3.nasm| INTEL - X64/WriteMm2.nasm| INTEL - X64/WriteMm1.nasm| INTEL - X64/WriteMm0.nasm| INTEL - X64/ReadMm7.nasm| INTEL - X64/ReadMm6.nasm| INTEL - X64/ReadMm5.nasm| INTEL - X64/ReadMm4.nasm| INTEL - X64/ReadMm3.nasm| INTEL - X64/ReadMm2.nasm| INTEL - X64/ReadMm1.nasm| INTEL - X64/ReadMm0.nasm| INTEL - X64/FxRestore.nasm| INTEL - X64/FxSave.nasm| INTEL - X64/WriteLdtr.nasm| INTEL - X64/ReadLdtr.nasm| INTEL - X64/WriteIdtr.nasm| INTEL - X64/ReadIdtr.nasm| INTEL - X64/WriteGdtr.nasm| INTEL - X64/ReadGdtr.nasm| INTEL - X64/ReadTr.nasm| INTEL - X64/ReadSs.nasm| INTEL - X64/ReadGs.nasm| INTEL - X64/ReadFs.nasm| INTEL - X64/ReadEs.nasm| INTEL - X64/ReadDs.nasm| INTEL - X64/ReadCs.nasm| INTEL - X64/WriteDr7.nasm| INTEL - X64/WriteDr6.nasm| INTEL - X64/WriteDr5.nasm| INTEL - X64/WriteDr4.nasm| INTEL - X64/WriteDr3.nasm| INTEL - X64/WriteDr2.nasm| INTEL - X64/WriteDr1.nasm| INTEL - X64/WriteDr0.nasm| INTEL - X64/ReadDr7.nasm| INTEL - X64/ReadDr6.nasm| INTEL - X64/ReadDr5.nasm| INTEL - X64/ReadDr4.nasm| INTEL - X64/ReadDr3.nasm| INTEL - X64/ReadDr2.nasm| INTEL - X64/ReadDr1.nasm| INTEL - X64/ReadDr0.nasm| INTEL - X64/WriteCr4.nasm| INTEL - X64/WriteCr3.nasm| INTEL - X64/WriteCr2.nasm| INTEL - X64/WriteCr0.nasm| INTEL - X64/ReadCr4.nasm| INTEL - X64/ReadCr3.nasm| INTEL - X64/ReadCr2.nasm| INTEL - X64/ReadCr0.nasm| INTEL - X64/ReadEflags.nasm| INTEL - - X64/Non-existing.c - Math64.c - Unaligned.c - X86WriteIdtr.c - X86WriteGdtr.c - X86Thunk.c - X86ReadIdtr.c - X86ReadGdtr.c - X86Msr.c - X86MemoryFence.c | MSFT - X86MemoryFence.c | INTEL - X86GetInterruptState.c - X86FxSave.c - X86FxRestore.c - X86EnablePaging64.c - X86EnablePaging32.c - X86DisablePaging64.c - X86DisablePaging32.c - X86RdRand.c - X86PatchInstruction.c - X86SpeculationBarrier.c - X64/GccInline.c | GCC - X64/Thunk16.S | XCODE - X64/SwitchStack.nasm| GCC - X64/SwitchStack.S | GCC - X64/SetJump.nasm| GCC - X64/SetJump.S | GCC - X64/LongJump.nasm| GCC - X64/LongJump.S | GCC - X64/EnableDisableInterrupts.nasm| GCC - X64/EnableDisableInterrupts.S | GCC - X64/DisablePaging64.nasm| GCC - X64/DisablePaging64.S | GCC - X64/CpuId.nasm| GCC - X64/CpuId.S | GCC - X64/CpuIdEx.nasm| GCC - X64/CpuIdEx.S | GCC - X64/EnableCache.nasm| GCC - X64/EnableCache.S | GCC - X64/DisableCache.nasm| GCC - X64/DisableCache.S | GCC - X64/RdRand.nasm| GCC - X64/RdRand.S | GCC - ChkStkGcc.c | GCC - -[Sources.EBC] - Ebc/CpuBreakpoint.c - Ebc/SetJumpLongJump.c - Ebc/SwitchStack.c - Ebc/SpeculationBarrier.c - Unaligned.c - Math64.c - -[Sources.ARM] - Arm/InternalSwitchStack.c - Arm/Unaligned.c - Math64.c | RVCT - Math64.c | MSFT - - Arm/SwitchStack.asm | RVCT - Arm/SetJumpLongJump.asm | RVCT - Arm/DisableInterrupts.asm | RVCT - Arm/EnableInterrupts.asm | RVCT - Arm/GetInterruptsState.asm | RVCT - Arm/CpuPause.asm | RVCT - Arm/CpuBreakpoint.asm | RVCT - Arm/MemoryFence.asm | RVCT - Arm/SpeculationBarrier.S | RVCT - - Arm/SwitchStack.asm | MSFT - Arm/SetJumpLongJump.asm | MSFT - Arm/DisableInterrupts.asm | MSFT - Arm/EnableInterrupts.asm | MSFT - Arm/GetInterruptsState.asm | MSFT - Arm/CpuPause.asm | MSFT - Arm/CpuBreakpoint.asm | MSFT - Arm/MemoryFence.asm | MSFT - Arm/SpeculationBarrier.asm | MSFT - - Arm/Math64.S | GCC - Arm/SwitchStack.S | GCC - Arm/EnableInterrupts.S | GCC - Arm/DisableInterrupts.S | GCC - Arm/GetInterruptsState.S | GCC - Arm/SetJumpLongJump.S | GCC - Arm/CpuBreakpoint.S | GCC - Arm/MemoryFence.S | GCC - Arm/SpeculationBarrier.S | GCC - -[Sources.AARCH64] - Arm/InternalSwitchStack.c - Arm/Unaligned.c - Math64.c - - AArch64/MemoryFence.S | GCC - AArch64/SwitchStack.S | GCC - AArch64/EnableInterrupts.S | GCC - AArch64/DisableInterrupts.S | GCC - AArch64/GetInterruptsState.S | GCC - AArch64/SetJumpLongJump.S | GCC - AArch64/CpuBreakpoint.S | GCC - AArch64/SpeculationBarrier.S | GCC - - AArch64/MemoryFence.asm | MSFT - AArch64/SwitchStack.asm | MSFT - AArch64/EnableInterrupts.asm | MSFT - AArch64/DisableInterrupts.asm | MSFT - AArch64/GetInterruptsState.asm | MSFT - AArch64/SetJumpLongJump.asm | MSFT - AArch64/CpuBreakpoint.asm | MSFT - AArch64/SpeculationBarrier.asm | MSFT - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PcdLib - DebugLib - BaseMemoryLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask ## SOMETIMES_CONSUMES - -[FeaturePcd] - gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.uni deleted file mode 100644 index 6e4c32e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Base Library implementation. -// -// Base Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Base Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLibInternals.h deleted file mode 100644 index d02feff..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BaseLibInternals.h +++ /dev/null @@ -1,875 +0,0 @@ -/** @file - Declaration of internal functions in BaseLib. - - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __BASE_LIB_INTERNALS__ -#define __BASE_LIB_INTERNALS__ - -#include -#include -#include -#include -#include - -// -// Math functions -// - -/** - Shifts a 64-bit integer left between 0 and 63 bits. The low bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the left by Count bits. The - low Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift left. - @param Count The number of bits to shift left. - - @return Operand << Count - -**/ -UINT64 -EFIAPI -InternalMathLShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -/** - Shifts a 64-bit integer right between 0 and 63 bits. The high bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand >> Count - -**/ -UINT64 -EFIAPI -InternalMathRShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -/** - 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. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to bit 63 of Operand. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand arithmetically shifted right by Count - -**/ -UINT64 -EFIAPI -InternalMathARShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -/** - Rotates a 64-bit integer left between 0 and 63 bits, filling - the low bits with the high bits that were rotated. - - This function rotates the 64-bit value Operand to the left by Count bits. The - low Count bits are filled with the high Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate left. - @param Count The number of bits to rotate left. - - @return Operand <<< Count - -**/ -UINT64 -EFIAPI -InternalMathLRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -/** - Rotates a 64-bit integer right between 0 and 63 bits, filling - the high bits with the high low bits that were rotated. - - This function rotates the 64-bit value Operand to the right by Count bits. - The high Count bits are filled with the low Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate right. - @param Count The number of bits to rotate right. - - @return Operand >>> Count - -**/ -UINT64 -EFIAPI -InternalMathRRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -/** - Switches the endianess of a 64-bit integer. - - This function swaps the bytes in a 64-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Operand A 64-bit unsigned value. - - @return The byte swapped Operand. - -**/ -UINT64 -EFIAPI -InternalMathSwapBytes64 ( - IN UINT64 Operand - ); - -/** - Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer - and generates a 64-bit unsigned result. - - This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 32-bit unsigned value. - - @return Multiplicand * Multiplier - -**/ -UINT64 -EFIAPI -InternalMathMultU64x32 ( - IN UINT64 Multiplicand, - IN UINT32 Multiplier - ); - -/** - Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer - and generates a 64-bit unsigned result. - - This function multiples the 64-bit unsigned value Multiplicand by the 64-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 64-bit unsigned value. - - @return Multiplicand * Multiplier - -**/ -UINT64 -EFIAPI -InternalMathMultU64x64 ( - IN UINT64 Multiplicand, - IN UINT64 Multiplier - ); - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. This - function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ); - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 32-bit remainder. This function - returns the 32-bit unsigned remainder. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend % Divisor - -**/ -UINT32 -EFIAPI -InternalMathModU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ); - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result and an optional 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 32-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - @param Remainder A pointer to a 32-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivRemU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor, - OUT UINT32 *Remainder OPTIONAL - ); - -/** - Divides a 64-bit unsigned integer by a 64-bit unsigned integer and - generates a 64-bit unsigned result and an optional 64-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 64-bit unsigned value. - @param Remainder A pointer to a 64-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivRemU64x64 ( - IN UINT64 Dividend, - IN UINT64 Divisor, - OUT UINT64 *Remainder OPTIONAL - ); - -/** - Divides a 64-bit signed integer by a 64-bit signed integer and - generates a 64-bit signed result and an optional 64-bit signed remainder. - - This function divides the 64-bit signed value Dividend by the 64-bit - signed value Divisor and generates a 64-bit signed quotient. If Remainder - is not NULL, then the 64-bit signed remainder is returned in Remainder. - This function returns the 64-bit signed quotient. - - @param Dividend A 64-bit signed value. - @param Divisor A 64-bit signed value. - @param Remainder A pointer to a 64-bit signed value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -INT64 -EFIAPI -InternalMathDivRemS64x64 ( - IN INT64 Dividend, - IN INT64 Divisor, - OUT INT64 *Remainder OPTIONAL - ); - -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the - new stack specified by NewStack and passing in the parameters specified - by Context1 and Context2. Context1 and Context2 are optional and may - be NULL. The function EntryPoint must never return. - Marker will be ignored on IA-32, x64, and EBC. - IPF CPUs expect one additional parameter of type VOID * that specifies - the new backing store pointer. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param Marker VA_LIST marker for the variable argument list. - -**/ -VOID -EFIAPI -InternalSwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VA_LIST Marker - ); - - -/** - Worker function that returns a bit field from Operand. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - - @return The bit field read. - -**/ -UINTN -EFIAPI -BitFieldReadUint ( - 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. - - Performs a bitwise OR between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new value is returned. - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - @param OrData The value to OR with the read value from the value - - @return The new value. - -**/ -UINTN -EFIAPI -BitFieldOrUint ( - 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. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new value is returned. - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - @param AndData The value to And with the read value from the value - - @return The new value. - -**/ -UINTN -EFIAPI -BitFieldAndUint ( - IN UINTN Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINTN AndData - ); - - -/** - Worker function that checks ASSERT condition for JumpBuffer - - Checks ASSERT condition for JumpBuffer. - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - -**/ -VOID -EFIAPI -InternalAssertJumpBuffer ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer - ); - - -/** - Restores the CPU context that was saved with SetJump(). - - Restores the CPU context from the buffer specified by JumpBuffer. - This function never returns to the caller. - Instead is resumes execution based on the state of JumpBuffer. - - @param JumpBuffer A pointer to CPU context buffer. - @param Value The value to return when the SetJump() context is restored. - -**/ -VOID -EFIAPI -InternalLongJump ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, - IN UINTN Value - ); - - -/** - Check if a Unicode character is a decimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid decimal character is from - L'0' to L'9'. - - @param Char The character to check against. - - @retval TRUE If the Char is a decmial character. - @retval FALSE If the Char is not a decmial character. - -**/ -BOOLEAN -EFIAPI -InternalIsDecimalDigitCharacter ( - IN CHAR16 Char - ); - - -/** - Convert a Unicode character to numerical value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other - Unicode character, the value returned does not make sense. - - @param Char The character to convert. - - @return The numerical value converted. - -**/ -UINTN -EFIAPI -InternalHexCharToUintn ( - IN CHAR16 Char - ); - - -/** - Check if a Unicode character is a hexadecimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid hexadecimal character is - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -InternalIsHexaDecimalDigitCharacter ( - IN CHAR16 Char - ); - - -/** - Check if a ASCII character is a decimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid decimal character is from - '0' to '9'. - - @param Char The character to check against. - - @retval TRUE If the Char is a decmial character. - @retval FALSE If the Char is not a decmial character. - -**/ -BOOLEAN -EFIAPI -InternalAsciiIsDecimalDigitCharacter ( - IN CHAR8 Char - ); - - -/** - Check if a ASCII character is a hexadecimal character. - - This internal function checks if a ASCII character is a - decimal character. The valid hexadecimal character is - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -InternalAsciiIsHexaDecimalDigitCharacter ( - IN CHAR8 Char - ); - - -/** - Convert a ASCII character to numerical value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - '0' to '9', 'a' to 'f' or 'A' to 'F'. For other - ASCII character, the value returned does not make sense. - - @param Char The character to convert. - - @return The numerical value converted. - -**/ -UINTN -EFIAPI -InternalAsciiHexCharToUintn ( - IN CHAR8 Char - ); - - -// -// Ia32 and x64 specific functions -// -#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) - -/** - Reads the current Global Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and x64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr - ); - -/** - Writes the current Global Descriptor Table Register (GDTR) descriptor. - - Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and x64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr - ); - -/** - Reads the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and x64. - - @param Idtr The pointer to an IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr - ); - -/** - Writes the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and x64. - - @param Idtr The pointer to an IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr - ); - -/** - Save the current floating point/SSE/SSE2 context to a buffer. - - Saves the current floating point/SSE/SSE2 state to the buffer specified by - Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and x64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxSave ( - OUT IA32_FX_BUFFER *Buffer - ); - -/** - Restores the current floating point/SSE/SSE2 context from a buffer. - - Restores the current floating point/SSE/SSE2 state from the buffer specified - by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and x64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxRestore ( - IN CONST IA32_FX_BUFFER *Buffer - ); - -/** - Enables the 32-bit paging mode on the CPU. - - Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode. This function is - only available on IA-32. After the 32-bit paging mode is enabled, control is - transferred to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit protected mode with flat descriptors. This - means all descriptors must have a base of 0 and a limit of 4GB. - 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat - descriptors. - 4) CR3 must point to valid page tables that will be used once the transition - is complete, and those page tables must guarantee that the pages for this - function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is enabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is enabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is enabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is enabled. - -**/ -VOID -EFIAPI -InternalX86EnablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ); - -/** - Disables the 32-bit paging mode on the CPU. - - Disables the 32-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 32-paged protected - mode. This function is only available on IA-32. After the 32-bit paging mode - is disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be NULL. The function EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit paged mode. - 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode. - 4) CR3 must point to valid page tables that guarantee that the pages for - this function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is disabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is disabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is - disabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is disabled. - -**/ -VOID -EFIAPI -InternalX86DisablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ); - -/** - Enables the 64-bit paging mode on the CPU. - - Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode with flat - descriptors. This function is only available on IA-32. After the 64-bit - paging mode is enabled, control is transferred to the function specified by - EntryPoint using the new stack specified by NewStack and passing in the - parameters specified by Context1 and Context2. Context1 and Context2 are - optional and may be 0. The function EntryPoint must never return. - - @param Cs The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for long mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is enabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is enabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is enabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is enabled. - -**/ -VOID -EFIAPI -InternalX86EnablePaging64 ( - IN UINT16 Cs, - IN UINT64 EntryPoint, - IN UINT64 Context1, OPTIONAL - IN UINT64 Context2, OPTIONAL - IN UINT64 NewStack - ); - -/** - Disables the 64-bit paging mode on the CPU. - - Disables the 64-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 64-paging mode. - This function is only available on x64. After the 64-bit paging mode is - disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be 0. The function EntryPoint must never return. - - @param Cs The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for 32-bit protected mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is disabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is disabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is disabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is disabled. - -**/ -VOID -EFIAPI -InternalX86DisablePaging64 ( - IN UINT16 Cs, - IN UINT32 EntryPoint, - IN UINT32 Context1, OPTIONAL - IN UINT32 Context2, OPTIONAL - IN UINT32 NewStack - ); - -/** - Generates a 16-bit random number through RDRAND instruction. - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - - **/ -BOOLEAN -EFIAPI -InternalX86RdRand16 ( - OUT UINT16 *Rand - ); - -/** - Generates a 32-bit random number through RDRAND instruction. - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - -**/ -BOOLEAN -EFIAPI -InternalX86RdRand32 ( - OUT UINT32 *Rand - ); - -/** - Generates a 64-bit random number through RDRAND instruction. - - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - -**/ -BOOLEAN -EFIAPI -InternalX86RdRand64 ( - OUT UINT64 *Rand - ); - -#else - -#endif - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BitField.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BitField.c deleted file mode 100644 index 05dbe01..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/BitField.c +++ /dev/null @@ -1,1008 +0,0 @@ -/** @file - Bit field functions of BaseLib. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Worker function that returns a bit field from Operand. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - - @return The bit field read. - -**/ -UINTN -EFIAPI -InternalBaseLibBitFieldReadUint ( - IN UINTN Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - // - // ~((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 & ~((UINTN)-2 << EndBit)) >> StartBit; -} - -/** - Worker function that reads a bit field from Operand, performs a bitwise OR, - and returns the result. - - Performs a bitwise OR between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new value is returned. - - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - @param OrData The value to OR with the read value from the value. - - @return The new value. - -**/ -UINTN -EFIAPI -InternalBaseLibBitFieldOrUint ( - IN UINTN Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINTN OrData - ) -{ - // - // Higher bits in OrData those are not used must be zero. - // - // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined, - // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. - // - ASSERT ((OrData >> (EndBit - StartBit)) == ((OrData >> (EndBit - StartBit)) & 1)); - - // - // ~((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)); -} - -/** - Worker function that reads a bit field from Operand, performs a bitwise AND, - and returns the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new value is returned. - - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - @param EndBit The ordinal of the most significant bit in the bit field. - @param AndData The value to And with the read value from the value. - - @return The new value. - -**/ -UINTN -EFIAPI -InternalBaseLibBitFieldAndUint ( - IN UINTN Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINTN AndData - ) -{ - // - // Higher bits in AndData those are not used must be zero. - // - // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined, - // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. - // - ASSERT ((AndData >> (EndBit - StartBit)) == ((AndData >> (EndBit - StartBit)) & 1)); - - // - // ~((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 & ~((~AndData << StartBit) & ~((UINTN)-2 << EndBit)); -} - -/** - Returns a bit field from an 8-bit value. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - If 8-bit operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The bit field read. - -**/ -UINT8 -EFIAPI -BitFieldRead8 ( - IN UINT8 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT (EndBit < 8); - ASSERT (StartBit <= EndBit); - return (UINT8)InternalBaseLibBitFieldReadUint (Operand, StartBit, EndBit); -} - -/** - Writes a bit field to an 8-bit value, and returns the result. - - Writes Value to the bit field specified by the StartBit and the EndBit in - Operand. All other bits in Operand are preserved. The new 8-bit value is - returned. - - If 8-bit operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The new 8-bit value. - -**/ -UINT8 -EFIAPI -BitFieldWrite8 ( - IN UINT8 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - ASSERT (EndBit < 8); - ASSERT (StartBit <= EndBit); - return BitFieldAndThenOr8 (Operand, StartBit, EndBit, 0, Value); -} - -/** - Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the - result. - - Performs a bitwise OR between the bit field specified by StartBit - and EndBit in Operand and the value specified by OrData. All other bits in - Operand are preserved. The new 8-bit value is returned. - - If 8-bit operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the value. - - @return The new 8-bit value. - -**/ -UINT8 -EFIAPI -BitFieldOr8 ( - IN UINT8 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - ASSERT (EndBit < 8); - ASSERT (StartBit <= EndBit); - return (UINT8)InternalBaseLibBitFieldOrUint (Operand, StartBit, EndBit, OrData); -} - -/** - Reads a bit field from an 8-bit value, performs a bitwise AND, and returns - the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new 8-bit value is returned. - - If 8-bit operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the value. - - @return The new 8-bit value. - -**/ -UINT8 -EFIAPI -BitFieldAnd8 ( - IN UINT8 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - ASSERT (EndBit < 8); - ASSERT (StartBit <= EndBit); - return (UINT8)InternalBaseLibBitFieldAndUint (Operand, StartBit, EndBit, AndData); -} - -/** - Reads a bit field from an 8-bit value, performs a bitwise AND followed by a - bitwise OR, and returns the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - OR with value specified by OrData. All other bits in Operand are - preserved. The new 8-bit value is returned. - - If 8-bit operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the value. - @param OrData The value to OR with the result of the AND operation. - - @return The new 8-bit value. - -**/ -UINT8 -EFIAPI -BitFieldAndThenOr8 ( - IN UINT8 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - ASSERT (EndBit < 8); - ASSERT (StartBit <= EndBit); - return BitFieldOr8 ( - BitFieldAnd8 (Operand, StartBit, EndBit, AndData), - StartBit, - EndBit, - OrData - ); -} - -/** - Returns a bit field from a 16-bit value. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - If 16-bit operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The bit field read. - -**/ -UINT16 -EFIAPI -BitFieldRead16 ( - IN UINT16 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT (EndBit < 16); - ASSERT (StartBit <= EndBit); - return (UINT16)InternalBaseLibBitFieldReadUint (Operand, StartBit, EndBit); -} - -/** - Writes a bit field to a 16-bit value, and returns the result. - - Writes Value to the bit field specified by the StartBit and the EndBit in - Operand. All other bits in Operand are preserved. The new 16-bit value is - returned. - - If 16-bit operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The new 16-bit value. - -**/ -UINT16 -EFIAPI -BitFieldWrite16 ( - IN UINT16 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - ASSERT (EndBit < 16); - ASSERT (StartBit <= EndBit); - return BitFieldAndThenOr16 (Operand, StartBit, EndBit, 0, Value); -} - -/** - Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the - result. - - Performs a bitwise OR between the bit field specified by StartBit - and EndBit in Operand and the value specified by OrData. All other bits in - Operand are preserved. The new 16-bit value is returned. - - If 16-bit operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the value. - - @return The new 16-bit value. - -**/ -UINT16 -EFIAPI -BitFieldOr16 ( - IN UINT16 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - ASSERT (EndBit < 16); - ASSERT (StartBit <= EndBit); - return (UINT16)InternalBaseLibBitFieldOrUint (Operand, StartBit, EndBit, OrData); -} - -/** - Reads a bit field from a 16-bit value, performs a bitwise AND, and returns - the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new 16-bit value is returned. - - If 16-bit operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the value. - - @return The new 16-bit value. - -**/ -UINT16 -EFIAPI -BitFieldAnd16 ( - IN UINT16 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - ASSERT (EndBit < 16); - ASSERT (StartBit <= EndBit); - return (UINT16)InternalBaseLibBitFieldAndUint (Operand, StartBit, EndBit, AndData); -} - -/** - Reads a bit field from a 16-bit value, performs a bitwise AND followed by a - bitwise OR, and returns the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - OR with value specified by OrData. All other bits in Operand are - preserved. The new 16-bit value is returned. - - If 16-bit operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the value. - @param OrData The value to OR with the result of the AND operation. - - @return The new 16-bit value. - -**/ -UINT16 -EFIAPI -BitFieldAndThenOr16 ( - IN UINT16 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - ASSERT (EndBit < 16); - ASSERT (StartBit <= EndBit); - return BitFieldOr16 ( - BitFieldAnd16 (Operand, StartBit, EndBit, AndData), - StartBit, - EndBit, - OrData - ); -} - -/** - Returns a bit field from a 32-bit value. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - If 32-bit operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The bit field read. - -**/ -UINT32 -EFIAPI -BitFieldRead32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - return (UINT32)InternalBaseLibBitFieldReadUint (Operand, StartBit, EndBit); -} - -/** - Writes a bit field to a 32-bit value, and returns the result. - - Writes Value to the bit field specified by the StartBit and the EndBit in - Operand. All other bits in Operand are preserved. The new 32-bit value is - returned. - - If 32-bit operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The new 32-bit value. - -**/ -UINT32 -EFIAPI -BitFieldWrite32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - return BitFieldAndThenOr32 (Operand, StartBit, EndBit, 0, Value); -} - -/** - Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the - result. - - Performs a bitwise OR between the bit field specified by StartBit - and EndBit in Operand and the value specified by OrData. All other bits in - Operand are preserved. The new 32-bit value is returned. - - If 32-bit operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the value. - - @return The new 32-bit value. - -**/ -UINT32 -EFIAPI -BitFieldOr32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - return (UINT32)InternalBaseLibBitFieldOrUint (Operand, StartBit, EndBit, OrData); -} - -/** - Reads a bit field from a 32-bit value, performs a bitwise AND, and returns - the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new 32-bit value is returned. - - If 32-bit operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the value. - - @return The new 32-bit value. - -**/ -UINT32 -EFIAPI -BitFieldAnd32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - return (UINT32)InternalBaseLibBitFieldAndUint (Operand, StartBit, EndBit, AndData); -} - -/** - Reads a bit field from a 32-bit value, performs a bitwise AND followed by a - bitwise OR, and returns the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - OR with value specified by OrData. All other bits in Operand are - preserved. The new 32-bit value is returned. - - If 32-bit operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the value. - @param OrData The value to OR with the result of the AND operation. - - @return The new 32-bit value. - -**/ -UINT32 -EFIAPI -BitFieldAndThenOr32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - return BitFieldOr32 ( - BitFieldAnd32 (Operand, StartBit, EndBit, AndData), - StartBit, - EndBit, - OrData - ); -} - -/** - Returns a bit field from a 64-bit value. - - Returns the bitfield specified by the StartBit and the EndBit from Operand. - - If 64-bit operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The bit field read. - -**/ -UINT64 -EFIAPI -BitFieldRead64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT (EndBit < 64); - ASSERT (StartBit <= EndBit); - return RShiftU64 (Operand & ~LShiftU64 ((UINT64)-2, EndBit), StartBit); -} - -/** - Writes a bit field to a 64-bit value, and returns the result. - - Writes Value to the bit field specified by the StartBit and the EndBit in - Operand. All other bits in Operand are preserved. The new 64-bit value is - returned. - - If 64-bit operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The new 64-bit value. - -**/ -UINT64 -EFIAPI -BitFieldWrite64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - ASSERT (EndBit < 64); - ASSERT (StartBit <= EndBit); - return BitFieldAndThenOr64 (Operand, StartBit, EndBit, 0, Value); -} - -/** - Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the - result. - - Performs a bitwise OR between the bit field specified by StartBit - and EndBit in Operand and the value specified by OrData. All other bits in - Operand are preserved. The new 64-bit value is returned. - - If 64-bit operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the value - - @return The new 64-bit value. - -**/ -UINT64 -EFIAPI -BitFieldOr64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - UINT64 Value1; - UINT64 Value2; - - ASSERT (EndBit < 64); - ASSERT (StartBit <= EndBit); - // - // Higher bits in OrData those are not used must be zero. - // - // EndBit - StartBit + 1 might be 64 while the result right shifting 64 on RShiftU64() API is invalid, - // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. - // - ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1)); - - Value1 = LShiftU64 (OrData, StartBit); - Value2 = LShiftU64 ((UINT64) - 2, EndBit); - - return Operand | (Value1 & ~Value2); -} - -/** - Reads a bit field from a 64-bit value, performs a bitwise AND, and returns - the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData. All other bits in Operand are - preserved. The new 64-bit value is returned. - - If 64-bit operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the value. - - @return The new 64-bit value. - -**/ -UINT64 -EFIAPI -BitFieldAnd64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - UINT64 Value1; - UINT64 Value2; - - ASSERT (EndBit < 64); - ASSERT (StartBit <= EndBit); - // - // Higher bits in AndData those are not used must be zero. - // - // EndBit - StartBit + 1 might be 64 while the right shifting 64 on RShiftU64() API is invalid, - // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. - // - ASSERT (RShiftU64 (AndData, EndBit - StartBit) == (RShiftU64 (AndData, EndBit - StartBit) & 1)); - - Value1 = LShiftU64 (~AndData, StartBit); - Value2 = LShiftU64 ((UINT64)-2, EndBit); - - return Operand & ~(Value1 & ~Value2); -} - -/** - Reads a bit field from a 64-bit value, performs a bitwise AND followed by a - bitwise OR, and returns the result. - - Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - OR with value specified by OrData. All other bits in Operand are - preserved. The new 64-bit value is returned. - - If 64-bit operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the value. - @param OrData The value to OR with the result of the AND operation. - - @return The new 64-bit value. - -**/ -UINT64 -EFIAPI -BitFieldAndThenOr64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - ASSERT (EndBit < 64); - ASSERT (StartBit <= EndBit); - return BitFieldOr64 ( - BitFieldAnd64 (Operand, StartBit, EndBit, AndData), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field from a 32-bit value, counts and returns - the number of set bits. - - Counts the number of set bits in the bit field specified by - StartBit and EndBit in Operand. The count is returned. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The number of bits set between StartBit and EndBit. - -**/ -UINT8 -EFIAPI -BitFieldCountOnes32 ( - IN UINT32 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - UINT32 Count; - - ASSERT (EndBit < 32); - ASSERT (StartBit <= EndBit); - - Count = BitFieldRead32 (Operand, StartBit, EndBit); - Count -= ((Count >> 1) & 0x55555555); - Count = (Count & 0x33333333) + ((Count >> 2) & 0x33333333); - Count += Count >> 4; - Count &= 0x0F0F0F0F; - Count += Count >> 8; - Count += Count >> 16; - - return (UINT8) Count & 0x3F; -} - -/** - Reads a bit field from a 64-bit value, counts and returns - the number of set bits. - - Counts the number of set bits in the bit field specified by - StartBit and EndBit in Operand. The count is returned. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Operand Operand on which to perform the bitfield operation. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The number of bits set between StartBit and EndBit. - -**/ -UINT8 -EFIAPI -BitFieldCountOnes64 ( - IN UINT64 Operand, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - 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); - - return Count; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CheckSum.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CheckSum.c deleted file mode 100644 index 92f0930..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CheckSum.c +++ /dev/null @@ -1,632 +0,0 @@ -/** @file - Utility functions to generate checksum based on 2's complement - algorithm. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Returns the sum of all elements in a buffer in unit of UINT8. - During calculation, the carry bits are dropped. - - This function calculates the sum of all elements in a buffer - in unit of UINT8. The carry bits in result of addition are dropped. - The result is returned as UINT8. If Length is Zero, then Zero is - returned. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the sum operation. - @param Length The size, in bytes, of Buffer. - - @return Sum The sum of Buffer with carry bits dropped during additions. - -**/ -UINT8 -EFIAPI -CalculateSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length - ) -{ - UINT8 Sum; - UINTN Count; - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1)); - - for (Sum = 0, Count = 0; Count < Length; Count++) { - Sum = (UINT8) (Sum + *(Buffer + Count)); - } - - return Sum; -} - - -/** - Returns the two's complement checksum of all elements in a buffer - of 8-bit values. - - This function first calculates the sum of the 8-bit values in the - buffer specified by Buffer and Length. The carry bits in the result - of addition are dropped. Then, the two's complement of the sum is - returned. If Length is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the checksum operation. - @param Length The size, in bytes, of Buffer. - - @return Checksum The 2's complement checksum of Buffer. - -**/ -UINT8 -EFIAPI -CalculateCheckSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length - ) -{ - UINT8 CheckSum; - - CheckSum = CalculateSum8 (Buffer, Length); - - // - // Return the checksum based on 2's complement. - // - return (UINT8) (0x100 - CheckSum); -} - -/** - Returns the sum of all elements in a buffer of 16-bit values. During - calculation, the carry bits are dropped. - - This function calculates the sum of the 16-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 16-bit result is returned. If Length is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the sum operation. - @param Length The size, in bytes, of Buffer. - - @return Sum The sum of Buffer with carry bits dropped during additions. - -**/ -UINT16 -EFIAPI -CalculateSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length - ) -{ - UINT16 Sum; - UINTN Count; - UINTN Total; - - ASSERT (Buffer != NULL); - ASSERT (((UINTN) Buffer & 0x1) == 0); - ASSERT ((Length & 0x1) == 0); - ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1)); - - Total = Length / sizeof (*Buffer); - for (Sum = 0, Count = 0; Count < Total; Count++) { - Sum = (UINT16) (Sum + *(Buffer + Count)); - } - - return Sum; -} - - -/** - Returns the two's complement checksum of all elements in a buffer of - 16-bit values. - - This function first calculates the sum of the 16-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length - is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the checksum operation. - @param Length The size, in bytes, of Buffer. - - @return Checksum The 2's complement checksum of Buffer. - -**/ -UINT16 -EFIAPI -CalculateCheckSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length - ) -{ - UINT16 CheckSum; - - CheckSum = CalculateSum16 (Buffer, Length); - - // - // Return the checksum based on 2's complement. - // - return (UINT16) (0x10000 - CheckSum); -} - - -/** - Returns the sum of all elements in a buffer of 32-bit values. During - calculation, the carry bits are dropped. - - This function calculates the sum of the 32-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 32-bit result is returned. If Length is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the sum operation. - @param Length The size, in bytes, of Buffer. - - @return Sum The sum of Buffer with carry bits dropped during additions. - -**/ -UINT32 -EFIAPI -CalculateSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length - ) -{ - UINT32 Sum; - UINTN Count; - UINTN Total; - - ASSERT (Buffer != NULL); - ASSERT (((UINTN) Buffer & 0x3) == 0); - ASSERT ((Length & 0x3) == 0); - ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1)); - - Total = Length / sizeof (*Buffer); - for (Sum = 0, Count = 0; Count < Total; Count++) { - Sum = Sum + *(Buffer + Count); - } - - return Sum; -} - - -/** - Returns the two's complement checksum of all elements in a buffer of - 32-bit values. - - This function first calculates the sum of the 32-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length - is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the checksum operation. - @param Length The size, in bytes, of Buffer. - - @return Checksum The 2's complement checksum of Buffer. - -**/ -UINT32 -EFIAPI -CalculateCheckSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length - ) -{ - UINT32 CheckSum; - - CheckSum = CalculateSum32 (Buffer, Length); - - // - // Return the checksum based on 2's complement. - // - 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. - - This function calculates the sum of the 64-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 64-bit result is returned. If Length is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the sum operation. - @param Length The size, in bytes, of Buffer. - - @return Sum The sum of Buffer with carry bits dropped during additions. - -**/ -UINT64 -EFIAPI -CalculateSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length - ) -{ - UINT64 Sum; - UINTN Count; - UINTN Total; - - ASSERT (Buffer != NULL); - ASSERT (((UINTN) Buffer & 0x7) == 0); - ASSERT ((Length & 0x7) == 0); - ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1)); - - Total = Length / sizeof (*Buffer); - for (Sum = 0, Count = 0; Count < Total; Count++) { - Sum = Sum + *(Buffer + Count); - } - - return Sum; -} - - -/** - Returns the two's complement checksum of all elements in a buffer of - 64-bit values. - - This function first calculates the sum of the 64-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length - is 0, then 0 is returned. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to carry out the checksum operation. - @param Length The size, in bytes, of Buffer. - - @return Checksum The 2's complement checksum of Buffer. - -**/ -UINT64 -EFIAPI -CalculateCheckSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length - ) -{ - UINT64 CheckSum; - - CheckSum = CalculateSum64 (Buffer, Length); - - // - // Return the checksum based on 2's complement. - // - return (UINT64) ((UINT64)(-1) - CheckSum + 1); -} - -GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] = { - 0x00000000, - 0x77073096, - 0xEE0E612C, - 0x990951BA, - 0x076DC419, - 0x706AF48F, - 0xE963A535, - 0x9E6495A3, - 0x0EDB8832, - 0x79DCB8A4, - 0xE0D5E91E, - 0x97D2D988, - 0x09B64C2B, - 0x7EB17CBD, - 0xE7B82D07, - 0x90BF1D91, - 0x1DB71064, - 0x6AB020F2, - 0xF3B97148, - 0x84BE41DE, - 0x1ADAD47D, - 0x6DDDE4EB, - 0xF4D4B551, - 0x83D385C7, - 0x136C9856, - 0x646BA8C0, - 0xFD62F97A, - 0x8A65C9EC, - 0x14015C4F, - 0x63066CD9, - 0xFA0F3D63, - 0x8D080DF5, - 0x3B6E20C8, - 0x4C69105E, - 0xD56041E4, - 0xA2677172, - 0x3C03E4D1, - 0x4B04D447, - 0xD20D85FD, - 0xA50AB56B, - 0x35B5A8FA, - 0x42B2986C, - 0xDBBBC9D6, - 0xACBCF940, - 0x32D86CE3, - 0x45DF5C75, - 0xDCD60DCF, - 0xABD13D59, - 0x26D930AC, - 0x51DE003A, - 0xC8D75180, - 0xBFD06116, - 0x21B4F4B5, - 0x56B3C423, - 0xCFBA9599, - 0xB8BDA50F, - 0x2802B89E, - 0x5F058808, - 0xC60CD9B2, - 0xB10BE924, - 0x2F6F7C87, - 0x58684C11, - 0xC1611DAB, - 0xB6662D3D, - 0x76DC4190, - 0x01DB7106, - 0x98D220BC, - 0xEFD5102A, - 0x71B18589, - 0x06B6B51F, - 0x9FBFE4A5, - 0xE8B8D433, - 0x7807C9A2, - 0x0F00F934, - 0x9609A88E, - 0xE10E9818, - 0x7F6A0DBB, - 0x086D3D2D, - 0x91646C97, - 0xE6635C01, - 0x6B6B51F4, - 0x1C6C6162, - 0x856530D8, - 0xF262004E, - 0x6C0695ED, - 0x1B01A57B, - 0x8208F4C1, - 0xF50FC457, - 0x65B0D9C6, - 0x12B7E950, - 0x8BBEB8EA, - 0xFCB9887C, - 0x62DD1DDF, - 0x15DA2D49, - 0x8CD37CF3, - 0xFBD44C65, - 0x4DB26158, - 0x3AB551CE, - 0xA3BC0074, - 0xD4BB30E2, - 0x4ADFA541, - 0x3DD895D7, - 0xA4D1C46D, - 0xD3D6F4FB, - 0x4369E96A, - 0x346ED9FC, - 0xAD678846, - 0xDA60B8D0, - 0x44042D73, - 0x33031DE5, - 0xAA0A4C5F, - 0xDD0D7CC9, - 0x5005713C, - 0x270241AA, - 0xBE0B1010, - 0xC90C2086, - 0x5768B525, - 0x206F85B3, - 0xB966D409, - 0xCE61E49F, - 0x5EDEF90E, - 0x29D9C998, - 0xB0D09822, - 0xC7D7A8B4, - 0x59B33D17, - 0x2EB40D81, - 0xB7BD5C3B, - 0xC0BA6CAD, - 0xEDB88320, - 0x9ABFB3B6, - 0x03B6E20C, - 0x74B1D29A, - 0xEAD54739, - 0x9DD277AF, - 0x04DB2615, - 0x73DC1683, - 0xE3630B12, - 0x94643B84, - 0x0D6D6A3E, - 0x7A6A5AA8, - 0xE40ECF0B, - 0x9309FF9D, - 0x0A00AE27, - 0x7D079EB1, - 0xF00F9344, - 0x8708A3D2, - 0x1E01F268, - 0x6906C2FE, - 0xF762575D, - 0x806567CB, - 0x196C3671, - 0x6E6B06E7, - 0xFED41B76, - 0x89D32BE0, - 0x10DA7A5A, - 0x67DD4ACC, - 0xF9B9DF6F, - 0x8EBEEFF9, - 0x17B7BE43, - 0x60B08ED5, - 0xD6D6A3E8, - 0xA1D1937E, - 0x38D8C2C4, - 0x4FDFF252, - 0xD1BB67F1, - 0xA6BC5767, - 0x3FB506DD, - 0x48B2364B, - 0xD80D2BDA, - 0xAF0A1B4C, - 0x36034AF6, - 0x41047A60, - 0xDF60EFC3, - 0xA867DF55, - 0x316E8EEF, - 0x4669BE79, - 0xCB61B38C, - 0xBC66831A, - 0x256FD2A0, - 0x5268E236, - 0xCC0C7795, - 0xBB0B4703, - 0x220216B9, - 0x5505262F, - 0xC5BA3BBE, - 0xB2BD0B28, - 0x2BB45A92, - 0x5CB36A04, - 0xC2D7FFA7, - 0xB5D0CF31, - 0x2CD99E8B, - 0x5BDEAE1D, - 0x9B64C2B0, - 0xEC63F226, - 0x756AA39C, - 0x026D930A, - 0x9C0906A9, - 0xEB0E363F, - 0x72076785, - 0x05005713, - 0x95BF4A82, - 0xE2B87A14, - 0x7BB12BAE, - 0x0CB61B38, - 0x92D28E9B, - 0xE5D5BE0D, - 0x7CDCEFB7, - 0x0BDBDF21, - 0x86D3D2D4, - 0xF1D4E242, - 0x68DDB3F8, - 0x1FDA836E, - 0x81BE16CD, - 0xF6B9265B, - 0x6FB077E1, - 0x18B74777, - 0x88085AE6, - 0xFF0F6A70, - 0x66063BCA, - 0x11010B5C, - 0x8F659EFF, - 0xF862AE69, - 0x616BFFD3, - 0x166CCF45, - 0xA00AE278, - 0xD70DD2EE, - 0x4E048354, - 0x3903B3C2, - 0xA7672661, - 0xD06016F7, - 0x4969474D, - 0x3E6E77DB, - 0xAED16A4A, - 0xD9D65ADC, - 0x40DF0B66, - 0x37D83BF0, - 0xA9BCAE53, - 0xDEBB9EC5, - 0x47B2CF7F, - 0x30B5FFE9, - 0xBDBDF21C, - 0xCABAC28A, - 0x53B39330, - 0x24B4A3A6, - 0xBAD03605, - 0xCDD70693, - 0x54DE5729, - 0x23D967BF, - 0xB3667A2E, - 0xC4614AB8, - 0x5D681B02, - 0x2A6F2B94, - 0xB40BBE37, - 0xC30C8EA1, - 0x5A05DF1B, - 0x2D02EF8D -}; - -/** - Computes and returns a 32-bit CRC for a data buffer. - CRC32 value bases on ITU-T V.42. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param[in] Buffer A pointer to the buffer on which the 32-bit CRC is to be computed. - @param[in] Length The number of bytes in the buffer Data. - - @retval Crc32 The 32-bit CRC was computed for the data buffer. - -**/ -UINT32 -EFIAPI -CalculateCrc32( - IN VOID *Buffer, - IN UINTN Length - ) -{ - UINTN Index; - UINT32 Crc; - UINT8 *Ptr; - - ASSERT (Buffer != NULL); - 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]; - } - - return Crc ^ 0xffffffff; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ChkStkGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ChkStkGcc.c deleted file mode 100644 index 099fb95..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ChkStkGcc.c +++ /dev/null @@ -1,24 +0,0 @@ -/** @file - Provides hack function for passng GCC build. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Hack function for passing GCC build. -**/ -VOID -__chkstk() -{ -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Cpu.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Cpu.c deleted file mode 100644 index 38bab1e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Cpu.c +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - Base Library CPU Functions for all architectures. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - - -/** - Disables CPU interrupts and returns the interrupt state prior to the disable - operation. - - @retval TRUE CPU interrupts were enabled on entry to this call. - @retval FALSE CPU interrupts were disabled on entry to this call. - -**/ -BOOLEAN -EFIAPI -SaveAndDisableInterrupts ( - VOID - ) -{ - BOOLEAN InterruptState; - - InterruptState = GetInterruptState (); - DisableInterrupts (); - return InterruptState; -} - -/** - Set the current CPU interrupt state. - - Sets the current CPU interrupt state to the state specified by - InterruptState. If InterruptState is TRUE, then interrupts are enabled. If - InterruptState is FALSE, then interrupts are disabled. InterruptState is - returned. - - @param InterruptState TRUE if interrupts should be enabled. FALSE if - interrupts should be disabled. - - @return InterruptState - -**/ -BOOLEAN -EFIAPI -SetInterruptState ( - IN BOOLEAN InterruptState - ) -{ - if (InterruptState) { - EnableInterrupts (); - } else { - DisableInterrupts (); - } - return InterruptState; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CpuDeadLoop.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CpuDeadLoop.c deleted file mode 100644 index 21c6f39..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/CpuDeadLoop.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - Base Library CPU Functions for all architectures. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -#include -#include - -/** - Executes an infinite loop. - - Forces the CPU to execute an infinite loop. A debugger may be used to skip - past the loop and the code that follows the loop must execute properly. This - implies that the infinite loop must not cause the code that follow it to be - optimized away. - -**/ -VOID -EFIAPI -CpuDeadLoop ( - VOID - ) -{ - volatile UINTN Index; - - for (Index = 0; Index == 0;); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivS64x64Remainder.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivS64x64Remainder.c deleted file mode 100644 index 9b8abbd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivS64x64Remainder.c +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Divides a 64-bit signed integer by a 64-bit signed integer and generates a - 64-bit signed result and a optional 64-bit signed remainder. - - This function divides the 64-bit signed value Dividend by the 64-bit signed - value Divisor and generates a 64-bit signed quotient. If Remainder is not - NULL, then the 64-bit signed remainder is returned in Remainder. This - function returns the 64-bit signed quotient. - - It is the caller's responsibility to not call this function with a Divisor of 0. - If Divisor is 0, then the quotient and remainder should be assumed to be - the largest negative integer. - - If Divisor is 0, then ASSERT(). - - @param Dividend A 64-bit signed value. - @param Divisor A 64-bit signed value. - @param Remainder A pointer to a 64-bit signed value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -INT64 -EFIAPI -DivS64x64Remainder ( - IN INT64 Dividend, - IN INT64 Divisor, - OUT INT64 *Remainder OPTIONAL - ) -{ - ASSERT (Divisor != 0); - return InternalMathDivRemS64x64 (Dividend, Divisor, Remainder); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32.c deleted file mode 100644 index 501adda..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32.c +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates - a 64-bit unsigned result. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. This - function returns the 64-bit unsigned quotient. - - If Divisor is 0, then ASSERT(). - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -DivU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - ASSERT (Divisor != 0); - return InternalMathDivU64x32 (Dividend, Divisor); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32Remainder.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32Remainder.c deleted file mode 100644 index e18a0a2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x32Remainder.c +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates - a 64-bit unsigned result and an optional 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 32-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - If Divisor is 0, then ASSERT(). - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - @param Remainder A pointer to a 32-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -DivU64x32Remainder ( - IN UINT64 Dividend, - IN UINT32 Divisor, - OUT UINT32 *Remainder OPTIONAL - ) -{ - ASSERT (Divisor != 0); - return InternalMathDivRemU64x32 (Dividend, Divisor, Remainder); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x64Remainder.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x64Remainder.c deleted file mode 100644 index 13509b8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/DivU64x64Remainder.c +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates - a 64-bit unsigned result and an optional 64-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - If Divisor is 0, then ASSERT(). - - @param Dividend A 64-bit unsigned value. - @param Divisor A 64-bit unsigned value. - @param Remainder A pointer to a 64-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -DivU64x64Remainder ( - IN UINT64 Dividend, - IN UINT64 Divisor, - OUT UINT64 *Remainder OPTIONAL - ) -{ - ASSERT (Divisor != 0); - return InternalMathDivRemU64x64 (Dividend, Divisor, Remainder); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c deleted file mode 100644 index 4f33bd8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c +++ /dev/null @@ -1,129 +0,0 @@ -/** @file - Base Library CPU Functions for EBC - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -extern -UINT64 -_break ( - CHAR8 BreakCode - ); - -/** - Generates a breakpoint on the CPU. - - Generates a breakpoint on the CPU. The breakpoint must be implemented such - that code can resume normal execution after the breakpoint. - -**/ -VOID -EFIAPI -CpuBreakpoint ( - VOID - ) -{ - _break (3); -} - -/** - Used to serialize load and store operations. - - All loads and stores that proceed calls to this function are guaranteed to be - globally visible when this function returns. - -**/ -VOID -EFIAPI -MemoryFence ( - VOID - ) -{ -} - -/** - Disables CPU interrupts. - -**/ -VOID -EFIAPI -DisableInterrupts ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - Enables CPU interrupts. - -**/ -VOID -EFIAPI -EnableInterrupts ( - VOID - ) -{ - ASSERT (FALSE); -} - -/** - Retrieves the current CPU interrupt state. - - Returns TRUE means interrupts are currently enabled. Otherwise, - returns FALSE. - - @retval TRUE CPU interrupts are enabled. - @retval FALSE CPU interrupts are disabled. - -**/ -BOOLEAN -EFIAPI -GetInterruptState ( - VOID - ) -{ - ASSERT (FALSE); - return FALSE; -} - -/** - Enables CPU interrupts for the smallest window required to capture any - pending interrupts. - -**/ -VOID -EFIAPI -EnableDisableInterrupts ( - VOID - ) -{ - EnableInterrupts (); - DisableInterrupts (); -} - -/** - Requests CPU to pause for a short period of time. - - Requests CPU to pause for a short period of time. Typically used in MP - systems to prevent memory starvation while waiting for a spin lock. - -**/ -VOID -EFIAPI -CpuPause ( - VOID - ) -{ -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c deleted file mode 100644 index 3c26c78..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c +++ /dev/null @@ -1,68 +0,0 @@ -/** @file - Implementation of SetJump() and LongJump() on EBC. - - SetJump() and LongJump() are not currently supported for the EBC processor type. - Implementation for EBC just returns 0 for SetJump(), and ASSERT() for LongJump(). - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Saves the current CPU context that can be restored with a call to LongJump() and returns 0. - - Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial - call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero - value to be returned by SetJump(). - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - - @retval 0 Indicates a return from SetJump(). - -**/ -RETURNS_TWICE -UINTN -EFIAPI -SetJump ( - OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer - ) -{ - InternalAssertJumpBuffer (JumpBuffer); - return 0; -} - -/** - Restores the CPU context that was saved with SetJump(). - - Restores the CPU context from the buffer specified by JumpBuffer. - This function never returns to the caller. - Instead it resumes execution based on the state of JumpBuffer. - - @param JumpBuffer A pointer to CPU context buffer. - @param Value The value to return when the SetJump() context is restored. - -**/ -VOID -EFIAPI -InternalLongJump ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, - IN UINTN Value - ) -{ - // - // This function cannot work on EBC - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c deleted file mode 100644 index 25a9116..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c +++ /dev/null @@ -1,30 +0,0 @@ -/** @file - SpeculationBarrier() function for EBC. - - Copyright (C) 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT - WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/** - Uses as a barrier to stop speculative execution. - - Ensures that no later instruction will execute speculatively, until all prior - instructions have completed. - -**/ -VOID -EFIAPI -SpeculationBarrier ( - VOID - ) -{ -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SwitchStack.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SwitchStack.c deleted file mode 100644 index c90b07a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ebc/SwitchStack.c +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - Switch Stack functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the - new stack specified by NewStack and passing in the parameters specified - by Context1 and Context2. Context1 and Context2 are optional and may - be NULL. The function EntryPoint must never return. - Marker will be ignored on IA-32, x64, and EBC. - IPF CPUs expect one additional parameter of type VOID * that specifies - the new backing store pointer. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param Marker A VA_LIST marker for the variable argument list. - -**/ -VOID -EFIAPI -InternalSwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VA_LIST Marker - ) - -{ - // - // This version of this function does not actually change the stack pointer - // This is to support compilation of CPU types that do not support assemblers - // such as EBC - // - EntryPoint (Context1, Context2); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/FilePaths.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/FilePaths.c deleted file mode 100644 index ebba690..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/FilePaths.c +++ /dev/null @@ -1,121 +0,0 @@ -/** @file - Defines file-path manipulation functions. - - Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
- Copyright (c) 2018, Dell Technologies. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#include -#include - -/** - Removes the last directory or file entry in a path. For a path which is - like L"fs0:startup.nsh", it's converted to L"fs0:". - - @param[in,out] Path A pointer to the path to modify. - - @retval FALSE Nothing was found to remove. - @retval TRUE A directory or file was removed. -**/ -BOOLEAN -EFIAPI -PathRemoveLastItem( - IN OUT CHAR16 *Path - ) -{ - 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) { - LastSlash = Walker+1; - } else if (*Walker == L':' && *(Walker + 1) != L'\\' && *(Walker + 1) != CHAR_NULL) { - LastSlash = Walker+1; - } - } - if (LastSlash != NULL) { - *LastSlash = CHAR_NULL; - return (TRUE); - } - return (FALSE); -} - -/** - Function to clean up paths. - - - Single periods in the path are removed. - - Double periods in the path are removed along with a single parent directory. - - Forward slashes L'/' are converted to backward slashes L'\'. - - This will be done inline and the existing buffer may be larger than required - upon completion. - - @param[in] Path The pointer to the string containing the path. - - @return Returns Path, otherwise returns NULL to indicate that an error has occured. -**/ -CHAR16* -EFIAPI -PathCleanUpDirectories( - IN CHAR16 *Path -) -{ - CHAR16 *TempString; - - if (Path == NULL) { - return NULL; - } - - // - // Replace the '/' with '\' - // - for (TempString = Path; *TempString != CHAR_NULL; TempString++) { - if (*TempString == L'/') { - *TempString = L'\\'; - } - } - - // - // Replace the "\\" with "\" - // - while ((TempString = StrStr (Path, L"\\\\")) != NULL) { - CopyMem (TempString, TempString + 1, StrSize (TempString + 1)); - } - - // - // Remove all the "\.". E.g.: fs0:\abc\.\def\. - // - 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; - } - - // - // Remove all the "\..". E.g.: fs0:\abc\..\def\.. - // - while (((TempString = StrStr(Path, L"\\..")) != NULL) && - ((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL)) - ) { - *(TempString + 1) = CHAR_NULL; - PathRemoveLastItem(Path); - if (*(TempString + 3) != CHAR_NULL) { - CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4)); - } - } - - return Path; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo32.c deleted file mode 100644 index 67b64d6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo32.c +++ /dev/null @@ -1,44 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the value of the highest bit set in a 32-bit value. Equivalent to - 1 << log2(x). - - This function computes the value of the highest bit set in the 32-bit value - specified by Operand. If Operand is zero, then zero is returned. - - @param Operand The 32-bit operand to evaluate. - - @return 1 << HighBitSet32(Operand) - @retval 0 Operand is zero. - -**/ -UINT32 -EFIAPI -GetPowerOfTwo32 ( - IN UINT32 Operand - ) -{ - if (0 == Operand) { - return 0; - } - - return 1ul << HighBitSet32 (Operand); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo64.c deleted file mode 100644 index 021b30e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/GetPowerOfTwo64.c +++ /dev/null @@ -1,44 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the value of the highest bit set in a 64-bit value. Equivalent to - 1 << log2(x). - - This function computes the value of the highest bit set in the 64-bit value - specified by Operand. If Operand is zero, then zero is returned. - - @param Operand The 64-bit operand to evaluate. - - @return 1 << HighBitSet64(Operand) - @retval 0 Operand is zero. - -**/ -UINT64 -EFIAPI -GetPowerOfTwo64 ( - IN UINT64 Operand - ) -{ - if (Operand == 0) { - return 0; - } - - return LShiftU64 (1, (UINTN) HighBitSet64 (Operand)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet32.c deleted file mode 100644 index 7d73398..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet32.c +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the bit position of the highest bit set in a 32-bit value. Equivalent - to log2(x). - - This function computes the bit position of the highest bit set in the 32-bit - value specified by Operand. If Operand is zero, then -1 is returned. - Otherwise, a value between 0 and 31 is returned. - - @param Operand The 32-bit operand to evaluate. - - @retval 0..31 Position of the highest bit set in Operand if found. - @retval -1 Operand is zero. - -**/ -INTN -EFIAPI -HighBitSet32 ( - IN UINT32 Operand - ) -{ - INTN BitIndex; - - if (Operand == 0) { - return - 1; - } - for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1); - return BitIndex; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet64.c deleted file mode 100644 index 4fc96fd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/HighBitSet64.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the bit position of the highest bit set in a 64-bit value. Equivalent - to log2(x). - - This function computes the bit position of the highest bit set in the 64-bit - value specified by Operand. If Operand is zero, then -1 is returned. - Otherwise, a value between 0 and 63 is returned. - - @param Operand The 64-bit operand to evaluate. - - @retval 0..63 Position of the highest bit set in Operand if found. - @retval -1 Operand is zero. - -**/ -INTN -EFIAPI -HighBitSet64 ( - IN UINT64 Operand - ) -{ - if (Operand == (UINT32)Operand) { - // - // Operand is just a 32-bit integer - // - return HighBitSet32 ((UINT32)Operand); - } - - // - // Operand is really a 64-bit integer - // - if (sizeof (UINTN) == sizeof (UINT32)) { - return HighBitSet32 (((UINT32*)&Operand)[1]) + 32; - } else { - return HighBitSet32 ((UINT32)RShiftU64 (Operand, 32)) + 32; - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S deleted file mode 100644 index aeaadd7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ARShiftU64.S -# -# Abstract: -# -# 64-bit arithmetic right shift function for IA-32 -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathARShiftU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathARShiftU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathARShiftU64): - movb 12(%esp), %cl - movl 8(%esp), %eax - cltd - testb $32, %cl - jnz L0 - movl %eax, %edx - movl 4(%esp), %eax -L0: - shrdl %cl, %edx, %eax - sar %cl, %edx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c deleted file mode 100644 index c2ebaeb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - 64-bit arithmetic right shift function for IA-32. - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - 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. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to bit 63 of Operand. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand arithmetically shifted right by Count. - -**/ -UINT64 -EFIAPI -InternalMathARShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - _asm { - mov cl, byte ptr [Count] - mov eax, dword ptr [Operand + 4] - cdq - test cl, 32 - jnz L0 - mov edx, eax - mov eax, dword ptr [Operand + 0] -L0: - shrd eax, edx, cl - sar edx, cl - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.nasm deleted file mode 100644 index 448e3ab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ARShiftU64.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ARShiftU64.nasm -; -; Abstract: -; -; 64-bit arithmetic right shift function for IA-32 -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathARShiftU64 ( -; IN UINT64 Operand, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathARShiftU64) -ASM_PFX(InternalMathARShiftU64): - mov cl, [esp + 12] - mov eax, [esp + 8] - cdq - test cl, 32 - jnz .0 - mov edx, eax - mov eax, [esp + 4] -.0: - shrd eax, edx, cl - sar edx, cl - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c deleted file mode 100644 index e933313..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - CpuBreakpoint function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -void __debugbreak (VOID); - -#pragma intrinsic(__debugbreak) - -/** - Generates a breakpoint on the CPU. - - Generates a breakpoint on the CPU. The breakpoint must be implemented such - that code can resume normal execution after the breakpoint. - -**/ -VOID -EFIAPI -CpuBreakpoint ( - VOID - ) -{ - __debugbreak (); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.nasm deleted file mode 100644 index 4f91895..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.nasm +++ /dev/null @@ -1,36 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuBreakpoint.Asm -; -; Abstract: -; -; CpuBreakpoint function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuBreakpoint ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuBreakpoint) -ASM_PFX(CpuBreakpoint): - int 3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.S deleted file mode 100644 index 6f9e10c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.S +++ /dev/null @@ -1,63 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuId.S -# -# Abstract: -# -# AsmCpuid function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(AsmCpuid) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmCpuid ( -# IN UINT32 RegisterInEax, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -ASM_PFX(AsmCpuid): - push %ebx - push %ebp - movl %esp, %ebp - movl 12(%ebp), %eax - cpuid - push %ecx - movl 16(%ebp), %ecx - jecxz L1 - movl %eax, (%ecx) -L1: - movl 20(%ebp), %ecx - jecxz L2 - movl %ebx, (%ecx) -L2: - movl 24(%ebp), %ecx - jecxz L3 - popl (%ecx) -L3: - movl 28(%ebp), %ecx - jecxz L4 - movl %edx, (%ecx) -L4: - movl 12(%ebp), %eax - leave - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.c deleted file mode 100644 index d9c7266..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.c +++ /dev/null @@ -1,74 +0,0 @@ -/** @file - AsmCpuid function. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Retrieves CPUID information. - - Executes the CPUID instruction with EAX set to the value specified by Index. - This function always returns Index. - If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. - If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. - If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. - If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. - This function is only available on IA-32 and x64. - - @param Index The 32-bit value to load into EAX prior to invoking the CPUID - instruction. - @param RegisterEax A pointer to the 32-bit EAX value returned by the CPUID - instruction. This is an optional parameter that may be NULL. - @param RegisterEbx A pointer to the 32-bit EBX value returned by the CPUID - instruction. This is an optional parameter that may be NULL. - @param RegisterEcx A pointer to the 32-bit ECX value returned by the CPUID - instruction. This is an optional parameter that may be NULL. - @param RegisterEdx A pointer to the 32-bit EDX value returned by the CPUID - instruction. This is an optional parameter that may be NULL. - - @return Index. - -**/ -UINT32 -EFIAPI -AsmCpuid ( - IN UINT32 Index, - OUT UINT32 *RegisterEax, OPTIONAL - OUT UINT32 *RegisterEbx, OPTIONAL - OUT UINT32 *RegisterEcx, OPTIONAL - OUT UINT32 *RegisterEdx OPTIONAL - ) -{ - _asm { - mov eax, Index - cpuid - push ecx - mov ecx, RegisterEax - jecxz SkipEax - mov [ecx], eax -SkipEax: - mov ecx, RegisterEbx - jecxz SkipEbx - mov [ecx], ebx -SkipEbx: - pop eax - mov ecx, RegisterEcx - jecxz SkipEcx - mov [ecx], eax -SkipEcx: - mov ecx, RegisterEdx - jecxz SkipEdx - mov [ecx], edx -SkipEdx: - mov eax, Index - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.nasm deleted file mode 100644 index 5996b92..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuId.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuId.Asm -; -; Abstract: -; -; AsmCpuid function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmCpuid ( -; IN UINT32 RegisterInEax, -; OUT UINT32 *RegisterOutEax OPTIONAL, -; OUT UINT32 *RegisterOutEbx OPTIONAL, -; OUT UINT32 *RegisterOutEcx OPTIONAL, -; OUT UINT32 *RegisterOutEdx OPTIONAL -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmCpuid) -ASM_PFX(AsmCpuid): - push ebx - push ebp - mov ebp, esp - mov eax, [ebp + 12] - cpuid - push ecx - mov ecx, [ebp + 16] - jecxz .0 - mov [ecx], eax -.0: - mov ecx, [ebp + 20] - jecxz .1 - mov [ecx], ebx -.1: - mov ecx, [ebp + 24] - jecxz .2 - pop DWORD [ecx] -.2: - mov ecx, [ebp + 28] - jecxz .3 - mov [ecx], edx -.3: - mov eax, [ebp + 12] - leave - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S deleted file mode 100644 index edcaa89..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S +++ /dev/null @@ -1,67 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuIdEx.S -# -# Abstract: -# -# AsmCpuidEx function -# -# Notes: -# -#------------------------------------------------------------------------------ - - - .code: - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# AsmCpuidEx ( -# IN UINT32 RegisterInEax, -# IN UINT32 RegisterInEcx, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push %ebx - push %ebp - movl %esp, %ebp - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - cpuid - push %ecx - movl 20(%ebp), %ecx - jecxz L1 - movl %eax, (%ecx) -L1: - movl 24(%ebp), %ecx - jecxz L2 - movl %ebx, (%ecx) -L2: - movl 32(%ebp), %ecx - jecxz L3 - movl %edx, (%ecx) -L3: - movl 28(%ebp), %ecx - jecxz L4 - popl (%ecx) -L4: - movl 12(%ebp), %eax - leave - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c deleted file mode 100644 index 1b3d91d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c +++ /dev/null @@ -1,82 +0,0 @@ -/** @file - AsmCpuidEx function. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Retrieves CPUID information using an extended leaf identifier. - - Executes the CPUID instruction with EAX set to the value specified by Index - and ECX set to the value specified by SubIndex. This function always returns - Index. This function is only available on IA-32 and x64. - - If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. - If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. - If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. - If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. - - @param Index The 32-bit value to load into EAX prior to invoking the - CPUID instruction. - @param SubIndex The 32-bit value to load into ECX prior to invoking the - CPUID instruction. - @param RegisterEax A pointer to the 32-bit EAX value returned by the CPUID - instruction. This is an optional parameter that may be - NULL. - @param RegisterEbx A pointer to the 32-bit EBX value returned by the CPUID - instruction. This is an optional parameter that may be - NULL. - @param RegisterEcx A pointer to the 32-bit ECX value returned by the CPUID - instruction. This is an optional parameter that may be - NULL. - @param RegisterEdx A pointer to the 32-bit EDX value returned by the CPUID - instruction. This is an optional parameter that may be - NULL. - - @return Index. - -**/ -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 - ) -{ - _asm { - mov eax, Index - mov ecx, SubIndex - cpuid - push ecx - mov ecx, RegisterEax - jecxz SkipEax - mov [ecx], eax -SkipEax: - mov ecx, RegisterEbx - jecxz SkipEbx - mov [ecx], ebx -SkipEbx: - pop eax - mov ecx, RegisterEcx - jecxz SkipEcx - mov [ecx], eax -SkipEcx: - mov ecx, RegisterEdx - jecxz SkipEdx - mov [ecx], edx -SkipEdx: - mov eax, Index - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.nasm deleted file mode 100644 index e3d16ec..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuIdEx.nasm +++ /dev/null @@ -1,67 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuIdEx.Asm -; -; Abstract: -; -; AsmCpuidEx function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; AsmCpuidEx ( -; IN UINT32 RegisterInEax, -; IN UINT32 RegisterInEcx, -; OUT UINT32 *RegisterOutEax OPTIONAL, -; OUT UINT32 *RegisterOutEbx OPTIONAL, -; OUT UINT32 *RegisterOutEcx OPTIONAL, -; OUT UINT32 *RegisterOutEdx OPTIONAL -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push ebx - push ebp - mov ebp, esp - mov eax, [ebp + 12] - mov ecx, [ebp + 16] - cpuid - push ecx - mov ecx, [ebp + 20] - jecxz .0 - mov [ecx], eax -.0: - mov ecx, [ebp + 24] - jecxz .1 - mov [ecx], ebx -.1: - mov ecx, [ebp + 32] - jecxz .2 - mov [ecx], edx -.2: - mov ecx, [ebp + 28] - jecxz .3 - pop DWORD [ecx] -.3: - mov eax, [ebp + 12] - leave - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.c deleted file mode 100644 index e3094e2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.c +++ /dev/null @@ -1,35 +0,0 @@ -/** @file - CpuPause function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Requests CPU to pause for a short period of time. - - Requests CPU to pause for a short period of time. Typically used in MP - systems to prevent memory starvation while waiting for a spin lock. - -**/ -VOID -EFIAPI -CpuPause ( - VOID - ) -{ - _asm { - pause - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.nasm deleted file mode 100644 index fb92687..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/CpuPause.nasm +++ /dev/null @@ -1,36 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuPause.Asm -; -; Abstract: -; -; CpuPause function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuPause ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuPause) -ASM_PFX(CpuPause): - pause - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.S deleted file mode 100644 index cadfa7a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.S +++ /dev/null @@ -1,39 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DisableCache.S -# -# Abstract: -# -# Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a -# WBINVD instruction. -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmDisableCache ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmDisableCache) -ASM_PFX(AsmDisableCache): - movl %cr0, %eax - btsl $30, %eax - btrl $29, %eax - movl %eax, %cr0 - wbinvd - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.c deleted file mode 100644 index 5980639..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - AsmDisableCache function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Set CD bit and clear NW bit of CR0 followed by a WBINVD. - - Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0, - and executing a WBINVD instruction. This function is only available on IA-32 and x64. - -**/ -VOID -EFIAPI -AsmDisableCache ( - VOID - ) -{ - _asm { - mov eax, cr0 - bts eax, 30 - btr eax, 29 - mov cr0, eax - wbinvd - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.nasm deleted file mode 100644 index c956b72..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableCache.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisableCache.Asm -; -; Abstract: -; -; Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a -; WBINVD instruction. -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmDisableCache ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmDisableCache) -ASM_PFX(AsmDisableCache): - mov eax, cr0 - bts eax, 30 - btr eax, 29 - mov cr0, eax - wbinvd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c deleted file mode 100644 index a20b3d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - DisableInterrupts function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Disables CPU interrupts. - -**/ -VOID -EFIAPI -DisableInterrupts ( - VOID - ) -{ - _asm { - cli - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.nasm deleted file mode 100644 index ccf69b0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisableInterrupts.Asm -; -; Abstract: -; -; DisableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; DisableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(DisableInterrupts) -ASM_PFX(DisableInterrupts): - cli - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S deleted file mode 100644 index 08b3cc6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DisablePaging32.S -# -# Abstract: -# -# InternalX86DisablePaging32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalX86DisablePaging32) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86DisablePaging32 ( -# IN SWITCH_STACK_ENTRY_POINT EntryPoint, -# IN VOID *Context1, OPTIONAL -# IN VOID *Context2, OPTIONAL -# IN VOID *NewStack -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalX86DisablePaging32): - movl 4(%esp), %ebx - movl 8(%esp), %ecx - movl 12(%esp), %edx - pushfl - pop %edi # save EFLAGS to edi - cli - movl %cr0, %eax - btrl $31, %eax - movl 16(%esp), %esp - movl %eax, %cr0 - push %edi - popfl # restore EFLAGS from edi - push %edx - push %ecx - call *%ebx - jmp . # EntryPoint() should not return diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c deleted file mode 100644 index eb75566..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c +++ /dev/null @@ -1,77 +0,0 @@ -/** @file - AsmDisablePaging32 function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Disables the 32-bit paging mode on the CPU. - - Disables the 32-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 32-paged protected - mode. This function is only available on IA-32. After the 32-bit paging mode - is disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be NULL. The function EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit paged mode. - 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode. - 4) CR3 must point to valid page tables that guarantee that the pages for - this function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is disabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is disabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is - disabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is disabled. - -**/ -__declspec (naked) -VOID -EFIAPI -InternalX86DisablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - _asm { - push ebp - mov ebp, esp - mov ebx, EntryPoint - mov ecx, Context1 - mov edx, Context2 - pushfd - pop edi // save EFLAGS to edi - cli - mov eax, cr0 - btr eax, 31 - mov esp, NewStack - mov cr0, eax - push edi - popfd // restore EFLAGS from edi - push edx - push ecx - call ebx - jmp $ // EntryPoint() should not return - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.nasm deleted file mode 100644 index 62813c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DisablePaging32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisablePaging32.Asm -; -; Abstract: -; -; AsmDisablePaging32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86DisablePaging32 ( -; IN SWITCH_STACK_ENTRY_POINT EntryPoint, -; IN VOID *Context1, OPTIONAL -; IN VOID *Context2, OPTIONAL -; IN VOID *NewStack -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86DisablePaging32) -ASM_PFX(InternalX86DisablePaging32): - mov ebx, [esp + 4] - mov ecx, [esp + 8] - mov edx, [esp + 12] - pushfd - pop edi ; save EFLAGS to edi - cli - mov eax, cr0 - btr eax, 31 - mov esp, [esp + 16] - mov cr0, eax - push edi - popfd ; restore EFLAGS from edi - push edx - push ecx - call ebx - jmp $ ; EntryPoint() should not return - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c deleted file mode 100644 index 90c1042..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - Integer division worker functions for Ia32. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and - generates a 64-bit signed result and a optional 64-bit signed remainder. - - This function divides the 64-bit signed value Dividend by the 64-bit - signed value Divisor and generates a 64-bit signed quotient. If Remainder - is not NULL, then the 64-bit signed remainder is returned in Remainder. - This function returns the 64-bit signed quotient. - - @param Dividend A 64-bit signed value. - @param Divisor A 64-bit signed value. - @param Remainder A pointer to a 64-bit signed value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -INT64 -EFIAPI -InternalMathDivRemS64x64 ( - IN INT64 Dividend, - IN INT64 Divisor, - OUT INT64 *Remainder OPTIONAL - ) -{ - INT64 Quot; - - Quot = InternalMathDivRemU64x64 ( - (UINT64) (Dividend >= 0 ? Dividend : -Dividend), - (UINT64) (Divisor >= 0 ? Divisor : -Divisor), - (UINT64 *) Remainder - ); - if (Remainder != NULL && Dividend < 0) { - *Remainder = -*Remainder; - } - return (Dividend ^ Divisor) >= 0 ? Quot : -Quot; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.S deleted file mode 100644 index 55a6854..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.S +++ /dev/null @@ -1,41 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DivU64x32.S -# -# Abstract: -# -# Calculate the quotient of a 64-bit integer by a 32-bit integer -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathDivU64x32) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathDivU64x32 ( -# IN UINT64 Dividend, -# IN UINT32 Divisor -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathDivU64x32): - movl 8(%esp), %eax - movl 12(%esp), %ecx - xorl %edx, %edx - divl %ecx - push %eax # save quotient on stack - movl 8(%esp), %eax - divl %ecx - pop %edx # restore high-order dword of the quotient - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.c deleted file mode 100644 index e680bf2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.c +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - Calculate the quotient of a 64-bit integer by a 32-bit integer - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. This - function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - _asm { - mov eax, dword ptr [Dividend + 4] - mov ecx, Divisor - xor edx, edx - div ecx - push eax ; save quotient on stack - mov eax, dword ptr [Dividend] - div ecx - pop edx ; restore high-order dword of the quotient - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.nasm deleted file mode 100644 index 6b96f82..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DivU64x32.nasm -; -; Abstract: -; -; Calculate the quotient of a 64-bit integer by a 32-bit integer -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathDivU64x32 ( -; IN UINT64 Dividend, -; IN UINT32 Divisor -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathDivU64x32) -ASM_PFX(InternalMathDivU64x32): - mov eax, [esp + 8] - mov ecx, [esp + 12] - xor edx, edx - div ecx - push eax ; save quotient on stack - mov eax, [esp + 8] - div ecx - pop edx ; restore high-order dword of the quotient - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S deleted file mode 100644 index 743abf2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DivError.S -# -# Abstract: -# -# Set error flag for all division functions -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathDivRemU64x32) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathDivRemU64x32 ( -# IN UINT64 Dividend, -# IN UINT32 Divisor, -# OUT UINT32 *Remainder -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathDivRemU64x32): - movl 12(%esp), %ecx # ecx <- divisor - movl 8(%esp), %eax # eax <- dividend[32..63] - xorl %edx, %edx - divl %ecx # eax <- quotient[32..63], edx <- remainder - push %eax - movl 8(%esp), %eax # eax <- dividend[0..31] - divl %ecx # eax <- quotient[0..31] - movl 20(%esp), %ecx # ecx <- Remainder - jecxz L1 # abandon remainder if Remainder == NULL - movl %edx, (%ecx) -L1: - pop %edx # edx <- quotient[32..63] - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c deleted file mode 100644 index 87f9352..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - Set error flag for all division functions - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result and an optional 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 32-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - @param Remainder A pointer to a 32-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivRemU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor, - OUT UINT32 *Remainder - ) -{ - _asm { - mov ecx, Divisor - mov eax, dword ptr [Dividend + 4] - xor edx, edx - div ecx - push eax - mov eax, dword ptr [Dividend + 0] - div ecx - mov ecx, Remainder - jecxz RemainderNull // abandon remainder if Remainder == NULL - mov [ecx], edx -RemainderNull: - pop edx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.nasm deleted file mode 100644 index 1ccc4de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DivError.asm -; -; Abstract: -; -; Set error flag for all division functions -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathDivRemU64x32 ( -; IN UINT64 Dividend, -; IN UINT32 Divisor, -; OUT UINT32 *Remainder -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathDivRemU64x32) -ASM_PFX(InternalMathDivRemU64x32): - mov ecx, [esp + 12] ; ecx <- divisor - mov eax, [esp + 8] ; eax <- dividend[32..63] - xor edx, edx - div ecx ; eax <- quotient[32..63], edx <- remainder - push eax - mov eax, [esp + 8] ; eax <- dividend[0..31] - div ecx ; eax <- quotient[0..31] - mov ecx, [esp + 20] ; ecx <- Remainder - jecxz .0 ; abandon remainder if Remainder == NULL - mov [ecx], edx -.0: - pop edx ; edx <- quotient[32..63] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S deleted file mode 100644 index 709c69f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S +++ /dev/null @@ -1,89 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DivU64x64Remainder.S -# -# Abstract: -# -# Calculate the quotient of a 64-bit integer by a 64-bit integer and returns -# both the quotient and the remainder -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathDivRemU64x32), ASM_PFX(InternalMathDivRemU64x64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathDivRemU64x64 ( -# IN UINT64 Dividend, -# IN UINT64 Divisor, -# OUT UINT64 *Remainder OPTIONAL -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathDivRemU64x64): - movl 16(%esp), %ecx # ecx <- divisor[32..63] - testl %ecx, %ecx - jnz Hard # call _@DivRemU64x64 if Divisor > 2^32 - movl 20(%esp), %ecx - jecxz L1 - andl $0, 4(%ecx) # zero high dword of remainder - movl %ecx, 16(%esp) # set up stack frame to match DivRemU64x32 -L1: - jmp ASM_PFX(InternalMathDivRemU64x32) -Hard: - push %ebx - push %esi - push %edi - mov 20(%esp), %edx - mov 16(%esp), %eax # edx:eax <- dividend - movl %edx, %edi - movl %eax, %esi # edi:esi <- dividend - mov 24(%esp), %ebx # ecx:ebx <- divisor -L2: - shrl %edx - rcrl $1, %eax - shrdl $1, %ecx, %ebx - shrl %ecx - jnz L2 - divl %ebx - movl %eax, %ebx # ebx <- quotient - movl 28(%esp), %ecx # ecx <- high dword of divisor - mull 24(%esp) # edx:eax <- quotient * divisor[0..31] - imull %ebx, %ecx # ecx <- quotient * divisor[32..63] - addl %ecx, %edx # edx <- (quotient * divisor)[32..63] - mov 32(%esp), %ecx # ecx <- addr for Remainder - jc TooLarge # product > 2^64 - cmpl %edx, %edi # compare high 32 bits - ja Correct - jb TooLarge # product > dividend - cmpl %eax, %esi - jae Correct # product <= dividend -TooLarge: - decl %ebx # adjust quotient by -1 - jecxz Return # return if Remainder == NULL - sub 24(%esp), %eax - sbb 28(%esp), %edx # edx:eax <- (quotient - 1) * divisor -Correct: - jecxz Return - subl %eax, %esi - sbbl %edx, %edi # edi:esi <- remainder - movl %esi, (%ecx) - movl %edi, 4(%ecx) -Return: - movl %ebx, %eax # eax <- quotient - xorl %edx, %edx # quotient is 32 bits long - pop %edi - pop %esi - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.nasm deleted file mode 100644 index c70e129..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.nasm +++ /dev/null @@ -1,94 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DivU64x64Remainder.nasm -; -; Abstract: -; -; Calculate the quotient of a 64-bit integer by a 64-bit integer and returns -; both the quotient and the remainder -; -;------------------------------------------------------------------------------ - - SECTION .text - -extern ASM_PFX(InternalMathDivRemU64x32) - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathDivRemU64x64 ( -; IN UINT64 Dividend, -; IN UINT64 Divisor, -; OUT UINT64 *Remainder OPTIONAL -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathDivRemU64x64) -ASM_PFX(InternalMathDivRemU64x64): - mov ecx, [esp + 16] ; ecx <- divisor[32..63] - test ecx, ecx - jnz _@DivRemU64x64 ; call _@DivRemU64x64 if Divisor > 2^32 - mov ecx, [esp + 20] - jecxz .0 - and dword [ecx + 4], 0 ; zero high dword of remainder - mov [esp + 16], ecx ; set up stack frame to match DivRemU64x32 -.0: - jmp ASM_PFX(InternalMathDivRemU64x32) - -_@DivRemU64x64: - push ebx - push esi - push edi - mov edx, dword [esp + 20] - mov eax, dword [esp + 16] ; edx:eax <- dividend - mov edi, edx - mov esi, eax ; edi:esi <- dividend - mov ebx, dword [esp + 24] ; ecx:ebx <- divisor -.1: - shr edx, 1 - rcr eax, 1 - shrd ebx, ecx, 1 - shr ecx, 1 - jnz .1 - div ebx - mov ebx, eax ; ebx <- quotient - mov ecx, [esp + 28] ; ecx <- high dword of divisor - mul dword [esp + 24] ; edx:eax <- quotient * divisor[0..31] - imul ecx, ebx ; ecx <- quotient * divisor[32..63] - add edx, ecx ; edx <- (quotient * divisor)[32..63] - mov ecx, dword [esp + 32] ; ecx <- addr for Remainder - jc @TooLarge ; product > 2^64 - cmp edi, edx ; compare high 32 bits - ja @Correct - jb @TooLarge ; product > dividend - cmp esi, eax - jae @Correct ; product <= dividend -@TooLarge: - dec ebx ; adjust quotient by -1 - jecxz @Return ; return if Remainder == NULL - sub eax, dword [esp + 24] - sbb edx, dword [esp + 28] ; edx:eax <- (quotient - 1) * divisor -@Correct: - jecxz @Return - sub esi, eax - sbb edi, edx ; edi:esi <- remainder - mov [ecx], esi - mov [ecx + 4], edi -@Return: - mov eax, ebx ; eax <- quotient - xor edx, edx ; quotient is 32 bits long - pop edi - pop esi - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.S deleted file mode 100644 index da60eeb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.S +++ /dev/null @@ -1,39 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnableCache.S -# -# Abstract: -# -# Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear -# the NW bit of CR0 to 0 -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmEnableCache ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmEnableCache) -ASM_PFX(AsmEnableCache): - wbinvd - movl %cr0, %eax - btrl $30, %eax - btrl $29, %eax - movl %eax, %cr0 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.c deleted file mode 100644 index 912defb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - AsmEnableCache function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Perform a WBINVD and clear both the CD and NW bits of CR0. - - Enables the caches by executing a WBINVD instruction and then clear both the CD and NW - bits of CR0 to 0. This function is only available on IA-32 and x64. - -**/ -VOID -EFIAPI -AsmEnableCache ( - VOID - ) -{ - _asm { - wbinvd - mov eax, cr0 - btr eax, 30 - btr eax, 29 - mov cr0, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.nasm deleted file mode 100644 index 63c605d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableCache.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableCache.Asm -; -; Abstract: -; -; Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear -; the NW bit of CR0 to 0 -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmEnableCache ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmEnableCache) -ASM_PFX(AsmEnableCache): - wbinvd - mov eax, cr0 - btr eax, 29 - btr eax, 30 - mov cr0, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S deleted file mode 100644 index 446c36b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnableDisableInterrupts.S -# -# Abstract: -# -# EnableDisableInterrupts function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(EnableDisableInterrupts) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# EnableDisableInterrupts ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_PFX(EnableDisableInterrupts): - sti - cli - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c deleted file mode 100644 index d351afb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - EnableDisableInterrupts function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Enables CPU interrupts for the smallest window required to capture any - pending interrupts. - -**/ -VOID -EFIAPI -EnableDisableInterrupts ( - VOID - ) -{ - _asm { - sti - nop - nop - cli - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.nasm deleted file mode 100644 index d5cb3e6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableDisableInterrupts.Asm -; -; Abstract: -; -; EnableDisableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; EnableDisableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(EnableDisableInterrupts) -ASM_PFX(EnableDisableInterrupts): - sti - cli - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c deleted file mode 100644 index 7fe14cb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - EnableInterrupts function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Enables CPU interrupts. - -**/ -VOID -EFIAPI -EnableInterrupts ( - VOID - ) -{ - _asm { - sti - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm deleted file mode 100644 index f4a4111..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableInterrupts.Asm -; -; Abstract: -; -; EnableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; EnableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(EnableInterrupts) -ASM_PFX(EnableInterrupts): - sti - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S deleted file mode 100644 index 2449556..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnablePaging32.S -# -# Abstract: -# -# InternalX86EnablePaging32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalX86EnablePaging32) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86EnablePaging32 ( -# IN SWITCH_STACK_ENTRY_POINT EntryPoint, -# IN VOID *Context1, OPTIONAL -# IN VOID *Context2, OPTIONAL -# IN VOID *NewStack -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalX86EnablePaging32): - movl 4(%esp), %ebx - movl 8(%esp), %ecx - movl 12(%esp), %edx - pushfl - pop %edi # save flags in edi - cli - movl %cr0, %eax - btsl $31, %eax - movl 16(%esp), %esp - movl %eax, %cr0 - push %edi - popfl # restore flags - push %edx - push %ecx - call *%ebx - jmp . diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c deleted file mode 100644 index 18e9d11..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c +++ /dev/null @@ -1,81 +0,0 @@ -/** @file - AsmEnablePaging32 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Enables the 32-bit paging mode on the CPU. - - Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode. This function is - only available on IA-32. After the 32-bit paging mode is enabled, control is - transferred to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit protected mode with flat descriptors. This - means all descriptors must have a base of 0 and a limit of 4GB. - 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat - descriptors. - 4) CR3 must point to valid page tables that will be used once the transition - is complete, and those page tables must guarantee that the pages for this - function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is enabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is enabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is enabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is enabled. - -**/ -__declspec (naked) -VOID -EFIAPI -InternalX86EnablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - _asm { - push ebp - mov ebp, esp - mov ebx, EntryPoint - mov ecx, Context1 - mov edx, Context2 - pushfd - pop edi - cli - mov eax, cr0 - bts eax, 31 - mov esp, NewStack - mov cr0, eax - push edi - popfd - push edx - push ecx - call ebx - jmp $ - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.nasm deleted file mode 100644 index f0949be..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnablePaging32.Asm -; -; Abstract: -; -; AsmEnablePaging32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86EnablePaging32 ( -; IN SWITCH_STACK_ENTRY_POINT EntryPoint, -; IN VOID *Context1, OPTIONAL -; IN VOID *Context2, OPTIONAL -; IN VOID *NewStack -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86EnablePaging32) -ASM_PFX(InternalX86EnablePaging32): - mov ebx, [esp + 4] - mov ecx, [esp + 8] - mov edx, [esp + 12] - pushfd - pop edi ; save flags in edi - cli - mov eax, cr0 - bts eax, 31 - mov esp, [esp + 16] - mov cr0, eax - push edi - popfd ; restore flags - push edx - push ecx - call ebx - jmp $ - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S deleted file mode 100644 index e1c7f60..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S +++ /dev/null @@ -1,63 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnablePaging64.S -# -# Abstract: -# -# InternalX86EnablePaging64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalX86EnablePaging64) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86EnablePaging64 ( -# IN UINT16 CodeSelector, -# IN UINT64 EntryPoint, -# IN UINT64 Context1, OPTIONAL -# IN UINT64 Context2, OPTIONAL -# IN UINT64 NewStack -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalX86EnablePaging64): - cli - movl $LongStart, (%esp) # offset for far retf, seg is the 1st arg - movl %cr4, %eax - orb $0x20, %al - movl %eax, %cr4 # enable PAE - movl $0xc0000080, %ecx - rdmsr - orb $1, %ah # set LME - wrmsr - movl %cr0, %eax - btsl $31, %eax # set PG - movl %eax, %cr0 # enable paging - lret # topmost 2 dwords hold the address -LongStart: # long mode starts here - .byte 0x67, 0x48 # 32-bit address size, 64-bit operand size - movl (%esp), %ebx # mov rbx, [esp] - .byte 0x67, 0x48 - movl 8(%esp), %ecx # mov rcx, [esp + 8] - .byte 0x67, 0x48 - movl 0x10(%esp), %edx # mov rdx, [esp + 10h] - .byte 0x67, 0x48 - movl 0x18(%esp), %esp # mov rsp, [esp + 18h] - .byte 0x48 - addl $-0x20, %esp # add rsp, -20h - call *%ebx # call rbx - jmp . # no one should get here diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm deleted file mode 100644 index 91c89ee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnablePaging64.Asm -; -; Abstract: -; -; AsmEnablePaging64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86EnablePaging64 ( -; IN UINT16 Cs, -; IN UINT64 EntryPoint, -; IN UINT64 Context1, OPTIONAL -; IN UINT64 Context2, OPTIONAL -; IN UINT64 NewStack -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86EnablePaging64) -ASM_PFX(InternalX86EnablePaging64): - cli - mov DWORD [esp], .0 ; offset for far retf, seg is the 1st arg - mov eax, cr4 - or al, (1 << 5) - mov cr4, eax ; enable PAE - mov ecx, 0xc0000080 - rdmsr - or ah, 1 ; set LME - wrmsr - mov eax, cr0 - bts eax, 31 ; set PG - mov cr0, eax ; enable paging - retf ; topmost 2 dwords hold the address -.0: - DB 0x67, 0x48 ; 32-bit address size, 64-bit operand size - mov ebx, [esp] ; mov rbx, [esp] - DB 0x67, 0x48 - mov ecx, [esp + 8] ; mov rcx, [esp + 8] - DB 0x67, 0x48 - mov edx, [esp + 0x10] ; mov rdx, [esp + 10h] - DB 0x67, 0x48 - mov esp, [esp + 0x18] ; mov rsp, [esp + 18h] - DB 0x48 - add esp, -0x20 ; add rsp, -20h - call ebx ; call rbx - hlt ; no one should get here - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c deleted file mode 100644 index bd6d2bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - AsmFlushCacheLine function - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Flushes a cache line from all the instruction and data caches within the - coherency domain of the CPU. - - Flushed the cache line specified by LinearAddress, and returns LinearAddress. - This function is only available on IA-32 and x64. - - @param LinearAddress The address of the cache line to flush. If the CPU is - in a physical addressing mode, then LinearAddress is a - physical address. If the CPU is in a virtual - addressing mode, then LinearAddress is a virtual - address. - - @return LinearAddress -**/ -VOID * -EFIAPI -AsmFlushCacheLine ( - IN VOID *LinearAddress - ) -{ - // - // If the CPU does not support CLFLUSH instruction, - // then promote flush range to flush entire cache. - // - _asm { - mov eax, 1 - cpuid - test edx, BIT19 - jz NoClflush - mov eax, dword ptr [LinearAddress] - clflush [eax] - jmp Done -NoClflush: - wbinvd -Done: - } - - return LinearAddress; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.nasm deleted file mode 100644 index 088b7aa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.nasm +++ /dev/null @@ -1,51 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FlushCacheLine.Asm -; -; Abstract: -; -; AsmFlushCacheLine function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; AsmFlushCacheLine ( -; IN VOID *LinearAddress -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmFlushCacheLine) -ASM_PFX(AsmFlushCacheLine): - ; - ; If the CPU does not support CLFLUSH instruction, - ; then promote flush range to flush entire cache. - ; - mov eax, 1 - push ebx - cpuid - pop ebx - mov eax, [esp + 4] - test edx, BIT19 - jz .0 - clflush [eax] - ret -.0: - wbinvd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.c deleted file mode 100644 index b64284a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - AsmFxRestore function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Restores the current floating point/SSE/SSE2 context from a buffer. - - Restores the current floating point/SSE/SSE2 state from the buffer specified - by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and x64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxRestore ( - IN CONST IA32_FX_BUFFER *Buffer - ) -{ - _asm { - mov eax, Buffer - fxrstor [eax] - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.nasm deleted file mode 100644 index 5c33747..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxRestore.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FxRestore.Asm -; -; Abstract: -; -; AsmFxRestore function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86FxRestore ( -; IN CONST IA32_FX_BUFFER *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86FxRestore) -ASM_PFX(InternalX86FxRestore): - mov eax, [esp + 4] ; Buffer must be 16-byte aligned - fxrstor [eax] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.c deleted file mode 100644 index 0de252f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - AsmFxSave function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Save the current floating point/SSE/SSE2 context to a buffer. - - Saves the current floating point/SSE/SSE2 state to the buffer specified by - Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and x64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxSave ( - OUT IA32_FX_BUFFER *Buffer - ) -{ - _asm { - mov eax, Buffer - fxsave [eax] - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.nasm deleted file mode 100644 index f22e19e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/FxSave.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FxSave.Asm -; -; Abstract: -; -; AsmFxSave function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86FxSave ( -; OUT IA32_FX_BUFFER *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86FxSave) -ASM_PFX(InternalX86FxSave): - mov eax, [esp + 4] ; Buffer must be 16-byte aligned - fxsave [eax] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/GccInline.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/GccInline.c deleted file mode 100644 index e46a6c6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/GccInline.c +++ /dev/null @@ -1,1771 +0,0 @@ -/** @file - GCC inline implementation of BaseLib processor specific functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - - -/** - Used to serialize load and store operations. - - All loads and stores that proceed calls to this function are guaranteed to be - globally visible when this function returns. - -**/ -VOID -EFIAPI -MemoryFence ( - VOID - ) -{ - // This is a little bit of overkill and it is more about the compiler that it is - // actually processor synchronization. This is like the _ReadWriteBarrier - // Microsoft specific intrinsic - __asm__ __volatile__ ("":::"memory"); -} - - -/** - Enables CPU interrupts. - - Enables CPU interrupts. - -**/ -VOID -EFIAPI -EnableInterrupts ( - VOID - ) -{ - __asm__ __volatile__ ("sti"::: "memory"); -} - - -/** - Disables CPU interrupts. - - Disables CPU interrupts. - -**/ -VOID -EFIAPI -DisableInterrupts ( - VOID - ) -{ - __asm__ __volatile__ ("cli"::: "memory"); -} - - - - -/** - Requests CPU to pause for a short period of time. - - Requests CPU to pause for a short period of time. Typically used in MP - systems to prevent memory starvation while waiting for a spin lock. - -**/ -VOID -EFIAPI -CpuPause ( - VOID - ) -{ - __asm__ __volatile__ ("pause"); -} - - -/** - Generates a breakpoint on the CPU. - - Generates a breakpoint on the CPU. The breakpoint must be implemented such - that code can resume normal execution after the breakpoint. - -**/ -VOID -EFIAPI -CpuBreakpoint ( - VOID - ) -{ - __asm__ __volatile__ ("int $3"); -} - - - -/** - Returns a 64-bit Machine Specific Register(MSR). - - Reads and returns the 64-bit MSR specified by Index. No parameter checking is - performed on Index, and some Index values may cause CPU exceptions. The - caller must either guarantee that Index is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. - - @param Index The 32-bit MSR index to read. - - @return The value of the MSR identified by Index. - -**/ -UINT64 -EFIAPI -AsmReadMsr64 ( - IN UINT32 Index - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "rdmsr" - : "=A" (Data) // %0 - : "c" (Index) // %1 - ); - - return Data; -} - -/** - Writes a 64-bit value to a Machine Specific Register(MSR), and returns the - value. - - Writes the 64-bit value specified by Value to the MSR specified by Index. The - 64-bit value written to the MSR is returned. No parameter checking is - performed on Index or Value, and some of these may cause CPU exceptions. The - caller must either guarantee that Index and Value are valid, or the caller - must establish proper exception handlers. This function is only available on - IA-32 and X64. - - @param Index The 32-bit MSR index to write. - @param Value The 64-bit value to write to the MSR. - - @return Value - -**/ -UINT64 -EFIAPI -AsmWriteMsr64 ( - IN UINT32 Index, - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "wrmsr" - : - : "c" (Index), - "A" (Value) - ); - - return Value; -} - - - -/** - Reads the current value of the EFLAGS register. - - Reads and returns the current value of the EFLAGS register. This function is - only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a - 64-bit value on X64. - - @return EFLAGS on IA-32 or RFLAGS on X64. - -**/ -UINTN -EFIAPI -AsmReadEflags ( - VOID - ) -{ - UINTN Eflags; - - __asm__ __volatile__ ( - "pushfl \n\t" - "popl %0 " - : "=r" (Eflags) - ); - - return Eflags; -} - - - -/** - Reads the current value of the Control Register 0 (CR0). - - Reads and returns the current value of CR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 0 (CR0). - -**/ -UINTN -EFIAPI -AsmReadCr0 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%cr0,%0" - : "=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of the Control Register 2 (CR2). - - Reads and returns the current value of CR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 2 (CR2). - -**/ -UINTN -EFIAPI -AsmReadCr2 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%cr2, %0" - : "=r" (Data) - ); - - return Data; -} - -/** - Reads the current value of the Control Register 3 (CR3). - - Reads and returns the current value of CR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 3 (CR3). - -**/ -UINTN -EFIAPI -AsmReadCr3 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%cr3, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of the Control Register 4 (CR4). - - Reads and returns the current value of CR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 4 (CR4). - -**/ -UINTN -EFIAPI -AsmReadCr4 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%cr4, %0" - : "=a" (Data) - ); - - return Data; -} - - -/** - Writes a value to Control Register 0 (CR0). - - Writes and returns a new value to CR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr0 The value to write to CR0. - - @return The value written to CR0. - -**/ -UINTN -EFIAPI -AsmWriteCr0 ( - UINTN Cr0 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%cr0" - : - : "r" (Cr0) - ); - return Cr0; -} - - -/** - Writes a value to Control Register 2 (CR2). - - Writes and returns a new value to CR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr2 The value to write to CR2. - - @return The value written to CR2. - -**/ -UINTN -EFIAPI -AsmWriteCr2 ( - UINTN Cr2 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%cr2" - : - : "r" (Cr2) - ); - return Cr2; -} - - -/** - Writes a value to Control Register 3 (CR3). - - Writes and returns a new value to CR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr3 The value to write to CR3. - - @return The value written to CR3. - -**/ -UINTN -EFIAPI -AsmWriteCr3 ( - UINTN Cr3 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%cr3" - : - : "r" (Cr3) - ); - return Cr3; -} - - -/** - Writes a value to Control Register 4 (CR4). - - Writes and returns a new value to CR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr4 The value to write to CR4. - - @return The value written to CR4. - -**/ -UINTN -EFIAPI -AsmWriteCr4 ( - UINTN Cr4 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%cr4" - : - : "r" (Cr4) - ); - return Cr4; -} - - -/** - Reads the current value of Debug Register 0 (DR0). - - Reads and returns the current value of DR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmReadDr0 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr0, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 1 (DR1). - - Reads and returns the current value of DR1. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmReadDr1 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr1, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 2 (DR2). - - Reads and returns the current value of DR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmReadDr2 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr2, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 3 (DR3). - - Reads and returns the current value of DR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmReadDr3 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr3, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 4 (DR4). - - Reads and returns the current value of DR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmReadDr4 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr4, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 5 (DR5). - - Reads and returns the current value of DR5. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmReadDr5 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr5, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 6 (DR6). - - Reads and returns the current value of DR6. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmReadDr6 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr6, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 7 (DR7). - - Reads and returns the current value of DR7. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmReadDr7 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "movl %%dr7, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Writes a value to Debug Register 0 (DR0). - - Writes and returns a new value to DR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr0 The value to write to Dr0. - - @return The value written to Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmWriteDr0 ( - UINTN Dr0 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr0" - : - : "r" (Dr0) - ); - return Dr0; -} - - -/** - Writes a value to Debug Register 1 (DR1). - - Writes and returns a new value to DR1. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr1 The value to write to Dr1. - - @return The value written to Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmWriteDr1 ( - UINTN Dr1 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr1" - : - : "r" (Dr1) - ); - return Dr1; -} - - -/** - Writes a value to Debug Register 2 (DR2). - - Writes and returns a new value to DR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr2 The value to write to Dr2. - - @return The value written to Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmWriteDr2 ( - UINTN Dr2 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr2" - : - : "r" (Dr2) - ); - return Dr2; -} - - -/** - Writes a value to Debug Register 3 (DR3). - - Writes and returns a new value to DR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr3 The value to write to Dr3. - - @return The value written to Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmWriteDr3 ( - UINTN Dr3 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr3" - : - : "r" (Dr3) - ); - return Dr3; -} - - -/** - Writes a value to Debug Register 4 (DR4). - - Writes and returns a new value to DR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr4 The value to write to Dr4. - - @return The value written to Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmWriteDr4 ( - UINTN Dr4 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr4" - : - : "r" (Dr4) - ); - return Dr4; -} - - -/** - Writes a value to Debug Register 5 (DR5). - - Writes and returns a new value to DR5. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr5 The value to write to Dr5. - - @return The value written to Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmWriteDr5 ( - UINTN Dr5 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr5" - : - : "r" (Dr5) - ); - return Dr5; -} - - -/** - Writes a value to Debug Register 6 (DR6). - - Writes and returns a new value to DR6. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr6 The value to write to Dr6. - - @return The value written to Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmWriteDr6 ( - UINTN Dr6 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr6" - : - : "r" (Dr6) - ); - return Dr6; -} - - -/** - Writes a value to Debug Register 7 (DR7). - - Writes and returns a new value to DR7. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr7 The value to write to Dr7. - - @return The value written to Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmWriteDr7 ( - UINTN Dr7 - ) -{ - __asm__ __volatile__ ( - "movl %0, %%dr7" - : - : "r" (Dr7) - ); - return Dr7; -} - - -/** - Reads the current value of Code Segment Register (CS). - - Reads and returns the current value of CS. This function is only available on - IA-32 and X64. - - @return The current value of CS. - -**/ -UINT16 -EFIAPI -AsmReadCs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%cs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Data Segment Register (DS). - - Reads and returns the current value of DS. This function is only available on - IA-32 and X64. - - @return The current value of DS. - -**/ -UINT16 -EFIAPI -AsmReadDs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%ds, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Extra Segment Register (ES). - - Reads and returns the current value of ES. This function is only available on - IA-32 and X64. - - @return The current value of ES. - -**/ -UINT16 -EFIAPI -AsmReadEs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%es, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of FS Data Segment Register (FS). - - Reads and returns the current value of FS. This function is only available on - IA-32 and X64. - - @return The current value of FS. - -**/ -UINT16 -EFIAPI -AsmReadFs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%fs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of GS Data Segment Register (GS). - - Reads and returns the current value of GS. This function is only available on - IA-32 and X64. - - @return The current value of GS. - -**/ -UINT16 -EFIAPI -AsmReadGs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%gs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Stack Segment Register (SS). - - Reads and returns the current value of SS. This function is only available on - IA-32 and X64. - - @return The current value of SS. - -**/ -UINT16 -EFIAPI -AsmReadSs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%ds, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Task Register (TR). - - Reads and returns the current value of TR. This function is only available on - IA-32 and X64. - - @return The current value of TR. - -**/ -UINT16 -EFIAPI -AsmReadTr ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "str %0" - : "=a" (Data) - ); - - return Data; -} - - -/** - Reads the current Global Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and X64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr - ) -{ - __asm__ __volatile__ ( - "sgdt %0" - : "=m" (*Gdtr) - ); -} - - -/** - Writes the current Global Descriptor Table Register (GDTR) descriptor. - - Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and X64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr - ) -{ - __asm__ __volatile__ ( - "lgdt %0" - : - : "m" (*Gdtr) - ); - -} - - -/** - Reads the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and X64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr - ) -{ - __asm__ __volatile__ ( - "sidt %0" - : "=m" (*Idtr) - ); -} - - -/** - Writes the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and X64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr - ) -{ - __asm__ __volatile__ ( - "lidt %0" - : - : "m" (*Idtr) - ); -} - - -/** - Reads the current Local Descriptor Table Register(LDTR) selector. - - Reads and returns the current 16-bit LDTR descriptor value. This function is - only available on IA-32 and X64. - - @return The current selector of LDT. - -**/ -UINT16 -EFIAPI -AsmReadLdtr ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "sldt %0" - : "=g" (Data) // %0 - ); - - return Data; -} - - -/** - Writes the current Local Descriptor Table Register (GDTR) selector. - - Writes and the current LDTR descriptor specified by Ldtr. This function is - only available on IA-32 and X64. - - @param Ldtr 16-bit LDTR selector value. - -**/ -VOID -EFIAPI -AsmWriteLdtr ( - IN UINT16 Ldtr - ) -{ - __asm__ __volatile__ ( - "lldtw %0" - : - : "g" (Ldtr) // %0 - ); -} - - -/** - Save the current floating point/SSE/SSE2 context to a buffer. - - Saves the current floating point/SSE/SSE2 state to the buffer specified by - Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and X64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxSave ( - OUT IA32_FX_BUFFER *Buffer - ) -{ - __asm__ __volatile__ ( - "fxsave %0" - : - : "m" (*Buffer) // %0 - ); -} - - -/** - Restores the current floating point/SSE/SSE2 context from a buffer. - - Restores the current floating point/SSE/SSE2 state from the buffer specified - by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and X64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxRestore ( - IN CONST IA32_FX_BUFFER *Buffer - ) -{ - __asm__ __volatile__ ( - "fxrstor %0" - : - : "m" (*Buffer) // %0 - ); -} - - -/** - Reads the current value of 64-bit MMX Register #0 (MM0). - - Reads and returns the current value of MM0. This function is only available - on IA-32 and X64. - - @return The current value of MM0. - -**/ -UINT64 -EFIAPI -AsmReadMm0 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm0, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #1 (MM1). - - Reads and returns the current value of MM1. This function is only available - on IA-32 and X64. - - @return The current value of MM1. - -**/ -UINT64 -EFIAPI -AsmReadMm1 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm1, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #2 (MM2). - - Reads and returns the current value of MM2. This function is only available - on IA-32 and X64. - - @return The current value of MM2. - -**/ -UINT64 -EFIAPI -AsmReadMm2 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm2, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #3 (MM3). - - Reads and returns the current value of MM3. This function is only available - on IA-32 and X64. - - @return The current value of MM3. - -**/ -UINT64 -EFIAPI -AsmReadMm3 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm3, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #4 (MM4). - - Reads and returns the current value of MM4. This function is only available - on IA-32 and X64. - - @return The current value of MM4. - -**/ -UINT64 -EFIAPI -AsmReadMm4 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm4, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #5 (MM5). - - Reads and returns the current value of MM5. This function is only available - on IA-32 and X64. - - @return The current value of MM5. - -**/ -UINT64 -EFIAPI -AsmReadMm5 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm5, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #6 (MM6). - - Reads and returns the current value of MM6. This function is only available - on IA-32 and X64. - - @return The current value of MM6. - -**/ -UINT64 -EFIAPI -AsmReadMm6 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm6, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #7 (MM7). - - Reads and returns the current value of MM7. This function is only available - on IA-32 and X64. - - @return The current value of MM7. - -**/ -UINT64 -EFIAPI -AsmReadMm7 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "push %%eax \n\t" - "push %%eax \n\t" - "movq %%mm7, (%%esp)\n\t" - "pop %%eax \n\t" - "pop %%edx \n\t" - : "=A" (Data) // %0 - ); - - return Data; -} - - -/** - Writes the current value of 64-bit MMX Register #0 (MM0). - - Writes the current value of MM0. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM0. - -**/ -VOID -EFIAPI -AsmWriteMm0 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm0" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #1 (MM1). - - Writes the current value of MM1. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM1. - -**/ -VOID -EFIAPI -AsmWriteMm1 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm1" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #2 (MM2). - - Writes the current value of MM2. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM2. - -**/ -VOID -EFIAPI -AsmWriteMm2 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm2" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #3 (MM3). - - Writes the current value of MM3. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM3. - -**/ -VOID -EFIAPI -AsmWriteMm3 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm3" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #4 (MM4). - - Writes the current value of MM4. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM4. - -**/ -VOID -EFIAPI -AsmWriteMm4 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm4" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #5 (MM5). - - Writes the current value of MM5. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM5. - -**/ -VOID -EFIAPI -AsmWriteMm5 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm5" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #6 (MM6). - - Writes the current value of MM6. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM6. - -**/ -VOID -EFIAPI -AsmWriteMm6 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm6" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #7 (MM7). - - Writes the current value of MM7. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM7. - -**/ -VOID -EFIAPI -AsmWriteMm7 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movq %0, %%mm7" // %0 - : - : "m" (Value) - ); -} - - -/** - Reads the current value of Time Stamp Counter (TSC). - - Reads and returns the current value of TSC. This function is only available - on IA-32 and X64. - - @return The current value of TSC - -**/ -UINT64 -EFIAPI -AsmReadTsc ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "rdtsc" - : "=A" (Data) - ); - - return Data; -} - - -/** - Reads the current value of a Performance Counter (PMC). - - Reads and returns the current value of performance counter specified by - Index. This function is only available on IA-32 and X64. - - @param Index The 32-bit Performance Counter index to read. - - @return The value of the PMC specified by Index. - -**/ -UINT64 -EFIAPI -AsmReadPmc ( - IN UINT32 Index - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "rdpmc" - : "=A" (Data) - : "c" (Index) - ); - - return Data; -} - - - - -/** - Executes a WBINVD instruction. - - Executes a WBINVD instruction. This function is only available on IA-32 and - X64. - -**/ -VOID -EFIAPI -AsmWbinvd ( - VOID - ) -{ - __asm__ __volatile__ ("wbinvd":::"memory"); -} - - -/** - Executes a INVD instruction. - - Executes a INVD instruction. This function is only available on IA-32 and - X64. - -**/ -VOID -EFIAPI -AsmInvd ( - VOID - ) -{ - __asm__ __volatile__ ("invd":::"memory"); - -} - - -/** - Flushes a cache line from all the instruction and data caches within the - coherency domain of the CPU. - - Flushed the cache line specified by LinearAddress, and returns LinearAddress. - This function is only available on IA-32 and X64. - - @param LinearAddress The address of the cache line to flush. If the CPU is - in a physical addressing mode, then LinearAddress is a - physical address. If the CPU is in a virtual - addressing mode, then LinearAddress is a virtual - address. - - @return LinearAddress -**/ -VOID * -EFIAPI -AsmFlushCacheLine ( - IN VOID *LinearAddress - ) -{ - UINT32 RegEdx; - - // - // If the CPU does not support CLFLUSH instruction, - // then promote flush range to flush entire cache. - // - AsmCpuid (0x01, NULL, NULL, NULL, &RegEdx); - if ((RegEdx & BIT19) == 0) { - __asm__ __volatile__ ("wbinvd":::"memory"); - return LinearAddress; - } - - - __asm__ __volatile__ ( - "clflush (%0)" - : "+a" (LinearAddress) - : - : "memory" - ); - - return LinearAddress; -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S deleted file mode 100644 index cf732b0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S +++ /dev/null @@ -1,48 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# InternalSwitchStack.S -# -# Abstract: -# -# Implementation of a stack switch on IA-32. -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalSwitchStack) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalSwitchStack ( -# IN SWITCH_STACK_ENTRY_POINT EntryPoint, -# IN VOID *Context1, OPTIONAL -# IN VOID *Context2, OPTIONAL -# IN VOID *NewStack -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalSwitchStack): - pushl %ebp - movl %esp, %ebp - - movl 20(%ebp), %esp # switch stack - subl $8, %esp - - movl 16(%ebp), %eax - movl %eax, 4(%esp) - movl 12(%ebp), %eax - movl %eax, (%esp) - pushl $0 # keeps gdb from unwinding stack - jmp *8(%ebp) # call and never return - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c deleted file mode 100644 index 182b0b0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c +++ /dev/null @@ -1,60 +0,0 @@ -/** @file - SwitchStack() function for IA-32. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the - new stack specified by NewStack and passing in the parameters specified - by Context1 and Context2. Context1 and Context2 are optional and may - be NULL. The function EntryPoint must never return. - Marker will be ignored on IA-32, x64, and EBC. - IPF CPUs expect one additional parameter of type VOID * that specifies - the new backing store pointer. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param Marker VA_LIST marker for the variable argument list. - -**/ -VOID -EFIAPI -InternalSwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VA_LIST Marker - ) -{ - 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; - - LongJump (&JumpBuffer, (UINTN)-1); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm deleted file mode 100644 index b3c4f7b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; Portions copyright (c) 2011, Apple Inc. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InternalSwitchStack.nasm -; -; Abstract: -; -; Implementation of a stack switch on IA-32. -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalSwitchStack ( -; IN SWITCH_STACK_ENTRY_POINT EntryPoint, -; IN VOID *Context1, OPTIONAL -; IN VOID *Context2, OPTIONAL -; IN VOID *NewStack -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSwitchStack) -ASM_PFX(InternalSwitchStack): - push ebp - mov ebp, esp - - mov esp, [ebp + 20] ; switch stack - sub esp, 8 - mov eax, [ebp + 16] - mov [esp + 4], eax - mov eax, [ebp + 12] - mov [esp], eax - push 0 ; keeps gdb from unwinding stack - jmp dword [ebp + 8] ; call and never return diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.c deleted file mode 100644 index e5c29b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.c +++ /dev/null @@ -1,35 +0,0 @@ -/** @file - AsmInvd function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Executes a INVD instruction. - - Executes a INVD instruction. This function is only available on IA-32 and - x64. - -**/ -VOID -EFIAPI -AsmInvd ( - VOID - ) -{ - _asm { - invd - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.nasm deleted file mode 100644 index 13b8795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Invd.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Invd.Asm -; -; Abstract: -; -; AsmInvd function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmInvd ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmInvd) -ASM_PFX(AsmInvd): - invd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.S deleted file mode 100644 index 451f527..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.S +++ /dev/null @@ -1,48 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# LRotU64.S -# -# Abstract: -# -# 64-bit left rotation for Ia32 -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathLRotU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathLRotU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathLRotU64): - push %ebx - movb 16(%esp), %cl - movl 12(%esp), %edx - movl 8(%esp), %eax - shldl %cl, %edx, %ebx - shldl %cl, %eax, %edx - rorl %cl, %ebx - shldl %cl, %ebx, %eax - testb $32, %cl # Count >= 32? - jz L0 - movl %eax, %ecx - movl %edx, %eax - movl %ecx, %edx -L0: - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.c deleted file mode 100644 index 1dfef3b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - 64-bit left rotation for Ia32 - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Rotates a 64-bit integer left between 0 and 63 bits, filling - the low bits with the high bits that were rotated. - - This function rotates the 64-bit value Operand to the left by Count bits. The - low Count bits are fill with the high Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate left. - @param Count The number of bits to rotate left. - - @return Operand <<< Count - -**/ -UINT64 -EFIAPI -InternalMathLRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - _asm { - mov cl, byte ptr [Count] - mov edx, dword ptr [Operand + 4] - mov eax, dword ptr [Operand + 0] - shld ebx, edx, cl - shld edx, eax, cl - ror ebx, cl - shld eax, ebx, cl - test cl, 32 ; Count >= 32? - jz L0 - mov ecx, eax - mov eax, edx - mov edx, ecx -L0: - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.nasm deleted file mode 100644 index e3dc015..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LRotU64.nasm +++ /dev/null @@ -1,50 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; LRotU64.nasm -; -; Abstract: -; -; 64-bit left rotation for Ia32 -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathLRotU64 ( -; IN UINT64 Operand, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathLRotU64) -ASM_PFX(InternalMathLRotU64): - push ebx - mov cl, [esp + 16] - mov edx, [esp + 12] - mov eax, [esp + 8] - shld ebx, edx, cl - shld edx, eax, cl - ror ebx, cl - shld eax, ebx, cl - test cl, 32 ; Count >= 32? - jz .0 - mov ecx, eax - mov eax, edx - mov edx, ecx -.0: - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.S deleted file mode 100644 index 15394ab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# LShiftU64.S -# -# Abstract: -# -# 64-bit left shift function for IA-32 -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathLShiftU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathLShiftU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathLShiftU64): - movb 12(%esp), %cl - xorl %eax, %eax - movl 4(%esp), %edx - testb $32, %cl # Count >= 32? - jnz L0 - movl %edx, %eax - movl 0x8(%esp), %edx -L0: - shld %cl, %eax, %edx - shl %cl, %eax - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.c deleted file mode 100644 index 08266f7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - 64-bit left shift function for IA-32. - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Shifts a 64-bit integer left between 0 and 63 bits. The low bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the left by Count bits. The - low Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift left. - @param Count The number of bits to shift left. - - @return Operand << Count - -**/ -UINT64 -EFIAPI -InternalMathLShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - _asm { - mov cl, byte ptr [Count] - xor eax, eax - mov edx, dword ptr [Operand + 0] - test cl, 32 // Count >= 32? - jnz L0 - mov eax, edx - mov edx, dword ptr [Operand + 4] -L0: - shld edx, eax, cl - shl eax, cl - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.nasm deleted file mode 100644 index 93de11d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LShiftU64.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; LShiftU64.nasm -; -; Abstract: -; -; 64-bit left shift function for IA-32 -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathLShiftU64 ( -; IN UINT64 Operand, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathLShiftU64) -ASM_PFX(InternalMathLShiftU64): - mov cl, [esp + 12] - xor eax, eax - mov edx, [esp + 4] - test cl, 32 ; Count >= 32? - jnz .0 - mov eax, edx - mov edx, [esp + 8] -.0: - shld edx, eax, cl - shl eax, cl - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Lfence.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Lfence.nasm deleted file mode 100644 index 7802a5f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Lfence.nasm +++ /dev/null @@ -1,36 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2018, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Lfence.nasm -; -; Abstract: -; -; Performs a serializing operation on all load-from-memory instructions that -; were issued prior to the call of this function. -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmLfence ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmLfence) -ASM_PFX(AsmLfence): - lfence - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.S deleted file mode 100644 index dfd52f2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.S +++ /dev/null @@ -1,41 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# LongJump.S -# -# Abstract: -# -# Implementation of _LongJump() on IA-32. -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalLongJump) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalLongJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalLongJump): - pop %eax # skip return address - pop %edx # edx <- JumpBuffer - pop %eax # eax <- Value - movl (%edx), %ebx - movl 4(%edx), %esi - movl 8(%edx), %edi - movl 12(%edx), %ebp - movl 16(%edx), %esp - jmp *20(%edx) # restore "eip" diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.c deleted file mode 100644 index 9d271ad..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.c +++ /dev/null @@ -1,76 +0,0 @@ -/** @file - Implementation of _LongJump() on IA-32. - - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Restores the CPU context that was saved with SetJump(). - - Restores the CPU context from the buffer specified by JumpBuffer. - This function never returns to the caller. - Instead is resumes execution based on the state of JumpBuffer. - - @param JumpBuffer A pointer to CPU context buffer. - @param Value The value to return when the SetJump() context is restored. - -**/ -__declspec (naked) -VOID -EFIAPI -InternalLongJump ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, - IN UINTN Value - ) -{ - _asm { - mov eax, [PcdGet32 (PcdControlFlowEnforcementPropertyMask)] - test eax, eax - jz CetDone - _emit 0x0F - _emit 0x20 - _emit 0xE0 ; mov eax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - mov edx, [esp + 4] ; edx = JumpBuffer - mov edx, [edx + 24] ; edx = target SSP - _emit 0xF3 - _emit 0x0F - _emit 0x1E - _emit 0xC8 ; READSSP EAX - sub edx, eax ; edx = delta - mov eax, edx ; eax = delta - - shr eax, 2 ; eax = delta/sizeof(UINT32) - _emit 0xF3 - _emit 0x0F - _emit 0xAE - _emit 0xE8 ; INCSSP EAX - -CetDone: - - pop eax ; skip return address - pop edx ; edx <- JumpBuffer - pop eax ; eax <- Value - mov ebx, [edx] - mov esi, [edx + 4] - mov edi, [edx + 8] - mov ebp, [edx + 12] - mov esp, [edx + 16] - jmp dword ptr [edx + 20] - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.nasm deleted file mode 100644 index 1af52ee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/LongJump.nasm +++ /dev/null @@ -1,66 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; LongJump.Asm -; -; Abstract: -; -; Implementation of _LongJump() on IA-32. -; -;------------------------------------------------------------------------------ - -%include "Nasm.inc" - - SECTION .text - -extern ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask)) - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalLongJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalLongJump) -ASM_PFX(InternalLongJump): - - mov eax, [ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))] - test eax, eax - jz CetDone - mov eax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - mov edx, [esp + 4] ; edx = JumpBuffer - mov edx, [edx + 24] ; edx = target SSP - READSSP_EAX - sub edx, eax ; edx = delta - mov eax, edx ; eax = delta - - shr eax, 2 ; eax = delta/sizeof(UINT32) - INCSSP_EAX - -CetDone: - - pop eax ; skip return address - pop edx ; edx <- JumpBuffer - pop eax ; eax <- Value - mov ebx, [edx] - mov esi, [edx + 4] - mov edi, [edx + 8] - mov ebp, [edx + 12] - mov esp, [edx + 16] - jmp dword [edx + 20] ; restore "eip" - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.S deleted file mode 100644 index 91ea463..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.S +++ /dev/null @@ -1,40 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DivU64x32.S -# -# Abstract: -# -# Calculate the remainder of a 64-bit integer by a 32-bit integer -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathModU64x32) - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# InternalMathModU64x32 ( -# IN UINT64 Dividend, -# IN UINT32 Divisor -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathModU64x32): - movl 8(%esp), %eax - movl 12(%esp), %ecx - xorl %edx, %edx - divl %ecx - movl 4(%esp), %eax - divl %ecx - movl %edx, %eax - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.c deleted file mode 100644 index 3186ccb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - Calculate the remainder of a 64-bit integer by a 32-bit integer - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 32-bit remainder. This function - returns the 32-bit unsigned remainder. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend % Divisor - -**/ -UINT32 -EFIAPI -InternalMathModU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - _asm { - mov eax, dword ptr [Dividend + 4] - mov ecx, Divisor - xor edx, edx - div ecx - mov eax, dword ptr [Dividend + 0] - div ecx - mov eax, edx - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.nasm deleted file mode 100644 index cb3681c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ModU64x32.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DivU64x32.asm -; -; Abstract: -; -; Calculate the remainder of a 64-bit integer by a 32-bit integer -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalMathModU64x32 ( -; IN UINT64 Dividend, -; IN UINT32 Divisor -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathModU64x32) -ASM_PFX(InternalMathModU64x32): - mov eax, [esp + 8] - mov ecx, [esp + 12] - xor edx, edx - div ecx - mov eax, [esp + 4] - div ecx - mov eax, edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.S deleted file mode 100644 index b6bfbee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.S +++ /dev/null @@ -1,40 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# Monitor.S -# -# Abstract: -# -# AsmMonitor function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(AsmMonitor) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmMonitor ( -# IN UINTN Eax, -# IN UINTN Ecx, -# IN UINTN Edx -# ); -#------------------------------------------------------------------------------ -ASM_PFX(AsmMonitor): - movl 4(%esp), %eax - movl 8(%esp), %ecx - movl 12(%esp), %edx - monitor %eax, %ecx, %edx # monitor - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.c deleted file mode 100644 index d9c9325..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - AsmMonitor function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Sets up a monitor buffer that is used by AsmMwait(). - - Executes a MONITOR instruction with the register state specified by Eax, Ecx - and Edx. Returns Eax. This function is only available on IA-32 and x64. - - @param RegisterEax The value to load into EAX or RAX before executing the MONITOR - instruction. - @param RegisterEcx The value to load into ECX or RCX before executing the MONITOR - instruction. - @param RegisterEdx The value to load into EDX or RDX before executing the MONITOR - instruction. - - @return RegisterEax - -**/ -UINTN -EFIAPI -AsmMonitor ( - IN UINTN RegisterEax, - IN UINTN RegisterEcx, - IN UINTN RegisterEdx - ) -{ - _asm { - mov eax, RegisterEax - mov ecx, RegisterEcx - mov edx, RegisterEdx - _emit 0x0f // monitor - _emit 0x01 - _emit 0xc8 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.nasm deleted file mode 100644 index 6cf8ffd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Monitor.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Monitor.Asm -; -; Abstract: -; -; AsmMonitor function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmMonitor ( -; IN UINTN Eax, -; IN UINTN Ecx, -; IN UINTN Edx -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmMonitor) -ASM_PFX(AsmMonitor): - mov eax, [esp + 4] - mov ecx, [esp + 8] - mov edx, [esp + 12] - DB 0xf, 1, 0xc8 ; monitor - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.S deleted file mode 100644 index 245687a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.S +++ /dev/null @@ -1,41 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# MultU64x32.S -# -# Abstract: -# -# Calculate the product of a 64-bit integer and a 32-bit integer -# -#------------------------------------------------------------------------------ - - - .code: - -ASM_GLOBAL ASM_PFX(InternalMathMultU64x32) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathMultU64x32 ( -# IN UINT64 Multiplicand, -# IN UINT32 Multiplier -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathMultU64x32): - movl 12(%esp), %ecx - movl %ecx, %eax - imull 8(%esp), %ecx # overflow not detectable - mull 0x4(%esp) - addl %ecx, %edx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.c deleted file mode 100644 index 8b534aa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.c +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Calculate the product of a 64-bit integer and a 32-bit integer - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Multiples a 64-bit unsigned integer by a 32-bit unsigned integer - and generates a 64-bit unsigned result. - - This function multiples the 64-bit unsigned value Multiplicand by the 32-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 32-bit unsigned value. - - @return Multiplicand * Multiplier - -**/ -UINT64 -EFIAPI -InternalMathMultU64x32 ( - IN UINT64 Multiplicand, - IN UINT32 Multiplier - ) -{ - _asm { - mov ecx, Multiplier - mov eax, ecx - imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable - mul dword ptr [Multiplicand + 0] - add edx, ecx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm deleted file mode 100644 index d4c9e51..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; MultU64x32.nasm -; -; Abstract: -; -; Calculate the product of a 64-bit integer and a 32-bit integer -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathMultU64x32 ( -; IN UINT64 Multiplicand, -; IN UINT32 Multiplier -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathMultU64x32) -ASM_PFX(InternalMathMultU64x32): - mov ecx, [esp + 12] - mov eax, ecx - imul ecx, [esp + 8] ; overflow not detectable - mul dword [esp + 4] - add edx, ecx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.S deleted file mode 100644 index a3a8ec7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.S +++ /dev/null @@ -1,44 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# MultU64x64.S -# -# Abstract: -# -# Calculate the product of a 64-bit integer and another 64-bit integer -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathMultU64x64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathMultU64x64 ( -# IN UINT64 Multiplicand, -# IN UINT64 Multiplier -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathMultU64x64): - push %ebx - movl 8(%esp), %ebx # ebx <- M1[0..31] - movl 16(%esp), %edx # edx <- M2[0..31] - movl %ebx, %ecx - movl %edx, %eax - imull 20(%esp), %ebx # ebx <- M1[0..31] * M2[32..63] - imull 12(%esp), %edx # edx <- M1[32..63] * M2[0..31] - addl %edx, %ebx # carries are abandoned - mull %ecx # edx:eax <- M1[0..31] * M2[0..31] - addl %ebx, %edx # carries are abandoned - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.c deleted file mode 100644 index 5f10486..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - Calculate the product of a 64-bit integer and another 64-bit integer - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer - and generates a 64-bit unsigned result. - - This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 64-bit unsigned value. - - @return Multiplicand * Multiplier - -**/ -UINT64 -EFIAPI -InternalMathMultU64x64 ( - IN UINT64 Multiplicand, - IN UINT64 Multiplier - ) -{ - _asm { - mov ebx, dword ptr [Multiplicand + 0] - mov edx, dword ptr [Multiplier + 0] - mov ecx, ebx - mov eax, edx - imul ebx, dword ptr [Multiplier + 4] - imul edx, dword ptr [Multiplicand + 4] - add ebx, edx - mul ecx - add edx, ebx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.nasm deleted file mode 100644 index 4fdbf86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/MultU64x64.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; MultU64x64.nasm -; -; Abstract: -; -; Calculate the product of a 64-bit integer and another 64-bit integer -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathMultU64x64 ( -; IN UINT64 Multiplicand, -; IN UINT64 Multiplier -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathMultU64x64) -ASM_PFX(InternalMathMultU64x64): - push ebx - mov ebx, [esp + 8] ; ebx <- M1[0..31] - mov edx, [esp + 16] ; edx <- M2[0..31] - mov ecx, ebx - mov eax, edx - imul ebx, [esp + 20] ; ebx <- M1[0..31] * M2[32..63] - imul edx, [esp + 12] ; edx <- M1[32..63] * M2[0..31] - add ebx, edx ; carries are abandoned - mul ecx ; edx:eax <- M1[0..31] * M2[0..31] - add edx, ebx ; carries are abandoned - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.S deleted file mode 100644 index 1b8ef9b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.S +++ /dev/null @@ -1,38 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# Mwait.S -# -# Abstract: -# -# AsmMwait function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(AsmMwait) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# AsmMwait ( -# IN UINTN Eax, -# IN UINTN Ecx -# ); -#------------------------------------------------------------------------------ -ASM_PFX(AsmMwait): - movl 4(%esp), %eax - movl 8(%esp), %ecx - mwait - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.c deleted file mode 100644 index 0cac0ac..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.c +++ /dev/null @@ -1,44 +0,0 @@ -/** @file - AsmMwait function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Executes an MWAIT instruction. - - Executes an MWAIT instruction with the register state specified by Eax and - Ecx. Returns Eax. This function is only available on IA-32 and x64. - - @param RegisterEax The value to load into EAX or RAX before executing the MONITOR - instruction. - @param RegisterEcx The value to load into ECX or RCX before executing the MONITOR - instruction. - - @return RegisterEax - -**/ -UINTN -EFIAPI -AsmMwait ( - IN UINTN RegisterEax, - IN UINTN RegisterEcx - ) -{ - _asm { - mov eax, RegisterEax - mov ecx, RegisterEcx - _emit 0x0f // mwait - _emit 0x01 - _emit 0xC9 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.nasm deleted file mode 100644 index 1a369d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Mwait.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Mwait.Asm -; -; Abstract: -; -; AsmMwait function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmMwait ( -; IN UINTN Eax, -; IN UINTN Ecx -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmMwait) -ASM_PFX(AsmMwait): - mov eax, [esp + 4] - mov ecx, [esp + 8] - DB 0xf, 1, 0xc9 ; mwait - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Non-existing.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Non-existing.c deleted file mode 100644 index 20146c0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Non-existing.c +++ /dev/null @@ -1,57 +0,0 @@ -/** @file - Non-existing BaseLib functions on Ia32 - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -/** - Disables the 64-bit paging mode on the CPU. - - Disables the 64-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 64-paging mode. - This function is only available on x64. After the 64-bit paging mode is - disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be 0. The function EntryPoint must never return. - - @param CodeSelector The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for 32-bit protected mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is disabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is disabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is disabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is disabled. - -**/ -VOID -EFIAPI -InternalX86DisablePaging64 ( - IN UINT16 CodeSelector, - IN UINT32 EntryPoint, - IN UINT32 Context1, OPTIONAL - IN UINT32 Context2, OPTIONAL - IN UINT32 NewStack - ) -{ - // - // This function cannot work on IA32 platform - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.S deleted file mode 100644 index ddb2029..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.S +++ /dev/null @@ -1,48 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# RRotU64.S -# -# Abstract: -# -# 64-bit right rotation for Ia32 -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMathRRotU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathRRotU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathRRotU64): - push %ebx - movb 16(%esp), %cl - movl 8(%esp), %eax - movl 12(%esp), %edx - shrdl %cl, %eax, %ebx - shrdl %cl, %edx, %eax - roll %cl, %ebx - shrdl %cl, %ebx, %edx - testb $32, %cl # Count >= 32? - jz L0 - movl %eax, %ecx # switch eax & edx if Count >= 32 - movl %edx, %eax - movl %ecx, %edx -L0: - pop %ebx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.c deleted file mode 100644 index bbf0146..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - 64-bit right rotation for Ia32 - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Rotates a 64-bit integer right between 0 and 63 bits, filling - the high bits with the high low bits that were rotated. - - This function rotates the 64-bit value Operand to the right by Count bits. - The high Count bits are fill with the low Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate right. - @param Count The number of bits to rotate right. - - @return Operand >>> Count - -**/ -UINT64 -EFIAPI -InternalMathRRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - _asm { - mov cl, byte ptr [Count] - mov eax, dword ptr [Operand + 0] - mov edx, dword ptr [Operand + 4] - shrd ebx, eax, cl - shrd eax, edx, cl - rol ebx, cl - shrd edx, ebx, cl - test cl, 32 // Count >= 32? - jz L0 - mov ecx, eax - mov eax, edx - mov edx, ecx -L0: - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.nasm deleted file mode 100644 index 5946b3d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RRotU64.nasm +++ /dev/null @@ -1,50 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; RRotU64.nasm -; -; Abstract: -; -; 64-bit right rotation for Ia32 -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathRRotU64 ( -; IN UINT64 Operand, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathRRotU64) -ASM_PFX(InternalMathRRotU64): - push ebx - mov cl, [esp + 16] - mov eax, [esp + 8] - mov edx, [esp + 12] - shrd ebx, eax, cl - shrd eax, edx, cl - rol ebx, cl - shrd edx, ebx, cl - test cl, 32 ; Count >= 32? - jz .0 - mov ecx, eax ; switch eax & edx if Count >= 32 - mov eax, edx - mov edx, ecx -.0: - pop ebx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.S deleted file mode 100644 index 607ec2e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# RShiftU64.S -# -# Abstract: -# -# 64-bit logical right shift function for IA-32 -# -#------------------------------------------------------------------------------ - - - .code: - -ASM_GLOBAL ASM_PFX(InternalMathRShiftU64) - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathRShiftU64 ( -# IN UINT64 Operand, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMathRShiftU64): - movb 12(%esp), %cl # cl <- Count - xorl %edx, %edx - movl 8(%esp), %eax - testb $32, %cl # Count >= 32? - jnz L0 - movl %eax, %edx - movl 0x4(%esp), %eax -L0: - shrdl %cl, %edx, %eax - shr %cl, %edx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.c deleted file mode 100644 index 2db0d97..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - 64-bit logical right shift function for IA-32 - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Shifts a 64-bit integer right between 0 and 63 bits. This high bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand >> Count - -**/ -UINT64 -EFIAPI -InternalMathRShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - _asm { - mov cl, byte ptr [Count] - xor edx, edx - mov eax, dword ptr [Operand + 4] - test cl, 32 - jnz L0 - mov edx, eax - mov eax, dword ptr [Operand + 0] -L0: - shrd eax, edx, cl - shr edx, cl - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.nasm deleted file mode 100644 index 67de7ee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RShiftU64.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; RShiftU64.nasm -; -; Abstract: -; -; 64-bit logical right shift function for IA-32 -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathRShiftU64 ( -; IN UINT64 Operand, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathRShiftU64) -ASM_PFX(InternalMathRShiftU64): - mov cl, [esp + 12] ; cl <- Count - xor edx, edx - mov eax, [esp + 8] - test cl, 32 ; Count >= 32? - jnz .0 - mov edx, eax - mov eax, [esp + 4] -.0: - shrd eax, edx, cl - shr edx, cl - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.S deleted file mode 100644 index 92048b3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.S +++ /dev/null @@ -1,80 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# RdRand.S -# -# Abstract: -# -# Generates random number through CPU RdRand instruction under 32-bit platform. -# -# Notes: -# -#------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Generates a 16 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand16) -ASM_PFX(InternalX86RdRand16): - .byte 0x0f, 0xc7, 0xf0 // rdrand r16: "0f c7 /6 ModRM:r/m(w)" - jc rn16_ok // jmp if CF=1 - xor %eax, %eax // reg=0 if CF=0 - ret // return with failure status -rn16_ok: - mov 0x4(%esp), %edx - mov %ax, (%edx) - mov $0x1, %eax - ret - -//------------------------------------------------------------------------------ -// Generates a 32 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand32) -ASM_PFX(InternalX86RdRand32): - .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jc rn32_ok // jmp if CF=1 - xor %eax, %eax // reg=0 if CF=0 - ret // return with failure status -rn32_ok: - mov 0x4(%esp), %edx - mov %eax, (%edx) - mov $0x1, %eax - ret - -//------------------------------------------------------------------------------ -// Generates a 64 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand64) -ASM_PFX(InternalX86RdRand64): - .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jnc rn64_ret // jmp if CF=0 - mov 0x4(%esp), %edx - mov %eax, (%edx) - - .byte 0x0f, 0xc7, 0xf0 // generate another 32 bit RN - jnc rn64_ret // jmp if CF=0 - mov %eax, 0x4(%edx) - - mov $0x1, %eax - ret -rn64_ret: - xor %eax, %eax - ret // return with failure status diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.nasm deleted file mode 100644 index 0668f43..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/RdRand.nasm +++ /dev/null @@ -1,90 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; RdRand.nasm -; -; Abstract: -; -; Generates random number through CPU RdRand instruction under 32-bit platform. -; -; Notes: -; -;------------------------------------------------------------------------------ - -SECTION .text - -;------------------------------------------------------------------------------ -; Generates a 16 bit random number through RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand16) -ASM_PFX(InternalX86RdRand16): - ; rdrand ax ; generate a 16 bit RN into ax - ; CF=1 if RN generated ok, otherwise CF=0 - db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)" - jc rn16_ok ; jmp if CF=1 - xor eax, eax ; reg=0 if CF=0 - ret ; return with failure status -rn16_ok: - mov edx, dword [esp + 4] - mov [edx], ax - mov eax, 1 - ret - -;------------------------------------------------------------------------------ -; Generates a 32 bit random number through RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand32) -ASM_PFX(InternalX86RdRand32): - ; rdrand eax ; generate a 32 bit RN into eax - ; CF=1 if RN generated ok, otherwise CF=0 - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jc rn32_ok ; jmp if CF=1 - xor eax, eax ; reg=0 if CF=0 - ret ; return with failure status -rn32_ok: - mov edx, dword [esp + 4] - mov [edx], eax - mov eax, 1 - ret - -;------------------------------------------------------------------------------ -; Generates a 64 bit random number through RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Rand); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand64) -ASM_PFX(InternalX86RdRand64): - ; rdrand eax ; generate a 32 bit RN into eax - ; CF=1 if RN generated ok, otherwise CF=0 - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jnc rn64_ret ; jmp if CF=0 - mov edx, dword [esp + 4] - mov [edx], eax - - db 0xf, 0xc7, 0xf0 ; generate another 32 bit RN - jnc rn64_ret ; jmp if CF=0 - mov [edx + 4], eax - - mov eax, 1 - ret -rn64_ret: - xor eax, eax - ret ; return with failure status - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.c deleted file mode 100644 index 0e39ee7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmReadCr0 function - - Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of the Control Register 0 (CR0). - - Reads and returns the current value of CR0. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of the Control Register 0 (CR0). - -**/ -UINTN -EFIAPI -AsmReadCr0 ( - VOID - ) -{ - __asm { - mov eax, cr0 - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.nasm deleted file mode 100644 index d09ceea..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr0.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr0.Asm -; -; Abstract: -; -; AsmReadCr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr0) -ASM_PFX(AsmReadCr0): - mov eax, cr0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.c deleted file mode 100644 index e75b950..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadCr2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of the Control Register 2 (CR2). - - Reads and returns the current value of CR2. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of the Control Register 2 (CR2). - -**/ -UINTN -EFIAPI -AsmReadCr2 ( - VOID - ) -{ - __asm { - mov eax, cr2 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.nasm deleted file mode 100644 index 5b83d89..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr2.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr2.Asm -; -; Abstract: -; -; AsmReadCr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr2) -ASM_PFX(AsmReadCr2): - mov eax, cr2 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.c deleted file mode 100644 index 2f01731..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadCr3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of the Control Register 3 (CR3). - - Reads and returns the current value of CR3. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of the Control Register 3 (CR3). - -**/ -UINTN -EFIAPI -AsmReadCr3 ( - VOID - ) -{ - __asm { - mov eax, cr3 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.nasm deleted file mode 100644 index 366e4cc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr3.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr3.Asm -; -; Abstract: -; -; AsmReadCr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr3) -ASM_PFX(AsmReadCr3): - mov eax, cr3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.c deleted file mode 100644 index d12bf5c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - AsmReadCr4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of the Control Register 4 (CR4). - - Reads and returns the current value of CR4. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of the Control Register 4 (CR4). - -**/ -UINTN -EFIAPI -AsmReadCr4 ( - VOID - ) -{ - __asm { - _emit 0x0f // mov eax, cr4 - _emit 0x20 - _emit 0xE0 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.nasm deleted file mode 100644 index 7276092..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCr4.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr4.Asm -; -; Abstract: -; -; AsmReadCr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr4) -ASM_PFX(AsmReadCr4): - mov eax, cr4 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.c deleted file mode 100644 index fe10702..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadCs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Code Segment Register (CS). - - Reads and returns the current value of CS. This function is only available on - IA-32 and x64. - - @return The current value of CS. - -**/ -UINT16 -EFIAPI -AsmReadCs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, cs - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.nasm deleted file mode 100644 index 3bfa816..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadCs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCs.Asm -; -; Abstract: -; -; AsmReadCs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadCs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCs) -ASM_PFX(AsmReadCs): - mov eax, cs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.c deleted file mode 100644 index a3a9387..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr0 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 0 (DR0). - - Reads and returns the current value of DR0. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmReadDr0 ( - VOID - ) -{ - __asm { - mov eax, dr0 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.nasm deleted file mode 100644 index 28a846e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr0.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr0.Asm -; -; Abstract: -; -; AsmReadDr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr0) -ASM_PFX(AsmReadDr0): - mov eax, dr0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.c deleted file mode 100644 index 7adbd78..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr1 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 1 (DR1). - - Reads and returns the current value of DR1. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmReadDr1 ( - VOID - ) -{ - __asm { - mov eax, dr1 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.nasm deleted file mode 100644 index 63c3341..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr1.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr1.Asm -; -; Abstract: -; -; AsmReadDr1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr1 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr1) -ASM_PFX(AsmReadDr1): - mov eax, dr1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.c deleted file mode 100644 index 5ec9695..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 2 (DR2). - - Reads and returns the current value of DR2. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmReadDr2 ( - VOID - ) -{ - __asm { - mov eax, dr2 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.nasm deleted file mode 100644 index 49f16bb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr2.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr2.Asm -; -; Abstract: -; -; AsmReadDr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr2) -ASM_PFX(AsmReadDr2): - mov eax, dr2 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.c deleted file mode 100644 index 07b587c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 3 (DR3). - - Reads and returns the current value of DR3. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmReadDr3 ( - VOID - ) -{ - __asm { - mov eax, dr3 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.nasm deleted file mode 100644 index c09b2a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr3.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr3.Asm -; -; Abstract: -; -; AsmReadDr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr3) -ASM_PFX(AsmReadDr3): - mov eax, dr3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.c deleted file mode 100644 index c42fb1c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - AsmReadDr4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 4 (DR4). - - Reads and returns the current value of DR4. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmReadDr4 ( - VOID - ) -{ - __asm { - _emit 0x0f - _emit 0x21 - _emit 0xe0 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm deleted file mode 100644 index 5d784df..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr4.Asm -; -; Abstract: -; -; AsmReadDr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr4) -ASM_PFX(AsmReadDr4): - ; - ; DR4 is alias to DR6 only if DE (in CR4) is cleared. Otherwise, reading - ; this register will cause a #UD exception. - ; - ; MS assembler doesn't support this instruction since no one would use it - ; under normal circustances. Here opcode is used. - ; - DB 0xf, 0x21, 0xe0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.c deleted file mode 100644 index 9743fe2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - AsmReadDr5 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 5 (DR5). - - Reads and returns the current value of DR5. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmReadDr5 ( - VOID - ) -{ - __asm { - _emit 0x0f - _emit 0x21 - _emit 0xe8 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm deleted file mode 100644 index a12ecb6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr5.Asm -; -; Abstract: -; -; AsmReadDr5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr5 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr5) -ASM_PFX(AsmReadDr5): - ; - ; DR5 is alias to DR7 only if DE (in CR4) is cleared. Otherwise, reading - ; this register will cause a #UD exception. - ; - ; MS assembler doesn't support this instruction since no one would use it - ; under normal circustances. Here opcode is used. - ; - DB 0xf, 0x21, 0xe8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.c deleted file mode 100644 index da04965..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr6 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 6 (DR6). - - Reads and returns the current value of DR6. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmReadDr6 ( - VOID - ) -{ - __asm { - mov eax, dr6 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.nasm deleted file mode 100644 index 1daa361..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr6.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr6.Asm -; -; Abstract: -; -; AsmReadDr6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr6 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr6) -ASM_PFX(AsmReadDr6): - mov eax, dr6 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.c deleted file mode 100644 index e3ec1eb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDr7 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Debug Register 7 (DR7). - - Reads and returns the current value of DR7. This function is only available - on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on - x64. - - @return The value of Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmReadDr7 ( - VOID - ) -{ - __asm { - mov eax, dr7 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.nasm deleted file mode 100644 index 2777a11..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDr7.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr7.Asm -; -; Abstract: -; -; AsmReadDr7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr7 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr7) -ASM_PFX(AsmReadDr7): - mov eax, dr7 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.c deleted file mode 100644 index a73aa2e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadDs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Data Segment Register (DS). - - Reads and returns the current value of DS. This function is only available on - IA-32 and x64. - - @return The current value of DS. - -**/ -UINT16 -EFIAPI -AsmReadDs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, ds - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.nasm deleted file mode 100644 index f9b194c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadDs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDs.Asm -; -; Abstract: -; -; AsmReadDs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadDs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDs) -ASM_PFX(AsmReadDs): - mov eax, ds - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.c deleted file mode 100644 index f537474..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmReadEflags function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of the EFLAGS register. - - Reads and returns the current value of the EFLAGS register. This function is - only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a - 64-bit value on x64. - - @return EFLAGS on IA-32 or RFLAGS on x64. - -**/ -UINTN -EFIAPI -AsmReadEflags ( - VOID - ) -{ - __asm { - pushfd - pop eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.nasm deleted file mode 100644 index 51c5202..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEflags.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadEflags.Asm -; -; Abstract: -; -; AsmReadEflags function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadEflags ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadEflags) -ASM_PFX(AsmReadEflags): - pushfd - pop eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.c deleted file mode 100644 index d537fcd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadEs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of ES Data Segment Register (ES). - - Reads and returns the current value of ES. This function is only available on - IA-32 and x64. - - @return The current value of ES. - -**/ -UINT16 -EFIAPI -AsmReadEs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, es - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.nasm deleted file mode 100644 index 497c647..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadEs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadEs.Asm -; -; Abstract: -; -; AsmReadEs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadEs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadEs) -ASM_PFX(AsmReadEs): - mov eax, es - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.c deleted file mode 100644 index 9cc92b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadFs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of FS Data Segment Register (FS). - - Reads and returns the current value of FS. This function is only available on - IA-32 and x64. - - @return The current value of FS. - -**/ -UINT16 -EFIAPI -AsmReadFs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, fs - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.nasm deleted file mode 100644 index 2de6296..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadFs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadFs.Asm -; -; Abstract: -; -; AsmReadFs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadFs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadFs) -ASM_PFX(AsmReadFs): - mov eax, fs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c deleted file mode 100644 index 01d0a72..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmReadGdtr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Reads the current Global Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and x64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr - ) -{ - _asm { - mov eax, Gdtr - sgdt fword ptr [eax] - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.nasm deleted file mode 100644 index 2637cbd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadGdtr.Asm -; -; Abstract: -; -; AsmReadGdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86ReadGdtr ( -; OUT IA32_DESCRIPTOR *Gdtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86ReadGdtr) -ASM_PFX(InternalX86ReadGdtr): - mov eax, [esp + 4] - sgdt [eax] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.c deleted file mode 100644 index 53eab43..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadGs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of GS Data Segment Register (GS). - - Reads and returns the current value of GS. This function is only available on - IA-32 and x64. - - @return The current value of GS. - -**/ -UINT16 -EFIAPI -AsmReadGs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, gs - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.nasm deleted file mode 100644 index 9c6fcee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadGs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadGs.Asm -; -; Abstract: -; -; AsmReadGs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadGs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadGs) -ASM_PFX(AsmReadGs): - mov eax, gs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c deleted file mode 100644 index 42d9aab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadIdtr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Reads the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and x64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr - ) -{ - _asm { - mov eax, Idtr - sidt fword ptr [eax] - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.nasm deleted file mode 100644 index 3ee40e5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadIdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadIdtr.Asm -; -; Abstract: -; -; AsmReadIdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86ReadIdtr ( -; OUT IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86ReadIdtr) -ASM_PFX(InternalX86ReadIdtr): - mov eax, [esp + 4] - sidt [eax] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c deleted file mode 100644 index d185572..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmReadLdtr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current Local Descriptor Table Register(LDTR) selector. - - Reads and returns the current 16-bit LDTR descriptor value. This function is - only available on IA-32 and x64. - - @return The current selector of LDT. - -**/ -UINT16 -EFIAPI -AsmReadLdtr ( - VOID - ) -{ - _asm { - sldt ax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.nasm deleted file mode 100644 index 29eddf2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadLdtr.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadLdtr.Asm -; -; Abstract: -; -; AsmReadLdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadLdtr ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadLdtr) -ASM_PFX(AsmReadLdtr): - sldt ax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.c deleted file mode 100644 index 8db4ca5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm0 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #0 (MM0). - - Reads and returns the current value of MM0. This function is only available - on IA-32 and x64. - - @return The current value of MM0. - -**/ -UINT64 -EFIAPI -AsmReadMm0 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm0 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.nasm deleted file mode 100644 index 1330c71..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm0.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm0.Asm -; -; Abstract: -; -; AsmReadMm0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm0) -ASM_PFX(AsmReadMm0): - push eax - push eax - movq [esp], mm0 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.c deleted file mode 100644 index f0750f4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm1 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #1 (MM1). - - Reads and returns the current value of MM1. This function is only available - on IA-32 and x64. - - @return The current value of MM1. - -**/ -UINT64 -EFIAPI -AsmReadMm1 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm1 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.nasm deleted file mode 100644 index e411df8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm1.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm1.Asm -; -; Abstract: -; -; AsmReadMm1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm1 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm1) -ASM_PFX(AsmReadMm1): - push eax - push eax - movq [esp], mm1 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.c deleted file mode 100644 index 17929b2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #2 (MM2). - - Reads and returns the current value of MM2. This function is only available - on IA-32 and x64. - - @return The current value of MM2. - -**/ -UINT64 -EFIAPI -AsmReadMm2 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm2 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.nasm deleted file mode 100644 index 4190119..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm2.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm2.Asm -; -; Abstract: -; -; AsmReadMm2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm2) -ASM_PFX(AsmReadMm2): - push eax - push eax - movq [esp], mm2 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.c deleted file mode 100644 index a505f18..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #3 (MM3). - - Reads and returns the current value of MM3. This function is only available - on IA-32 and x64. - - @return The current value of MM3. - -**/ -UINT64 -EFIAPI -AsmReadMm3 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm3 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.nasm deleted file mode 100644 index 89125e8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm3.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm3.Asm -; -; Abstract: -; -; AsmReadMm3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm3) -ASM_PFX(AsmReadMm3): - push eax - push eax - movq [esp], mm3 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.c deleted file mode 100644 index ecc3896..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #4 (MM4). - - Reads and returns the current value of MM4. This function is only available - on IA-32 and x64. - - @return The current value of MM4. - -**/ -UINT64 -EFIAPI -AsmReadMm4 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm4 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.nasm deleted file mode 100644 index a0e8d16..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm4.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm4.Asm -; -; Abstract: -; -; AsmReadMm4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm4) -ASM_PFX(AsmReadMm4): - push eax - push eax - movq [esp], mm4 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.c deleted file mode 100644 index e974717..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm5 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #5 (MM5). - - Reads and returns the current value of MM5. This function is only available - on IA-32 and x64. - - @return The current value of MM5. - -**/ -UINT64 -EFIAPI -AsmReadMm5 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm5 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.nasm deleted file mode 100644 index 2c96bfa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm5.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm5.Asm -; -; Abstract: -; -; AsmReadMm5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm5 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm5) -ASM_PFX(AsmReadMm5): - push eax - push eax - movq [esp], mm5 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.c deleted file mode 100644 index a64cf50..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm6 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #6 (MM6). - - Reads and returns the current value of MM6. This function is only available - on IA-32 and x64. - - @return The current value of MM6. - -**/ -UINT64 -EFIAPI -AsmReadMm6 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm6 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.nasm deleted file mode 100644 index f6a6047..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm6.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm6.Asm -; -; Abstract: -; -; AsmReadMm6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm6 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm6) -ASM_PFX(AsmReadMm6): - push eax - push eax - movq [esp], mm6 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.c deleted file mode 100644 index 0cea219..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - AsmReadMm7 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of 64-bit MMX Register #7 (MM7). - - Reads and returns the current value of MM7. This function is only available - on IA-32 and x64. - - @return The current value of MM7. - -**/ -UINT64 -EFIAPI -AsmReadMm7 ( - VOID - ) -{ - _asm { - push eax - push eax - movq [esp], mm7 - pop eax - pop edx - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.nasm deleted file mode 100644 index 655aa40..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMm7.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm7.Asm -; -; Abstract: -; -; AsmReadMm7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm7 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm7) -ASM_PFX(AsmReadMm7): - push eax - push eax - movq [esp], mm7 - pop eax - pop edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c deleted file mode 100644 index e16c917..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c +++ /dev/null @@ -1,43 +0,0 @@ -/** @file - AsmReadMsr64 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Returns a 64-bit Machine Specific Register(MSR). - - Reads and returns the 64-bit MSR specified by Index. No parameter checking is - performed on Index, and some Index values may cause CPU exceptions. The - caller must either guarantee that Index is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and x64. - - @param Index The 32-bit MSR index to read. - - @return The value of the MSR identified by Index. - -**/ -UINT64 -EFIAPI -AsmReadMsr64 ( - IN UINT32 Index - ) -{ - _asm { - mov ecx, Index - rdmsr - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.nasm deleted file mode 100644 index f1dbd41..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadMsr64.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMsr64.Asm -; -; Abstract: -; -; AsmReadMsr64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMsr64 ( -; IN UINT64 Index -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMsr64) -ASM_PFX(AsmReadMsr64): - mov ecx, [esp + 4] - rdmsr - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c deleted file mode 100644 index faa1f56..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmReadPmc function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Reads the current value of a Performance Counter (PMC). - - Reads and returns the current value of performance counter specified by - Index. This function is only available on IA-32 and x64. - - @param Index The 32-bit Performance Counter index to read. - - @return The value of the PMC specified by Index. - -**/ -UINT64 -EFIAPI -AsmReadPmc ( - IN UINT32 Index - ) -{ - _asm { - mov ecx, Index - rdpmc - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.nasm deleted file mode 100644 index 8eb0501..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadPmc.Asm -; -; Abstract: -; -; AsmReadPmc function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadPmc ( -; IN UINT32 PmcIndex -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadPmc) -ASM_PFX(AsmReadPmc): - mov ecx, [esp + 4] - rdpmc - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.c deleted file mode 100644 index f1ced5e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmReadSs function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Stack Segment Register (SS). - - Reads and returns the current value of SS. This function is only available on - IA-32 and x64. - - @return The current value of SS. - -**/ -UINT16 -EFIAPI -AsmReadSs ( - VOID - ) -{ - __asm { - xor eax, eax - mov ax, ss - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.nasm deleted file mode 100644 index 6b3da79..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadSs.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadSs.Asm -; -; Abstract: -; -; AsmReadSs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadSs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadSs) -ASM_PFX(AsmReadSs): - mov eax, ss - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.c deleted file mode 100644 index 23273f3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmReadTr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Task Register (TR). - - Reads and returns the current value of TR. This function is only available on - IA-32 and x64. - - @return The current value of TR. - -**/ -UINT16 -EFIAPI -AsmReadTr ( - VOID - ) -{ - _asm { - str ax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.nasm deleted file mode 100644 index 811153c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTr.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadTr.Asm -; -; Abstract: -; -; AsmReadTr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadTr ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadTr) -ASM_PFX(AsmReadTr): - str ax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.c deleted file mode 100644 index 79f676e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmReadTsc function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Reads the current value of Time Stamp Counter (TSC). - - Reads and returns the current value of TSC. This function is only available - on IA-32 and x64. - - @return The current value of TSC - -**/ -UINT64 -EFIAPI -AsmReadTsc ( - VOID - ) -{ - _asm { - rdtsc - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.nasm deleted file mode 100644 index f28e20e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/ReadTsc.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadTsc.Asm -; -; Abstract: -; -; AsmReadTsc function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadTsc ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadTsc) -ASM_PFX(AsmReadTsc): - rdtsc - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.S deleted file mode 100644 index 744a77e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.S +++ /dev/null @@ -1,44 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetJump.S -# -# Abstract: -# -# Implementation of SetJump() on IA-32. -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(SetJump), ASM_PFX(InternalAssertJumpBuffer) - -#------------------------------------------------------------------------------ -# UINTN -# EFIAPI -# SetJump ( -# OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer -# ); -#------------------------------------------------------------------------------ -ASM_PFX(SetJump): - pushl 0x4(%esp) - call ASM_PFX(InternalAssertJumpBuffer) # To validate JumpBuffer - pop %ecx - pop %ecx # ecx <- return address - movl (%esp), %edx - movl %ebx, (%edx) - movl %esi, 4(%edx) - movl %edi, 8(%edx) - movl %ebp, 12(%edx) - movl %esp, 16(%edx) - movl %ecx, 20(%edx) # eip value to restore in LongJump - xorl %eax, %eax - jmp *%ecx diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.c deleted file mode 100644 index 3bb9ac9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - Implementation of SetJump() on IA-32. - - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - -/** - Worker function that checks ASSERT condition for JumpBuffer - - Checks ASSERT condition for JumpBuffer. - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - -**/ -VOID -EFIAPI -InternalAssertJumpBuffer ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer - ); - -/** - Saves the current CPU context that can be restored with a call to LongJump() - and returns 0. - - Saves the current CPU context in the buffer specified by JumpBuffer and - returns 0. The initial call to SetJump() must always return 0. Subsequent - calls to LongJump() cause a non-zero value to be returned by SetJump(). - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - - @retval 0 Indicates a return from SetJump(). - -**/ -_declspec (naked) -RETURNS_TWICE -UINTN -EFIAPI -SetJump ( - OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer - ) -{ - _asm { - push [esp + 4] - call InternalAssertJumpBuffer - pop ecx - pop ecx - mov edx, [esp] - - xor eax, eax - mov [edx + 24], eax ; save 0 to SSP - - mov eax, [PcdGet32 (PcdControlFlowEnforcementPropertyMask)] - test eax, eax - jz CetDone - _emit 0x0F - _emit 0x20 - _emit 0xE0 ; mov eax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - mov eax, 1 - _emit 0xF3 - _emit 0x0F - _emit 0xAE - _emit 0xE8 ; INCSSP EAX to read original SSP - _emit 0xF3 - _emit 0x0F - _emit 0x1E - _emit 0xC8 ; READSSP EAX - mov [edx + 0x24], eax ; save SSP - -CetDone: - - mov [edx], ebx - mov [edx + 4], esi - mov [edx + 8], edi - mov [edx + 12], ebp - mov [edx + 16], esp - mov [edx + 20], ecx - xor eax, eax - jmp ecx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.nasm deleted file mode 100644 index 820ffec..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SetJump.nasm +++ /dev/null @@ -1,69 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetJump.Asm -; -; Abstract: -; -; Implementation of SetJump() on IA-32. -; -;------------------------------------------------------------------------------ - -%include "Nasm.inc" - - SECTION .text - -extern ASM_PFX(InternalAssertJumpBuffer) -extern ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask)) - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; SetJump ( -; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SetJump) -ASM_PFX(SetJump): - push DWORD [esp + 4] - call ASM_PFX(InternalAssertJumpBuffer) ; To validate JumpBuffer - pop ecx - pop ecx ; ecx <- return address - mov edx, [esp] - - xor eax, eax - mov [edx + 24], eax ; save 0 to SSP - - mov eax, [ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))] - test eax, eax - jz CetDone - mov eax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - mov eax, 1 - INCSSP_EAX ; to read original SSP - READSSP_EAX - mov [edx + 0x24], eax ; save SSP - -CetDone: - - mov [edx], ebx - mov [edx + 4], esi - mov [edx + 8], edi - mov [edx + 12], ebp - mov [edx + 16], esp - mov [edx + 20], ecx ; eip value to restore in LongJump - xor eax, eax - jmp ecx - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S deleted file mode 100644 index 265b6b7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S +++ /dev/null @@ -1,38 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuId.S -# -# Abstract: -# -# AsmCpuid function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# UINT64 -# EFIAPI -# InternalMathSwapBytes64 ( -# IN UINT64 Operand -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMathSwapBytes64) -ASM_PFX(InternalMathSwapBytes64): - movl 8(%esp), %eax # eax <- upper 32 bits - movl 4(%esp), %edx # edx <- lower 32 bits - bswapl %eax - bswapl %edx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c deleted file mode 100644 index 3e03b65..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c +++ /dev/null @@ -1,43 +0,0 @@ -/** @file - Implementation of 64-bit swap bytes - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Switches the endianess of a 64-bit integer. - - This function swaps the bytes in a 64-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Operand A 64-bit unsigned value. - - @return The byte swaped Operand. - -**/ -UINT64 -EFIAPI -InternalMathSwapBytes64 ( - IN UINT64 Operand - ) -{ - _asm { - mov eax, dword ptr [Operand + 4] - mov edx, dword ptr [Operand + 0] - bswap eax - bswap edx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.nasm deleted file mode 100644 index 32fc1a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/SwapBytes64.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuId.Asm -; -; Abstract: -; -; AsmCpuid function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalMathSwapBytes64 ( -; IN UINT64 Operand -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMathSwapBytes64) -ASM_PFX(InternalMathSwapBytes64): - mov eax, [esp + 8] ; eax <- upper 32 bits - mov edx, [esp + 4] ; edx <- lower 32 bits - bswap eax - bswap edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.S deleted file mode 100644 index f5189d0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.S +++ /dev/null @@ -1,222 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# Thunk16.S -# -# Abstract: -# -# Real mode thunk -# -#------------------------------------------------------------------------------ - -#include - -ASM_GLOBAL ASM_PFX(m16Start), ASM_PFX(m16Size), ASM_PFX(mThunk16Attr), ASM_PFX(m16Gdt), ASM_PFX(m16GdtrBase), ASM_PFX(mTransition) -ASM_GLOBAL ASM_PFX(InternalAsmThunk16) - -# define the structure of IA32_REGS -.set _EDI, 0 #size 4 -.set _ESI, 4 #size 4 -.set _EBP, 8 #size 4 -.set _ESP, 12 #size 4 -.set _EBX, 16 #size 4 -.set _EDX, 20 #size 4 -.set _ECX, 24 #size 4 -.set _EAX, 28 #size 4 -.set _DS, 32 #size 2 -.set _ES, 34 #size 2 -.set _FS, 36 #size 2 -.set _GS, 38 #size 2 -.set _EFLAGS, 40 #size 4 -.set _EIP, 44 #size 4 -.set _CS, 48 #size 2 -.set _SS, 50 #size 2 -.set IA32_REGS_SIZE, 52 - - .text - .code16 - -ASM_PFX(m16Start): - -SavedGdt: .space 6 - -ASM_PFX(BackFromUserCode): - push %ss - push %cs - - calll L_Base1 # push eip -L_Base1: - pushfl - cli # disable interrupts - push %gs - push %fs - push %es - push %ds - pushal - .byte 0x66, 0xba # mov edx, imm32 -ASM_PFX(ThunkAttr): .space 4 - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl - jz 1f - movw $0x2401, %ax - int $0x15 - cli # disable interrupts - jnc 2f -1: - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl - jz 2f - inb $0x92, %al - orb $2, %al - outb %al, $0x92 # deactivate A20M# -2: - xorl %eax, %eax - movw %ss, %ax - leal IA32_REGS_SIZE(%esp), %ebp - mov %ebp, (_ESP - IA32_REGS_SIZE)(%bp) - mov (_EIP - IA32_REGS_SIZE)(%bp), %bx - shll $4, %eax - addl %eax, %ebp - .byte 0x66, 0xb8 # mov eax, imm32 -SavedCr4: .space 4 - movl %eax, %cr4 - lgdtl %cs:(SavedGdt - L_Base1)(%bx) - .byte 0x66, 0xb8 # mov eax, imm32 -SavedCr0: .space 4 - movl %eax, %cr0 - .byte 0xb8 # mov ax, imm16 -SavedSs: .space 2 - movl %eax, %ss - .byte 0x66, 0xbc # mov esp, imm32 -SavedEsp: .space 4 - lretl # return to protected mode - -_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start) - .word 0x8 -_16Idtr: .word 0x3ff - .long 0 -_16Gdtr: .word GdtEnd - _NullSegDesc - 1 -_16GdtrBase: .long _NullSegDesc - -ASM_PFX(ToUserCode): - movw %ss, %dx - movw %cx, %ss # set new segment selectors - movw %cx, %ds - movw %cx, %es - movw %cx, %fs - movw %cx, %gs - movl %eax, %cr0 # real mode starts at next instruction - # which (per SDM) *must* be a far JMP. - ljmpw $0,$0 # will be filled in by InternalAsmThunk16 -L_Base: # to point here. - movl %ebp, %cr4 - movw %si, %ss # set up 16-bit stack segment - xchgl %ebx, %esp # set up 16-bit stack pointer - - movw IA32_REGS_SIZE(%esp), %bp # get BackToUserCode address from stack - mov %dx, %cs:(SavedSs - ASM_PFX(BackFromUserCode))(%bp) - mov %ebx, %cs:(SavedEsp - ASM_PFX(BackFromUserCode))(%bp) - lidtl %cs:(_16Idtr - ASM_PFX(BackFromUserCode))(%bp) - popal - pop %ds - pop %es - pop %fs - pop %gs - popfl - lretl # transfer control to user code - -_NullSegDesc: .quad 0 -_16CsDesc: - .word -1 - .word 0 - .byte 0 - .byte 0x9b - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -_16DsDesc: - .word -1 - .word 0 - .byte 0 - .byte 0x93 - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -GdtEnd: - - .code32 -# -# @param RegSet The pointer to a IA32_DWORD_REGS structure -# @param Transition The pointer to the transition code -# @return The address of the 16-bit stack after returning from user code -# -ASM_PFX(InternalAsmThunk16): - push %ebp - push %ebx - push %esi - push %edi - push %ds - push %es - push %fs - push %gs - movl 36(%esp), %esi # esi <- RegSet - movzwl _SS(%esi), %edx - mov _ESP(%esi), %edi - add $(-(IA32_REGS_SIZE + 4)), %edi - movl %edi, %ebx # ebx <- stack offset - imul $0x10, %edx, %eax - push $(IA32_REGS_SIZE / 4) - addl %eax, %edi # edi <- linear address of 16-bit stack - pop %ecx - rep - movsl # copy RegSet - movl 40(%esp), %eax # eax <- address of transition code - movl %edx, %esi # esi <- 16-bit stack segment - lea (SavedCr0 - ASM_PFX(m16Start))(%eax), %edx - movl %eax, %ecx - andl $0xf, %ecx - shll $12, %eax - lea (ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start))(%ecx), %ecx - movw %cx, %ax - stosl # [edi] <- return address of user code - addl $(L_Base - ASM_PFX(BackFromUserCode)), %eax - movl %eax, (L_Base - SavedCr0 - 4)(%edx) - sgdtl (SavedGdt - SavedCr0)(%edx) - sidtl 0x24(%esp) - movl %cr0, %eax - movl %eax, (%edx) # save CR0 in SavedCr0 - andl $0x7ffffffe, %eax # clear PE, PG bits - movl %cr4, %ebp - mov %ebp, (SavedCr4 - SavedCr0)(%edx) - andl $0xffffffcf, %ebp # clear PAE, PSE bits - pushl $0x10 - pop %ecx # ecx <- selector for data segments - lgdtl (_16Gdtr - SavedCr0)(%edx) - pushfl - lcall *(_EntryPoint - SavedCr0)(%edx) - popfl - lidtl 0x24(%esp) - lea -IA32_REGS_SIZE(%ebp), %eax - pop %gs - pop %fs - pop %es - pop %ds - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - - .const: - -ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) -ASM_PFX(mThunk16Attr): .word ASM_PFX(ThunkAttr) - ASM_PFX(m16Start) -ASM_PFX(m16Gdt): .word _NullSegDesc - ASM_PFX(m16Start) -ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start) -ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start) diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm deleted file mode 100644 index 1c02140..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm +++ /dev/null @@ -1,263 +0,0 @@ - -#include "BaseLibInternals.h" - -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Thunk.asm -; -; Abstract: -; -; Real mode thunk -; -;------------------------------------------------------------------------------ - -global ASM_PFX(m16Size) -global ASM_PFX(mThunk16Attr) -global ASM_PFX(m16Gdt) -global ASM_PFX(m16GdtrBase) -global ASM_PFX(mTransition) -global ASM_PFX(m16Start) - -struc IA32_REGS - - ._EDI: resd 1 - ._ESI: resd 1 - ._EBP: resd 1 - ._ESP: resd 1 - ._EBX: resd 1 - ._EDX: resd 1 - ._ECX: resd 1 - ._EAX: resd 1 - ._DS: resw 1 - ._ES: resw 1 - ._FS: resw 1 - ._GS: resw 1 - ._EFLAGS: resd 1 - ._EIP: resd 1 - ._CS: resw 1 - ._SS: resw 1 - .size: - -endstruc - -;; .const - -SECTION .data - -; -; These are global constant to convey information to C code. -; -ASM_PFX(m16Size) DW ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) -ASM_PFX(mThunk16Attr) DW _BackFromUserCode.ThunkAttrEnd - 4 - ASM_PFX(m16Start) -ASM_PFX(m16Gdt) DW _NullSegDesc - ASM_PFX(m16Start) -ASM_PFX(m16GdtrBase) DW _16GdtrBase - ASM_PFX(m16Start) -ASM_PFX(mTransition) DW _EntryPoint - ASM_PFX(m16Start) - -SECTION .text - -ASM_PFX(m16Start): - -SavedGdt: - dw 0 - dd 0 - -;------------------------------------------------------------------------------ -; _BackFromUserCode() takes control in real mode after 'retf' has been executed -; by user code. It will be shadowed to somewhere in memory below 1MB. -;------------------------------------------------------------------------------ -_BackFromUserCode: - ; - ; The order of saved registers on the stack matches the order they appears - ; in IA32_REGS structure. This facilitates wrapper function to extract them - ; into that structure. - ; -BITS 16 - push ss - push cs - ; - ; Note: We can't use o32 on the next instruction because of a bug - ; in NASM 2.09.04 through 2.10rc1. - ; - call dword .Base ; push eip -.Base: - pushfd - cli ; disable interrupts - push gs - push fs - push es - push ds - pushad - mov edx, strict dword 0 -.ThunkAttrEnd: - test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 - jz .1 - mov ax, 2401h - int 15h - cli ; disable interrupts - jnc .2 -.1: - test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL - jz .2 - in al, 92h - or al, 2 - out 92h, al ; deactivate A20M# -.2: - xor eax, eax - mov ax, ss - lea ebp, [esp + IA32_REGS.size] - mov [bp - IA32_REGS.size + IA32_REGS._ESP], ebp - mov bx, [bp - IA32_REGS.size + IA32_REGS._EIP] - shl eax, 4 ; shl eax, 4 - add ebp, eax ; add ebp, eax - mov eax, strict dword 0 -.SavedCr4End: - mov cr4, eax -o32 lgdt [cs:bx + (SavedGdt - .Base)] - mov eax, strict dword 0 -.SavedCr0End: - mov cr0, eax - mov ax, strict word 0 -.SavedSsEnd: - mov ss, eax - mov esp, strict dword 0 -.SavedEspEnd: -o32 retf ; return to protected mode - -_EntryPoint: - DD _ToUserCode - ASM_PFX(m16Start) - DW 8h -_16Idtr: - DW (1 << 10) - 1 - DD 0 -_16Gdtr: - DW GdtEnd - _NullSegDesc - 1 -_16GdtrBase: - DD 0 - -;------------------------------------------------------------------------------ -; _ToUserCode() takes control in real mode before passing control to user code. -; It will be shadowed to somewhere in memory below 1MB. -;------------------------------------------------------------------------------ -_ToUserCode: -BITS 16 - mov dx, ss - mov ss, cx ; set new segment selectors - mov ds, cx - mov es, cx - mov fs, cx - mov gs, cx - mov cr0, eax ; real mode starts at next instruction - ; which (per SDM) *must* be a far JMP. - jmp 0:strict word 0 -.RealAddrEnd: - mov cr4, ebp - mov ss, si ; set up 16-bit stack segment - xchg esp, ebx ; set up 16-bit stack pointer - mov bp, [esp + IA32_REGS.size] - mov [cs:bp + (_BackFromUserCode.SavedSsEnd - 2 - _BackFromUserCode)], dx - mov [cs:bp + (_BackFromUserCode.SavedEspEnd - 4 - _BackFromUserCode)], ebx - lidt [cs:bp + (_16Idtr - _BackFromUserCode)] - - popad - pop ds - pop es - pop fs - pop gs - popfd - -o32 retf ; transfer control to user code - -ALIGN 16 -_NullSegDesc DQ 0 -_16CsDesc: - DW -1 - DW 0 - DB 0 - DB 9bh - DB 8fh ; 16-bit segment, 4GB limit - DB 0 -_16DsDesc: - DW -1 - DW 0 - DB 0 - DB 93h - DB 8fh ; 16-bit segment, 4GB limit - DB 0 -GdtEnd: - -;------------------------------------------------------------------------------ -; IA32_REGISTER_SET * -; EFIAPI -; InternalAsmThunk16 ( -; IN IA32_REGISTER_SET *RegisterSet, -; IN OUT VOID *Transition -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalAsmThunk16) -ASM_PFX(InternalAsmThunk16): -BITS 32 - push ebp - push ebx - push esi - push edi - push ds - push es - push fs - push gs - mov esi, [esp + 36] ; esi <- RegSet, the 1st parameter - movzx edx, word [esi + IA32_REGS._SS] - mov edi, [esi + IA32_REGS._ESP] - add edi, - (IA32_REGS.size + 4) ; reserve stack space - mov ebx, edi ; ebx <- stack offset - imul eax, edx, 16 ; eax <- edx * 16 - push IA32_REGS.size / 4 - add edi, eax ; edi <- linear address of 16-bit stack - pop ecx - rep movsd ; copy RegSet - mov eax, [esp + 40] ; eax <- address of transition code - mov esi, edx ; esi <- 16-bit stack segment - lea edx, [eax + (_BackFromUserCode.SavedCr0End - ASM_PFX(m16Start))] - mov ecx, eax - and ecx, 0fh - shl eax, 12 - lea ecx, [ecx + (_BackFromUserCode - ASM_PFX(m16Start))] - mov ax, cx - stosd ; [edi] <- return address of user code - add eax, _ToUserCode.RealAddrEnd - _BackFromUserCode - mov [edx + (_ToUserCode.RealAddrEnd - 4 - _BackFromUserCode.SavedCr0End)], eax - sgdt [edx + (SavedGdt - _BackFromUserCode.SavedCr0End)] - sidt [esp + 36] ; save IDT stack in argument space - mov eax, cr0 - mov [edx - 4], eax ; save CR0 in _BackFromUserCode.SavedCr0End - 4 - and eax, 7ffffffeh ; clear PE, PG bits - mov ebp, cr4 - mov [edx + (_BackFromUserCode.SavedCr4End - 4 - _BackFromUserCode.SavedCr0End)], ebp - and ebp, ~30h ; clear PAE, PSE bits - push 10h - pop ecx ; ecx <- selector for data segments - lgdt [edx + (_16Gdtr - _BackFromUserCode.SavedCr0End)] - pushfd ; Save df/if indeed - call dword far [edx + (_EntryPoint - _BackFromUserCode.SavedCr0End)] - popfd - lidt [esp + 36] ; restore protected mode IDTR - lea eax, [ebp - IA32_REGS.size] ; eax <- the address of IA32_REGS - pop gs - pop fs - pop es - pop ds - pop edi - pop esi - pop ebx - pop ebp - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.c deleted file mode 100644 index 16b9cf7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.c +++ /dev/null @@ -1,35 +0,0 @@ -/** @file - AsmWbinvd function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Executes a WBINVD instruction. - - Executes a WBINVD instruction. This function is only available on IA-32 and - x64. - -**/ -VOID -EFIAPI -AsmWbinvd ( - VOID - ) -{ - _asm { - wbinvd - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.nasm deleted file mode 100644 index 7bdf793..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/Wbinvd.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Wbinvd.Asm -; -; Abstract: -; -; AsmWbinvd function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWbinvd ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWbinvd) -ASM_PFX(AsmWbinvd): - wbinvd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.c deleted file mode 100644 index 177da80..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteCr0 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Control Register 0 (CR0). - - Writes and returns a new value to CR0. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to CR0. - - @return The value written to CR0. - -**/ -UINTN -EFIAPI -AsmWriteCr0 ( - UINTN Value - ) -{ - _asm { - mov eax, Value - mov cr0, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.nasm deleted file mode 100644 index 0c0ea5c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr0.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr0.Asm -; -; Abstract: -; -; AsmWriteCr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr0 ( -; UINTN Cr0 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr0) -ASM_PFX(AsmWriteCr0): - mov eax, [esp + 4] - mov cr0, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.c deleted file mode 100644 index efbdf63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteCr2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Control Register 2 (CR2). - - Writes and returns a new value to CR2. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to CR2. - - @return The value written to CR2. - -**/ -UINTN -EFIAPI -AsmWriteCr2 ( - UINTN Value - ) -{ - _asm { - mov eax, Value - mov cr2, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.nasm deleted file mode 100644 index 2b7afa8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr2.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr2.Asm -; -; Abstract: -; -; AsmWriteCr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr2 ( -; UINTN Cr2 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr2) -ASM_PFX(AsmWriteCr2): - mov eax, [esp + 4] - mov cr2, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.c deleted file mode 100644 index 6aeb0f2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteCr3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Control Register 3 (CR3). - - Writes and returns a new value to CR3. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to CR3. - - @return The value written to CR3. - -**/ -UINTN -EFIAPI -AsmWriteCr3 ( - UINTN Value - ) -{ - _asm { - mov eax, Value - mov cr3, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.nasm deleted file mode 100644 index 90a2219..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr3.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr3.Asm -; -; Abstract: -; -; AsmWriteCr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr3 ( -; UINTN Cr3 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr3) -ASM_PFX(AsmWriteCr3): - mov eax, [esp + 4] - mov cr3, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.c deleted file mode 100644 index f145564..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmWriteCr4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Control Register 4 (CR4). - - Writes and returns a new value to CR4. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to CR4. - - @return The value written to CR4. - -**/ -UINTN -EFIAPI -AsmWriteCr4 ( - UINTN Value - ) -{ - _asm { - mov eax, Value - _emit 0x0f // mov cr4, eax - _emit 0x22 - _emit 0xE0 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.nasm deleted file mode 100644 index 486fe24..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteCr4.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr4.Asm -; -; Abstract: -; -; AsmWriteCr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr4 ( -; UINTN Cr4 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr4) -ASM_PFX(AsmWriteCr4): - mov eax, [esp + 4] - mov cr4, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.c deleted file mode 100644 index bd5e101..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr0 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 0 (DR0). - - Writes and returns a new value to DR0. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr0. - - @return The value written to Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmWriteDr0 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr0, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.nasm deleted file mode 100644 index 5c2af94..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr0.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr0.Asm -; -; Abstract: -; -; AsmWriteDr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr0 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr0) -ASM_PFX(AsmWriteDr0): - mov eax, [esp + 4] - mov dr0, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.c deleted file mode 100644 index 695f346..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr1 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 1 (DR1). - - Writes and returns a new value to DR1. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr1. - - @return The value written to Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmWriteDr1 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr1, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.nasm deleted file mode 100644 index a35389e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr1.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr1.Asm -; -; Abstract: -; -; AsmWriteDr1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr1 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr1) -ASM_PFX(AsmWriteDr1): - mov eax, [esp + 4] - mov dr1, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.c deleted file mode 100644 index 8a24b94..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 2 (DR2). - - Writes and returns a new value to DR2. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr2. - - @return The value written to Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmWriteDr2 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr2, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.nasm deleted file mode 100644 index 936cefc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr2.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr2.Asm -; -; Abstract: -; -; AsmWriteDr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr2 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr2) -ASM_PFX(AsmWriteDr2): - mov eax, [esp + 4] - mov dr2, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.c deleted file mode 100644 index 3a0921b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 3 (DR3). - - Writes and returns a new value to DR3. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr3. - - @return The value written to Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmWriteDr3 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr3, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.nasm deleted file mode 100644 index d7a58cf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr3.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr3.Asm -; -; Abstract: -; -; AsmWriteDr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr3 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr3) -ASM_PFX(AsmWriteDr3): - mov eax, [esp + 4] - mov dr3, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.c deleted file mode 100644 index acfe93f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmWriteDr4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 4 (DR4). - - Writes and returns a new value to DR4. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr4. - - @return The value written to Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmWriteDr4 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - _emit 0x0f // mov dr4, eax - _emit 0x23 - _emit 0xe0 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm deleted file mode 100644 index 95c6d06..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr4.Asm -; -; Abstract: -; -; AsmWriteDr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr4 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr4) -ASM_PFX(AsmWriteDr4): - mov eax, [esp + 4] - ; - ; DR4 is alias to DR6 only if DE (in CR4) is cleared. Otherwise, writing to - ; this register will cause a #UD exception. - ; - ; MS assembler doesn't support this instruction since no one would use it - ; under normal circustances. Here opcode is used. - ; - DB 0xf, 0x23, 0xe0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.c deleted file mode 100644 index 4e00ceb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmWriteDr5 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 5 (DR5). - - Writes and returns a new value to DR5. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr5. - - @return The value written to Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmWriteDr5 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - _emit 0x0f // mov dr5, eax - _emit 0x23 - _emit 0xe8 - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm deleted file mode 100644 index a6256ef..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr5.Asm -; -; Abstract: -; -; AsmWriteDr5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr5 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr5) -ASM_PFX(AsmWriteDr5): - mov eax, [esp + 4] - ; - ; DR5 is alias to DR7 only if DE (in CR4) is cleared. Otherwise, writing to - ; this register will cause a #UD exception. - ; - ; MS assembler doesn't support this instruction since no one would use it - ; under normal circustances. Here opcode is used. - ; - DB 0xf, 0x23, 0xe8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.c deleted file mode 100644 index 29ab483..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr6 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 6 (DR6). - - Writes and returns a new value to DR6. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr6. - - @return The value written to Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmWriteDr6 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr6, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.nasm deleted file mode 100644 index 75ae84b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr6.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr6.Asm -; -; Abstract: -; -; AsmWriteDr6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr6 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr6) -ASM_PFX(AsmWriteDr6): - mov eax, [esp + 4] - mov dr6, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.c deleted file mode 100644 index aa2286f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteDr7 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Writes a value to Debug Register 7 (DR7). - - Writes and returns a new value to DR7. This function is only available on - IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. - - @param Value The value to write to Dr7. - - @return The value written to Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmWriteDr7 ( - IN UINTN Value - ) -{ - _asm { - mov eax, Value - mov dr7, eax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.nasm deleted file mode 100644 index 06539e3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteDr7.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr7.Asm -; -; Abstract: -; -; AsmWriteDr7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr7 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr7) -ASM_PFX(AsmWriteDr7): - mov eax, [esp + 4] - mov dr7, eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c deleted file mode 100644 index 905d585..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmWriteGdtr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Writes the current Global Descriptor Table Register (GDTR) descriptor. - - Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and x64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr - ) -{ - _asm { - mov eax, Gdtr - lgdt fword ptr [eax] - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.nasm deleted file mode 100644 index 4f4f590..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteGdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteGdtr.Asm -; -; Abstract: -; -; AsmWriteGdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86WriteGdtr ( -; IN CONST IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86WriteGdtr) -ASM_PFX(InternalX86WriteGdtr): - mov eax, [esp + 4] - lgdt [eax] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c deleted file mode 100644 index ceef0e8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - AsmWriteIdtr function - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - -/** - Writes the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and x64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr - ) -{ - _asm { - mov eax, Idtr - pushfd - cli - lidt fword ptr [eax] - popfd - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.nasm deleted file mode 100644 index f82f3a8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteIdtr.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteIdtr.Asm -; -; Abstract: -; -; AsmWriteIdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86WriteIdtr ( -; IN CONST IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86WriteIdtr) -ASM_PFX(InternalX86WriteIdtr): - mov eax, [esp + 4] - pushfd - cli - lidt [eax] - popfd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c deleted file mode 100644 index fe9ad0f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - AsmWriteLdtr function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current Local Descriptor Table Register (GDTR) selector. - - Writes and the current LDTR descriptor specified by Ldtr. This function is - only available on IA-32 and x64. - - @param Ldtr 16-bit LDTR selector value. - -**/ -VOID -EFIAPI -AsmWriteLdtr ( - IN UINT16 Ldtr - ) -{ - _asm { - xor eax, eax - mov ax, Ldtr - lldt ax - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.nasm deleted file mode 100644 index e3d9e0d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteLdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteLdtr.Asm -; -; Abstract: -; -; AsmWriteLdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteLdtr ( -; IN UINT16 Ldtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteLdtr) -ASM_PFX(AsmWriteLdtr): - mov eax, [esp + 4] - lldt ax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.c deleted file mode 100644 index 076ccd9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm0 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #0 (MM0). - - Writes the current value of MM0. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM0. - -**/ -VOID -EFIAPI -AsmWriteMm0 ( - IN UINT64 Value - ) -{ - _asm { - movq mm0, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.nasm deleted file mode 100644 index c43005b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm0.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm0.Asm -; -; Abstract: -; -; AsmWriteMm0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm0 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm0) -ASM_PFX(AsmWriteMm0): - movq mm0, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.c deleted file mode 100644 index dadf7c1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm1 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #1 (MM1). - - Writes the current value of MM1. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM1. - -**/ -VOID -EFIAPI -AsmWriteMm1 ( - IN UINT64 Value - ) -{ - _asm { - movq mm1, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.nasm deleted file mode 100644 index b3171b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm1.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm1.Asm -; -; Abstract: -; -; AsmWriteMm1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm1 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm1) -ASM_PFX(AsmWriteMm1): - movq mm1, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.c deleted file mode 100644 index 830a03e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm2 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #2 (MM2). - - Writes the current value of MM2. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM2. - -**/ -VOID -EFIAPI -AsmWriteMm2 ( - IN UINT64 Value - ) -{ - _asm { - movq mm2, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.nasm deleted file mode 100644 index ff7bcee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm2.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm2.Asm -; -; Abstract: -; -; AsmWriteMm2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm2 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm2) -ASM_PFX(AsmWriteMm2): - movq mm2, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.c deleted file mode 100644 index c9c6476..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm3 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #3 (MM3). - - Writes the current value of MM3. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM3. - -**/ -VOID -EFIAPI -AsmWriteMm3 ( - IN UINT64 Value - ) -{ - _asm { - movq mm3, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.nasm deleted file mode 100644 index 0e60af5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm3.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm3.Asm -; -; Abstract: -; -; AsmWriteMm3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm3 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm3) -ASM_PFX(AsmWriteMm3): - movq mm3, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.c deleted file mode 100644 index 1822811..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteMm4 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #4 (MM4). - - Writes the current value of MM4. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM4. - -**/ -VOID -EFIAPI -AsmWriteMm4 ( - IN UINT64 Value - ) -{ - _asm { - movq mm4, qword ptr [Value] - emms - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.nasm deleted file mode 100644 index 26552fb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm4.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm4.Asm -; -; Abstract: -; -; AsmWriteMm4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm4 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm4) -ASM_PFX(AsmWriteMm4): - movq mm4, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.c deleted file mode 100644 index f6ad0e0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.c +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - AsmWriteMm5 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #5 (MM5). - - Writes the current value of MM5. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM5. - -**/ -VOID -EFIAPI -AsmWriteMm5 ( - IN UINT64 Value - ) -{ - _asm { - movq mm5, qword ptr [Value] - emms - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.nasm deleted file mode 100644 index 8bf690c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm5.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm5.Asm -; -; Abstract: -; -; AsmWriteMm5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm5 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm5) -ASM_PFX(AsmWriteMm5): - movq mm5, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.c deleted file mode 100644 index 28e06b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm6 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #6 (MM6). - - Writes the current value of MM6. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM6. - -**/ -VOID -EFIAPI -AsmWriteMm6 ( - IN UINT64 Value - ) -{ - _asm { - movq mm6, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.nasm deleted file mode 100644 index 6234135..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm6.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm6.Asm -; -; Abstract: -; -; AsmWriteMm6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm6 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm6) -ASM_PFX(AsmWriteMm6): - movq mm6, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.c deleted file mode 100644 index d7350bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - AsmWriteMm7 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes the current value of 64-bit MMX Register #7 (MM7). - - Writes the current value of MM7. This function is only available on IA32 and - x64. - - @param Value The 64-bit value to write to MM7. - -**/ -VOID -EFIAPI -AsmWriteMm7 ( - IN UINT64 Value - ) -{ - _asm { - movq mm7, qword ptr [Value] - emms - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.nasm deleted file mode 100644 index c4afbe5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMm7.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm7.Asm -; -; Abstract: -; -; AsmWriteMm7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm7 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm7) -ASM_PFX(AsmWriteMm7): - movq mm7, [esp + 4] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c deleted file mode 100644 index 39a792b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - AsmWriteMsr64 function - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Writes a 64-bit value to a Machine Specific Register(MSR), and returns the - value. - - Writes the 64-bit value specified by Value to the MSR specified by Index. The - 64-bit value written to the MSR is returned. No parameter checking is - performed on Index or Value, and some of these may cause CPU exceptions. The - caller must either guarantee that Index and Value are valid, or the caller - must establish proper exception handlers. This function is only available on - IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param Value The 64-bit value to write to the MSR. - - @return Value - -**/ -UINT64 -EFIAPI -AsmWriteMsr64 ( - IN UINT32 Index, - IN UINT64 Value - ) -{ - _asm { - mov edx, dword ptr [Value + 4] - mov eax, dword ptr [Value + 0] - mov ecx, Index - wrmsr - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.nasm deleted file mode 100644 index 4eb9706..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteMsr64.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMsr64.Asm -; -; Abstract: -; -; AsmWriteMsr64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmWriteMsr64 ( -; IN UINT32 Index, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMsr64) -ASM_PFX(AsmWriteMsr64): - mov edx, [esp + 12] - mov eax, [esp + 8] - mov ecx, [esp + 4] - wrmsr - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteTr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteTr.nasm deleted file mode 100644 index 1fc18e1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Ia32/WriteTr.nasm +++ /dev/null @@ -1,36 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2017, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteTr.nasm -; -; Abstract: -; -; Write TR register -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; AsmWriteTr ( -; UINT16 Selector -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteTr) -ASM_PFX(AsmWriteTr): - mov eax, [esp+4] - ltr ax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU32.c deleted file mode 100644 index 573c30c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU32.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits - with the high bits that were rotated. - - This function rotates the 32-bit value Operand to the left by Count bits. The - low Count bits are fill with the high Count bits of Operand. The rotated - value is returned. - - If Count is greater than 31, then ASSERT(). - - @param Operand The 32-bit operand to rotate left. - @param Count The number of bits to rotate left. - - @return Operand << Count - -**/ -UINT32 -EFIAPI -LRotU32 ( - IN UINT32 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 32); - return (Operand << Count) | (Operand >> (32 - Count)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU64.c deleted file mode 100644 index c938456..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LRotU64.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits - with the high bits that were rotated. - - This function rotates the 64-bit value Operand to the left by Count bits. The - low Count bits are fill with the high Count bits of Operand. The rotated - value is returned. - - If Count is greater than 63, then ASSERT(). - - @param Operand The 64-bit operand to rotate left. - @param Count The number of bits to rotate left. - - @return Operand << Count - -**/ -UINT64 -EFIAPI -LRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 64); - return InternalMathLRotU64 (Operand, Count); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LShiftU64.c deleted file mode 100644 index e3be23f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LShiftU64.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled - with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the left by Count bits. The - low Count bits are set to zero. The shifted value is returned. - - If Count is greater than 63, then ASSERT(). - - @param Operand The 64-bit operand to shift left. - @param Count The number of bits to shift left. - - @return Operand << Count. - -**/ -UINT64 -EFIAPI -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 64); - return InternalMathLShiftU64 (Operand, Count); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LinkedList.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LinkedList.c deleted file mode 100644 index 0c7cd83..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LinkedList.c +++ /dev/null @@ -1,605 +0,0 @@ -/** @file - Linked List Library Functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - If PcdVerifyNodeInList is TRUE, ASSERTs when SecondEntry is or is not part of - the same doubly-linked list as FirstEntry depending on the value of InList. - Independent of PcdVerifyNodeInList, ASSERTs when FirstEntry is not part of a - valid list. - - If FirstEntry is NULL, then ASSERT(). - If FirstEntry->ForwardLink is NULL, then ASSERT(). - If FirstEntry->BackLink is NULL, then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and List contains more than - PcdMaximumLinkedListLength nodes, then ASSERT(). - If PcdVerifyNodeInList is TRUE and SecondEntry is NULL, then ASSERT(). - - @param FirstEntry A pointer to a node in a linked list. - @param SecondEntry A pointer to the node to locate. - @param InList Defines whether to check if SecondEntry is or is not part - of the same doubly-linked list as FirstEntry. - -**/ -#if !defined (MDEPKG_NDEBUG) - #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) \ - do { \ - if (FeaturePcdGet (PcdVerifyNodeInList)) { \ - ASSERT (InList == IsNodeInList ((FirstEntry), (SecondEntry))); \ - } else { \ - ASSERT (InternalBaseLibIsListValid (FirstEntry)); \ - } \ - } while (FALSE) -#else - #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) -#endif - -/** - Worker function that verifies the validity of this list. - - If List is NULL, then ASSERT(). - If List->ForwardLink is NULL, then ASSERT(). - If List->BackLink is NULL, then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and List contains more than - PcdMaximumLinkedListLength nodes, then ASSERT(). - - @param List A pointer to a node in a linked list. - - @retval TRUE if PcdVerifyNodeInList is FALSE - @retval TRUE if DoMembershipCheck is FALSE - @retval TRUE if PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE - and Node is a member of List. - @retval FALSE if PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE - and Node is in not a member of List. - -**/ -BOOLEAN -EFIAPI -InternalBaseLibIsListValid ( - IN CONST LIST_ENTRY *List - ) -{ - UINTN Count; - CONST LIST_ENTRY *Ptr; - - // - // Test the validity of List and Node - // - ASSERT (List != NULL); - ASSERT (List->ForwardLink != NULL); - ASSERT (List->BackLink != NULL); - - if (PcdGet32 (PcdMaximumLinkedListLength) > 0) { - Count = 0; - Ptr = List; - - // - // Count the total number of nodes in List. - // Exit early if the number of nodes in List >= PcdMaximumLinkedListLength - // - do { - Ptr = Ptr->ForwardLink; - Count++; - } while ((Ptr != List) && (Count < PcdGet32 (PcdMaximumLinkedListLength))); - - // - // return whether linked list is too long - // - return (BOOLEAN)(Count < PcdGet32 (PcdMaximumLinkedListLength)); - } - - return TRUE; -} - -/** - Checks whether FirstEntry and SecondEntry are part of the same doubly-linked - list. - - If FirstEntry is NULL, then ASSERT(). - If FirstEntry->ForwardLink is NULL, then ASSERT(). - If FirstEntry->BackLink is NULL, then ASSERT(). - If SecondEntry is NULL, then ASSERT(); - If PcdMaximumLinkedListLength is not zero, and List contains more than - PcdMaximumLinkedListLength nodes, then ASSERT(). - - @param FirstEntry A pointer to a node in a linked list. - @param SecondEntry A pointer to the node to locate. - - @retval TRUE SecondEntry is in the same doubly-linked list as FirstEntry. - @retval FALSE SecondEntry isn't in the same doubly-linked list as FirstEntry, - or FirstEntry is invalid. - -**/ -BOOLEAN -EFIAPI -IsNodeInList ( - IN CONST LIST_ENTRY *FirstEntry, - IN CONST LIST_ENTRY *SecondEntry - ) -{ - UINTN Count; - CONST LIST_ENTRY *Ptr; - - // - // ASSERT List not too long - // - ASSERT (InternalBaseLibIsListValid (FirstEntry)); - - ASSERT (SecondEntry != NULL); - - Count = 0; - Ptr = FirstEntry; - - // - // Check to see if SecondEntry is a member of FirstEntry. - // Exit early if the number of nodes in List >= PcdMaximumLinkedListLength - // - do { - Ptr = Ptr->ForwardLink; - if (PcdGet32 (PcdMaximumLinkedListLength) > 0) { - Count++; - - // - // Return if the linked list is too long - // - if (Count == PcdGet32 (PcdMaximumLinkedListLength)) { - return (BOOLEAN)(Ptr == SecondEntry); - } - } - - if (Ptr == SecondEntry) { - return TRUE; - } - } while (Ptr != FirstEntry); - - return FALSE; -} - -/** - Initializes the head node of a doubly-linked list, and returns the pointer to - the head node of the doubly-linked list. - - Initializes the forward and backward links of a new linked list. After - initializing a linked list with this function, the other linked list - functions may be used to add and remove nodes from the linked list. It is up - to the caller of this function to allocate the memory for ListHead. - - If ListHead is NULL, then ASSERT(). - - @param ListHead A pointer to the head node of a new doubly-linked list. - - @return ListHead - -**/ -LIST_ENTRY * -EFIAPI -InitializeListHead ( - IN OUT LIST_ENTRY *ListHead - ) - -{ - ASSERT (ListHead != NULL); - - ListHead->ForwardLink = ListHead; - ListHead->BackLink = ListHead; - return ListHead; -} - -/** - Adds a node to the beginning of a doubly-linked list, and returns the pointer - to the head node of the doubly-linked list. - - Adds the node Entry at the beginning of the doubly-linked list denoted by - ListHead, and returns ListHead. - - If ListHead is NULL, then ASSERT(). - If Entry is NULL, then ASSERT(). - If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and prior to insertion the number - of nodes in ListHead, including the ListHead node, is greater than or - equal to PcdMaximumLinkedListLength, then ASSERT(). - - @param ListHead A pointer to the head node of a doubly-linked list. - @param Entry A pointer to a node that is to be inserted at the beginning - of a doubly-linked list. - - @return ListHead - -**/ -LIST_ENTRY * -EFIAPI -InsertHeadList ( - IN OUT LIST_ENTRY *ListHead, - IN OUT LIST_ENTRY *Entry - ) -{ - // - // ASSERT List not too long and Entry is not one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE); - - Entry->ForwardLink = ListHead->ForwardLink; - Entry->BackLink = ListHead; - Entry->ForwardLink->BackLink = Entry; - ListHead->ForwardLink = Entry; - return ListHead; -} - -/** - Adds a node to the end of a doubly-linked list, and returns the pointer to - the head node of the doubly-linked list. - - Adds the node Entry to the end of the doubly-linked list denoted by ListHead, - and returns ListHead. - - If ListHead is NULL, then ASSERT(). - If Entry is NULL, then ASSERT(). - If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and prior to insertion the number - of nodes in ListHead, including the ListHead node, is greater than or - equal to PcdMaximumLinkedListLength, then ASSERT(). - - @param ListHead A pointer to the head node of a doubly-linked list. - @param Entry A pointer to a node that is to be added at the end of the - doubly-linked list. - - @return ListHead - -**/ -LIST_ENTRY * -EFIAPI -InsertTailList ( - IN OUT LIST_ENTRY *ListHead, - IN OUT LIST_ENTRY *Entry - ) -{ - // - // ASSERT List not too long and Entry is not one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE); - - Entry->ForwardLink = ListHead; - Entry->BackLink = ListHead->BackLink; - Entry->BackLink->ForwardLink = Entry; - ListHead->BackLink = Entry; - return ListHead; -} - -/** - Retrieves the first node of a doubly-linked list. - - Returns the first node of a doubly-linked list. List must have been - initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). - If List is empty, then List is returned. - - If List is NULL, then ASSERT(). - If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes - in List, including the List node, is greater than or equal to - PcdMaximumLinkedListLength, then ASSERT(). - - @param List A pointer to the head node of a doubly-linked list. - - @return The first node of a doubly-linked list. - @retval List The list is empty. - -**/ -LIST_ENTRY * -EFIAPI -GetFirstNode ( - IN CONST LIST_ENTRY *List - ) -{ - // - // ASSERT List not too long - // - ASSERT (InternalBaseLibIsListValid (List)); - - return List->ForwardLink; -} - -/** - Retrieves the next node of a doubly-linked list. - - Returns the node of a doubly-linked list that follows Node. - List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE() - or InitializeListHead(). If List is empty, then List is returned. - - If List is NULL, then ASSERT(). - If Node is NULL, then ASSERT(). - If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and List contains more than - PcdMaximumLinkedListLength nodes, then ASSERT(). - If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). - - @param List A pointer to the head node of a doubly-linked list. - @param Node A pointer to a node in the doubly-linked list. - - @return A pointer to the next node if one exists. Otherwise List is returned. - -**/ -LIST_ENTRY * -EFIAPI -GetNextNode ( - IN CONST LIST_ENTRY *List, - IN CONST LIST_ENTRY *Node - ) -{ - // - // ASSERT List not too long and Node is one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE); - - return Node->ForwardLink; -} - -/** - Retrieves the previous node of a doubly-linked list. - - Returns the node of a doubly-linked list that precedes Node. - List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE() - or InitializeListHead(). If List is empty, then List is returned. - - If List is NULL, then ASSERT(). - If Node is NULL, then ASSERT(). - If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and List contains more than - PcdMaximumLinkedListLength nodes, then ASSERT(). - If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). - - @param List A pointer to the head node of a doubly-linked list. - @param Node A pointer to a node in the doubly-linked list. - - @return A pointer to the previous node if one exists. Otherwise List is returned. - -**/ -LIST_ENTRY * -EFIAPI -GetPreviousNode ( - IN CONST LIST_ENTRY *List, - IN CONST LIST_ENTRY *Node - ) -{ - // - // ASSERT List not too long and Node is one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE); - - return Node->BackLink; -} - -/** - Checks to see if a doubly-linked list is empty or not. - - Checks to see if the doubly-linked list is empty. If the linked list contains - zero nodes, this function returns TRUE. Otherwise, it returns FALSE. - - If ListHead is NULL, then ASSERT(). - If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes - in List, including the List node, is greater than or equal to - PcdMaximumLinkedListLength, then ASSERT(). - - @param ListHead A pointer to the head node of a doubly-linked list. - - @retval TRUE The linked list is empty. - @retval FALSE The linked list is not empty. - -**/ -BOOLEAN -EFIAPI -IsListEmpty ( - IN CONST LIST_ENTRY *ListHead - ) -{ - // - // ASSERT List not too long - // - ASSERT (InternalBaseLibIsListValid (ListHead)); - - return (BOOLEAN)(ListHead->ForwardLink == ListHead); -} - -/** - Determines if a node in a doubly-linked list is the head node of a the same - doubly-linked list. This function is typically used to terminate a loop that - traverses all the nodes in a doubly-linked list starting with the head node. - - Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the - nodes in the doubly-linked list specified by List. List must have been - initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). - - If List is NULL, then ASSERT(). - If Node is NULL, then ASSERT(). - If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), - then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes - in List, including the List node, is greater than or equal to - PcdMaximumLinkedListLength, then ASSERT(). - If PcdVerifyNodeInList is TRUE and Node is not a node in List and Node is not - equal to List, then ASSERT(). - - @param List A pointer to the head node of a doubly-linked list. - @param Node A pointer to a node in the doubly-linked list. - - @retval TRUE Node is the head of the doubly-linked list pointed by List. - @retval FALSE Node is not the head of the doubly-linked list pointed by List. - -**/ -BOOLEAN -EFIAPI -IsNull ( - IN CONST LIST_ENTRY *List, - IN CONST LIST_ENTRY *Node - ) -{ - // - // ASSERT List not too long and Node is one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE); - - return (BOOLEAN)(Node == List); -} - -/** - Determines if a node the last node in a doubly-linked list. - - Returns TRUE if Node is the last node in the doubly-linked list specified by - List. Otherwise, FALSE is returned. List must have been initialized with - INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). - - If List is NULL, then ASSERT(). - If Node is NULL, then ASSERT(). - If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or - InitializeListHead(), then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes - in List, including the List node, is greater than or equal to - PcdMaximumLinkedListLength, then ASSERT(). - If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT(). - - @param List A pointer to the head node of a doubly-linked list. - @param Node A pointer to a node in the doubly-linked list. - - @retval TRUE Node is the last node in the linked list. - @retval FALSE Node is not the last node in the linked list. - -**/ -BOOLEAN -EFIAPI -IsNodeAtEnd ( - IN CONST LIST_ENTRY *List, - IN CONST LIST_ENTRY *Node - ) -{ - // - // ASSERT List not too long and Node is one of the nodes of List - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE); - - return (BOOLEAN)(!IsNull (List, Node) && List->BackLink == Node); -} - -/** - Swaps the location of two nodes in a doubly-linked list, and returns the - first node after the swap. - - If FirstEntry is identical to SecondEntry, then SecondEntry is returned. - Otherwise, the location of the FirstEntry node is swapped with the location - of the SecondEntry node in a doubly-linked list. SecondEntry must be in the - same double linked list as FirstEntry and that double linked list must have - been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). - SecondEntry is returned after the nodes are swapped. - - If FirstEntry is NULL, then ASSERT(). - If SecondEntry is NULL, then ASSERT(). - If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the - same linked list, then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes in the - linked list containing the FirstEntry and SecondEntry nodes, including - the FirstEntry and SecondEntry nodes, is greater than or equal to - PcdMaximumLinkedListLength, then ASSERT(). - - @param FirstEntry A pointer to a node in a linked list. - @param SecondEntry A pointer to another node in the same linked list. - - @return SecondEntry. - -**/ -LIST_ENTRY * -EFIAPI -SwapListEntries ( - IN OUT LIST_ENTRY *FirstEntry, - IN OUT LIST_ENTRY *SecondEntry - ) -{ - LIST_ENTRY *Ptr; - - if (FirstEntry == SecondEntry) { - return SecondEntry; - } - - // - // ASSERT Entry1 and Entry2 are in the same linked list - // - ASSERT_VERIFY_NODE_IN_VALID_LIST (FirstEntry, SecondEntry, TRUE); - - // - // Ptr is the node pointed to by FirstEntry->ForwardLink - // - Ptr = RemoveEntryList (FirstEntry); - - // - // If FirstEntry immediately follows SecondEntry, FirstEntry will be placed - // immediately in front of SecondEntry - // - if (Ptr->BackLink == SecondEntry) { - return InsertTailList (SecondEntry, FirstEntry); - } - - // - // Ptr == SecondEntry means SecondEntry immediately follows FirstEntry, - // then there are no further steps necessary - // - if (Ptr == InsertHeadList (SecondEntry, FirstEntry)) { - return Ptr; - } - - // - // Move SecondEntry to the front of Ptr - // - RemoveEntryList (SecondEntry); - InsertTailList (Ptr, SecondEntry); - return SecondEntry; -} - -/** - Removes a node from a doubly-linked list, and returns the node that follows - the removed node. - - Removes the node Entry from a doubly-linked list. It is up to the caller of - this function to release the memory used by this node if that is required. On - exit, the node following Entry in the doubly-linked list is returned. If - Entry is the only node in the linked list, then the head node of the linked - list is returned. - - If Entry is NULL, then ASSERT(). - If Entry is the head node of an empty list, then ASSERT(). - If PcdMaximumLinkedListLength is not zero, and the number of nodes in the - linked list containing Entry, including the Entry node, is greater than - or equal to PcdMaximumLinkedListLength, then ASSERT(). - - @param Entry A pointer to a node in a linked list. - - @return Entry. - -**/ -LIST_ENTRY * -EFIAPI -RemoveEntryList ( - IN CONST LIST_ENTRY *Entry - ) -{ - ASSERT (!IsListEmpty (Entry)); - - Entry->ForwardLink->BackLink = Entry->BackLink; - Entry->BackLink->ForwardLink = Entry->ForwardLink; - return Entry->ForwardLink; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LongJump.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LongJump.c deleted file mode 100644 index f432cfd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LongJump.c +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Long Jump functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Restores the CPU context that was saved with SetJump(). - - Restores the CPU context from the buffer specified by JumpBuffer. This - function never returns to the caller. Instead is resumes execution based on - the state of JumpBuffer. - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - If Value is 0, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - @param Value The value to return when the SetJump() context is - restored and must be non-zero. - -**/ -VOID -EFIAPI -LongJump ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, - IN UINTN Value - ) -{ - InternalAssertJumpBuffer (JumpBuffer); - ASSERT (Value != 0); - - InternalLongJump (JumpBuffer, Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet32.c deleted file mode 100644 index b613cd2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet32.c +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the bit position of the lowest bit set in a 32-bit value. - - This function computes the bit position of the lowest bit set in the 32-bit - value specified by Operand. If Operand is zero, then -1 is returned. - Otherwise, a value between 0 and 31 is returned. - - @param Operand The 32-bit operand to evaluate. - - @retval 0..31 The lowest bit set in Operand was found. - @retval -1 Operand is zero. - -**/ -INTN -EFIAPI -LowBitSet32 ( - IN UINT32 Operand - ) -{ - INTN BitIndex; - - if (Operand == 0) { - return -1; - } - - for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1); - return BitIndex; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet64.c deleted file mode 100644 index 911fbda..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/LowBitSet64.c +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Returns the bit position of the lowest bit set in a 64-bit value. - - This function computes the bit position of the lowest bit set in the 64-bit - value specified by Operand. If Operand is zero, then -1 is returned. - Otherwise, a value between 0 and 63 is returned. - - @param Operand The 64-bit operand to evaluate. - - @retval 0..63 The lowest bit set in Operand was found. - @retval -1 Operand is zero. - - -**/ -INTN -EFIAPI -LowBitSet64 ( - IN UINT64 Operand - ) -{ - INTN BitIndex; - - if (Operand == 0) { - return -1; - } - - for (BitIndex = 0; - (Operand & 1) == 0; - BitIndex++, Operand = RShiftU64 (Operand, 1)); - return BitIndex; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Math64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Math64.c deleted file mode 100644 index 662d559..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Math64.c +++ /dev/null @@ -1,368 +0,0 @@ -/** @file - Leaf math worker functions that require 64-bit arithmetic support from the - compiler. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Shifts a 64-bit integer left between 0 and 63 bits. The low bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the left by Count bits. The - low Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift left. - @param Count The number of bits to shift left. - - @return Operand << Count. - -**/ -UINT64 -EFIAPI -InternalMathLShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - return Operand << Count; -} - -/** - Shifts a 64-bit integer right between 0 and 63 bits. This high bits - are filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to zero. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand >> Count. - -**/ -UINT64 -EFIAPI -InternalMathRShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - return Operand >> Count; -} - -/** - 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. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to bit 63 of Operand. The shifted value is returned. - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand arithmetically shifted right by Count. - -**/ -UINT64 -EFIAPI -InternalMathARShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - INTN TestValue; - - // - // Test if this compiler supports arithmetic shift - // - TestValue = (INTN)((INT64)(1ULL << 63) >> 63); - if (TestValue == -1) { - // - // Arithmetic shift is supported - // - return (UINT64)((INT64)Operand >> Count); - } - - // - // Arithmetic is not supported - // - return (Operand >> Count) | - ((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. - - This function rotates the 64-bit value Operand to the left by Count bits. The - low Count bits are fill with the high Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate left. - @param Count The number of bits to rotate left. - - @return Operand <<< Count. - -**/ -UINT64 -EFIAPI -InternalMathLRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - return (Operand << Count) | (Operand >> (64 - Count)); -} - -/** - Rotates a 64-bit integer right between 0 and 63 bits, filling - the high bits with the high low bits that were rotated. - - This function rotates the 64-bit value Operand to the right by Count bits. - The high Count bits are fill with the low Count bits of Operand. The rotated - value is returned. - - @param Operand The 64-bit operand to rotate right. - @param Count The number of bits to rotate right. - - @return Operand >>> Count. - -**/ -UINT64 -EFIAPI -InternalMathRRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - return (Operand >> Count) | (Operand << (64 - Count)); -} - -/** - Switches the endianess of a 64-bit integer. - - This function swaps the bytes in a 64-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Operand A 64-bit unsigned value. - - @return The byte swapped Operand. - -**/ -UINT64 -EFIAPI -InternalMathSwapBytes64 ( - IN UINT64 Operand - ) -{ - UINT64 LowerBytes; - UINT64 HigherBytes; - - LowerBytes = (UINT64) SwapBytes32 ((UINT32) Operand); - HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32)); - - return (LowerBytes << 32 | HigherBytes); -} - -/** - Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer - and generates a 64-bit unsigned result. - - This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 32-bit unsigned value. - - @return Multiplicand * Multiplier - -**/ -UINT64 -EFIAPI -InternalMathMultU64x32 ( - 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. - - This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 64-bit unsigned value. - - @return Multiplicand * Multiplier. - -**/ -UINT64 -EFIAPI -InternalMathMultU64x64 ( - IN UINT64 Multiplicand, - IN UINT64 Multiplier - ) -{ - return Multiplicand * Multiplier; -} - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. This - function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend / Divisor. - -**/ -UINT64 -EFIAPI -InternalMathDivU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - return Dividend / Divisor; -} - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 32-bit remainder. This function - returns the 32-bit unsigned remainder. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend % Divisor. - -**/ -UINT32 -EFIAPI -InternalMathModU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - return (UINT32)(Dividend % Divisor); -} - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result and an optional 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 32-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - @param Remainder A pointer to a 32-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor. - -**/ -UINT64 -EFIAPI -InternalMathDivRemU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor, - OUT UINT32 *Remainder OPTIONAL - ) -{ - if (Remainder != NULL) { - *Remainder = (UINT32)(Dividend % Divisor); - } - return Dividend / Divisor; -} - -/** - Divides a 64-bit unsigned integer by a 64-bit unsigned integer and - generates a 64-bit unsigned result and an optional 64-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. - - @param Dividend A 64-bit unsigned value. - @param Divisor A 64-bit unsigned value. - @param Remainder A pointer to a 64-bit unsigned value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor - -**/ -UINT64 -EFIAPI -InternalMathDivRemU64x64 ( - IN UINT64 Dividend, - IN UINT64 Divisor, - OUT UINT64 *Remainder OPTIONAL - ) -{ - if (Remainder != NULL) { - *Remainder = Dividend % Divisor; - } - return Dividend / Divisor; -} - -/** - Divides a 64-bit signed integer by a 64-bit signed integer and - generates a 64-bit signed result and an optional 64-bit signed remainder. - - This function divides the 64-bit signed value Dividend by the 64-bit - signed value Divisor and generates a 64-bit signed quotient. If Remainder - is not NULL, then the 64-bit signed remainder is returned in Remainder. - This function returns the 64-bit signed quotient. - - @param Dividend A 64-bit signed value. - @param Divisor A 64-bit signed value. - @param Remainder A pointer to a 64-bit signed value. This parameter is - optional and may be NULL. - - @return Dividend / Divisor. - -**/ -INT64 -EFIAPI -InternalMathDivRemS64x64 ( - IN INT64 Dividend, - IN INT64 Divisor, - OUT INT64 *Remainder OPTIONAL - ) -{ - if (Remainder != NULL) { - *Remainder = Dividend % Divisor; - } - return Dividend / Divisor; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ModU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ModU64x32.c deleted file mode 100644 index 57c3e41..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/ModU64x32.c +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates - a 32-bit unsigned remainder. - - This function divides the 64-bit unsigned value Dividend by the 32-bit - unsigned value Divisor and generates a 32-bit remainder. This function - returns the 32-bit unsigned remainder. - - If Divisor is 0, then ASSERT(). - - @param Dividend A 64-bit unsigned value. - @param Divisor A 32-bit unsigned value. - - @return Dividend % Divisor. - -**/ -UINT32 -EFIAPI -ModU64x32 ( - IN UINT64 Dividend, - IN UINT32 Divisor - ) -{ - ASSERT (Divisor != 0); - return InternalMathModU64x32 (Dividend, Divisor); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultS64x64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultS64x64.c deleted file mode 100644 index c953b0d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultS64x64.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Multiplies a 64-bit signed integer by a 64-bit signed integer and generates a - 64-bit signed result. - - This function multiplies the 64-bit signed value Multiplicand by the 64-bit - signed value Multiplier and generates a 64-bit signed result. This 64-bit - signed result is returned. - - @param Multiplicand A 64-bit signed value. - @param Multiplier A 64-bit signed value. - - @return Multiplicand * Multiplier. - -**/ -INT64 -EFIAPI -MultS64x64 ( - IN INT64 Multiplicand, - IN INT64 Multiplier - ) -{ - return (INT64)MultU64x64 ((UINT64) Multiplicand, (UINT64) Multiplier); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x32.c deleted file mode 100644 index 1c49106..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x32.c +++ /dev/null @@ -1,46 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer and - generates a 64-bit unsigned result. - - This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 32-bit unsigned value. - - @return Multiplicand * Multiplier. - -**/ -UINT64 -EFIAPI -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINT32 Multiplier - ) -{ - UINT64 Result; - - Result = InternalMathMultU64x32 (Multiplicand, Multiplier); - - return Result; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x64.c deleted file mode 100644 index fee7f00..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/MultU64x64.c +++ /dev/null @@ -1,46 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer and - generates a 64-bit unsigned result. - - This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit - unsigned value Multiplier and generates a 64-bit unsigned result. This 64- - bit unsigned result is returned. - - @param Multiplicand A 64-bit unsigned value. - @param Multiplier A 64-bit unsigned value. - - @return Multiplicand * Multiplier. - -**/ -UINT64 -EFIAPI -MultU64x64 ( - IN UINT64 Multiplicand, - IN UINT64 Multiplier - ) -{ - UINT64 Result; - - Result = InternalMathMultU64x64 (Multiplicand, Multiplier); - - return Result; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU32.c deleted file mode 100644 index 64fdd76..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU32.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits - with the low bits that were rotated. - - This function rotates the 32-bit value Operand to the right by Count bits. - The high Count bits are fill with the low Count bits of Operand. The rotated - value is returned. - - If Count is greater than 31, then ASSERT(). - - @param Operand The 32-bit operand to rotate right. - @param Count The number of bits to rotate right. - - @return Operand >> Count. - -**/ -UINT32 -EFIAPI -RRotU32 ( - IN UINT32 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 32); - return (Operand >> Count) | (Operand << (32 - Count)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU64.c deleted file mode 100644 index 28fdf41..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RRotU64.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits - with the high low bits that were rotated. - - This function rotates the 64-bit value Operand to the right by Count bits. - The high Count bits are fill with the low Count bits of Operand. The rotated - value is returned. - - If Count is greater than 63, then ASSERT(). - - @param Operand The 64-bit operand to rotate right. - @param Count The number of bits to rotate right. - - @return Operand >> Count. - -**/ -UINT64 -EFIAPI -RRotU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 64); - return InternalMathRRotU64 (Operand, Count); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RShiftU64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RShiftU64.c deleted file mode 100644 index 3494c32..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/RShiftU64.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Shifts a 64-bit integer right between 0 and 63 bits. This high bits are - filled with zeros. The shifted value is returned. - - This function shifts the 64-bit value Operand to the right by Count bits. The - high Count bits are set to zero. The shifted value is returned. - - If Count is greater than 63, then ASSERT(). - - @param Operand The 64-bit operand to shift right. - @param Count The number of bits to shift right. - - @return Operand >> Count. - -**/ -UINT64 -EFIAPI -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -{ - ASSERT (Count < 64); - return InternalMathRShiftU64 (Operand, Count); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SafeString.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SafeString.c deleted file mode 100644 index baf6e41..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SafeString.c +++ /dev/null @@ -1,3650 +0,0 @@ -/** @file - Safe String functions. - - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -#define RSIZE_MAX (PcdGet32 (PcdMaximumUnicodeStringLength)) - -#define ASCII_RSIZE_MAX (PcdGet32 (PcdMaximumAsciiStringLength)) - -#define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \ - do { \ - ASSERT (Expression); \ - if (!(Expression)) { \ - return Status; \ - } \ - } while (FALSE) - -/** - Returns if 2 memory blocks are overlapped. - - @param Base1 Base address of 1st memory block. - @param Size1 Size of 1st memory block. - @param Base2 Base address of 2nd memory block. - @param Size2 Size of 2nd memory block. - - @retval TRUE 2 memory blocks are overlapped. - @retval FALSE 2 memory blocks are not overlapped. -**/ -BOOLEAN -InternalSafeStringIsOverlap ( - 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))) { - return TRUE; - } - return FALSE; -} - -/** - Returns if 2 Unicode strings are not overlapped. - - @param Str1 Start address of 1st Unicode string. - @param Size1 The number of char in 1st Unicode string, - including terminating null char. - @param Str2 Start address of 2nd Unicode string. - @param Size2 The number of char in 2nd Unicode string, - including terminating null char. - - @retval TRUE 2 Unicode strings are NOT overlapped. - @retval FALSE 2 Unicode strings are overlapped. -**/ -BOOLEAN -InternalSafeStringNoStrOverlap ( - IN CHAR16 *Str1, - IN UINTN Size1, - IN CHAR16 *Str2, - IN UINTN Size2 - ) -{ - return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16)); -} - -/** - Returns if 2 Ascii strings are not overlapped. - - @param Str1 Start address of 1st Ascii string. - @param Size1 The number of char in 1st Ascii string, - including terminating null char. - @param Str2 Start address of 2nd Ascii string. - @param Size2 The number of char in 2nd Ascii string, - including terminating null char. - - @retval TRUE 2 Ascii strings are NOT overlapped. - @retval FALSE 2 Ascii strings are overlapped. -**/ -BOOLEAN -InternalSafeStringNoAsciiStrOverlap ( - IN CHAR8 *Str1, - IN UINTN Size1, - IN CHAR8 *Str2, - IN UINTN Size2 - ) -{ - return !InternalSafeStringIsOverlap (Str1, Size1, Str2, Size2); -} - -/** - Returns the length of a Null-terminated Unicode string. - - This function is similar as strlen_s defined in C11. - - If String is not aligned on a 16-bit boundary, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - @param MaxSize The maximum number of Destination Unicode - char, including terminating null char. - - @retval 0 If String is NULL. - @retval MaxSize If there is no null character in the first MaxSize characters of String. - @return The number of characters that percede the terminating null character. - -**/ -UINTN -EFIAPI -StrnLenS ( - IN CONST CHAR16 *String, - IN UINTN MaxSize - ) -{ - UINTN Length; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero. - // - if ((String == NULL) || (MaxSize == 0)) { - return 0; - } - - // - // Otherwise, the StrnLenS function returns the number of characters that precede the - // terminating null character. If there is no null character in the first MaxSize characters of - // String then StrnLenS returns MaxSize. At most the first MaxSize characters of String shall - // be accessed by StrnLenS. - // - Length = 0; - while (String[Length] != 0) { - if (Length >= MaxSize - 1) { - return MaxSize; - } - Length++; - } - return Length; -} - -/** - Returns the size of a Null-terminated Unicode string in bytes, including the - Null terminator. - - This function returns the size of the Null-terminated Unicode string - specified by String in bytes, including the Null terminator. - - If String is not aligned on a 16-bit boundary, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - @param MaxSize The maximum number of Destination Unicode - char, including the Null terminator. - - @retval 0 If String is NULL. - @retval (sizeof (CHAR16) * (MaxSize + 1)) - If there is no Null terminator in the first MaxSize characters of - String. - @return The size of the Null-terminated Unicode string in bytes, including - the Null terminator. - -**/ -UINTN -EFIAPI -StrnSizeS ( - IN CONST CHAR16 *String, - IN UINTN MaxSize - ) -{ - // - // If String is a null pointer, then the StrnSizeS function returns zero. - // - if (String == NULL) { - return 0; - } - - // - // Otherwise, the StrnSizeS function returns the size of the Null-terminated - // Unicode string in bytes, including the Null terminator. If there is no - // Null terminator in the first MaxSize characters of String, then StrnSizeS - // returns (sizeof (CHAR16) * (MaxSize + 1)) to keep a consistent map with - // the StrnLenS function. - // - return (StrnLenS (String, MaxSize) + 1) * sizeof (*String); -} - -/** - Copies the string pointed to by Source (including the terminating null char) - to the array pointed to by Destination. - - This function is similar as strcpy_s defined in C11. - - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode - char, including terminating null char. - @param Source A pointer to a Null-terminated Unicode string. - - @retval RETURN_SUCCESS String is copied. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -StrCpyS ( - OUT CHAR16 *Destination, - IN UINTN DestMax, - IN CONST CHAR16 *Source - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than StrnLenS(Source, DestMax). - // - SourceLen = StrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 5. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The StrCpyS function copies the string pointed to by Source (including the terminating - // null character) into the array pointed to by Destination. - // - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Copies not more than Length successive char from the string pointed to by - Source to the array pointed to by Destination. If no null char is copied from - Source, then Destination[Length] is always set to null. - - This function is similar as strncpy_s defined in C11. - - If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode - char, including terminating null char. - @param Source A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to copy. - - @retval RETURN_SUCCESS String is copied. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than - MIN(StrLen(Source), Length). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -StrnCpyS ( - OUT CHAR16 *Destination, - IN UINTN DestMax, - IN CONST CHAR16 *Source, - IN UINTN Length - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither DestMax nor Length shall be greater than RSIZE_MAX - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. If Length is not less than DestMax, then DestMax shall be greater than StrnLenS(Source, DestMax). - // - SourceLen = StrnLenS (Source, MIN (DestMax, Length)); - if (Length >= DestMax) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 5. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The StrnCpyS function copies not more than Length successive characters (characters that - // follow a null character are not copied) from the array pointed to by Source to the array - // pointed to by Destination. If no null character was copied from Source, then Destination[Length] is set to a null - // character. - // - while ((SourceLen > 0) && (*Source != 0)) { - *(Destination++) = *(Source++); - SourceLen--; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Appends a copy of the string pointed to by Source (including the terminating - null char) to the end of the string pointed to by Destination. - - This function is similar as strcat_s defined in C11. - - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode - char, including terminating null char. - @param Source A pointer to a Null-terminated Unicode string. - - @retval RETURN_SUCCESS String is appended. - @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than - StrLen(Destination). - @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT - greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -StrCatS ( - IN OUT CHAR16 *Destination, - IN UINTN DestMax, - IN CONST CHAR16 *Source - ) -{ - UINTN DestLen; - UINTN CopyLen; - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrCatS. - // - DestLen = StrnLenS (Destination, DestMax); - CopyLen = DestMax - DestLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. CopyLen shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE); - - // - // 5. CopyLen shall be greater than StrnLenS(Source, CopyLen). - // - SourceLen = StrnLenS (Source, CopyLen); - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 6. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The StrCatS function appends a copy of the string pointed to by Source (including the - // terminating null character) to the end of the string pointed to by Destination. The initial character - // from Source overwrites the null character at the end of Destination. - // - Destination = Destination + DestLen; - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Appends not more than Length successive char from the string pointed to by - Source to the end of the string pointed to by Destination. If no null char is - copied from Source, then Destination[StrLen(Destination) + Length] is always - set to null. - - This function is similar as strncat_s defined in C11. - - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode - char, including terminating null char. - @param Source A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to copy. - - @retval RETURN_SUCCESS String is appended. - @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than - StrLen(Destination). - @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT - greater than MIN(StrLen(Source), Length). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -StrnCatS ( - IN OUT CHAR16 *Destination, - IN UINTN DestMax, - IN CONST CHAR16 *Source, - IN UINTN Length - ) -{ - UINTN DestLen; - UINTN CopyLen; - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrnCatS. - // - DestLen = StrnLenS (Destination, DestMax); - CopyLen = DestMax - DestLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither DestMax nor Length shall be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. CopyLen shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE); - - // - // 5. If Length is not less than CopyLen, then CopyLen shall be greater than StrnLenS(Source, CopyLen). - // - SourceLen = StrnLenS (Source, MIN (CopyLen, Length)); - if (Length >= CopyLen) { - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 6. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The StrnCatS function appends not more than Length successive characters (characters - // that follow a null character are not copied) from the array pointed to by Source to the end of - // the string pointed to by Destination. The initial character from Source overwrites the null character at - // the end of Destination. If no null character was copied from Source, then Destination[DestMax-CopyLen+Length] is set to - // a null character. - // - Destination = Destination + DestLen; - while ((SourceLen > 0) && (*Source != 0)) { - *(Destination++) = *(Source++); - SourceLen--; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode decimal string to a value of type UINTN. - - This function outputs a value of type UINTN by interpreting the contents of - the Unicode string specified by String as a decimal number. The format of the - input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before - [decimal digits]. The running zero in the beginning of [decimal digits] will - be ignored. Then, the function stops at the first character that is a not a - valid decimal character or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid decimal digits in the above format, then 0 is stored - at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINTN, then - MAX_UINTN is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - decimal digits right after the optional pad spaces, the value of String is - stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINTN. - -**/ -RETURN_STATUS -EFIAPI -StrDecimalToUintnS ( - IN CONST CHAR16 *String, - OUT CHAR16 **EndPointer, OPTIONAL - OUT UINTN *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - *Data = 0; - - while (InternalIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINTN, then MAX_UINTN is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINTN - (*String - L'0')) / 10)) { - *Data = MAX_UINTN; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = *Data * 10 + (*String - L'0'); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode decimal string to a value of type UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Unicode string specified by String as a decimal number. The format of the - input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before - [decimal digits]. The running zero in the beginning of [decimal digits] will - be ignored. Then, the function stops at the first character that is a not a - valid decimal character or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid decimal digits in the above format, then 0 is stored - at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - decimal digits right after the optional pad spaces, the value of String is - stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -EFIAPI -StrDecimalToUint64S ( - IN CONST CHAR16 *String, - OUT CHAR16 **EndPointer, OPTIONAL - OUT UINT64 *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - *Data = 0; - - while (InternalIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > DivU64x32 (MAX_UINT64 - (*String - L'0'), 10)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = MultU64x32 (*Data, 10) + (*String - L'0'); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type - UINTN. - - This function outputs a value of type UINTN by interpreting the contents of - the Unicode string specified by String as a hexadecimal number. The format of - the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab - characters, before [zeros], [x] or [hexadecimal digit]. The running zero - before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts - after [x] or the first valid hexadecimal digit. Then, the function stops at - the first character that is a not a valid hexadecimal character or NULL, - whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid hexadecimal digits in the above format, then 0 is - stored at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINTN, then - MAX_UINTN is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - hexadecimal digits right after the optional pad spaces, the value of String - is stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINTN. - -**/ -RETURN_STATUS -EFIAPI -StrHexToUintnS ( - IN CONST CHAR16 *String, - OUT CHAR16 **EndPointer, OPTIONAL - OUT UINTN *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - if (CharToUpper (*String) == L'X') { - if (*(String - 1) != L'0') { - *Data = 0; - return RETURN_SUCCESS; - } - // - // Skip the 'X' - // - String++; - } - - *Data = 0; - - while (InternalIsHexaDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINTN, then MAX_UINTN is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINTN - InternalHexCharToUintn (*String)) >> 4)) { - *Data = MAX_UINTN; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = (*Data << 4) + InternalHexCharToUintn (*String); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type - UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Unicode string specified by String as a hexadecimal number. The format of - the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab - characters, before [zeros], [x] or [hexadecimal digit]. The running zero - before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts - after [x] or the first valid hexadecimal digit. Then, the function stops at - the first character that is a not a valid hexadecimal character or NULL, - whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid hexadecimal digits in the above format, then 0 is - stored at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - hexadecimal digits right after the optional pad spaces, the value of String - is stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -EFIAPI -StrHexToUint64S ( - IN CONST CHAR16 *String, - OUT CHAR16 **EndPointer, OPTIONAL - OUT UINT64 *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - if (CharToUpper (*String) == L'X') { - if (*(String - 1) != L'0') { - *Data = 0; - return RETURN_SUCCESS; - } - // - // Skip the 'X' - // - String++; - } - - *Data = 0; - - while (InternalIsHexaDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > RShiftU64 (MAX_UINT64 - InternalHexCharToUintn (*String), 4)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = LShiftU64 (*Data, 4) + InternalHexCharToUintn (*String); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode string to IPv6 address and prefix length. - - This function outputs a value of type IPv6_ADDRESS and may output a value - of type UINT8 by interpreting the contents of the Unicode string specified - by String. The format of the input Unicode string String is as follows: - - X:X:X:X:X:X:X:X[/P] - - X contains one to four hexadecimal digit characters in the range [0-9], [a-f] and - [A-F]. X is converted to a value of type UINT16, whose low byte is stored in low - memory address and high byte is stored in high memory address. P contains decimal - digit characters in the range [0-9]. The running zero in the beginning of P will - be ignored. /P is optional. - - When /P is not in the String, the function stops at the first character that is - not a valid hexadecimal digit character after eight X's are converted. - - When /P is in the String, the function stops at the first character that is not - a valid decimal digit character after P is converted. - - "::" can be used to compress one or more groups of X when X contains only 0. - The "::" can only appear once in the String. - - If String is NULL, then ASSERT(). - - If Address is NULL, then ASSERT(). - - If String is not aligned in a 16-bit boundary, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If EndPointer is not NULL and Address is translated from String, a pointer - to the character that stopped the scan is stored at the location pointed to - by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Address Pointer to the converted IPv6 address. - @param PrefixLength Pointer to the converted IPv6 address prefix - length. MAX_UINT8 is returned when /P is - not in the String. - - @retval RETURN_SUCCESS Address is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If X contains more than four hexadecimal - digit characters. - If String contains "::" and number of X - is not less than 8. - If P starts with character that is not a - valid decimal digit character. - If the decimal number converted from P - exceeds 128. - -**/ -RETURN_STATUS -EFIAPI -StrToIpv6Address ( - 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; - - LocalPrefixLength = MAX_UINT8; - CompressStart = ARRAY_SIZE (Address->Addr); - ExpectPrefix = FALSE; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER); - - for (Pointer = String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) { - if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer != L':') { - // - // ":" or "/" should be followed by digit characters. - // - return RETURN_UNSUPPORTED; - } - - // - // Meet second ":" after previous ":" or "/" - // or meet first ":" in the beginning of String. - // - if (ExpectPrefix) { - // - // ":" shall not be after "/" - // - return RETURN_UNSUPPORTED; - } - - if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // "::" can only appear once. - // "::" can only appear when address is not full length. - // - return RETURN_UNSUPPORTED; - } else { - // - // Remember the start of zero compressing. - // - CompressStart = AddressIndex; - Pointer++; - - if (CompressStart == 0) { - if (*Pointer != L':') { - // - // Single ":" shall not be in the beginning of String. - // - return RETURN_UNSUPPORTED; - } - Pointer++; - } - } - } - - if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer == L'/') { - // - // Might be optional "/P" after "::". - // - if (CompressStart != AddressIndex) { - return RETURN_UNSUPPORTED; - } - } else { - break; - } - } else { - if (!ExpectPrefix) { - // - // Get X. - // - Status = StrHexToUintnS (Pointer, &End, &Uintn); - 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; - } else { - // - // Get P, then exit the loop. - // - Status = StrDecimalToUintnS (Pointer, &End, &Uintn); - if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) { - // - // Prefix length should not exceed 128. - // - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uintn; - Pointer = End; - break; - } - } - - // - // Skip ':' or "/" - // - if (*Pointer == L'/') { - ExpectPrefix = TRUE; - } else if (*Pointer == L':') { - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // Meet additional ":" after all 8 16-bit address - // - break; - } - } else { - // - // Meet other character that is not "/" or ":" after all 8 16-bit address - // - break; - } - Pointer++; - } - - 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) { - CopyMem ( - &Address->Addr[CompressStart + ARRAY_SIZE (Address->Addr) - AddressIndex], - &LocalAddress.Addr[CompressStart], - AddressIndex - CompressStart - ); - } - - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) Pointer; - } - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode string to IPv4 address and prefix length. - - This function outputs a value of type IPv4_ADDRESS and may output a value - of type UINT8 by interpreting the contents of the Unicode string specified - by String. The format of the input Unicode string String is as follows: - - D.D.D.D[/P] - - D and P are decimal digit characters in the range [0-9]. The running zero in - the beginning of D and P will be ignored. /P is optional. - - When /P is not in the String, the function stops at the first character that is - not a valid decimal digit character after four D's are converted. - - When /P is in the String, the function stops at the first character that is not - a valid decimal digit character after P is converted. - - If String is NULL, then ASSERT(). - - If Address is NULL, then ASSERT(). - - If String is not aligned in a 16-bit boundary, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If EndPointer is not NULL and Address is translated from String, a pointer - to the character that stopped the scan is stored at the location pointed to - by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Address Pointer to the converted IPv4 address. - @param PrefixLength Pointer to the converted IPv4 address prefix - length. MAX_UINT8 is returned when /P is - not in the String. - - @retval RETURN_SUCCESS Address is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If String is not in the correct format. - If any decimal number converted from D - exceeds 255. - If the decimal number converted from P - exceeds 32. - -**/ -RETURN_STATUS -EFIAPI -StrToIpv4Address ( - 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; - - LocalPrefixLength = MAX_UINT8; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - 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;) { - if (!InternalIsDecimalDigitCharacter (*Pointer)) { - // - // D or P contains invalid characters. - // - break; - } - - // - // Get D or P. - // - Status = StrDecimalToUintnS ((CONST CHAR16 *) Pointer, &Pointer, &Uintn); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // It's P. - // - if (Uintn > 32) { - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uintn; - } else { - // - // It's D. - // - if (Uintn > MAX_UINT8) { - return RETURN_UNSUPPORTED; - } - LocalAddress.Addr[AddressIndex] = (UINT8) Uintn; - AddressIndex++; - } - - // - // Check the '.' or '/', depending on the AddressIndex. - // - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - if (*Pointer == L'/') { - // - // '/P' is in the String. - // Skip "/" and get P in next loop. - // - Pointer++; - } else { - // - // '/P' is not in the String. - // - break; - } - } else if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - if (*Pointer == L'.') { - // - // D should be followed by '.' - // - Pointer++; - } else { - return RETURN_UNSUPPORTED; - } - } - } - - if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - return RETURN_UNSUPPORTED; - } - - CopyMem (Address, &LocalAddress, sizeof (*Address)); - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = Pointer; - } - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode GUID string to a value of type - EFI_GUID. - - This function outputs a GUID value by interpreting the contents of - the Unicode string specified by String. The format of the input - Unicode string String consists of 36 characters, as follows: - - aabbccdd-eeff-gghh-iijj-kkllmmnnoopp - - The pairs aa - pp are two characters in the range [0-9], [a-f] and - [A-F], with each pair representing a single byte hexadecimal value. - - The mapping between String and the EFI_GUID structure is as follows: - aa Data1[24:31] - bb Data1[16:23] - cc Data1[8:15] - dd Data1[0:7] - ee Data2[8:15] - ff Data2[0:7] - gg Data3[8:15] - hh Data3[0:7] - ii Data4[0:7] - jj Data4[8:15] - kk Data4[16:23] - ll Data4[24:31] - mm Data4[32:39] - nn Data4[40:47] - oo Data4[48:55] - pp Data4[56:63] - - If String is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - - @param String Pointer to a Null-terminated Unicode string. - @param Guid Pointer to the converted GUID. - - @retval RETURN_SUCCESS Guid is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If String is not as the above format. - -**/ -RETURN_STATUS -EFIAPI -StrToGuid ( - IN CONST CHAR16 *String, - OUT GUID *Guid - ) -{ - RETURN_STATUS Status; - GUID LocalGuid; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Guid != NULL), RETURN_INVALID_PARAMETER); - - // - // 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'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1); - 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'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2); - 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'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3); - 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'-') { - return RETURN_UNSUPPORTED; - } - String += 2 * 2 + 1; - - // - // Get kkllmmnnoopp. - // - Status = StrHexToBytes (String, 2 * 6, &LocalGuid.Data4[2], 6); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - CopyGuid (Guid, &LocalGuid); - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a byte array. - - This function outputs a byte array by interpreting the contents of - the Unicode string specified by String in hexadecimal format. The format of - the input Unicode string String is: - - [XX]* - - X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F]. - The function decodes every two hexadecimal digit characters as one byte. The - decoding stops after Length of characters and outputs Buffer containing - (Length / 2) bytes. - - If String is not aligned in a 16-bit boundary, then ASSERT(). - - If String is NULL, then ASSERT(). - - If Buffer is NULL, then ASSERT(). - - If Length is not multiple of 2, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - - If MaxBufferSize is less than (Length / 2), then ASSERT(). - - @param String Pointer to a Null-terminated Unicode string. - @param Length The number of Unicode characters to decode. - @param Buffer Pointer to the converted bytes array. - @param MaxBufferSize The maximum size of Buffer. - - @retval RETURN_SUCCESS Buffer is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If Length is not multiple of 2. - If PcdMaximumUnicodeStringLength is not zero, - and Length is greater than - PcdMaximumUnicodeStringLength. - @retval RETURN_UNSUPPORTED If Length of characters from String contain - a character that is not valid hexadecimal - digit characters, or a Null-terminator. - @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2). -**/ -RETURN_STATUS -EFIAPI -StrHexToBytes ( - IN CONST CHAR16 *String, - IN UINTN Length, - OUT UINT8 *Buffer, - IN UINTN MaxBufferSize - ) -{ - UINTN Index; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Buffer shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Buffer != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Length shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. Length shall not be odd. - // - SAFE_STRING_CONSTRAINT_CHECK (((Length & BIT0) == 0), RETURN_INVALID_PARAMETER); - - // - // 4. MaxBufferSize shall equal to or greater than Length / 2. - // - SAFE_STRING_CONSTRAINT_CHECK ((MaxBufferSize >= Length / 2), RETURN_BUFFER_TOO_SMALL); - - // - // 5. String shall not contains invalid hexadecimal digits. - // - for (Index = 0; Index < Length; Index++) { - if (!InternalIsHexaDecimalDigitCharacter (String[Index])) { - break; - } - } - if (Index != Length) { - return RETURN_UNSUPPORTED; - } - - // - // Convert the hex string to bytes. - // - 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; - } else { - Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]); - } - } - return RETURN_SUCCESS; -} - -/** - Returns the length of a Null-terminated Ascii string. - - This function is similar as strlen_s defined in C11. - - @param String A pointer to a Null-terminated Ascii string. - @param MaxSize The maximum number of Destination Ascii - char, including terminating null char. - - @retval 0 If String is NULL. - @retval MaxSize If there is no null character in the first MaxSize characters of String. - @return The number of characters that percede the terminating null character. - -**/ -UINTN -EFIAPI -AsciiStrnLenS ( - IN CONST CHAR8 *String, - IN UINTN MaxSize - ) -{ - UINTN Length; - - // - // If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function returns zero. - // - if ((String == NULL) || (MaxSize == 0)) { - return 0; - } - - // - // Otherwise, the AsciiStrnLenS function returns the number of characters that precede the - // terminating null character. If there is no null character in the first MaxSize characters of - // String then AsciiStrnLenS returns MaxSize. At most the first MaxSize characters of String shall - // be accessed by AsciiStrnLenS. - // - Length = 0; - while (String[Length] != 0) { - if (Length >= MaxSize - 1) { - return MaxSize; - } - Length++; - } - return Length; -} - -/** - Returns the size of a Null-terminated Ascii string in bytes, including the - Null terminator. - - This function returns the size of the Null-terminated Ascii string specified - by String in bytes, including the Null terminator. - - @param String A pointer to a Null-terminated Ascii string. - @param MaxSize The maximum number of Destination Ascii - char, including the Null terminator. - - @retval 0 If String is NULL. - @retval (sizeof (CHAR8) * (MaxSize + 1)) - If there is no Null terminator in the first MaxSize characters of - String. - @return The size of the Null-terminated Ascii string in bytes, including the - Null terminator. - -**/ -UINTN -EFIAPI -AsciiStrnSizeS ( - IN CONST CHAR8 *String, - IN UINTN MaxSize - ) -{ - // - // If String is a null pointer, then the AsciiStrnSizeS function returns - // zero. - // - if (String == NULL) { - return 0; - } - - // - // Otherwise, the AsciiStrnSizeS function returns the size of the - // Null-terminated Ascii string in bytes, including the Null terminator. If - // there is no Null terminator in the first MaxSize characters of String, - // then AsciiStrnSizeS returns (sizeof (CHAR8) * (MaxSize + 1)) to keep a - // consistent map with the AsciiStrnLenS function. - // - return (AsciiStrnLenS (String, MaxSize) + 1) * sizeof (*String); -} - -/** - Copies the string pointed to by Source (including the terminating null char) - to the array pointed to by Destination. - - This function is similar as strcpy_s defined in C11. - - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Ascii string. - @param DestMax The maximum number of Destination Ascii - char, including terminating null char. - @param Source A pointer to a Null-terminated Ascii string. - - @retval RETURN_SUCCESS String is copied. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -AsciiStrCpyS ( - OUT CHAR8 *Destination, - IN UINTN DestMax, - IN CONST CHAR8 *Source - ) -{ - UINTN SourceLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than AsciiStrnLenS(Source, DestMax). - // - SourceLen = AsciiStrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 5. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The AsciiStrCpyS function copies the string pointed to by Source (including the terminating - // null character) into the array pointed to by Destination. - // - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Copies not more than Length successive char from the string pointed to by - Source to the array pointed to by Destination. If no null char is copied from - Source, then Destination[Length] is always set to null. - - This function is similar as strncpy_s defined in C11. - - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Ascii string. - @param DestMax The maximum number of Destination Ascii - char, including terminating null char. - @param Source A pointer to a Null-terminated Ascii string. - @param Length The maximum number of Ascii characters to copy. - - @retval RETURN_SUCCESS String is copied. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than - MIN(StrLen(Source), Length). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -AsciiStrnCpyS ( - OUT CHAR8 *Destination, - IN UINTN DestMax, - IN CONST CHAR8 *Source, - IN UINTN Length - ) -{ - UINTN SourceLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither DestMax nor Length shall be greater than ASCII_RSIZE_MAX - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. If Length is not less than DestMax, then DestMax shall be greater than AsciiStrnLenS(Source, DestMax). - // - SourceLen = AsciiStrnLenS (Source, MIN (DestMax, Length)); - if (Length >= DestMax) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 5. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The AsciiStrnCpyS function copies not more than Length successive characters (characters that - // follow a null character are not copied) from the array pointed to by Source to the array - // pointed to by Destination. If no null character was copied from Source, then Destination[Length] is set to a null - // character. - // - while ((SourceLen > 0) && (*Source != 0)) { - *(Destination++) = *(Source++); - SourceLen--; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Appends a copy of the string pointed to by Source (including the terminating - null char) to the end of the string pointed to by Destination. - - This function is similar as strcat_s defined in C11. - - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Ascii string. - @param DestMax The maximum number of Destination Ascii - char, including terminating null char. - @param Source A pointer to a Null-terminated Ascii string. - - @retval RETURN_SUCCESS String is appended. - @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than - StrLen(Destination). - @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT - greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -AsciiStrCatS ( - IN OUT CHAR8 *Destination, - IN UINTN DestMax, - IN CONST CHAR8 *Source - ) -{ - UINTN DestLen; - UINTN CopyLen; - UINTN SourceLen; - - // - // Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrCatS. - // - DestLen = AsciiStrnLenS (Destination, DestMax); - CopyLen = DestMax - DestLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. CopyLen shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE); - - // - // 5. CopyLen shall be greater than AsciiStrnLenS(Source, CopyLen). - // - SourceLen = AsciiStrnLenS (Source, CopyLen); - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 6. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The AsciiStrCatS function appends a copy of the string pointed to by Source (including the - // terminating null character) to the end of the string pointed to by Destination. The initial character - // from Source overwrites the null character at the end of Destination. - // - Destination = Destination + DestLen; - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Appends not more than Length successive char from the string pointed to by - Source to the end of the string pointed to by Destination. If no null char is - copied from Source, then Destination[StrLen(Destination) + Length] is always - set to null. - - This function is similar as strncat_s defined in C11. - - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Destination A pointer to a Null-terminated Ascii string. - @param DestMax The maximum number of Destination Ascii - char, including terminating null char. - @param Source A pointer to a Null-terminated Ascii string. - @param Length The maximum number of Ascii characters to copy. - - @retval RETURN_SUCCESS String is appended. - @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than - StrLen(Destination). - @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT - greater than MIN(StrLen(Source), Length). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. -**/ -RETURN_STATUS -EFIAPI -AsciiStrnCatS ( - IN OUT CHAR8 *Destination, - IN UINTN DestMax, - IN CONST CHAR8 *Source, - IN UINTN Length - ) -{ - UINTN DestLen; - UINTN CopyLen; - UINTN SourceLen; - - // - // Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrnCatS. - // - DestLen = AsciiStrnLenS (Destination, DestMax); - CopyLen = DestMax - DestLen; - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither DestMax nor Length shall be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. CopyLen shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE); - - // - // 5. If Length is not less than CopyLen, then CopyLen shall be greater than AsciiStrnLenS(Source, CopyLen). - // - SourceLen = AsciiStrnLenS (Source, MIN (CopyLen, Length)); - if (Length >= CopyLen) { - SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 6. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The AsciiStrnCatS function appends not more than Length successive characters (characters - // that follow a null character are not copied) from the array pointed to by Source to the end of - // the string pointed to by Destination. The initial character from Source overwrites the null character at - // the end of Destination. If no null character was copied from Source, then Destination[DestMax-CopyLen+Length] is set to - // a null character. - // - Destination = Destination + DestLen; - while ((SourceLen > 0) && (*Source != 0)) { - *(Destination++) = *(Source++); - SourceLen--; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Ascii decimal string to a value of type UINTN. - - This function outputs a value of type UINTN by interpreting the contents of - the Ascii string specified by String as a decimal number. The format of the - input Ascii string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before - [decimal digits]. The running zero in the beginning of [decimal digits] will - be ignored. Then, the function stops at the first character that is a not a - valid decimal character or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength Ascii characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid decimal digits in the above format, then 0 is stored - at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINTN, then - MAX_UINTN is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - decimal digits right after the optional pad spaces, the value of String is - stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Ascii string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumAsciiStringLength is not zero, - and String contains more than - PcdMaximumAsciiStringLength Ascii - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINTN. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrDecimalToUintnS ( - IN CONST CHAR8 *String, - OUT CHAR8 **EndPointer, OPTIONAL - OUT UINTN *Data - ) -{ - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((AsciiStrnLenS (String, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == ' ') || (*String == '\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == '0') { - String++; - } - - *Data = 0; - - while (InternalAsciiIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINTN, then MAX_UINTN is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINTN - (*String - '0')) / 10)) { - *Data = MAX_UINTN; - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = *Data * 10 + (*String - '0'); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Ascii decimal string to a value of type UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Ascii string specified by String as a decimal number. The format of the - input Ascii string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before - [decimal digits]. The running zero in the beginning of [decimal digits] will - be ignored. Then, the function stops at the first character that is a not a - valid decimal character or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength Ascii characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid decimal digits in the above format, then 0 is stored - at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - decimal digits right after the optional pad spaces, the value of String is - stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Ascii string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumAsciiStringLength is not zero, - and String contains more than - PcdMaximumAsciiStringLength Ascii - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrDecimalToUint64S ( - IN CONST CHAR8 *String, - OUT CHAR8 **EndPointer, OPTIONAL - OUT UINT64 *Data - ) -{ - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((AsciiStrnLenS (String, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == ' ') || (*String == '\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == '0') { - String++; - } - - *Data = 0; - - while (InternalAsciiIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > DivU64x32 (MAX_UINT64 - (*String - '0'), 10)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = MultU64x32 (*Data, 10) + (*String - '0'); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Ascii hexadecimal string to a value of type UINTN. - - This function outputs a value of type UINTN by interpreting the contents of - the Ascii string specified by String as a hexadecimal number. The format of - the input Ascii string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If - "x" appears in the input string, it must be prefixed with at least one 0. The - function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or - [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or - the first valid hexadecimal digit. Then, the function stops at the first - character that is a not a valid hexadecimal character or Null-terminator, - whichever on comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength Ascii characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid hexadecimal digits in the above format, then 0 is - stored at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINTN, then - MAX_UINTN is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - hexadecimal digits right after the optional pad spaces, the value of String - is stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Ascii string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumAsciiStringLength is not zero, - and String contains more than - PcdMaximumAsciiStringLength Ascii - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINTN. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrHexToUintnS ( - IN CONST CHAR8 *String, - OUT CHAR8 **EndPointer, OPTIONAL - OUT UINTN *Data - ) -{ - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((AsciiStrnLenS (String, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == ' ') || (*String == '\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == '0') { - String++; - } - - if (AsciiCharToUpper (*String) == 'X') { - if (*(String - 1) != '0') { - *Data = 0; - return RETURN_SUCCESS; - } - // - // Skip the 'X' - // - String++; - } - - *Data = 0; - - while (InternalAsciiIsHexaDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINTN, then MAX_UINTN is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINTN - InternalAsciiHexCharToUintn (*String)) >> 4)) { - *Data = MAX_UINTN; - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = (*Data << 4) + InternalAsciiHexCharToUintn (*String); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Ascii hexadecimal string to a value of type UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Ascii string specified by String as a hexadecimal number. The format of - the input Ascii string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If - "x" appears in the input string, it must be prefixed with at least one 0. The - function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or - [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or - the first valid hexadecimal digit. Then, the function stops at the first - character that is a not a valid hexadecimal character or Null-terminator, - whichever on comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength Ascii characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid hexadecimal digits in the above format, then 0 is - stored at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - hexadecimal digits right after the optional pad spaces, the value of String - is stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Ascii string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumAsciiStringLength is not zero, - and String contains more than - PcdMaximumAsciiStringLength Ascii - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrHexToUint64S ( - IN CONST CHAR8 *String, - OUT CHAR8 **EndPointer, OPTIONAL - OUT UINT64 *Data - ) -{ - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((AsciiStrnLenS (String, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == ' ') || (*String == '\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == '0') { - String++; - } - - if (AsciiCharToUpper (*String) == 'X') { - if (*(String - 1) != '0') { - *Data = 0; - return RETURN_SUCCESS; - } - // - // Skip the 'X' - // - String++; - } - - *Data = 0; - - while (InternalAsciiIsHexaDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > RShiftU64 (MAX_UINT64 - InternalAsciiHexCharToUintn (*String), 4)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = LShiftU64 (*Data, 4) + InternalAsciiHexCharToUintn (*String); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode string to a Null-terminated - ASCII string. - - This function is similar to AsciiStrCpyS. - - This function converts the content of the Unicode string Source - to the ASCII string Destination by copying the lower 8 bits of - each Unicode character. The function terminates the ASCII string - Destination by appending a Null-terminator character at the end. - - The caller is responsible to make sure Destination points to a buffer with size - equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes. - - If any Unicode characters in Source contain non-zero value in - the upper 8 bits, then ASSERT(). - - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Source The pointer to a Null-terminated Unicode string. - @param Destination The pointer to a Null-terminated ASCII string. - @param DestMax The maximum number of Destination Ascii - char, including terminating null char. - - @retval RETURN_SUCCESS String is converted. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. - -**/ -RETURN_STATUS -EFIAPI -UnicodeStrToAsciiStrS ( - IN CONST CHAR16 *Source, - OUT CHAR8 *Destination, - IN UINTN DestMax - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than ASCII_RSIZE_MAX or RSIZE_MAX. - // - 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); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than StrnLenS (Source, DestMax). - // - SourceLen = StrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 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); - - // - // convert string - // - while (*Source != '\0') { - // - // If any Unicode characters in Source contain - // non-zero value in the upper 8 bits, then ASSERT(). - // - ASSERT (*Source < 0x100); - *(Destination++) = (CHAR8) *(Source++); - } - *Destination = '\0'; - - return RETURN_SUCCESS; -} - -/** - Convert not more than Length successive characters from a Null-terminated - Unicode string to a Null-terminated Ascii string. If no null char is copied - from Source, then Destination[Length] is always set to null. - - This function converts not more than Length successive characters from the - Unicode string Source to the Ascii string Destination by copying the lower 8 - bits of each Unicode character. The function terminates the Ascii string - Destination by appending a Null-terminator character at the end. - - The caller is responsible to make sure Destination points to a buffer with - size not smaller than ((MIN(StrLen(Source), Length) + 1) * sizeof (CHAR8)) - in bytes. - - If any Unicode characters in Source contain non-zero value in the upper 8 - bits, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then Destination and DestinationLength are - unmodified. - - @param Source The pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to - convert. - @param Destination The pointer to a Null-terminated Ascii string. - @param DestMax The maximum number of Destination Ascii char, - including terminating null char. - @param DestinationLength The number of Unicode characters converted. - - @retval RETURN_SUCCESS String is converted. - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If DestinationLength is NULL. - If PcdMaximumAsciiStringLength is not zero, - and Length or DestMax is greater than - PcdMaximumAsciiStringLength. - If PcdMaximumUnicodeStringLength is not - zero, and Length or DestMax is greater than - PcdMaximumUnicodeStringLength. - If DestMax is 0. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than - MIN(StrLen(Source), Length). - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. - -**/ -RETURN_STATUS -EFIAPI -UnicodeStrnToAsciiStrS ( - IN CONST CHAR16 *Source, - IN UINTN Length, - OUT CHAR8 *Destination, - IN UINTN DestMax, - OUT UINTN *DestinationLength - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. None of Destination, Source or DestinationLength shall be a null - // pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((DestinationLength != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither Length nor DestMax shall be greater than ASCII_RSIZE_MAX or - // RSIZE_MAX. - // - 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); - } - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. If Length is not less than DestMax, then DestMax shall be greater than - // StrnLenS(Source, DestMax). - // - SourceLen = StrnLenS (Source, DestMax); - if (Length >= DestMax) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 5. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED); - - *DestinationLength = 0; - - // - // Convert string - // - while ((*Source != 0) && (SourceLen > 0)) { - // - // If any Unicode characters in Source contain non-zero value in the upper - // 8 bits, then ASSERT(). - // - ASSERT (*Source < 0x100); - *(Destination++) = (CHAR8) *(Source++); - SourceLen--; - (*DestinationLength)++; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Convert one Null-terminated ASCII string to a Null-terminated - Unicode string. - - This function is similar to StrCpyS. - - This function converts the contents of the ASCII string Source to the Unicode - string Destination. The function terminates the Unicode string Destination by - appending a Null-terminator character at the end. - - The caller is responsible to make sure Destination points to a buffer with size - equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes. - - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then the Destination is unmodified. - - @param Source The pointer to a Null-terminated ASCII string. - @param Destination The pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode - char, including terminating null char. - - @retval RETURN_SUCCESS String is converted. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source). - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If PcdMaximumUnicodeStringLength is not zero, - and DestMax is greater than - PcdMaximumUnicodeStringLength. - If PcdMaximumAsciiStringLength is not zero, - and DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrToUnicodeStrS ( - IN CONST CHAR8 *Source, - OUT CHAR16 *Destination, - IN UINTN DestMax - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than RSIZE_MAX or ASCII_RSIZE_MAX. - // - 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); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than AsciiStrnLenS(Source, DestMax). - // - SourceLen = AsciiStrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 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); - - // - // Convert string - // - while (*Source != '\0') { - *(Destination++) = (CHAR16)(UINT8)*(Source++); - } - *Destination = '\0'; - - return RETURN_SUCCESS; -} - -/** - Convert not more than Length successive characters from a Null-terminated - Ascii string to a Null-terminated Unicode string. If no null char is copied - from Source, then Destination[Length] is always set to null. - - This function converts not more than Length successive characters from the - Ascii string Source to the Unicode string Destination. The function - terminates the Unicode string Destination by appending a Null-terminator - character at the end. - - The caller is responsible to make sure Destination points to a buffer with - size not smaller than - ((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes. - - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - If an error is returned, then Destination and DestinationLength are - unmodified. - - @param Source The pointer to a Null-terminated Ascii string. - @param Length The maximum number of Ascii characters to convert. - @param Destination The pointer to a Null-terminated Unicode string. - @param DestMax The maximum number of Destination Unicode char, - including terminating null char. - @param DestinationLength The number of Ascii characters converted. - - @retval RETURN_SUCCESS String is converted. - @retval RETURN_INVALID_PARAMETER If Destination is NULL. - If Source is NULL. - If DestinationLength is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and Length or DestMax is greater than - PcdMaximumUnicodeStringLength. - If PcdMaximumAsciiStringLength is not zero, - and Length or DestMax is greater than - PcdMaximumAsciiStringLength. - If DestMax is 0. - @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than - MIN(AsciiStrLen(Source), Length). - @retval RETURN_ACCESS_DENIED If Source and Destination overlap. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrnToUnicodeStrS ( - IN CONST CHAR8 *Source, - IN UINTN Length, - OUT CHAR16 *Destination, - IN UINTN DestMax, - OUT UINTN *DestinationLength - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - - // - // 1. None of Destination, Source or DestinationLength shall be a null - // pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((DestinationLength != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Neither Length nor DestMax shall be greater than ASCII_RSIZE_MAX or - // RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - 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); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. If Length is not less than DestMax, then DestMax shall be greater than - // AsciiStrnLenS(Source, DestMax). - // - SourceLen = AsciiStrnLenS (Source, DestMax); - if (Length >= DestMax) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - } - - // - // 5. Copying shall not take place between objects that overlap. - // - if (SourceLen > Length) { - SourceLen = Length; - } - SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof(CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - *DestinationLength = 0; - - // - // Convert string - // - while ((*Source != 0) && (SourceLen > 0)) { - *(Destination++) = (CHAR16)(UINT8)*(Source++); - SourceLen--; - (*DestinationLength)++; - } - *Destination = 0; - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated ASCII string to IPv6 address and prefix length. - - This function outputs a value of type IPv6_ADDRESS and may output a value - of type UINT8 by interpreting the contents of the ASCII string specified - by String. The format of the input ASCII string String is as follows: - - X:X:X:X:X:X:X:X[/P] - - X contains one to four hexadecimal digit characters in the range [0-9], [a-f] and - [A-F]. X is converted to a value of type UINT16, whose low byte is stored in low - memory address and high byte is stored in high memory address. P contains decimal - digit characters in the range [0-9]. The running zero in the beginning of P will - be ignored. /P is optional. - - When /P is not in the String, the function stops at the first character that is - not a valid hexadecimal digit character after eight X's are converted. - - When /P is in the String, the function stops at the first character that is not - a valid decimal digit character after P is converted. - - "::" can be used to compress one or more groups of X when X contains only 0. - The "::" can only appear once in the String. - - If String is NULL, then ASSERT(). - - If Address is NULL, then ASSERT(). - - If EndPointer is not NULL and Address is translated from String, a pointer - to the character that stopped the scan is stored at the location pointed to - by EndPointer. - - @param String Pointer to a Null-terminated ASCII string. - @param EndPointer Pointer to character that stops scan. - @param Address Pointer to the converted IPv6 address. - @param PrefixLength Pointer to the converted IPv6 address prefix - length. MAX_UINT8 is returned when /P is - not in the String. - - @retval RETURN_SUCCESS Address is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If X contains more than four hexadecimal - digit characters. - If String contains "::" and number of X - is not less than 8. - If P starts with character that is not a - valid decimal digit character. - If the decimal number converted from P - exceeds 128. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrToIpv6Address ( - 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; - - LocalPrefixLength = MAX_UINT8; - CompressStart = ARRAY_SIZE (Address->Addr); - ExpectPrefix = FALSE; - - // - // None of String or Address shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER); - - for (Pointer = String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) { - if (!InternalAsciiIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer != ':') { - // - // ":" or "/" should be followed by digit characters. - // - return RETURN_UNSUPPORTED; - } - - // - // Meet second ":" after previous ":" or "/" - // or meet first ":" in the beginning of String. - // - if (ExpectPrefix) { - // - // ":" shall not be after "/" - // - return RETURN_UNSUPPORTED; - } - - if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // "::" can only appear once. - // "::" can only appear when address is not full length. - // - return RETURN_UNSUPPORTED; - } else { - // - // Remember the start of zero compressing. - // - CompressStart = AddressIndex; - Pointer++; - - if (CompressStart == 0) { - if (*Pointer != ':') { - // - // Single ":" shall not be in the beginning of String. - // - return RETURN_UNSUPPORTED; - } - Pointer++; - } - } - } - - if (!InternalAsciiIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer == '/') { - // - // Might be optional "/P" after "::". - // - if (CompressStart != AddressIndex) { - return RETURN_UNSUPPORTED; - } - } else { - break; - } - } else { - if (!ExpectPrefix) { - // - // Get X. - // - Status = AsciiStrHexToUintnS (Pointer, &End, &Uintn); - 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; - } else { - // - // Get P, then exit the loop. - // - Status = AsciiStrDecimalToUintnS (Pointer, &End, &Uintn); - if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) { - // - // Prefix length should not exceed 128. - // - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uintn; - Pointer = End; - break; - } - } - - // - // Skip ':' or "/" - // - if (*Pointer == '/') { - ExpectPrefix = TRUE; - } else if (*Pointer == ':') { - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // Meet additional ":" after all 8 16-bit address - // - break; - } - } else { - // - // Meet other character that is not "/" or ":" after all 8 16-bit address - // - break; - } - Pointer++; - } - - 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) { - CopyMem ( - &Address->Addr[CompressStart + ARRAY_SIZE (Address->Addr) - AddressIndex], - &LocalAddress.Addr[CompressStart], - AddressIndex - CompressStart - ); - - } - - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = (CHAR8 *) Pointer; - } - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated ASCII string to IPv4 address and prefix length. - - This function outputs a value of type IPv4_ADDRESS and may output a value - of type UINT8 by interpreting the contents of the ASCII string specified - by String. The format of the input ASCII string String is as follows: - - D.D.D.D[/P] - - D and P are decimal digit characters in the range [0-9]. The running zero in - the beginning of D and P will be ignored. /P is optional. - - When /P is not in the String, the function stops at the first character that is - not a valid decimal digit character after four D's are converted. - - When /P is in the String, the function stops at the first character that is not - a valid decimal digit character after P is converted. - - If String is NULL, then ASSERT(). - - If Address is NULL, then ASSERT(). - - If EndPointer is not NULL and Address is translated from String, a pointer - to the character that stopped the scan is stored at the location pointed to - by EndPointer. - - @param String Pointer to a Null-terminated ASCII string. - @param EndPointer Pointer to character that stops scan. - @param Address Pointer to the converted IPv4 address. - @param PrefixLength Pointer to the converted IPv4 address prefix - length. MAX_UINT8 is returned when /P is - not in the String. - - @retval RETURN_SUCCESS Address is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If String is not in the correct format. - If any decimal number converted from D - exceeds 255. - If the decimal number converted from P - exceeds 32. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrToIpv4Address ( - 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; - - LocalPrefixLength = MAX_UINT8; - - // - // None of String or Address shall be a null pointer. - // - 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;) { - if (!InternalAsciiIsDecimalDigitCharacter (*Pointer)) { - // - // D or P contains invalid characters. - // - break; - } - - // - // Get D or P. - // - Status = AsciiStrDecimalToUintnS ((CONST CHAR8 *) Pointer, &Pointer, &Uintn); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // It's P. - // - if (Uintn > 32) { - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uintn; - } else { - // - // It's D. - // - if (Uintn > MAX_UINT8) { - return RETURN_UNSUPPORTED; - } - LocalAddress.Addr[AddressIndex] = (UINT8) Uintn; - AddressIndex++; - } - - // - // Check the '.' or '/', depending on the AddressIndex. - // - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - if (*Pointer == '/') { - // - // '/P' is in the String. - // Skip "/" and get P in next loop. - // - Pointer++; - } else { - // - // '/P' is not in the String. - // - break; - } - } else if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - if (*Pointer == '.') { - // - // D should be followed by '.' - // - Pointer++; - } else { - return RETURN_UNSUPPORTED; - } - } - } - - if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - return RETURN_UNSUPPORTED; - } - - CopyMem (Address, &LocalAddress, sizeof (*Address)); - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = Pointer; - } - - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated ASCII GUID string to a value of type - EFI_GUID. - - This function outputs a GUID value by interpreting the contents of - the ASCII string specified by String. The format of the input - ASCII string String consists of 36 characters, as follows: - - aabbccdd-eeff-gghh-iijj-kkllmmnnoopp - - The pairs aa - pp are two characters in the range [0-9], [a-f] and - [A-F], with each pair representing a single byte hexadecimal value. - - The mapping between String and the EFI_GUID structure is as follows: - aa Data1[24:31] - bb Data1[16:23] - cc Data1[8:15] - dd Data1[0:7] - ee Data2[8:15] - ff Data2[0:7] - gg Data3[8:15] - hh Data3[0:7] - ii Data4[0:7] - jj Data4[8:15] - kk Data4[16:23] - ll Data4[24:31] - mm Data4[32:39] - nn Data4[40:47] - oo Data4[48:55] - pp Data4[56:63] - - If String is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param String Pointer to a Null-terminated ASCII string. - @param Guid Pointer to the converted GUID. - - @retval RETURN_SUCCESS Guid is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If String is not as the above format. - -**/ -RETURN_STATUS -EFIAPI -AsciiStrToGuid ( - IN CONST CHAR8 *String, - OUT GUID *Guid - ) -{ - RETURN_STATUS Status; - GUID LocalGuid; - - // - // None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Guid != NULL), RETURN_INVALID_PARAMETER); - - // - // 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)] != '-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1); - 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)] != '-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2); - 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)] != '-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3); - String += 2 * sizeof (LocalGuid.Data3) + 1; - - // - // Get iijj. - // - Status = AsciiStrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2); - if (RETURN_ERROR (Status) || String[2 * 2] != '-') { - return RETURN_UNSUPPORTED; - } - String += 2 * 2 + 1; - - // - // Get kkllmmnnoopp. - // - Status = AsciiStrHexToBytes (String, 2 * 6, &LocalGuid.Data4[2], 6); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - CopyGuid (Guid, &LocalGuid); - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated ASCII hexadecimal string to a byte array. - - This function outputs a byte array by interpreting the contents of - the ASCII string specified by String in hexadecimal format. The format of - the input ASCII string String is: - - [XX]* - - X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F]. - The function decodes every two hexadecimal digit characters as one byte. The - decoding stops after Length of characters and outputs Buffer containing - (Length / 2) bytes. - - If String is NULL, then ASSERT(). - - If Buffer is NULL, then ASSERT(). - - If Length is not multiple of 2, then ASSERT(). - - If PcdMaximumAsciiStringLength is not zero and Length is greater than - PcdMaximumAsciiStringLength, then ASSERT(). - - If MaxBufferSize is less than (Length / 2), then ASSERT(). - - @param String Pointer to a Null-terminated ASCII string. - @param Length The number of ASCII characters to decode. - @param Buffer Pointer to the converted bytes array. - @param MaxBufferSize The maximum size of Buffer. - - @retval RETURN_SUCCESS Buffer is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If Length is not multiple of 2. - If PcdMaximumAsciiStringLength is not zero, - and Length is greater than - PcdMaximumAsciiStringLength. - @retval RETURN_UNSUPPORTED If Length of characters from String contain - a character that is not valid hexadecimal - digit characters, or a Null-terminator. - @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2). -**/ -RETURN_STATUS -EFIAPI -AsciiStrHexToBytes ( - IN CONST CHAR8 *String, - IN UINTN Length, - OUT UINT8 *Buffer, - IN UINTN MaxBufferSize - ) -{ - UINTN Index; - - // - // 1. None of String or Buffer shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Buffer != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Length shall not be greater than ASCII_RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. Length shall not be odd. - // - SAFE_STRING_CONSTRAINT_CHECK (((Length & BIT0) == 0), RETURN_INVALID_PARAMETER); - - // - // 4. MaxBufferSize shall equal to or greater than Length / 2. - // - SAFE_STRING_CONSTRAINT_CHECK ((MaxBufferSize >= Length / 2), RETURN_BUFFER_TOO_SMALL); - - // - // 5. String shall not contains invalid hexadecimal digits. - // - for (Index = 0; Index < Length; Index++) { - if (!InternalAsciiIsHexaDecimalDigitCharacter (String[Index])) { - break; - } - } - if (Index != Length) { - return RETURN_UNSUPPORTED; - } - - // - // Convert the hex string to bytes. - // - 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; - } else { - Buffer[Index / 2] |= (UINT8) InternalAsciiHexCharToUintn (String[Index]); - } - } - return RETURN_SUCCESS; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SetJump.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SetJump.c deleted file mode 100644 index 4e6e00c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SetJump.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @file - Internal ASSERT () functions for SetJump. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Worker function that checks ASSERT condition for JumpBuffer - - Checks ASSERT condition for JumpBuffer. - - If JumpBuffer is NULL, then ASSERT(). - For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param JumpBuffer A pointer to CPU context buffer. - -**/ -VOID -EFIAPI -InternalAssertJumpBuffer ( - IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer - ) -{ - ASSERT (JumpBuffer != NULL); - - ASSERT (((UINTN)JumpBuffer & (BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT - 1)) == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/String.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/String.c deleted file mode 100644 index a8ff885..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/String.c +++ /dev/null @@ -1,2143 +0,0 @@ -/** @file - Unicode and ASCII string primitives. - - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function will be deprecated for security reason. - - Copies one Null-terminated Unicode string to another Null-terminated Unicode - string and returns the new Unicode string. - - This function copies the contents of the Unicode string Source to the Unicode - string Destination, and returns Destination. If Source and Destination - overlap, then the results are undefined. - - If Destination is NULL, then ASSERT(). - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param Destination A pointer to a Null-terminated Unicode string. - @param Source A pointer to a Null-terminated Unicode string. - - @return Destination. - -**/ -CHAR16 * -EFIAPI -StrCpy ( - OUT CHAR16 *Destination, - IN CONST CHAR16 *Source - ) -{ - CHAR16 *ReturnValue; - - // - // Destination cannot be NULL - // - ASSERT (Destination != NULL); - ASSERT (((UINTN) Destination & BIT0) == 0); - - // - // Destination and source cannot overlap - // - ASSERT ((UINTN)(Destination - Source) > StrLen (Source)); - ASSERT ((UINTN)(Source - Destination) > StrLen (Source)); - - ReturnValue = Destination; - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - return ReturnValue; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Copies up to a specified length from one Null-terminated Unicode string to - another Null-terminated Unicode string and returns the new Unicode string. - - This function copies the contents of the Unicode string Source to the Unicode - string Destination, and returns Destination. At most, Length Unicode - characters are copied from Source to Destination. If Length is 0, then - Destination is returned unmodified. If Length is greater that the number of - Unicode characters in Source, then Destination is padded with Null Unicode - characters. If Source and Destination overlap, then the results are - undefined. - - If Length > 0 and Destination is NULL, then ASSERT(). - If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Length > 0 and Source is NULL, then ASSERT(). - If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - - @param Destination A pointer to a Null-terminated Unicode string. - @param Source A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to copy. - - @return Destination. - -**/ -CHAR16 * -EFIAPI -StrnCpy ( - OUT CHAR16 *Destination, - IN CONST CHAR16 *Source, - IN UINTN Length - ) -{ - CHAR16 *ReturnValue; - - if (Length == 0) { - return Destination; - } - - // - // Destination cannot be NULL if Length is not zero - // - ASSERT (Destination != NULL); - ASSERT (((UINTN) Destination & BIT0) == 0); - - // - // Destination and source cannot overlap - // - ASSERT ((UINTN)(Destination - Source) > StrLen (Source)); - ASSERT ((UINTN)(Source - Destination) >= Length); - - if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) { - ASSERT (Length <= PcdGet32 (PcdMaximumUnicodeStringLength)); - } - - ReturnValue = Destination; - - while ((*Source != L'\0') && (Length > 0)) { - *(Destination++) = *(Source++); - Length--; - } - - ZeroMem (Destination, Length * sizeof (*Destination)); - return ReturnValue; -} -#endif - -/** - Returns the length of a Null-terminated Unicode string. - - This function returns the number of Unicode characters in the Null-terminated - Unicode string specified by String. - - If String is NULL, then ASSERT(). - If String is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @return The length of String. - -**/ -UINTN -EFIAPI -StrLen ( - IN CONST CHAR16 *String - ) -{ - UINTN Length; - - ASSERT (String != NULL); - ASSERT (((UINTN) String & BIT0) == 0); - - for (Length = 0; *String != L'\0'; String++, Length++) { - // - // If PcdMaximumUnicodeStringLength is not zero, - // length should not more than PcdMaximumUnicodeStringLength - // - if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) { - ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength)); - } - } - return Length; -} - -/** - Returns the size of a Null-terminated Unicode string in bytes, including the - Null terminator. - - This function returns the size, in bytes, of the Null-terminated Unicode string - specified by String. - - If String is NULL, then ASSERT(). - If String is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @return The size of String. - -**/ -UINTN -EFIAPI -StrSize ( - IN CONST CHAR16 *String - ) -{ - return (StrLen (String) + 1) * sizeof (*String); -} - -/** - Compares two Null-terminated Unicode strings, and returns the difference - between the first mismatched Unicode characters. - - This function compares the Null-terminated Unicode string FirstString to the - Null-terminated Unicode string SecondString. If FirstString is identical to - SecondString, then 0 is returned. Otherwise, the value returned is the first - mismatched Unicode character in SecondString subtracted from the first - mismatched Unicode character in FirstString. - - If FirstString is NULL, then ASSERT(). - If FirstString is not aligned on a 16-bit boundary, then ASSERT(). - If SecondString is NULL, then ASSERT(). - If SecondString is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more - than PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more - than PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param FirstString A pointer to a Null-terminated Unicode string. - @param SecondString A pointer to a Null-terminated Unicode string. - - @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. - -**/ -INTN -EFIAPI -StrCmp ( - IN CONST CHAR16 *FirstString, - IN CONST CHAR16 *SecondString - ) -{ - // - // ASSERT both strings are less long than PcdMaximumUnicodeStringLength - // - ASSERT (StrSize (FirstString) != 0); - ASSERT (StrSize (SecondString) != 0); - - while ((*FirstString != L'\0') && (*FirstString == *SecondString)) { - FirstString++; - SecondString++; - } - return *FirstString - *SecondString; -} - -/** - Compares up to a specified length the contents of two Null-terminated Unicode strings, - and returns the difference between the first mismatched Unicode characters. - - This function compares the Null-terminated Unicode string FirstString to the - Null-terminated Unicode string SecondString. At most, Length Unicode - characters will be compared. If Length is 0, then 0 is returned. If - FirstString is identical to SecondString, then 0 is returned. Otherwise, the - value returned is the first mismatched Unicode character in SecondString - subtracted from the first mismatched Unicode character in FirstString. - - If Length > 0 and FirstString is NULL, then ASSERT(). - If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT(). - If Length > 0 and SecondString is NULL, then ASSERT(). - If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - - @param FirstString A pointer to a Null-terminated Unicode string. - @param SecondString A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to compare. - - @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. - -**/ -INTN -EFIAPI -StrnCmp ( - IN CONST CHAR16 *FirstString, - IN CONST CHAR16 *SecondString, - IN UINTN Length - ) -{ - if (Length == 0) { - return 0; - } - - // - // ASSERT both strings are less long than PcdMaximumUnicodeStringLength. - // Length tests are performed inside StrLen(). - // - ASSERT (StrSize (FirstString) != 0); - ASSERT (StrSize (SecondString) != 0); - - if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) { - ASSERT (Length <= PcdGet32 (PcdMaximumUnicodeStringLength)); - } - - while ((*FirstString != L'\0') && - (*SecondString != L'\0') && - (*FirstString == *SecondString) && - (Length > 1)) { - FirstString++; - SecondString++; - Length--; - } - - return *FirstString - *SecondString; -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function will be deprecated for security reason. - - Concatenates one Null-terminated Unicode string to another Null-terminated - Unicode string, and returns the concatenated Unicode string. - - This function concatenates two Null-terminated Unicode strings. The contents - of Null-terminated Unicode string Source are concatenated to the end of - Null-terminated Unicode string Destination. The Null-terminated concatenated - Unicode String is returned. If Source and Destination overlap, then the - results are undefined. - - If Destination is NULL, then ASSERT(). - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Destination contains more - than PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination - and Source results in a Unicode string with more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param Destination A pointer to a Null-terminated Unicode string. - @param Source A pointer to a Null-terminated Unicode string. - - @return Destination. - -**/ -CHAR16 * -EFIAPI -StrCat ( - IN OUT CHAR16 *Destination, - IN CONST CHAR16 *Source - ) -{ - StrCpy (Destination + StrLen (Destination), Source); - - // - // Size of the resulting string should never be zero. - // PcdMaximumUnicodeStringLength is tested inside StrLen(). - // - ASSERT (StrSize (Destination) != 0); - return Destination; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Concatenates up to a specified length one Null-terminated Unicode to the end - of another Null-terminated Unicode string, and returns the concatenated - Unicode string. - - This function concatenates two Null-terminated Unicode strings. The contents - of Null-terminated Unicode string Source are concatenated to the end of - Null-terminated Unicode string Destination, and Destination is returned. At - most, Length Unicode characters are concatenated from Source to the end of - Destination, and Destination is always Null-terminated. If Length is 0, then - Destination is returned unmodified. If Source and Destination overlap, then - the results are undefined. - - If Destination is NULL, then ASSERT(). - If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Length > 0 and Source is NULL, then ASSERT(). - If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Destination contains more - than PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination - and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength - Unicode characters, not including the Null-terminator, then ASSERT(). - - @param Destination A pointer to a Null-terminated Unicode string. - @param Source A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to concatenate from - Source. - - @return Destination. - -**/ -CHAR16 * -EFIAPI -StrnCat ( - IN OUT CHAR16 *Destination, - IN CONST CHAR16 *Source, - IN UINTN Length - ) -{ - UINTN DestinationLen; - - DestinationLen = StrLen (Destination); - StrnCpy (Destination + DestinationLen, Source, Length); - Destination[DestinationLen + Length] = L'\0'; - - // - // Size of the resulting string should never be zero. - // PcdMaximumUnicodeStringLength is tested inside StrLen(). - // - ASSERT (StrSize (Destination) != 0); - return Destination; -} -#endif - -/** - Returns the first occurrence of a Null-terminated Unicode sub-string - in a Null-terminated Unicode string. - - This function scans the contents of the Null-terminated Unicode string - specified by String and returns the first occurrence of SearchString. - If SearchString is not found in String, then NULL is returned. If - the length of SearchString is zero, then String is - returned. - - If String is NULL, then ASSERT(). - If String is not aligned on a 16-bit boundary, then ASSERT(). - If SearchString is NULL, then ASSERT(). - If SearchString is not aligned on a 16-bit boundary, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and SearchString - or String contains more than PcdMaximumUnicodeStringLength Unicode - characters, not including the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - @param SearchString A pointer to a Null-terminated Unicode string to search for. - - @retval NULL If the SearchString does not appear in String. - @return others If there is a match. - -**/ -CHAR16 * -EFIAPI -StrStr ( - IN CONST CHAR16 *String, - IN CONST CHAR16 *SearchString - ) -{ - CONST CHAR16 *FirstMatch; - CONST CHAR16 *SearchStringTmp; - - // - // ASSERT both strings are less long than PcdMaximumUnicodeStringLength. - // Length tests are performed inside StrLen(). - // - ASSERT (StrSize (String) != 0); - ASSERT (StrSize (SearchString) != 0); - - if (*SearchString == L'\0') { - return (CHAR16 *) String; - } - - while (*String != L'\0') { - SearchStringTmp = SearchString; - FirstMatch = String; - - while ((*String == *SearchStringTmp) - && (*String != L'\0')) { - String++; - SearchStringTmp++; - } - - if (*SearchStringTmp == L'\0') { - return (CHAR16 *) FirstMatch; - } - - if (*String == L'\0') { - return NULL; - } - - String = FirstMatch + 1; - } - - return NULL; -} - -/** - Check if a Unicode character is a decimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid decimal character is from - L'0' to L'9'. - - @param Char The character to check against. - - @retval TRUE If the Char is a decmial character. - @retval FALSE If the Char is not a decmial character. - -**/ -BOOLEAN -EFIAPI -InternalIsDecimalDigitCharacter ( - IN CHAR16 Char - ) -{ - return (BOOLEAN) (Char >= L'0' && Char <= L'9'); -} - -/** - Convert a Unicode character to upper case only if - it maps to a valid small-case ASCII character. - - This internal function only deal with Unicode character - which maps to a valid small-case ASCII character, i.e. - L'a' to L'z'. For other Unicode character, the input character - is returned directly. - - @param Char The character to convert. - - @retval LowerCharacter If the Char is with range L'a' to L'z'. - @retval Unchanged Otherwise. - -**/ -CHAR16 -EFIAPI -CharToUpper ( - IN CHAR16 Char - ) -{ - if (Char >= L'a' && Char <= L'z') { - return (CHAR16) (Char - (L'a' - L'A')); - } - - return Char; -} - -/** - Convert a Unicode character to numerical value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other - Unicode character, the value returned does not make sense. - - @param Char The character to convert. - - @return The numerical value converted. - -**/ -UINTN -EFIAPI -InternalHexCharToUintn ( - IN CHAR16 Char - ) -{ - if (InternalIsDecimalDigitCharacter (Char)) { - return Char - L'0'; - } - - return (10 + CharToUpper (Char) - L'A'); -} - -/** - Check if a Unicode character is a hexadecimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid hexadecimal character is - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -InternalIsHexaDecimalDigitCharacter ( - IN CHAR16 Char - ) -{ - - return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) || - (Char >= L'A' && Char <= L'F') || - (Char >= L'a' && Char <= L'f')); -} - -/** - Convert a Null-terminated Unicode decimal string to a value of - type UINTN. - - This function returns a value of type UINTN by interpreting the contents - of the Unicode string specified by String as a decimal number. The format - of the input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The - function will ignore the pad space, which includes spaces or - tab characters, before [decimal digits]. The running zero in the - beginning of [decimal digits] will be ignored. Then, the function - stops at the first character that is a not a valid decimal character - or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, - then 0 is returned. - If the number represented by String overflows according - to the range defined by UINTN, then MAX_UINTN is returned. - - If PcdMaximumUnicodeStringLength is not zero, and String contains - more than PcdMaximumUnicodeStringLength Unicode characters, not including - the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @retval Value translated from String. - -**/ -UINTN -EFIAPI -StrDecimalToUintn ( - IN CONST CHAR16 *String - ) -{ - UINTN Result; - - StrDecimalToUintnS (String, (CHAR16 **) NULL, &Result); - return Result; -} - - -/** - Convert a Null-terminated Unicode decimal string to a value of - type UINT64. - - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a decimal number. The format - of the input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The - function will ignore the pad space, which includes spaces or - tab characters, before [decimal digits]. The running zero in the - beginning of [decimal digits] will be ignored. Then, the function - stops at the first character that is a not a valid decimal character - or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, - then 0 is returned. - If the number represented by String overflows according - to the range defined by UINT64, then MAX_UINT64 is returned. - - If PcdMaximumUnicodeStringLength is not zero, and String contains - more than PcdMaximumUnicodeStringLength Unicode characters, not including - the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @retval Value translated from String. - -**/ -UINT64 -EFIAPI -StrDecimalToUint64 ( - IN CONST CHAR16 *String - ) -{ - UINT64 Result; - - StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result); - return Result; -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN. - - This function returns a value of type UINTN by interpreting the contents - of the Unicode string specified by String as a hexadecimal number. - The format of the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or - [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the - first valid hexadecimal digit. Then, the function stops at the first character that is - a not a valid hexadecimal character or NULL, whichever one comes first. - - If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If String has only pad spaces, then zero is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, - then zero is returned. - If the number represented by String overflows according to the range defined by - UINTN, then MAX_UINTN is returned. - - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @retval Value translated from String. - -**/ -UINTN -EFIAPI -StrHexToUintn ( - IN CONST CHAR16 *String - ) -{ - UINTN Result; - - StrHexToUintnS (String, (CHAR16 **) NULL, &Result); - return Result; -} - - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64. - - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a hexadecimal number. - The format of the input Unicode string String is - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or - [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the - first valid hexadecimal digit. Then, the function stops at the first character that is - a not a valid hexadecimal character or NULL, whichever one comes first. - - If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If String has only pad spaces, then zero is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, - then zero is returned. - If the number represented by String overflows according to the range defined by - UINT64, then MAX_UINT64 is returned. - - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @retval Value translated from String. - -**/ -UINT64 -EFIAPI -StrHexToUint64 ( - IN CONST CHAR16 *String - ) -{ - UINT64 Result; - - StrHexToUint64S (String, (CHAR16 **) NULL, &Result); - return Result; -} - -/** - Check if a ASCII character is a decimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid decimal character is from - '0' to '9'. - - @param Char The character to check against. - - @retval TRUE If the Char is a decmial character. - @retval FALSE If the Char is not a decmial character. - -**/ -BOOLEAN -EFIAPI -InternalAsciiIsDecimalDigitCharacter ( - IN CHAR8 Char - ) -{ - return (BOOLEAN) (Char >= '0' && Char <= '9'); -} - -/** - Check if a ASCII character is a hexadecimal character. - - This internal function checks if a ASCII character is a - decimal character. The valid hexadecimal character is - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -InternalAsciiIsHexaDecimalDigitCharacter ( - IN CHAR8 Char - ) -{ - - return (BOOLEAN) (InternalAsciiIsDecimalDigitCharacter (Char) || - (Char >= 'A' && Char <= 'F') || - (Char >= 'a' && Char <= 'f')); -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function is deprecated for security reason. - - Convert a Null-terminated Unicode string to a Null-terminated - ASCII string and returns the ASCII string. - - This function converts the content of the Unicode string Source - to the ASCII string Destination by copying the lower 8 bits of - each Unicode character. It returns Destination. - - The caller is responsible to make sure Destination points to a buffer with size - equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes. - - If any Unicode characters in Source contain non-zero value in - the upper 8 bits, then ASSERT(). - - If Destination is NULL, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source is not aligned on a 16-bit boundary, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and Source contains - more than PcdMaximumUnicodeStringLength Unicode characters, not including - the Null-terminator, then ASSERT(). - - If PcdMaximumAsciiStringLength is not zero, and Source contains more - than PcdMaximumAsciiStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param Source A pointer to a Null-terminated Unicode string. - @param Destination A pointer to a Null-terminated ASCII string. - - @return Destination. - -**/ -CHAR8 * -EFIAPI -UnicodeStrToAsciiStr ( - IN CONST CHAR16 *Source, - OUT CHAR8 *Destination - ) -{ - CHAR8 *ReturnValue; - - ASSERT (Destination != NULL); - - // - // ASSERT if Source is long than PcdMaximumUnicodeStringLength. - // Length tests are performed inside StrLen(). - // - ASSERT (StrSize (Source) != 0); - - // - // Source and Destination should not overlap - // - ASSERT ((UINTN) (Destination - (CHAR8 *) Source) >= StrSize (Source)); - ASSERT ((UINTN) ((CHAR8 *) Source - Destination) > StrLen (Source)); - - - ReturnValue = Destination; - while (*Source != '\0') { - // - // If any Unicode characters in Source contain - // non-zero value in the upper 8 bits, then ASSERT(). - // - ASSERT (*Source < 0x100); - *(Destination++) = (CHAR8) *(Source++); - } - - *Destination = '\0'; - - // - // ASSERT Original Destination is less long than PcdMaximumAsciiStringLength. - // Length tests are performed inside AsciiStrLen(). - // - ASSERT (AsciiStrSize (ReturnValue) != 0); - - return ReturnValue; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Copies one Null-terminated ASCII string to another Null-terminated ASCII - string and returns the new ASCII string. - - This function copies the contents of the ASCII string Source to the ASCII - string Destination, and returns Destination. If Source and Destination - overlap, then the results are undefined. - - If Destination is NULL, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and Source contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - - @param Destination A pointer to a Null-terminated ASCII string. - @param Source A pointer to a Null-terminated ASCII string. - - @return Destination - -**/ -CHAR8 * -EFIAPI -AsciiStrCpy ( - OUT CHAR8 *Destination, - IN CONST CHAR8 *Source - ) -{ - CHAR8 *ReturnValue; - - // - // Destination cannot be NULL - // - ASSERT (Destination != NULL); - - // - // Destination and source cannot overlap - // - ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source)); - ASSERT ((UINTN)(Source - Destination) > AsciiStrLen (Source)); - - ReturnValue = Destination; - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - return ReturnValue; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Copies up to a specified length one Null-terminated ASCII string to another - Null-terminated ASCII string and returns the new ASCII string. - - This function copies the contents of the ASCII string Source to the ASCII - string Destination, and returns Destination. At most, Length ASCII characters - are copied from Source to Destination. If Length is 0, then Destination is - returned unmodified. If Length is greater that the number of ASCII characters - in Source, then Destination is padded with Null ASCII characters. If Source - and Destination overlap, then the results are undefined. - - If Destination is NULL, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Length is greater than - PcdMaximumAsciiStringLength, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Source contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - - @param Destination A pointer to a Null-terminated ASCII string. - @param Source A pointer to a Null-terminated ASCII string. - @param Length The maximum number of ASCII characters to copy. - - @return Destination - -**/ -CHAR8 * -EFIAPI -AsciiStrnCpy ( - OUT CHAR8 *Destination, - IN CONST CHAR8 *Source, - IN UINTN Length - ) -{ - CHAR8 *ReturnValue; - - if (Length == 0) { - return Destination; - } - - // - // Destination cannot be NULL - // - ASSERT (Destination != NULL); - - // - // Destination and source cannot overlap - // - ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source)); - ASSERT ((UINTN)(Source - Destination) >= Length); - - if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) { - ASSERT (Length <= PcdGet32 (PcdMaximumAsciiStringLength)); - } - - ReturnValue = Destination; - - while (*Source != 0 && Length > 0) { - *(Destination++) = *(Source++); - Length--; - } - - ZeroMem (Destination, Length * sizeof (*Destination)); - return ReturnValue; -} -#endif - -/** - Returns the length of a Null-terminated ASCII string. - - This function returns the number of ASCII characters in the Null-terminated - ASCII string specified by String. - - If Length > 0 and Destination is NULL, then ASSERT(). - If Length > 0 and Source is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and String contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @return The length of String. - -**/ -UINTN -EFIAPI -AsciiStrLen ( - IN CONST CHAR8 *String - ) -{ - UINTN Length; - - ASSERT (String != NULL); - - for (Length = 0; *String != '\0'; String++, Length++) { - // - // If PcdMaximumUnicodeStringLength is not zero, - // length should not more than PcdMaximumUnicodeStringLength - // - if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) { - ASSERT (Length < PcdGet32 (PcdMaximumAsciiStringLength)); - } - } - return Length; -} - -/** - Returns the size of a Null-terminated ASCII string in bytes, including the - Null terminator. - - This function returns the size, in bytes, of the Null-terminated ASCII string - specified by String. - - If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and String contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @return The size of String. - -**/ -UINTN -EFIAPI -AsciiStrSize ( - IN CONST CHAR8 *String - ) -{ - return (AsciiStrLen (String) + 1) * sizeof (*String); -} - -/** - Compares two Null-terminated ASCII strings, and returns the difference - between the first mismatched ASCII characters. - - This function compares the Null-terminated ASCII string FirstString to the - Null-terminated ASCII string SecondString. If FirstString is identical to - SecondString, then 0 is returned. Otherwise, the value returned is the first - mismatched ASCII character in SecondString subtracted from the first - mismatched ASCII character in FirstString. - - If FirstString is NULL, then ASSERT(). - If SecondString is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and FirstString contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and SecondString contains more - than PcdMaximumAsciiStringLength ASCII characters, not including the - Null-terminator, then ASSERT(). - - @param FirstString A pointer to a Null-terminated ASCII string. - @param SecondString A pointer to a Null-terminated ASCII string. - - @retval ==0 FirstString is identical to SecondString. - @retval !=0 FirstString is not identical to SecondString. - -**/ -INTN -EFIAPI -AsciiStrCmp ( - IN CONST CHAR8 *FirstString, - IN CONST CHAR8 *SecondString - ) -{ - // - // ASSERT both strings are less long than PcdMaximumAsciiStringLength - // - ASSERT (AsciiStrSize (FirstString)); - ASSERT (AsciiStrSize (SecondString)); - - while ((*FirstString != '\0') && (*FirstString == *SecondString)) { - FirstString++; - SecondString++; - } - - return *FirstString - *SecondString; -} - -/** - Converts a lowercase Ascii character to upper one. - - If Chr is lowercase Ascii character, then converts it to upper one. - - If Value >= 0xA0, then ASSERT(). - If (Value & 0x0F) >= 0x0A, then ASSERT(). - - @param Chr one Ascii character - - @return The uppercase value of Ascii character - -**/ -CHAR8 -EFIAPI -AsciiCharToUpper ( - IN CHAR8 Chr - ) -{ - return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr); -} - -/** - Convert a ASCII character to numerical value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - '0' to '9', 'a' to 'f' or 'A' to 'F'. For other - ASCII character, the value returned does not make sense. - - @param Char The character to convert. - - @return The numerical value converted. - -**/ -UINTN -EFIAPI -InternalAsciiHexCharToUintn ( - IN CHAR8 Char - ) -{ - if (InternalIsDecimalDigitCharacter (Char)) { - return Char - '0'; - } - - 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. - - This function performs a case insensitive comparison of the Null-terminated - ASCII string FirstString to the Null-terminated ASCII string SecondString. If - FirstString is identical to SecondString, then 0 is returned. Otherwise, the - value returned is the first mismatched lower case ASCII character in - SecondString subtracted from the first mismatched lower case ASCII character - in FirstString. - - If FirstString is NULL, then ASSERT(). - If SecondString is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and FirstString contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and SecondString contains more - than PcdMaximumAsciiStringLength ASCII characters, not including the - Null-terminator, then ASSERT(). - - @param FirstString A pointer to a Null-terminated ASCII string. - @param SecondString A pointer to a Null-terminated ASCII string. - - @retval ==0 FirstString is identical to SecondString using case insensitive - comparisons. - @retval !=0 FirstString is not identical to SecondString using case - insensitive comparisons. - -**/ -INTN -EFIAPI -AsciiStriCmp ( - IN CONST CHAR8 *FirstString, - IN CONST CHAR8 *SecondString - ) -{ - CHAR8 UpperFirstString; - CHAR8 UpperSecondString; - - // - // ASSERT both strings are less long than PcdMaximumAsciiStringLength - // - ASSERT (AsciiStrSize (FirstString)); - ASSERT (AsciiStrSize (SecondString)); - - UpperFirstString = AsciiCharToUpper (*FirstString); - UpperSecondString = AsciiCharToUpper (*SecondString); - while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) { - FirstString++; - SecondString++; - UpperFirstString = AsciiCharToUpper (*FirstString); - UpperSecondString = AsciiCharToUpper (*SecondString); - } - - return UpperFirstString - UpperSecondString; -} - -/** - Compares two Null-terminated ASCII strings with maximum lengths, and returns - the difference between the first mismatched ASCII characters. - - This function compares the Null-terminated ASCII string FirstString to the - Null-terminated ASCII string SecondString. At most, Length ASCII characters - will be compared. If Length is 0, then 0 is returned. If FirstString is - identical to SecondString, then 0 is returned. Otherwise, the value returned - is the first mismatched ASCII character in SecondString subtracted from the - first mismatched ASCII character in FirstString. - - If Length > 0 and FirstString is NULL, then ASSERT(). - If Length > 0 and SecondString is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Length is greater than - PcdMaximumAsciiStringLength, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - - @param FirstString A pointer to a Null-terminated ASCII string. - @param SecondString A pointer to a Null-terminated ASCII string. - @param Length The maximum number of ASCII characters for compare. - - @retval ==0 FirstString is identical to SecondString. - @retval !=0 FirstString is not identical to SecondString. - -**/ -INTN -EFIAPI -AsciiStrnCmp ( - IN CONST CHAR8 *FirstString, - IN CONST CHAR8 *SecondString, - IN UINTN Length - ) -{ - if (Length == 0) { - return 0; - } - - // - // ASSERT both strings are less long than PcdMaximumAsciiStringLength - // - ASSERT (AsciiStrSize (FirstString)); - ASSERT (AsciiStrSize (SecondString)); - - if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) { - ASSERT (Length <= PcdGet32 (PcdMaximumAsciiStringLength)); - } - - while ((*FirstString != '\0') && - (*SecondString != '\0') && - (*FirstString == *SecondString) && - (Length > 1)) { - FirstString++; - SecondString++; - Length--; - } - return *FirstString - *SecondString; -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function will be deprecated for security reason. - - Concatenates one Null-terminated ASCII string to another Null-terminated - ASCII string, and returns the concatenated ASCII string. - - This function concatenates two Null-terminated ASCII strings. The contents of - Null-terminated ASCII string Source are concatenated to the end of Null- - terminated ASCII string Destination. The Null-terminated concatenated ASCII - String is returned. - - If Destination is NULL, then ASSERT(). - If Source is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and Destination contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and Source contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero and concatenating Destination and - Source results in a ASCII string with more than PcdMaximumAsciiStringLength - ASCII characters, then ASSERT(). - - @param Destination A pointer to a Null-terminated ASCII string. - @param Source A pointer to a Null-terminated ASCII string. - - @return Destination - -**/ -CHAR8 * -EFIAPI -AsciiStrCat ( - IN OUT CHAR8 *Destination, - IN CONST CHAR8 *Source - ) -{ - AsciiStrCpy (Destination + AsciiStrLen (Destination), Source); - - // - // Size of the resulting string should never be zero. - // PcdMaximumUnicodeStringLength is tested inside StrLen(). - // - ASSERT (AsciiStrSize (Destination) != 0); - return Destination; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Concatenates up to a specified length one Null-terminated ASCII string to - the end of another Null-terminated ASCII string, and returns the - concatenated ASCII string. - - This function concatenates two Null-terminated ASCII strings. The contents - of Null-terminated ASCII string Source are concatenated to the end of Null- - terminated ASCII string Destination, and Destination is returned. At most, - Length ASCII characters are concatenated from Source to the end of - Destination, and Destination is always Null-terminated. If Length is 0, then - Destination is returned unmodified. If Source and Destination overlap, then - the results are undefined. - - If Length > 0 and Destination is NULL, then ASSERT(). - If Length > 0 and Source is NULL, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Length is greater than - PcdMaximumAsciiStringLength, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Destination contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Source contains more than - PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and - Source results in a ASCII string with more than PcdMaximumAsciiStringLength - ASCII characters, not including the Null-terminator, then ASSERT(). - - @param Destination A pointer to a Null-terminated ASCII string. - @param Source A pointer to a Null-terminated ASCII string. - @param Length The maximum number of ASCII characters to concatenate from - Source. - - @return Destination - -**/ -CHAR8 * -EFIAPI -AsciiStrnCat ( - IN OUT CHAR8 *Destination, - IN CONST CHAR8 *Source, - IN UINTN Length - ) -{ - UINTN DestinationLen; - - DestinationLen = AsciiStrLen (Destination); - AsciiStrnCpy (Destination + DestinationLen, Source, Length); - Destination[DestinationLen + Length] = '\0'; - - // - // Size of the resulting string should never be zero. - // PcdMaximumUnicodeStringLength is tested inside StrLen(). - // - ASSERT (AsciiStrSize (Destination) != 0); - return Destination; -} -#endif - -/** - Returns the first occurrence of a Null-terminated ASCII sub-string - in a Null-terminated ASCII string. - - This function scans the contents of the ASCII string specified by String - and returns the first occurrence of SearchString. If SearchString is not - found in String, then NULL is returned. If the length of SearchString is zero, - then String is returned. - - If String is NULL, then ASSERT(). - If SearchString is NULL, then ASSERT(). - - If PcdMaximumAsciiStringLength is not zero, and SearchString or - String contains more than PcdMaximumAsciiStringLength Unicode characters - not including the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - @param SearchString A pointer to a Null-terminated ASCII string to search for. - - @retval NULL If the SearchString does not appear in String. - @retval others If there is a match return the first occurrence of SearchingString. - If the length of SearchString is zero,return String. - -**/ -CHAR8 * -EFIAPI -AsciiStrStr ( - IN CONST CHAR8 *String, - IN CONST CHAR8 *SearchString - ) -{ - CONST CHAR8 *FirstMatch; - CONST CHAR8 *SearchStringTmp; - - // - // ASSERT both strings are less long than PcdMaximumAsciiStringLength - // - ASSERT (AsciiStrSize (String) != 0); - ASSERT (AsciiStrSize (SearchString) != 0); - - if (*SearchString == '\0') { - return (CHAR8 *) String; - } - - while (*String != '\0') { - SearchStringTmp = SearchString; - FirstMatch = String; - - while ((*String == *SearchStringTmp) - && (*String != '\0')) { - String++; - SearchStringTmp++; - } - - if (*SearchStringTmp == '\0') { - return (CHAR8 *) FirstMatch; - } - - if (*String == '\0') { - return NULL; - } - - String = FirstMatch + 1; - } - - return NULL; -} - -/** - Convert a Null-terminated ASCII decimal string to a value of type - UINTN. - - This function returns a value of type UINTN by interpreting the contents - of the ASCII string String as a decimal number. The format of the input - ASCII string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before the digits. - The running zero in the beginning of [decimal digits] will be ignored. Then, the - function stops at the first character that is a not a valid decimal character or - Null-terminator, whichever on comes first. - - If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by - UINTN, then MAX_UINTN is returned. - If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @retval Value translated from String. - -**/ -UINTN -EFIAPI -AsciiStrDecimalToUintn ( - IN CONST CHAR8 *String - ) -{ - UINTN Result; - - AsciiStrDecimalToUintnS (String, (CHAR8 **) NULL, &Result); - return Result; -} - - -/** - Convert a Null-terminated ASCII decimal string to a value of type - UINT64. - - This function returns a value of type UINT64 by interpreting the contents - of the ASCII string String as a decimal number. The format of the input - ASCII string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before the digits. - The running zero in the beginning of [decimal digits] will be ignored. Then, the - function stops at the first character that is a not a valid decimal character or - Null-terminator, whichever on comes first. - - If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by - UINT64, then MAX_UINT64 is returned. - If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, - then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @retval Value translated from String. - -**/ -UINT64 -EFIAPI -AsciiStrDecimalToUint64 ( - IN CONST CHAR8 *String - ) -{ - UINT64 Result; - - AsciiStrDecimalToUint64S (String, (CHAR8 **) NULL, &Result); - return Result; -} - -/** - Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN. - - This function returns a value of type UINTN by interpreting the contents of - the ASCII string String as a hexadecimal number. The format of the input ASCII - string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" - appears in the input string, it must be prefixed with at least one 0. The function - will ignore the pad space, which includes spaces or tab characters, before [zeros], - [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] - will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal - digit. Then, the function stops at the first character that is a not a valid - hexadecimal character or Null-terminator, whichever on comes first. - - If String has only pad spaces, then 0 is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then - 0 is returned. - - If the number represented by String overflows according to the range defined by UINTN, - then MAX_UINTN is returned. - If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, - and String contains more than PcdMaximumAsciiStringLength ASCII characters not including - the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @retval Value translated from String. - -**/ -UINTN -EFIAPI -AsciiStrHexToUintn ( - IN CONST CHAR8 *String - ) -{ - UINTN Result; - - AsciiStrHexToUintnS (String, (CHAR8 **) NULL, &Result); - return Result; -} - - -/** - Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64. - - This function returns a value of type UINT64 by interpreting the contents of - the ASCII string String as a hexadecimal number. The format of the input ASCII - string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" - appears in the input string, it must be prefixed with at least one 0. The function - will ignore the pad space, which includes spaces or tab characters, before [zeros], - [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] - will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal - digit. Then, the function stops at the first character that is a not a valid - hexadecimal character or Null-terminator, whichever on comes first. - - If String has only pad spaces, then 0 is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then - 0 is returned. - - If the number represented by String overflows according to the range defined by UINT64, - then MAX_UINT64 is returned. - If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, - and String contains more than PcdMaximumAsciiStringLength ASCII characters not including - the Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated ASCII string. - - @retval Value translated from String. - -**/ -UINT64 -EFIAPI -AsciiStrHexToUint64 ( - IN CONST CHAR8 *String - ) -{ - UINT64 Result; - - AsciiStrHexToUint64S (String, (CHAR8 **) NULL, &Result); - return Result; -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function is deprecated for security reason. - - Convert one Null-terminated ASCII string to a Null-terminated - Unicode string and returns the Unicode string. - - This function converts the contents of the ASCII string Source to the Unicode - string Destination, and returns Destination. The function terminates the - Unicode string Destination by appending a Null-terminator character at the end. - The caller is responsible to make sure Destination points to a buffer with size - equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes. - - If Destination is NULL, then ASSERT(). - If Destination is not aligned on a 16-bit boundary, then ASSERT(). - If Source is NULL, then ASSERT(). - If Source and Destination overlap, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Source contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, - then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength ASCII characters not including the - Null-terminator, then ASSERT(). - - @param Source A pointer to a Null-terminated ASCII string. - @param Destination A pointer to a Null-terminated Unicode string. - - @return Destination. - -**/ -CHAR16 * -EFIAPI -AsciiStrToUnicodeStr ( - IN CONST CHAR8 *Source, - OUT CHAR16 *Destination - ) -{ - CHAR16 *ReturnValue; - - ASSERT (Destination != NULL); - - // - // ASSERT Source is less long than PcdMaximumAsciiStringLength - // - ASSERT (AsciiStrSize (Source) != 0); - - // - // Source and Destination should not overlap - // - ASSERT ((UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source)); - ASSERT ((UINTN) (Source - (CHAR8 *) Destination) >= (AsciiStrSize (Source) * sizeof (CHAR16))); - - - ReturnValue = Destination; - while (*Source != '\0') { - *(Destination++) = (CHAR16)(UINT8) *(Source++); - } - // - // End the Destination with a NULL. - // - *Destination = '\0'; - - // - // ASSERT Original Destination is less long than PcdMaximumUnicodeStringLength - // - ASSERT (StrSize (ReturnValue) != 0); - - return ReturnValue; -} - -#endif - -// -// The basis for Base64 encoding is RFC 4686 https://tools.ietf.org/html/rfc4648 -// -// RFC 4686 has a number of MAY and SHOULD cases. This implementation chooses -// the more restrictive versions for security concerns (see RFC 4686 section 3.3). -// -// A invalid character, if encountered during the decode operation, causes the data -// to be rejected. In addition, the '=' padding character is only allowed at the end -// of the Base64 encoded string. -// -#define BAD_V 99 - -STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -STATIC UINT8 DecodingTable[] = { - // - // Valid characters ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ - // Also, set '=' as a zero for decoding - // 0 , 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 10 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, 62, BAD_V, BAD_V, BAD_V, 63, // 20 - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, BAD_V, BAD_V, BAD_V, 0, BAD_V, BAD_V, // 30 - BAD_V, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40 - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 50 - BAD_V, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 60 - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 70 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 80 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // 90 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // a0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // b0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // c0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // d0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, // d0 - BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V, BAD_V // f0 -}; - -/** - Convert binary data to a Base64 encoded ascii string based on RFC4648. - - Produce a Null-terminated Ascii string in the output buffer specified by Destination and DestinationSize. - The Ascii string is produced by converting the data string specified by Source and SourceLength. - - @param Source Input UINT8 data - @param SourceLength Number of UINT8 bytes of data - @param Destination Pointer to output string buffer - @param DestinationSize Size of ascii buffer. Set to 0 to get the size needed. - Caller is responsible for passing in buffer of DestinationSize - - @retval RETURN_SUCCESS When ascii buffer is filled in. - @retval RETURN_INVALID_PARAMETER If Source is NULL or DestinationSize is NULL. - @retval RETURN_INVALID_PARAMETER If SourceLength or DestinationSize is bigger than (MAX_ADDRESS - (UINTN)Destination). - @retval RETURN_BUFFER_TOO_SMALL If SourceLength is 0 and DestinationSize is <1. - @retval RETURN_BUFFER_TOO_SMALL If Destination is NULL or DestinationSize is smaller than required buffersize. - -**/ -RETURN_STATUS -EFIAPI -Base64Encode ( - IN CONST UINT8 *Source, - IN UINTN SourceLength, - OUT CHAR8 *Destination OPTIONAL, - IN OUT UINTN *DestinationSize - ) -{ - - UINTN RequiredSize; - UINTN Left; - - // - // Check pointers, and SourceLength is valid - // - if ((Source == NULL) || (DestinationSize == NULL)) { - return RETURN_INVALID_PARAMETER; - } - - // - // Allow for RFC 4648 test vector 1 - // - if (SourceLength == 0) { - if (*DestinationSize < 1) { - *DestinationSize = 1; - return RETURN_BUFFER_TOO_SMALL; - } - *DestinationSize = 1; - *Destination = '\0'; - return RETURN_SUCCESS; - } - - // - // Check if SourceLength or DestinationSize is valid - // - if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))){ - return RETURN_INVALID_PARAMETER; - } - - // - // 4 ascii per 3 bytes + NULL - // - RequiredSize = ((SourceLength + 2) / 3) * 4 + 1; - if ((Destination == NULL) || *DestinationSize < RequiredSize) { - *DestinationSize = RequiredSize; - return RETURN_BUFFER_TOO_SMALL; - } - - Left = SourceLength; - - // - // Encode 24 bits (three bytes) into 4 ascii characters - // - while (Left >= 3) { - - *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; - } - - // - // Handle the remainder, and add padding '=' characters as necessary. - // - switch (Left) { - case 0: - - // - // No bytes Left, done. - // - break; - case 1: - - // - // One more data byte, two pad characters - // - *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2]; - *Destination++ = EncodingTable[((Source[0] & 0x03) << 4)]; - *Destination++ = '='; - *Destination++ = '='; - break; - case 2: - - // - // Two more data bytes, and one pad character - // - *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 - // - *Destination = '\0'; - return RETURN_SUCCESS; -} - -/** - Convert Base64 ascii string to binary data based on RFC4648. - - Produce Null-terminated binary data in the output buffer specified by Destination and DestinationSize. - The binary data is produced by converting the Base64 ascii string specified by Source and SourceLength. - - @param Source Input ASCII characters - @param SourceLength Number of ASCII characters - @param Destination Pointer to output buffer - @param DestinationSize Caller is responsible for passing in buffer of at least DestinationSize. - Set 0 to get the size needed. Set to bytes stored on return. - - @retval RETURN_SUCCESS When binary buffer is filled in. - @retval RETURN_INVALID_PARAMETER If Source is NULL or DestinationSize is NULL. - @retval RETURN_INVALID_PARAMETER If SourceLength or DestinationSize is bigger than (MAX_ADDRESS -(UINTN)Destination ). - @retval RETURN_INVALID_PARAMETER If there is any invalid character in input stream. - @retval RETURN_BUFFER_TOO_SMALL If buffer length is smaller than required buffer size. - **/ -RETURN_STATUS -EFIAPI -Base64Decode ( - IN CONST CHAR8 *Source, - IN UINTN SourceLength, - OUT UINT8 *Destination OPTIONAL, - IN OUT UINTN *DestinationSize - ) -{ - - UINT32 Value; - CHAR8 Chr; - INTN BufferSize; - UINTN SourceIndex; - UINTN DestinationIndex; - UINTN Index; - UINTN ActualSourceLength; - - // - // Check pointers are not NULL - // - if ((Source == NULL) || (DestinationSize == NULL)) { - return RETURN_INVALID_PARAMETER; - } - - // - // Check if SourceLength or DestinationSize is valid - // - if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))){ - return RETURN_INVALID_PARAMETER; - } - - ActualSourceLength = 0; - BufferSize = 0; - - // - // Determine the actual number of valid characters in the string. - // All invalid characters except selected white space characters, - // will cause the Base64 string to be rejected. White space to allow - // properly formatted XML will be ignored. - // - // See section 3.3 of RFC 4648. - // - for (SourceIndex = 0; SourceIndex < SourceLength; SourceIndex++) { - - // - // '=' is part of the quantum - // - if (Source[SourceIndex] == '=') { - ActualSourceLength++; - BufferSize--; - - // - // Only two '=' characters can be valid. - // - if (BufferSize < -2) { - return RETURN_INVALID_PARAMETER; - } - } - else { - Chr = Source[SourceIndex]; - if (BAD_V != DecodingTable[(UINT8) Chr]) { - - // - // The '=' characters are only valid at the end, so any - // valid character after an '=', will be flagged as an error. - // - if (BufferSize < 0) { - return RETURN_INVALID_PARAMETER; - } - ActualSourceLength++; - } - else { - - // - // The reset of the decoder will ignore all invalid characters allowed here. - // Ignoring selected white space is useful. In this case, the decoder will - // ignore ' ', '\t', '\n', and '\r'. - // - if ((Chr != ' ') &&(Chr != '\t') &&(Chr != '\n') &&(Chr != '\r')) { - return RETURN_INVALID_PARAMETER; - } - } - } - } - - // - // The Base64 character string must be a multiple of 4 character quantums. - // - if (ActualSourceLength % 4 != 0) { - return RETURN_INVALID_PARAMETER; - } - - BufferSize += ActualSourceLength / 4 * 3; - if (BufferSize < 0) { - return RETURN_INVALID_PARAMETER; - } - - // - // BufferSize is >= 0 - // - if ((Destination == NULL) || (*DestinationSize < (UINTN) BufferSize)) { - *DestinationSize = BufferSize; - return RETURN_BUFFER_TOO_SMALL; - } - - // - // If no decodable characters, return a size of zero. RFC 4686 test vector 1. - // - if (ActualSourceLength == 0) { - *DestinationSize = 0; - return RETURN_SUCCESS; - } - - // - // Input data is verified to be a multiple of 4 valid charcters. Process four - // characters at a time. Uncounted (ie. invalid) characters will be ignored. - // - for (SourceIndex = 0, DestinationIndex = 0; (SourceIndex < SourceLength) && (DestinationIndex < *DestinationSize); ) { - Value = 0; - - // - // Get 24 bits of data from 4 input characters, each character representing 6 bits - // - for (Index = 0; Index < 4; Index++) { - do { - Chr = DecodingTable[(UINT8) Source[SourceIndex++]]; - } while (Chr == BAD_V); - Value <<= 6; - Value |= (UINT32)Chr; - } - - // - // Store 3 bytes of binary data (24 bits) - // - *Destination++ = (UINT8) (Value >> 16); - DestinationIndex++; - - // - // Due to the '=' special cases for the two bytes at the end, - // we have to check the length and not store the padding data - // - if (DestinationIndex++ < *DestinationSize) { - *Destination++ = (UINT8) (Value >> 8); - } - if (DestinationIndex++ < *DestinationSize) { - *Destination++ = (UINT8) Value; - } - } - - return RETURN_SUCCESS; -} - -/** - Converts an 8-bit value to an 8-bit BCD value. - - Converts the 8-bit value specified by Value to BCD. The BCD value is - returned. - - If Value >= 100, then ASSERT(). - - @param Value The 8-bit value to convert to BCD. Range 0..99. - - @return The BCD value. - -**/ -UINT8 -EFIAPI -DecimalToBcd8 ( - IN UINT8 Value - ) -{ - ASSERT (Value < 100); - return (UINT8) (((Value / 10) << 4) | (Value % 10)); -} - -/** - Converts an 8-bit BCD value to an 8-bit value. - - Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit - value is returned. - - If Value >= 0xA0, then ASSERT(). - If (Value & 0x0F) >= 0x0A, then ASSERT(). - - @param Value The 8-bit BCD value to convert to an 8-bit value. - - @return The 8-bit value is returned. - -**/ -UINT8 -EFIAPI -BcdToDecimal8 ( - IN UINT8 Value - ) -{ - ASSERT (Value < 0xa0); - ASSERT ((Value & 0xf) < 0xa); - return (UINT8) ((Value >> 4) * 10 + (Value & 0xf)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes16.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes16.c deleted file mode 100644 index 39373bd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes16.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Switches the endianess of a 16-bit integer. - - This function swaps the bytes in a 16-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Value A 16-bit unsigned value. - - @return The byte swapped Value. - -**/ -UINT16 -EFIAPI -SwapBytes16 ( - IN UINT16 Value - ) -{ - return (UINT16) ((Value<< 8) | (Value>> 8)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes32.c deleted file mode 100644 index a0aecf5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes32.c +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Switches the endianess of a 32-bit integer. - - This function swaps the bytes in a 32-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Value A 32-bit unsigned value. - - @return The byte swapped Value. - -**/ -UINT32 -EFIAPI -SwapBytes32 ( - IN UINT32 Value - ) -{ - UINT32 LowerBytes; - UINT32 HigherBytes; - - LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value); - HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16)); - - return (LowerBytes << 16 | HigherBytes); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes64.c deleted file mode 100644 index 946fc83..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwapBytes64.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - Math worker functions. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Switches the endianess of a 64-bit integer. - - This function swaps the bytes in a 64-bit unsigned value to switch the value - from little endian to big endian or vice versa. The byte swapped value is - returned. - - @param Value A 64-bit unsigned value. - - @return The byte swapped Value. - -**/ -UINT64 -EFIAPI -SwapBytes64 ( - IN UINT64 Value - ) -{ - return InternalMathSwapBytes64 (Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwitchStack.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwitchStack.c deleted file mode 100644 index 656c673..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/SwitchStack.c +++ /dev/null @@ -1,76 +0,0 @@ -/** @file - Switch Stack functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the - new stack specified by NewStack and passing in the parameters specified - by Context1 and Context2. Context1 and Context2 are optional and may - be NULL. The function EntryPoint must never return. This function - supports a variable number of arguments following the NewStack parameter. - These additional arguments are ignored on IA-32, x64, and EBC. - IPF CPUs expect one additional parameter of type VOID * that specifies - the new backing store pointer. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param ... This variable argument list is ignored for IA32, x64, and EBC. - For IPF, this variable argument list is expected to contain - a single parameter of type VOID * that specifies the new backing - store pointer. - - -**/ -VOID -EFIAPI -SwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - ... - ) -{ - VA_LIST Marker; - - ASSERT (EntryPoint != NULL); - ASSERT (NewStack != NULL); - - // - // New stack must be aligned with CPU_STACK_ALIGNMENT - // - ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); - - VA_START (Marker, NewStack); - - InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker); - - VA_END (Marker); - - // - // InternalSwitchStack () will never return - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Unaligned.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Unaligned.c deleted file mode 100644 index 04249c8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/Unaligned.c +++ /dev/null @@ -1,222 +0,0 @@ -/** @file - Unaligned access functions of BaseLib. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Reads a 16-bit value from memory that may be unaligned. - - This function returns the 16-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 16-bit value that may be unaligned. - - @return The 16-bit value read from Buffer. - -**/ -UINT16 -EFIAPI -ReadUnaligned16 ( - IN CONST UINT16 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer; -} - -/** - Writes a 16-bit value to memory that may be unaligned. - - This function writes the 16-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 16-bit value that may be unaligned. - @param Value 16-bit value to write to Buffer. - - @return The 16-bit value to write to Buffer. - -**/ -UINT16 -EFIAPI -WriteUnaligned16 ( - OUT UINT16 *Buffer, - IN UINT16 Value - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer = Value; -} - -/** - Reads a 24-bit value from memory that may be unaligned. - - This function returns the 24-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 24-bit value that may be unaligned. - - @return The 24-bit value read from Buffer. - -**/ -UINT32 -EFIAPI -ReadUnaligned24 ( - IN CONST UINT32 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer & 0xffffff; -} - -/** - Writes a 24-bit value to memory that may be unaligned. - - This function writes the 24-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 24-bit value that may be unaligned. - @param Value 24-bit value to write to Buffer. - - @return The 24-bit value to write to Buffer. - -**/ -UINT32 -EFIAPI -WriteUnaligned24 ( - OUT UINT32 *Buffer, - IN UINT32 Value - ) -{ - ASSERT (Buffer != NULL); - - *Buffer = BitFieldWrite32 (*Buffer, 0, 23, Value); - return Value; -} - -/** - Reads a 32-bit value from memory that may be unaligned. - - This function returns the 32-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 32-bit value that may be unaligned. - - @return The 32-bit value read from Buffer. - -**/ -UINT32 -EFIAPI -ReadUnaligned32 ( - IN CONST UINT32 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer; -} - -/** - Writes a 32-bit value to memory that may be unaligned. - - This function writes the 32-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 32-bit value that may be unaligned. - @param Value The 32-bit value to write to Buffer. - - @return The 32-bit value to write to Buffer. - -**/ -UINT32 -EFIAPI -WriteUnaligned32 ( - OUT UINT32 *Buffer, - IN UINT32 Value - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer = Value; -} - -/** - Reads a 64-bit value from memory that may be unaligned. - - This function returns the 64-bit value pointed to by Buffer. The function - guarantees that the read operation does not produce an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 64-bit value that may be unaligned. - - @return The 64-bit value read from Buffer. - -**/ -UINT64 -EFIAPI -ReadUnaligned64 ( - IN CONST UINT64 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer; -} - -/** - Writes a 64-bit value to memory that may be unaligned. - - This function writes the 64-bit value specified by Value to Buffer. Value is - returned. The function guarantees that the write operation does not produce - an alignment fault. - - If the Buffer is NULL, then ASSERT(). - - @param Buffer A pointer to a 64-bit value that may be unaligned. - @param Value The 64-bit value to write to Buffer. - - @return The 64-bit value to write to Buffer. - -**/ -UINT64 -EFIAPI -WriteUnaligned64 ( - OUT UINT64 *Buffer, - IN UINT64 Value - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer = Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c deleted file mode 100644 index 2f08ca9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - CpuBreakpoint function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -void __debugbreak (VOID); - -#pragma intrinsic(__debugbreak) - -/** - Generates a breakpoint on the CPU. - - Generates a breakpoint on the CPU. The breakpoint must be implemented such - that code can resume normal execution after the breakpoint. - -**/ -VOID -EFIAPI -CpuBreakpoint ( - VOID - ) -{ - __debugbreak (); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.nasm deleted file mode 100644 index d39f8fe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuBreakpoint.Asm -; -; Abstract: -; -; CpuBreakpoint function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuBreakpoint ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuBreakpoint) -ASM_PFX(CpuBreakpoint): - int 3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.S deleted file mode 100644 index 19ae1c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.S +++ /dev/null @@ -1,60 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuId.S -# -# Abstract: -# -# AsmCpuid function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmCpuid ( -# IN UINT32 RegisterInEax, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmCpuid) -ASM_PFX(AsmCpuid): - push %rbx - mov %ecx, %eax - push %rax # save Index on stack - push %rdx - cpuid - test %r9, %r9 - jz L1 - mov %ecx, (%r9) -L1: - pop %rcx - jrcxz L2 - mov %eax, (%rcx) -L2: - mov %r8, %rcx - jrcxz L3 - mov %ebx, (%rcx) -L3: - mov 0x38(%rsp), %rcx - jrcxz L4 - mov %edx, (%rcx) -L4: - pop %rax # restore Index to rax as return value - pop %rbx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.nasm deleted file mode 100644 index 3f3060f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuId.nasm +++ /dev/null @@ -1,64 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuId.Asm -; -; Abstract: -; -; AsmCpuid function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmCpuid ( -; IN UINT32 RegisterInEax, -; OUT UINT32 *RegisterOutEax OPTIONAL, -; OUT UINT32 *RegisterOutEbx OPTIONAL, -; OUT UINT32 *RegisterOutEcx OPTIONAL, -; OUT UINT32 *RegisterOutEdx OPTIONAL -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(AsmCpuid) -ASM_PFX(AsmCpuid): - push rbx - mov eax, ecx - push rax ; save Index on stack - push rdx - cpuid - test r9, r9 - jz .0 - mov [r9], ecx -.0: - pop rcx - jrcxz .1 - mov [rcx], eax -.1: - mov rcx, r8 - jrcxz .2 - mov [rcx], ebx -.2: - mov rcx, [rsp + 0x38] - jrcxz .3 - mov [rcx], edx -.3: - pop rax ; restore Index to rax as return value - pop rbx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S deleted file mode 100644 index c41456f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S +++ /dev/null @@ -1,62 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CpuIdEx.S -# -# Abstract: -# -# AsmCpuidEx function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# UINT32 -# EFIAPI -# AsmCpuidEx ( -# IN UINT32 RegisterInEax, -# IN UINT32 RegisterInEcx, -# OUT UINT32 *RegisterOutEax OPTIONAL, -# OUT UINT32 *RegisterOutEbx OPTIONAL, -# OUT UINT32 *RegisterOutEcx OPTIONAL, -# OUT UINT32 *RegisterOutEdx OPTIONAL -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push %rbx - movl %ecx,%eax - movl %edx,%ecx - push %rax # save Index on stack - cpuid - mov 0x38(%rsp), %r10 - test %r10, %r10 - jz L1 - mov %ecx,(%r10) -L1: - mov %r8, %rcx - jrcxz L2 - movl %eax,(%rcx) -L2: - mov %r9, %rcx - jrcxz L3 - mov %ebx, (%rcx) -L3: - mov 0x40(%rsp), %rcx - jrcxz L4 - mov %edx, (%rcx) -L4: - pop %rax # restore Index to rax as return value - pop %rbx - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.nasm deleted file mode 100644 index 624b8df..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.nasm +++ /dev/null @@ -1,66 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuIdEx.Asm -; -; Abstract: -; -; AsmCpuidEx function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; AsmCpuidEx ( -; IN UINT32 RegisterInEax, -; IN UINT32 RegisterInEcx, -; OUT UINT32 *RegisterOutEax OPTIONAL, -; OUT UINT32 *RegisterOutEbx OPTIONAL, -; OUT UINT32 *RegisterOutEcx OPTIONAL, -; OUT UINT32 *RegisterOutEdx OPTIONAL -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(AsmCpuidEx) -ASM_PFX(AsmCpuidEx): - push rbx - mov eax, ecx - mov ecx, edx - push rax ; save Index on stack - cpuid - mov r10, [rsp + 0x38] - test r10, r10 - jz .0 - mov [r10], ecx -.0: - mov rcx, r8 - jrcxz .1 - mov [rcx], eax -.1: - mov rcx, r9 - jrcxz .2 - mov [rcx], ebx -.2: - mov rcx, [rsp + 0x40] - jrcxz .3 - mov [rcx], edx -.3: - pop rax ; restore Index to rax as return value - pop rbx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuPause.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuPause.nasm deleted file mode 100644 index 83efe57..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/CpuPause.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CpuPause.Asm -; -; Abstract: -; -; CpuPause function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuPause ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(CpuPause) -ASM_PFX(CpuPause): - pause - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.S deleted file mode 100644 index 45c1a22..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.S +++ /dev/null @@ -1,39 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DisableCache.S -# -# Abstract: -# -# Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a -# WBINVD instruction. -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmDisableCache ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmDisableCache) -ASM_PFX(AsmDisableCache): - movq %cr0, %rax - btsq $30, %rax - btrq $29, %rax - movq %rax, %cr0 - wbinvd - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.nasm deleted file mode 100644 index 9f565b1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableCache.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisableCache.Asm -; -; Abstract: -; -; Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a -; WBINVD instruction. -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmDisableCache ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmDisableCache) -ASM_PFX(AsmDisableCache): - mov rax, cr0 - bts rax, 30 - btr rax, 29 - mov cr0, rax - wbinvd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.nasm deleted file mode 100644 index eb11e14..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisableInterrupts.Asm -; -; Abstract: -; -; DisableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; DisableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(DisableInterrupts) -ASM_PFX(DisableInterrupts): - cli - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S deleted file mode 100644 index ecf580b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S +++ /dev/null @@ -1,82 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# DisablePaging64.S -# -# Abstract: -# -# AsmDisablePaging64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalX86DisablePaging64 ( -# IN UINT16 Cs, -# IN UINT32 EntryPoint, -# IN UINT32 Context1, OPTIONAL -# IN UINT32 Context2, OPTIONAL -# IN UINT32 NewStack -# ); -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalX86DisablePaging64) -ASM_PFX(InternalX86DisablePaging64): - cli - lea L1(%rip), %rsi # rsi <- The start address of transition code - mov 0x28(%rsp), %edi # rdi <- New stack - lea _mTransitionEnd(%rip), %rax # rax <- end of transition code - sub %rsi, %rax # rax <- The size of transition piece code - add $4, %rax # round rax up to the next 4 byte boundary - and $0xfc, %al - sub %rax, %rdi # rdi <- use stack to hold transition code - mov %edi, %r10d # r10 <- The start address of transicition code below 4G - push %rcx # save rcx to stack - mov %rax, %rcx # rcx <- The size of transition piece code - rep - movsb # copy transition code to (new stack - 64byte) below 4G - pop %rcx # restore rcx - - mov %r8d, %esi - mov %r9d, %edi - mov %r10d, %eax - sub $4, %eax - push %rcx # push Cs to stack - push %r10 # push address of transition code on stack - .byte 0x48, 0xcb # retq: Use far return to load CS register from stack - # (Use raw byte code since some GNU assemblers generates incorrect code for "retq") -L1: - mov %eax,%esp # set up new stack - mov %cr0,%rax - btr $0x1f,%eax # clear CR0.PG - mov %rax,%cr0 # disable paging - - mov %edx,%ebx # save EntryPoint to ebx, for rdmsr will overwrite edx - mov $0xc0000080,%ecx - rdmsr - and $0xfe,%ah # clear LME - wrmsr - mov %cr4,%rax - and $0xdf,%al # clear PAE - mov %rax,%cr4 - push %rdi # push Context2 - push %rsi # push Context1 - callq *%rbx # transfer control to EntryPoint - jmp . # no one should get here - -_mTransitionEnd : diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm deleted file mode 100644 index 9410b35..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm +++ /dev/null @@ -1,84 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; DisablePaging64.Asm -; -; Abstract: -; -; AsmDisablePaging64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86DisablePaging64 ( -; IN UINT16 Cs, -; IN UINT32 EntryPoint, -; IN UINT32 Context1, OPTIONAL -; IN UINT32 Context2, OPTIONAL -; IN UINT32 NewStack -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86DisablePaging64) -ASM_PFX(InternalX86DisablePaging64): - cli - lea rsi, [.0] ; rsi <- The start address of transition code - mov edi, [rsp + 0x28] ; rdi <- New stack - lea rax, [mTransitionEnd] ; rax <- end of transition code - sub rax, rsi ; rax <- The size of transition piece code - add rax, 4 ; Round RAX up to the next 4 byte boundary - and al, 0xfc - sub rdi, rax ; rdi <- Use stack to hold transition code - mov r10d, edi ; r10 <- The start address of transicition code below 4G - push rcx ; save rcx to stack - mov rcx, rax ; rcx <- The size of transition piece code - rep movsb ; copy transition code to top of new stack which must be below 4GB - pop rcx ; restore rcx - - mov esi, r8d - mov edi, r9d - mov eax, r10d ; eax <- start of the transition code on the stack - sub eax, 4 ; eax <- One slot below transition code on the stack - push rcx ; push Cs to stack - push r10 ; push address of tansition code on stack - DB 0x48 ; prefix to composite "retq" with next "retf" - retf ; Use far return to load CS register from stack - -; Start of transition code -.0: - mov esp, eax ; set up new stack - mov rax, cr0 - btr eax, 31 ; Clear CR0.PG - mov cr0, rax ; disable paging and caches - - mov ebx, edx ; save EntryPoint to rbx, for rdmsr will overwrite rdx - mov ecx, 0xc0000080 - rdmsr - and ah, ~ 1 ; clear LME - wrmsr - mov rax, cr4 - and al, ~ (1 << 5) ; clear PAE - mov cr4, rax - push rdi ; push Context2 - push rsi ; push Context1 - call rbx ; transfer control to EntryPoint - hlt ; no one should get here - -mTransitionEnd: - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.S deleted file mode 100644 index 9af08df..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.S +++ /dev/null @@ -1,39 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnableCache.S -# -# Abstract: -# -# Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear -# the NW bit of CR0 to 0 -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# AsmEnableCache ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(AsmEnableCache) -ASM_PFX(AsmEnableCache): - wbinvd - movq %cr0, %rax - btrq $30, %rax - btrq $29, %rax - movq %rax, %cr0 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.nasm deleted file mode 100644 index 317ee8c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableCache.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableCache.Asm -; -; Abstract: -; -; Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear -; the NW bit of CR0 to 0 -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmEnableCache ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmEnableCache) -ASM_PFX(AsmEnableCache): - wbinvd - mov rax, cr0 - btr rax, 29 - btr rax, 30 - mov cr0, rax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S deleted file mode 100644 index 0ffc6e9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# EnableDisableInterrupts.S -# -# Abstract: -# -# EnableDisableInterrupts function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# EnableDisableInterrupts ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(EnableDisableInterrupts) -ASM_PFX(EnableDisableInterrupts): - sti - cli - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.nasm deleted file mode 100644 index ad90580..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableDisableInterrupts.Asm -; -; Abstract: -; -; EnableDisableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; EnableDisableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(EnableDisableInterrupts) -ASM_PFX(EnableDisableInterrupts): - sti - cli - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm deleted file mode 100644 index 2b9f67c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; EnableInterrupts.Asm -; -; Abstract: -; -; EnableInterrupts function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; EnableInterrupts ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(EnableInterrupts) -ASM_PFX(EnableInterrupts): - sti - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.nasm deleted file mode 100644 index 6fff993..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FlushCacheLine.Asm -; -; Abstract: -; -; AsmFlushCacheLine function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; AsmFlushCacheLine ( -; IN VOID *LinearAddress -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmFlushCacheLine) -ASM_PFX(AsmFlushCacheLine): - clflush [rcx] - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxRestore.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxRestore.nasm deleted file mode 100644 index 6b2db0e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxRestore.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FxRestore.Asm -; -; Abstract: -; -; AsmFxRestore function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86FxRestore ( -; IN CONST IA32_FX_BUFFER *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86FxRestore) -ASM_PFX(InternalX86FxRestore): - fxrstor [rcx] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxSave.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxSave.nasm deleted file mode 100644 index f729b3a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/FxSave.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; FxSave.Asm -; -; Abstract: -; -; AsmFxSave function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86FxSave ( -; OUT IA32_FX_BUFFER *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86FxSave) -ASM_PFX(InternalX86FxSave): - fxsave [rcx] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/GccInline.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/GccInline.c deleted file mode 100644 index f8a9ff8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/GccInline.c +++ /dev/null @@ -1,1806 +0,0 @@ -/** @file - GCC inline implementation of BaseLib processor specific functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - - - -/** - Used to serialize load and store operations. - - All loads and stores that proceed calls to this function are guaranteed to be - globally visible when this function returns. - -**/ -VOID -EFIAPI -MemoryFence ( - VOID - ) -{ - // This is a little bit of overkill and it is more about the compiler that it is - // actually processor synchronization. This is like the _ReadWriteBarrier - // Microsoft specific intrinsic - __asm__ __volatile__ ("":::"memory"); -} - - -/** - Enables CPU interrupts. - - Enables CPU interrupts. - -**/ -VOID -EFIAPI -EnableInterrupts ( - VOID - ) -{ - __asm__ __volatile__ ("sti"::: "memory"); -} - - -/** - Disables CPU interrupts. - - Disables CPU interrupts. - -**/ -VOID -EFIAPI -DisableInterrupts ( - VOID - ) -{ - __asm__ __volatile__ ("cli"::: "memory"); -} - - - - -/** - Requests CPU to pause for a short period of time. - - Requests CPU to pause for a short period of time. Typically used in MP - systems to prevent memory starvation while waiting for a spin lock. - -**/ -VOID -EFIAPI -CpuPause ( - VOID - ) -{ - __asm__ __volatile__ ("pause"); -} - - -/** - Generates a breakpoint on the CPU. - - Generates a breakpoint on the CPU. The breakpoint must be implemented such - that code can resume normal execution after the breakpoint. - -**/ -VOID -EFIAPI -CpuBreakpoint ( - VOID - ) -{ - __asm__ __volatile__ ("int $3"); -} - - - -/** - Returns a 64-bit Machine Specific Register(MSR). - - Reads and returns the 64-bit MSR specified by Index. No parameter checking is - performed on Index, and some Index values may cause CPU exceptions. The - caller must either guarantee that Index is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. - - @param Index The 32-bit MSR index to read. - - @return The value of the MSR identified by Index. - -**/ -UINT64 -EFIAPI -AsmReadMsr64 ( - IN UINT32 Index - ) -{ - UINT32 LowData; - UINT32 HighData; - - __asm__ __volatile__ ( - "rdmsr" - : "=a" (LowData), // %0 - "=d" (HighData) // %1 - : "c" (Index) // %2 - ); - - return (((UINT64)HighData) << 32) | LowData; -} - -/** - Writes a 64-bit value to a Machine Specific Register(MSR), and returns the - value. - - Writes the 64-bit value specified by Value to the MSR specified by Index. The - 64-bit value written to the MSR is returned. No parameter checking is - performed on Index or Value, and some of these may cause CPU exceptions. The - caller must either guarantee that Index and Value are valid, or the caller - must establish proper exception handlers. This function is only available on - IA-32 and X64. - - @param Index The 32-bit MSR index to write. - @param Value The 64-bit value to write to the MSR. - - @return Value - -**/ -UINT64 -EFIAPI -AsmWriteMsr64 ( - IN UINT32 Index, - IN UINT64 Value - ) -{ - UINT32 LowData; - UINT32 HighData; - - LowData = (UINT32)(Value); - HighData = (UINT32)(Value >> 32); - - __asm__ __volatile__ ( - "wrmsr" - : - : "c" (Index), - "a" (LowData), - "d" (HighData) - ); - - return Value; -} - - - -/** - Reads the current value of the EFLAGS register. - - Reads and returns the current value of the EFLAGS register. This function is - only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a - 64-bit value on X64. - - @return EFLAGS on IA-32 or RFLAGS on X64. - -**/ -UINTN -EFIAPI -AsmReadEflags ( - VOID - ) -{ - UINTN Eflags; - - __asm__ __volatile__ ( - "pushfq \n\t" - "pop %0 " - : "=r" (Eflags) // %0 - ); - - return Eflags; -} - - - -/** - Reads the current value of the Control Register 0 (CR0). - - Reads and returns the current value of CR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 0 (CR0). - -**/ -UINTN -EFIAPI -AsmReadCr0 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%cr0,%0" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of the Control Register 2 (CR2). - - Reads and returns the current value of CR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 2 (CR2). - -**/ -UINTN -EFIAPI -AsmReadCr2 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%cr2, %0" - : "=r" (Data) // %0 - ); - - return Data; -} - -/** - Reads the current value of the Control Register 3 (CR3). - - Reads and returns the current value of CR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 3 (CR3). - -**/ -UINTN -EFIAPI -AsmReadCr3 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%cr3, %0" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of the Control Register 4 (CR4). - - Reads and returns the current value of CR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of the Control Register 4 (CR4). - -**/ -UINTN -EFIAPI -AsmReadCr4 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%cr4, %0" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Writes a value to Control Register 0 (CR0). - - Writes and returns a new value to CR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr0 The value to write to CR0. - - @return The value written to CR0. - -**/ -UINTN -EFIAPI -AsmWriteCr0 ( - UINTN Cr0 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%cr0" - : - : "r" (Cr0) - ); - return Cr0; -} - - -/** - Writes a value to Control Register 2 (CR2). - - Writes and returns a new value to CR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr2 The value to write to CR2. - - @return The value written to CR2. - -**/ -UINTN -EFIAPI -AsmWriteCr2 ( - UINTN Cr2 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%cr2" - : - : "r" (Cr2) - ); - return Cr2; -} - - -/** - Writes a value to Control Register 3 (CR3). - - Writes and returns a new value to CR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr3 The value to write to CR3. - - @return The value written to CR3. - -**/ -UINTN -EFIAPI -AsmWriteCr3 ( - UINTN Cr3 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%cr3" - : - : "r" (Cr3) - ); - return Cr3; -} - - -/** - Writes a value to Control Register 4 (CR4). - - Writes and returns a new value to CR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Cr4 The value to write to CR4. - - @return The value written to CR4. - -**/ -UINTN -EFIAPI -AsmWriteCr4 ( - UINTN Cr4 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%cr4" - : - : "r" (Cr4) - ); - return Cr4; -} - - -/** - Reads the current value of Debug Register 0 (DR0). - - Reads and returns the current value of DR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmReadDr0 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr0, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 1 (DR1). - - Reads and returns the current value of DR1. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmReadDr1 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr1, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 2 (DR2). - - Reads and returns the current value of DR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmReadDr2 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr2, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 3 (DR3). - - Reads and returns the current value of DR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmReadDr3 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr3, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 4 (DR4). - - Reads and returns the current value of DR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmReadDr4 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr4, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 5 (DR5). - - Reads and returns the current value of DR5. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmReadDr5 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr5, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 6 (DR6). - - Reads and returns the current value of DR6. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmReadDr6 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr6, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Debug Register 7 (DR7). - - Reads and returns the current value of DR7. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. - - @return The value of Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmReadDr7 ( - VOID - ) -{ - UINTN Data; - - __asm__ __volatile__ ( - "mov %%dr7, %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Writes a value to Debug Register 0 (DR0). - - Writes and returns a new value to DR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr0 The value to write to Dr0. - - @return The value written to Debug Register 0 (DR0). - -**/ -UINTN -EFIAPI -AsmWriteDr0 ( - UINTN Dr0 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr0" - : - : "r" (Dr0) - ); - return Dr0; -} - - -/** - Writes a value to Debug Register 1 (DR1). - - Writes and returns a new value to DR1. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr1 The value to write to Dr1. - - @return The value written to Debug Register 1 (DR1). - -**/ -UINTN -EFIAPI -AsmWriteDr1 ( - UINTN Dr1 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr1" - : - : "r" (Dr1) - ); - return Dr1; -} - - -/** - Writes a value to Debug Register 2 (DR2). - - Writes and returns a new value to DR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr2 The value to write to Dr2. - - @return The value written to Debug Register 2 (DR2). - -**/ -UINTN -EFIAPI -AsmWriteDr2 ( - UINTN Dr2 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr2" - : - : "r" (Dr2) - ); - return Dr2; -} - - -/** - Writes a value to Debug Register 3 (DR3). - - Writes and returns a new value to DR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr3 The value to write to Dr3. - - @return The value written to Debug Register 3 (DR3). - -**/ -UINTN -EFIAPI -AsmWriteDr3 ( - UINTN Dr3 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr3" - : - : "r" (Dr3) - ); - return Dr3; -} - - -/** - Writes a value to Debug Register 4 (DR4). - - Writes and returns a new value to DR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr4 The value to write to Dr4. - - @return The value written to Debug Register 4 (DR4). - -**/ -UINTN -EFIAPI -AsmWriteDr4 ( - UINTN Dr4 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr4" - : - : "r" (Dr4) - ); - return Dr4; -} - - -/** - Writes a value to Debug Register 5 (DR5). - - Writes and returns a new value to DR5. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr5 The value to write to Dr5. - - @return The value written to Debug Register 5 (DR5). - -**/ -UINTN -EFIAPI -AsmWriteDr5 ( - UINTN Dr5 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr5" - : - : "r" (Dr5) - ); - return Dr5; -} - - -/** - Writes a value to Debug Register 6 (DR6). - - Writes and returns a new value to DR6. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr6 The value to write to Dr6. - - @return The value written to Debug Register 6 (DR6). - -**/ -UINTN -EFIAPI -AsmWriteDr6 ( - UINTN Dr6 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr6" - : - : "r" (Dr6) - ); - return Dr6; -} - - -/** - Writes a value to Debug Register 7 (DR7). - - Writes and returns a new value to DR7. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. - - @param Dr7 The value to write to Dr7. - - @return The value written to Debug Register 7 (DR7). - -**/ -UINTN -EFIAPI -AsmWriteDr7 ( - UINTN Dr7 - ) -{ - __asm__ __volatile__ ( - "mov %0, %%dr7" - : - : "r" (Dr7) - ); - return Dr7; -} - - -/** - Reads the current value of Code Segment Register (CS). - - Reads and returns the current value of CS. This function is only available on - IA-32 and X64. - - @return The current value of CS. - -**/ -UINT16 -EFIAPI -AsmReadCs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%cs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Data Segment Register (DS). - - Reads and returns the current value of DS. This function is only available on - IA-32 and X64. - - @return The current value of DS. - -**/ -UINT16 -EFIAPI -AsmReadDs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%ds, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Extra Segment Register (ES). - - Reads and returns the current value of ES. This function is only available on - IA-32 and X64. - - @return The current value of ES. - -**/ -UINT16 -EFIAPI -AsmReadEs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%es, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of FS Data Segment Register (FS). - - Reads and returns the current value of FS. This function is only available on - IA-32 and X64. - - @return The current value of FS. - -**/ -UINT16 -EFIAPI -AsmReadFs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%fs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of GS Data Segment Register (GS). - - Reads and returns the current value of GS. This function is only available on - IA-32 and X64. - - @return The current value of GS. - -**/ -UINT16 -EFIAPI -AsmReadGs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%gs, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Stack Segment Register (SS). - - Reads and returns the current value of SS. This function is only available on - IA-32 and X64. - - @return The current value of SS. - -**/ -UINT16 -EFIAPI -AsmReadSs ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "mov %%ds, %0" - :"=a" (Data) - ); - - return Data; -} - - -/** - Reads the current value of Task Register (TR). - - Reads and returns the current value of TR. This function is only available on - IA-32 and X64. - - @return The current value of TR. - -**/ -UINT16 -EFIAPI -AsmReadTr ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "str %0" - : "=r" (Data) - ); - - return Data; -} - - -/** - Reads the current Global Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and X64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr - ) -{ - __asm__ __volatile__ ( - "sgdt %0" - : "=m" (*Gdtr) - ); -} - - -/** - Writes the current Global Descriptor Table Register (GDTR) descriptor. - - Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and X64. - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr - ) -{ - __asm__ __volatile__ ( - "lgdt %0" - : - : "m" (*Gdtr) - ); - -} - - -/** - Reads the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and X64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86ReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr - ) -{ - __asm__ __volatile__ ( - "sidt %0" - : "=m" (*Idtr) - ); -} - - -/** - Writes the current Interrupt Descriptor Table Register(GDTR) descriptor. - - Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and X64. - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -InternalX86WriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr - ) -{ - __asm__ __volatile__ ( - "lidt %0" - : - : "m" (*Idtr) - ); -} - - -/** - Reads the current Local Descriptor Table Register(LDTR) selector. - - Reads and returns the current 16-bit LDTR descriptor value. This function is - only available on IA-32 and X64. - - @return The current selector of LDT. - -**/ -UINT16 -EFIAPI -AsmReadLdtr ( - VOID - ) -{ - UINT16 Data; - - __asm__ __volatile__ ( - "sldt %0" - : "=g" (Data) // %0 - ); - - return Data; -} - - -/** - Writes the current Local Descriptor Table Register (GDTR) selector. - - Writes and the current LDTR descriptor specified by Ldtr. This function is - only available on IA-32 and X64. - - @param Ldtr 16-bit LDTR selector value. - -**/ -VOID -EFIAPI -AsmWriteLdtr ( - IN UINT16 Ldtr - ) -{ - __asm__ __volatile__ ( - "lldtw %0" - : - : "g" (Ldtr) // %0 - ); -} - - -/** - Save the current floating point/SSE/SSE2 context to a buffer. - - Saves the current floating point/SSE/SSE2 state to the buffer specified by - Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and X64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxSave ( - OUT IA32_FX_BUFFER *Buffer - ) -{ - __asm__ __volatile__ ( - "fxsave %0" - : - : "m" (*Buffer) // %0 - ); -} - - -/** - Restores the current floating point/SSE/SSE2 context from a buffer. - - Restores the current floating point/SSE/SSE2 state from the buffer specified - by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and X64. - - @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -InternalX86FxRestore ( - IN CONST IA32_FX_BUFFER *Buffer - ) -{ - __asm__ __volatile__ ( - "fxrstor %0" - : - : "m" (*Buffer) // %0 - ); -} - - -/** - Reads the current value of 64-bit MMX Register #0 (MM0). - - Reads and returns the current value of MM0. This function is only available - on IA-32 and X64. - - @return The current value of MM0. - -**/ -UINT64 -EFIAPI -AsmReadMm0 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm0, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #1 (MM1). - - Reads and returns the current value of MM1. This function is only available - on IA-32 and X64. - - @return The current value of MM1. - -**/ -UINT64 -EFIAPI -AsmReadMm1 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm1, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #2 (MM2). - - Reads and returns the current value of MM2. This function is only available - on IA-32 and X64. - - @return The current value of MM2. - -**/ -UINT64 -EFIAPI -AsmReadMm2 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm2, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #3 (MM3). - - Reads and returns the current value of MM3. This function is only available - on IA-32 and X64. - - @return The current value of MM3. - -**/ -UINT64 -EFIAPI -AsmReadMm3 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm3, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #4 (MM4). - - Reads and returns the current value of MM4. This function is only available - on IA-32 and X64. - - @return The current value of MM4. - -**/ -UINT64 -EFIAPI -AsmReadMm4 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm4, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #5 (MM5). - - Reads and returns the current value of MM5. This function is only available - on IA-32 and X64. - - @return The current value of MM5. - -**/ -UINT64 -EFIAPI -AsmReadMm5 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm5, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #6 (MM6). - - Reads and returns the current value of MM6. This function is only available - on IA-32 and X64. - - @return The current value of MM6. - -**/ -UINT64 -EFIAPI -AsmReadMm6 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm6, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Reads the current value of 64-bit MMX Register #7 (MM7). - - Reads and returns the current value of MM7. This function is only available - on IA-32 and X64. - - @return The current value of MM7. - -**/ -UINT64 -EFIAPI -AsmReadMm7 ( - VOID - ) -{ - UINT64 Data; - - __asm__ __volatile__ ( - "movd %%mm7, %0 \n\t" - : "=r" (Data) // %0 - ); - - return Data; -} - - -/** - Writes the current value of 64-bit MMX Register #0 (MM0). - - Writes the current value of MM0. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM0. - -**/ -VOID -EFIAPI -AsmWriteMm0 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm0" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #1 (MM1). - - Writes the current value of MM1. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM1. - -**/ -VOID -EFIAPI -AsmWriteMm1 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm1" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #2 (MM2). - - Writes the current value of MM2. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM2. - -**/ -VOID -EFIAPI -AsmWriteMm2 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm2" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #3 (MM3). - - Writes the current value of MM3. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM3. - -**/ -VOID -EFIAPI -AsmWriteMm3 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm3" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #4 (MM4). - - Writes the current value of MM4. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM4. - -**/ -VOID -EFIAPI -AsmWriteMm4 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm4" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #5 (MM5). - - Writes the current value of MM5. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM5. - -**/ -VOID -EFIAPI -AsmWriteMm5 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm5" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #6 (MM6). - - Writes the current value of MM6. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM6. - -**/ -VOID -EFIAPI -AsmWriteMm6 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm6" // %0 - : - : "m" (Value) - ); -} - - -/** - Writes the current value of 64-bit MMX Register #7 (MM7). - - Writes the current value of MM7. This function is only available on IA32 and - X64. - - @param Value The 64-bit value to write to MM7. - -**/ -VOID -EFIAPI -AsmWriteMm7 ( - IN UINT64 Value - ) -{ - __asm__ __volatile__ ( - "movd %0, %%mm7" // %0 - : - : "m" (Value) - ); -} - - -/** - Reads the current value of Time Stamp Counter (TSC). - - Reads and returns the current value of TSC. This function is only available - on IA-32 and X64. - - @return The current value of TSC - -**/ -UINT64 -EFIAPI -AsmReadTsc ( - VOID - ) -{ - UINT32 LowData; - UINT32 HiData; - - __asm__ __volatile__ ( - "rdtsc" - : "=a" (LowData), - "=d" (HiData) - ); - - return (((UINT64)HiData) << 32) | LowData; -} - - -/** - Reads the current value of a Performance Counter (PMC). - - Reads and returns the current value of performance counter specified by - Index. This function is only available on IA-32 and X64. - - @param Index The 32-bit Performance Counter index to read. - - @return The value of the PMC specified by Index. - -**/ -UINT64 -EFIAPI -AsmReadPmc ( - IN UINT32 Index - ) -{ - UINT32 LowData; - UINT32 HiData; - - __asm__ __volatile__ ( - "rdpmc" - : "=a" (LowData), - "=d" (HiData) - : "c" (Index) - ); - - return (((UINT64)HiData) << 32) | LowData; -} - - -/** - Sets up a monitor buffer that is used by AsmMwait(). - - Executes a MONITOR instruction with the register state specified by Eax, Ecx - and Edx. Returns Eax. This function is only available on IA-32 and X64. - - @param Eax The value to load into EAX or RAX before executing the MONITOR - instruction. - @param Ecx The value to load into ECX or RCX before executing the MONITOR - instruction. - @param Edx The value to load into EDX or RDX before executing the MONITOR - instruction. - - @return Eax - -**/ -UINTN -EFIAPI -AsmMonitor ( - IN UINTN Eax, - IN UINTN Ecx, - IN UINTN Edx - ) -{ - __asm__ __volatile__ ( - "monitor" - : - : "a" (Eax), - "c" (Ecx), - "d" (Edx) - ); - - return Eax; -} - - -/** - Executes an MWAIT instruction. - - Executes an MWAIT instruction with the register state specified by Eax and - Ecx. Returns Eax. This function is only available on IA-32 and X64. - - @param Eax The value to load into EAX or RAX before executing the MONITOR - instruction. - @param Ecx The value to load into ECX or RCX before executing the MONITOR - instruction. - - @return Eax - -**/ -UINTN -EFIAPI -AsmMwait ( - IN UINTN Eax, - IN UINTN Ecx - ) -{ - __asm__ __volatile__ ( - "mwait" - : - : "a" (Eax), - "c" (Ecx) - ); - - return Eax; -} - - -/** - Executes a WBINVD instruction. - - Executes a WBINVD instruction. This function is only available on IA-32 and - X64. - -**/ -VOID -EFIAPI -AsmWbinvd ( - VOID - ) -{ - __asm__ __volatile__ ("wbinvd":::"memory"); -} - - -/** - Executes a INVD instruction. - - Executes a INVD instruction. This function is only available on IA-32 and - X64. - -**/ -VOID -EFIAPI -AsmInvd ( - VOID - ) -{ - __asm__ __volatile__ ("invd":::"memory"); - -} - - -/** - Flushes a cache line from all the instruction and data caches within the - coherency domain of the CPU. - - Flushed the cache line specified by LinearAddress, and returns LinearAddress. - This function is only available on IA-32 and X64. - - @param LinearAddress The address of the cache line to flush. If the CPU is - in a physical addressing mode, then LinearAddress is a - physical address. If the CPU is in a virtual - addressing mode, then LinearAddress is a virtual - address. - - @return LinearAddress -**/ -VOID * -EFIAPI -AsmFlushCacheLine ( - IN VOID *LinearAddress - ) -{ - __asm__ __volatile__ ( - "clflush (%0)" - : - : "r" (LinearAddress) - : "memory" - ); - - return LinearAddress; -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Invd.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Invd.nasm deleted file mode 100644 index 8fcd187..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Invd.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Invd.Asm -; -; Abstract: -; -; AsmInvd function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmInvd ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmInvd) -ASM_PFX(AsmInvd): - invd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Lfence.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Lfence.nasm deleted file mode 100644 index 814d025..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Lfence.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2018, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Lfence.nasm -; -; Abstract: -; -; Performs a serializing operation on all load-from-memory instructions that -; were issued prior to the call of this function. -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmLfence ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmLfence) -ASM_PFX(AsmLfence): - lfence - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.S deleted file mode 100644 index 885fdd9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.S +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# LongJump.S -# -# Abstract: -# -# Implementation of _LongJump() on x64. -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# InternalLongJump ( -# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, -# IN UINTN Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalLongJump) -ASM_PFX(InternalLongJump): - mov (%rcx), %rbx - mov 0x8(%rcx), %rsp - mov 0x10(%rcx), %rbp - mov 0x18(%rcx), %rdi - mov 0x20(%rcx), %rsi - mov 0x28(%rcx), %r12 - mov 0x30(%rcx), %r13 - mov 0x38(%rcx), %r14 - mov 0x40(%rcx), %r15 - # load non-volatile fp registers - ldmxcsr 0x50(%rcx) - movdqu 0x58(%rcx), %xmm6 - movdqu 0x68(%rcx), %xmm7 - movdqu 0x78(%rcx), %xmm8 - movdqu 0x88(%rcx), %xmm9 - movdqu 0x98(%rcx), %xmm10 - movdqu 0xA8(%rcx), %xmm11 - movdqu 0xB8(%rcx), %xmm12 - movdqu 0xC8(%rcx), %xmm13 - movdqu 0xD8(%rcx), %xmm14 - movdqu 0xE8(%rcx), %xmm15 - mov %rdx, %rax # set return value - jmp *0x48(%rcx) diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.nasm deleted file mode 100644 index f328222..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/LongJump.nasm +++ /dev/null @@ -1,83 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; LongJump.Asm -; -; Abstract: -; -; Implementation of _LongJump() on x64. -; -;------------------------------------------------------------------------------ - -%include "Nasm.inc" - - DEFAULT REL - SECTION .text - -extern ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask)) - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalLongJump ( -; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalLongJump) -ASM_PFX(InternalLongJump): - - mov eax, [ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))] - test eax, eax - jz CetDone - mov rax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - push rdx ; save rdx - - mov rdx, [rcx + 0xF8] ; rdx = target SSP - READSSP_RAX - sub rdx, rax ; rdx = delta - mov rax, rdx ; rax = delta - - shr rax, 3 ; rax = delta/sizeof(UINT64) - INCSSP_RAX - - pop rdx ; restore rdx -CetDone: - - mov rbx, [rcx] - mov rsp, [rcx + 8] - mov rbp, [rcx + 0x10] - mov rdi, [rcx + 0x18] - mov rsi, [rcx + 0x20] - mov r12, [rcx + 0x28] - mov r13, [rcx + 0x30] - mov r14, [rcx + 0x38] - mov r15, [rcx + 0x40] - ; load non-volatile fp registers - ldmxcsr [rcx + 0x50] - movdqu xmm6, [rcx + 0x58] - movdqu xmm7, [rcx + 0x68] - movdqu xmm8, [rcx + 0x78] - movdqu xmm9, [rcx + 0x88] - movdqu xmm10, [rcx + 0x98] - movdqu xmm11, [rcx + 0xA8] - movdqu xmm12, [rcx + 0xB8] - movdqu xmm13, [rcx + 0xC8] - movdqu xmm14, [rcx + 0xD8] - movdqu xmm15, [rcx + 0xE8] - mov rax, rdx ; set return value - jmp qword [rcx + 0x48] - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Monitor.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Monitor.nasm deleted file mode 100644 index 980678a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Monitor.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Monitor.Asm -; -; Abstract: -; -; AsmMonitor function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmMonitor ( -; IN UINTN Eax, -; IN UINTN Ecx, -; IN UINTN Edx -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmMonitor) -ASM_PFX(AsmMonitor): - mov eax, ecx - mov ecx, edx - mov edx, r8d - DB 0xf, 1, 0xc8 ; monitor - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Mwait.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Mwait.nasm deleted file mode 100644 index 912d7a2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Mwait.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Mwait.Asm -; -; Abstract: -; -; AsmMwait function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmMwait ( -; IN UINTN Eax, -; IN UINTN Ecx -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmMwait) -ASM_PFX(AsmMwait): - mov eax, ecx - mov ecx, edx - DB 0xf, 1, 0xc9 ; mwait - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Non-existing.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Non-existing.c deleted file mode 100644 index 76503e3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Non-existing.c +++ /dev/null @@ -1,153 +0,0 @@ -/** @file - Non-existing BaseLib functions on x64 - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/** - Enables the 32-bit paging mode on the CPU. - - Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode. This function is - only available on IA-32. After the 32-bit paging mode is enabled, control is - transferred to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit protected mode with flat descriptors. This - means all descriptors must have a base of 0 and a limit of 4GB. - 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat - descriptors. - 4) CR3 must point to valid page tables that will be used once the transition - is complete, and those page tables must guarantee that the pages for this - function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is enabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is enabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is enabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is enabled. - -**/ -VOID -EFIAPI -InternalX86EnablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - // - // This function cannot work on x64 platform - // - ASSERT (FALSE); -} - -/** - Disables the 32-bit paging mode on the CPU. - - Disables the 32-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 32-paged protected - mode. This function is only available on IA-32. After the 32-bit paging mode - is disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be NULL. The function EntryPoint must never return. - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit paged mode. - 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode. - 4) CR3 must point to valid page tables that guarantee that the pages for - this function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is disabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is disabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is - disabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is disabled. - -**/ -VOID -EFIAPI -InternalX86DisablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - // - // This function cannot work on x64 platform - // - ASSERT (FALSE); -} - - -/** - Enables the 64-bit paging mode on the CPU. - - Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode with flat - descriptors. This function is only available on IA-32. After the 64-bit - paging mode is enabled, control is transferred to the function specified by - EntryPoint using the new stack specified by NewStack and passing in the - parameters specified by Context1 and Context2. Context1 and Context2 are - optional and may be 0. The function EntryPoint must never return. - - @param Cs The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for long mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is enabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is enabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is enabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is enabled. - -**/ -VOID -EFIAPI -InternalX86EnablePaging64 ( - IN UINT16 Cs, - IN UINT64 EntryPoint, - IN UINT64 Context1, OPTIONAL - IN UINT64 Context2, OPTIONAL - IN UINT64 NewStack - ) -{ - // - // This function cannot work on x64 platform. - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.S deleted file mode 100644 index 0556979..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.S +++ /dev/null @@ -1,72 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# RdRand.S -# -# Abstract: -# -# Generates random number through CPU RdRand instruction under 64-bit platform. -# -# Notes: -# -#------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Generates a 16 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand16) -ASM_PFX(InternalX86RdRand16): - .byte 0x0f, 0xc7, 0xf0 // rdrand r16: "0f c7 /6 ModRM:r/m(w)" - jc rn16_ok // jmp if CF=1 - xor %rax, %rax // reg=0 if CF=0 - ret // return with failure status -rn16_ok: - mov %ax, (%rcx) - mov $0x1, %rax - ret - -//------------------------------------------------------------------------------ -// Generates a 32 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand32) -ASM_PFX(InternalX86RdRand32): - .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jc rn32_ok // jmp if CF=1 - xor %rax, %rax // reg=0 if CF=0 - ret // return with failure status -rn32_ok: - mov %eax, (%rcx) - mov $0x1, %rax - ret - -//------------------------------------------------------------------------------ -// Generates a 64 bit random number through RDRAND instruction. -// Return TRUE if Rand generated successfully, or FALSE if not. -// -// BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Rand); -//------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalX86RdRand64) -ASM_PFX(InternalX86RdRand64): - .byte 0x48, 0x0f, 0xc7, 0xf0 // rdrand r64: "REX.W + 0f c7 /6 ModRM:r/m(w)" - jc rn64_ok // jmp if CF=1 - xor %rax, %rax // reg=0 if CF=0 - ret // return with failure status -rn64_ok: - mov %rax, (%rcx) - mov $0x1, %rax - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.nasm deleted file mode 100644 index e1a21eb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/RdRand.nasm +++ /dev/null @@ -1,83 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; RdRand.nasm -; -; Abstract: -; -; Generates random number through CPU RdRand instruction under 64-bit platform. -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; Generates a 16 bit random number through RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand16) -ASM_PFX(InternalX86RdRand16): - ; rdrand ax ; generate a 16 bit RN into eax, - ; CF=1 if RN generated ok, otherwise CF=0 - db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)" - jc rn16_ok ; jmp if CF=1 - xor rax, rax ; reg=0 if CF=0 - ret ; return with failure status -rn16_ok: - mov [rcx], ax - mov rax, 1 - ret - -;------------------------------------------------------------------------------ -; Generates a 32 bit random number through RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand32) -ASM_PFX(InternalX86RdRand32): - ; rdrand eax ; generate a 32 bit RN into eax, - ; CF=1 if RN generated ok, otherwise CF=0 - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)" - jc rn32_ok ; jmp if CF=1 - xor rax, rax ; reg=0 if CF=0 - ret ; return with failure status -rn32_ok: - mov [rcx], eax - mov rax, 1 - ret - -;------------------------------------------------------------------------------ -; Generates a 64 bit random number through one RDRAND instruction. -; Return TRUE if Rand generated successfully, or FALSE if not. -; -; BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Random); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86RdRand64) -ASM_PFX(InternalX86RdRand64): - ; rdrand rax ; generate a 64 bit RN into rax, - ; CF=1 if RN generated ok, otherwise CF=0 - db 0x48, 0xf, 0xc7, 0xf0 ; rdrand r64: "REX.W + 0f c7 /6 ModRM:r/m(w)" - jc rn64_ok ; jmp if CF=1 - xor rax, rax ; reg=0 if CF=0 - ret ; return with failure status -rn64_ok: - mov [rcx], rax - mov rax, 1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.nasm deleted file mode 100644 index 0c6e2f9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr0.Asm -; -; Abstract: -; -; AsmReadCr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr0) -ASM_PFX(AsmReadCr0): - mov rax, cr0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.nasm deleted file mode 100644 index 45055ec..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr2.Asm -; -; Abstract: -; -; AsmReadCr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr2) -ASM_PFX(AsmReadCr2): - mov rax, cr2 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.nasm deleted file mode 100644 index 3a3a935..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr3.Asm -; -; Abstract: -; -; AsmReadCr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr3) -ASM_PFX(AsmReadCr3): - mov rax, cr3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.nasm deleted file mode 100644 index 68b6028..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCr4.Asm -; -; Abstract: -; -; AsmReadCr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadCr4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCr4) -ASM_PFX(AsmReadCr4): - mov rax, cr4 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCs.nasm deleted file mode 100644 index e5d09cb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadCs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadCs.Asm -; -; Abstract: -; -; AsmReadCs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadCs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadCs) -ASM_PFX(AsmReadCs): - mov eax, cs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.nasm deleted file mode 100644 index bf5955a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr0.Asm -; -; Abstract: -; -; AsmReadDr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr0) -ASM_PFX(AsmReadDr0): - mov rax, dr0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.nasm deleted file mode 100644 index a797490..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr1.Asm -; -; Abstract: -; -; AsmReadDr1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr1 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr1) -ASM_PFX(AsmReadDr1): - mov rax, dr1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.nasm deleted file mode 100644 index 2ef64f4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr2.Asm -; -; Abstract: -; -; AsmReadDr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr2) -ASM_PFX(AsmReadDr2): - mov rax, dr2 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.nasm deleted file mode 100644 index 1222185..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr3.Asm -; -; Abstract: -; -; AsmReadDr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr3) -ASM_PFX(AsmReadDr3): - mov rax, dr3 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.nasm deleted file mode 100644 index c8d1581..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr4.Asm -; -; Abstract: -; -; AsmReadDr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr4) -ASM_PFX(AsmReadDr4): - ; - ; There's no obvious reason to access this register, since it's aliased to - ; DR7 when DE=0 or an exception generated when DE=1 - ; - DB 0xf, 0x21, 0xe0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.nasm deleted file mode 100644 index 771e71c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr5.Asm -; -; Abstract: -; -; AsmReadDr5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr5 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr5) -ASM_PFX(AsmReadDr5): - ; - ; There's no obvious reason to access this register, since it's aliased to - ; DR7 when DE=0 or an exception generated when DE=1 - ; - DB 0xf, 0x21, 0xe8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.nasm deleted file mode 100644 index a75656d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr6.Asm -; -; Abstract: -; -; AsmReadDr6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr6 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr6) -ASM_PFX(AsmReadDr6): - mov rax, dr6 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.nasm deleted file mode 100644 index 65d8f76..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDr7.Asm -; -; Abstract: -; -; AsmReadDr7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadDr7 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDr7) -ASM_PFX(AsmReadDr7): - mov rax, dr7 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDs.nasm deleted file mode 100644 index 6eba940..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadDs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadDs.Asm -; -; Abstract: -; -; AsmReadDs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadDs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadDs) -ASM_PFX(AsmReadDs): - mov eax, ds - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.nasm deleted file mode 100644 index 98d4b49..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadEflags.Asm -; -; Abstract: -; -; AsmReadEflags function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmReadEflags ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadEflags) -ASM_PFX(AsmReadEflags): - pushfq - pop rax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEs.nasm deleted file mode 100644 index ea016d8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadEs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadEs.Asm -; -; Abstract: -; -; AsmReadEs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadEs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadEs) -ASM_PFX(AsmReadEs): - mov eax, es - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadFs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadFs.nasm deleted file mode 100644 index 123790e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadFs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadFs.Asm -; -; Abstract: -; -; AsmReadFs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadFs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadFs) -ASM_PFX(AsmReadFs): - mov eax, fs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.nasm deleted file mode 100644 index 0f51605..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadGdtr.Asm -; -; Abstract: -; -; AsmReadGdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86ReadGdtr ( -; OUT IA32_DESCRIPTOR *Gdtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86ReadGdtr) -ASM_PFX(InternalX86ReadGdtr): - sgdt [rcx] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGs.nasm deleted file mode 100644 index 8786454..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadGs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadGs.Asm -; -; Abstract: -; -; AsmReadGs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadGs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadGs) -ASM_PFX(AsmReadGs): - mov eax, gs - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.nasm deleted file mode 100644 index cfc32c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadIdtr.Asm -; -; Abstract: -; -; AsmReadIdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86ReadIdtr ( -; OUT IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86ReadIdtr) -ASM_PFX(InternalX86ReadIdtr): - sidt [rcx] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.nasm deleted file mode 100644 index 9fbf5ac..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadLdtr.Asm -; -; Abstract: -; -; AsmReadLdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadLdtr ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadLdtr) -ASM_PFX(AsmReadLdtr): - sldt eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.nasm deleted file mode 100644 index a69149b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm0.Asm -; -; Abstract: -; -; AsmReadMm0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm0 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm0) -ASM_PFX(AsmReadMm0): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xc0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.nasm deleted file mode 100644 index 917494c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm1.Asm -; -; Abstract: -; -; AsmReadMm1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm1 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm1) -ASM_PFX(AsmReadMm1): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xc8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.nasm deleted file mode 100644 index d31c34a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm2.Asm -; -; Abstract: -; -; AsmReadMm2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm2 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm2) -ASM_PFX(AsmReadMm2): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xd0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.nasm deleted file mode 100644 index 9cabaa2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm3.Asm -; -; Abstract: -; -; AsmReadMm3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm3 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm3) -ASM_PFX(AsmReadMm3): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xd8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.nasm deleted file mode 100644 index 7eae1fd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm4.Asm -; -; Abstract: -; -; AsmReadMm4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm4 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm4) -ASM_PFX(AsmReadMm4): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xe0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.nasm deleted file mode 100644 index 4784d6a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm5.Asm -; -; Abstract: -; -; AsmReadMm5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm5 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm5) -ASM_PFX(AsmReadMm5): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xe8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.nasm deleted file mode 100644 index 58f8b98..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm6.Asm -; -; Abstract: -; -; AsmReadMm6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm6 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm6) -ASM_PFX(AsmReadMm6): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xf0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.nasm deleted file mode 100644 index 46e4807..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMm7.Asm -; -; Abstract: -; -; AsmReadMm7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMm7 ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMm7) -ASM_PFX(AsmReadMm7): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x7e, 0xf8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.c deleted file mode 100644 index 06a9dbc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - CpuBreakpoint function. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -unsigned __int64 __readmsr (int register); - -#pragma intrinsic(__readmsr) - -/** - Read data to MSR. - - @param Index Register index of MSR. - - @return Value read from MSR. - -**/ -UINT64 -EFIAPI -AsmReadMsr64 ( - IN UINT32 Index - ) -{ - return __readmsr (Index); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.nasm deleted file mode 100644 index 650be2c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMsr64.Asm -; -; Abstract: -; -; AsmReadMsr64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadMsr64 ( -; IN UINT32 Index -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadMsr64) -ASM_PFX(AsmReadMsr64): - rdmsr ; edx & eax are zero extended - shl rdx, 0x20 - or rax, rdx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.nasm deleted file mode 100644 index 507e9b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadPmc.Asm -; -; Abstract: -; -; AsmReadPmc function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadPmc ( -; IN UINT32 PmcIndex -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadPmc) -ASM_PFX(AsmReadPmc): - rdpmc - shl rdx, 0x20 - or rax, rdx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadSs.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadSs.nasm deleted file mode 100644 index be764ba..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadSs.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadSs.Asm -; -; Abstract: -; -; AsmReadSs function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadSs ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadSs) -ASM_PFX(AsmReadSs): - mov eax, ss - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTr.nasm deleted file mode 100644 index df2f7d7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadTr.Asm -; -; Abstract: -; -; AsmReadTr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; AsmReadTr ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadTr) -ASM_PFX(AsmReadTr): - str eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.nasm deleted file mode 100644 index 61fa2f0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadTsc.Asm -; -; Abstract: -; -; AsmReadTsc function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmReadTsc ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmReadTsc) -ASM_PFX(AsmReadTsc): - rdtsc - shl rdx, 0x20 - or rax, rdx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.S deleted file mode 100644 index ef6beee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.S +++ /dev/null @@ -1,53 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetJump.S -# -# Abstract: -# -# Implementation of SetJump() on x86_64 -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(SetJump) -ASM_PFX(SetJump): - push %rcx - add $0xffffffffffffffe0,%rsp - call ASM_PFX(InternalAssertJumpBuffer) - add $0x20,%rsp - pop %rcx - pop %rdx - mov %rbx,(%rcx) - mov %rsp,0x8(%rcx) - mov %rbp,0x10(%rcx) - mov %rdi,0x18(%rcx) - mov %rsi,0x20(%rcx) - mov %r12,0x28(%rcx) - mov %r13,0x30(%rcx) - mov %r14,0x38(%rcx) - mov %r15,0x40(%rcx) - mov %rdx,0x48(%rcx) - # save non-volatile fp registers - stmxcsr 0x50(%rcx) - movdqu %xmm6, 0x58(%rcx) - movdqu %xmm7, 0x68(%rcx) - movdqu %xmm8, 0x78(%rcx) - movdqu %xmm9, 0x88(%rcx) - movdqu %xmm10, 0x98(%rcx) - movdqu %xmm11, 0xA8(%rcx) - movdqu %xmm12, 0xB8(%rcx) - movdqu %xmm13, 0xC8(%rcx) - movdqu %xmm14, 0xD8(%rcx) - movdqu %xmm15, 0xE8(%rcx) - xor %rax,%rax - jmpq *%rdx diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.nasm deleted file mode 100644 index 42ad913..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SetJump.nasm +++ /dev/null @@ -1,87 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetJump.Asm -; -; Abstract: -; -; Implementation of SetJump() on x64. -; -;------------------------------------------------------------------------------ - -%include "Nasm.inc" - - DEFAULT REL - SECTION .text - -extern ASM_PFX(InternalAssertJumpBuffer) -extern ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask)) - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; SetJump ( -; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SetJump) -ASM_PFX(SetJump): - push rcx - add rsp, -0x20 - call ASM_PFX(InternalAssertJumpBuffer) - add rsp, 0x20 - pop rcx - pop rdx - - xor rax, rax - mov [rcx + 0xF8], rax ; save 0 to SSP - - mov eax, [ASM_PFX(PcdGet32 (PcdControlFlowEnforcementPropertyMask))] - test eax, eax - jz CetDone - mov rax, cr4 - bt eax, 23 ; check if CET is enabled - jnc CetDone - - mov rax, 1 - INCSSP_RAX ; to read original SSP - READSSP_RAX - mov [rcx + 0xF8], rax ; save SSP - -CetDone: - - mov [rcx], rbx - mov [rcx + 8], rsp - mov [rcx + 0x10], rbp - mov [rcx + 0x18], rdi - mov [rcx + 0x20], rsi - mov [rcx + 0x28], r12 - mov [rcx + 0x30], r13 - mov [rcx + 0x38], r14 - mov [rcx + 0x40], r15 - mov [rcx + 0x48], rdx - ; save non-volatile fp registers - stmxcsr [rcx + 0x50] - movdqu [rcx + 0x58], xmm6 - movdqu [rcx + 0x68], xmm7 - movdqu [rcx + 0x78], xmm8 - movdqu [rcx + 0x88], xmm9 - movdqu [rcx + 0x98], xmm10 - movdqu [rcx + 0xA8], xmm11 - movdqu [rcx + 0xB8], xmm12 - movdqu [rcx + 0xC8], xmm13 - movdqu [rcx + 0xD8], xmm14 - movdqu [rcx + 0xE8], xmm15 - xor rax, rax - jmp rdx - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S deleted file mode 100644 index 40a2ae9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SwitchStack.S -# -# Abstract: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Routine Description: -# -# Routine for switching stacks with 2 parameters -# -# Arguments: -# -# (rcx) EntryPoint - Entry point with new stack. -# (rdx) Context1 - Parameter1 for entry point. -# (r8) Context2 - Parameter2 for entry point. -# (r9) NewStack - The pointer to new stack. -# -# Returns: -# -# None -# -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalSwitchStack) -ASM_PFX(InternalSwitchStack): - pushq %rbp - movq %rsp, %rbp - - mov %rcx, %rax // Shift registers for new call - mov %rdx, %rcx - mov %r8, %rdx - # - # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack, - # in case the callee wishes to spill them. - # - lea -0x20(%r9), %rsp - pushq $0 // stop gdb stack unwind - jmp *%rax // call EntryPoint () diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.nasm deleted file mode 100644 index 652baf6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.nasm +++ /dev/null @@ -1,51 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SwitchStack.Asm -; -; Abstract: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; Routine Description: -; -; Routine for switching stacks with 2 parameters -; -; Arguments: -; -; (rcx) EntryPoint - Entry point with new stack. -; (rdx) Context1 - Parameter1 for entry point. -; (r8) Context2 - Parameter2 for entry point. -; (r9) NewStack - The pointer to new stack. -; -; Returns: -; -; None -; -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSwitchStack) -ASM_PFX(InternalSwitchStack): - mov rax, rcx - mov rcx, rdx - mov rdx, r8 - ; - ; Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack, - ; in case the callee wishes to spill them. - ; - lea rsp, [r9 - 0x20] - call rax - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.S deleted file mode 100644 index c382906..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.S +++ /dev/null @@ -1,334 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# Thunk16.S -# -# Abstract: -# -# Real mode thunk -# -#------------------------------------------------------------------------------ - -#include - -ASM_GLOBAL ASM_PFX(m16Start) -ASM_GLOBAL ASM_PFX(m16Size) -ASM_GLOBAL ASM_PFX(mThunk16Attr) -ASM_GLOBAL ASM_PFX(m16Gdt) -ASM_GLOBAL ASM_PFX(m16GdtrBase) -ASM_GLOBAL ASM_PFX(mTransition) -ASM_GLOBAL ASM_PFX(InternalAsmThunk16) - -# define the structure of IA32_REGS -.set _EDI, 0 #size 4 -.set _ESI, 4 #size 4 -.set _EBP, 8 #size 4 -.set _ESP, 12 #size 4 -.set _EBX, 16 #size 4 -.set _EDX, 20 #size 4 -.set _ECX, 24 #size 4 -.set _EAX, 28 #size 4 -.set _DS, 32 #size 2 -.set _ES, 34 #size 2 -.set _FS, 36 #size 2 -.set _GS, 38 #size 2 -.set _EFLAGS, 40 #size 8 -.set _EIP, 48 #size 4 -.set _CS, 52 #size 2 -.set _SS, 54 #size 2 -.set IA32_REGS_SIZE, 56 - - .data - -.set Lm16Size, ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) -ASM_PFX(m16Size): .word Lm16Size -.set LmThunk16Attr, L_ThunkAttr - ASM_PFX(m16Start) -ASM_PFX(mThunk16Attr): .word LmThunk16Attr -.set Lm16Gdt, ASM_PFX(NullSeg) - ASM_PFX(m16Start) -ASM_PFX(m16Gdt): .word Lm16Gdt -.set Lm16GdtrBase, _16GdtrBase - ASM_PFX(m16Start) -ASM_PFX(m16GdtrBase): .word Lm16GdtrBase -.set LmTransition, _EntryPoint - ASM_PFX(m16Start) -ASM_PFX(mTransition): .word LmTransition - - .text - -ASM_PFX(m16Start): - -SavedGdt: .space 10 - -#------------------------------------------------------------------------------ -# _BackFromUserCode() takes control in real mode after 'retf' has been executed -# by user code. It will be shadowed to somewhere in memory below 1MB. -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(BackFromUserCode) -ASM_PFX(BackFromUserCode): - # - # The order of saved registers on the stack matches the order they appears - # in IA32_REGS structure. This facilitates wrapper function to extract them - # into that structure. - # - # Some instructions for manipulation of segment registers have to be written - # in opcode since 64-bit MASM prevents accesses to those registers. - # - .byte 0x16 # push ss - .byte 0xe # push cs - .byte 0x66 - call L_Base # push eip -L_Base: - .byte 0x66 - pushq $0 # reserved high order 32 bits of EFlags - .byte 0x66, 0x9c # pushfd actually - cli # disable interrupts - push %gs - push %fs - .byte 6 # push es - .byte 0x1e # push ds - .byte 0x66,0x60 # pushad - .byte 0x66,0xba # mov edx, imm32 -L_ThunkAttr: .space 4 - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl - jz L_1 - movl $0x15cd2401,%eax # mov ax, 2401h & int 15h - cli # disable interrupts - jnc L_2 -L_1: - testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl - jz L_2 - inb $0x92,%al - orb $2,%al - outb %al, $0x92 # deactivate A20M# -L_2: - xorw %ax, %ax # xor eax, eax - movl %ss, %eax # mov ax, ss - lea IA32_REGS_SIZE(%esp), %bp - # - # rsi in the following 2 instructions is indeed bp in 16-bit code - # - movw %bp, (_ESP - IA32_REGS_SIZE)(%rsi) - .byte 0x66 - movl (_EIP - IA32_REGS_SIZE)(%rsi), %ebx - shlw $4,%ax # shl eax, 4 - addw %ax,%bp # add ebp, eax - movw %cs,%ax - shlw $4,%ax - lea (L_64BitCode - L_Base)(%ebx, %eax), %ax - .byte 0x66,0x2e,0x89,0x87 # mov cs:[bx + (L_64Eip - L_Base)], eax - .word L_64Eip - L_Base - .byte 0x66,0xb8 # mov eax, imm32 -L_SavedCr4: .space 4 - movq %rax, %cr4 - # - # rdi in the instruction below is indeed bx in 16-bit code - # - .byte 0x66,0x2e # 2eh is "cs:" segment override - lgdt (SavedGdt - L_Base)(%rdi) - .byte 0x66 - movl $0xc0000080,%ecx - rdmsr - orb $1,%ah - wrmsr - .byte 0x66,0xb8 # mov eax, imm32 -L_SavedCr0: .space 4 - movq %rax, %cr0 - .byte 0x66,0xea # jmp far cs:L_64Bit -L_64Eip: .space 4 -L_SavedCs: .space 2 -L_64BitCode: - .byte 0x90 - .byte 0x48,0xbc # mov rsp, imm64 -L_SavedSp: .space 8 # restore stack - nop - ret - -_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start) - .word CODE16 -_16Gdtr: .word GDT_SIZE - 1 -_16GdtrBase: .quad 0 -_16Idtr: .word 0x3ff - .long 0 - -#------------------------------------------------------------------------------ -# _ToUserCode() takes control in real mode before passing control to user code. -# It will be shadowed to somewhere in memory below 1MB. -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(ToUserCode) -ASM_PFX(ToUserCode): - movl %edx,%ss # set new segment selectors - movl %edx,%ds - movl %edx,%es - movl %edx,%fs - movl %edx,%gs - .byte 0x66 - movl $0xc0000080,%ecx - movq %rax, %cr0 - rdmsr - andb $0xfe, %ah # $0b11111110 - wrmsr - movq %rbp, %cr4 - movl %esi,%ss # set up 16-bit stack segment - movw %bx,%sp # set up 16-bit stack pointer - .byte 0x66 # make the following call 32-bit - call L_Base1 # push eip -L_Base1: - popw %bp # ebp <- address of L_Base1 - pushq (IA32_REGS_SIZE + 2)(%esp) - lea 0x0c(%rsi), %eax - pushq %rax - lret # execution begins at next instruction -L_RealMode: - .byte 0x66,0x2e # CS and operand size override - lidt (_16Idtr - L_Base1)(%rsi) - .byte 0x66,0x61 # popad - .byte 0x1f # pop ds - .byte 0x7 # pop es - .byte 0x0f, 0xa1 # pop fs - .byte 0x0f, 0xa9 # pop gs - .byte 0x66, 0x9d # popfd - leaw 4(%esp),%sp # skip high order 32 bits of EFlags - .byte 0x66 # make the following retf 32-bit - lret # transfer control to user code - -.set CODE16, ASM_PFX(_16Code) - . -.set DATA16, ASM_PFX(_16Data) - . -.set DATA32, ASM_PFX(_32Data) - . - -ASM_PFX(NullSeg): .quad 0 -ASM_PFX(_16Code): - .word -1 - .word 0 - .byte 0 - .byte 0x9b - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -ASM_PFX(_16Data): - .word -1 - .word 0 - .byte 0 - .byte 0x93 - .byte 0x8f # 16-bit segment, 4GB limit - .byte 0 -ASM_PFX(_32Data): - .word -1 - .word 0 - .byte 0 - .byte 0x93 - .byte 0xcf # 16-bit segment, 4GB limit - .byte 0 - -.set GDT_SIZE, . - ASM_PFX(NullSeg) - -#------------------------------------------------------------------------------ -# IA32_REGISTER_SET * -# EFIAPI -# InternalAsmThunk16 ( -# IN IA32_REGISTER_SET *RegisterSet, -# IN OUT VOID *Transition -# ); -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalAsmThunk16) -ASM_PFX(InternalAsmThunk16): - pushq %rbp - pushq %rbx - pushq %rsi - pushq %rdi - - movl %ds, %ebx - pushq %rbx # Save ds segment register on the stack - movl %es, %ebx - pushq %rbx # Save es segment register on the stack - movl %ss, %ebx - pushq %rbx # Save ss segment register on the stack - - .byte 0x0f, 0xa0 #push fs - .byte 0x0f, 0xa8 #push gs - movq %rcx, %rsi - movzwl _SS(%rsi), %r8d - movl _ESP(%rsi), %edi - lea -(IA32_REGS_SIZE + 4)(%edi), %rdi - imul $16, %r8d, %eax - movl %edi,%ebx # ebx <- stack for 16-bit code - pushq $(IA32_REGS_SIZE / 4) - addl %eax,%edi # edi <- linear address of 16-bit stack - popq %rcx - rep - movsl # copy RegSet - lea (L_SavedCr4 - ASM_PFX(m16Start))(%rdx), %ecx - movl %edx,%eax # eax <- transition code address - andl $0xf,%edx - shll $12,%eax # segment address in high order 16 bits - .set LBackFromUserCodeDelta, ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start) - lea (LBackFromUserCodeDelta)(%rdx), %ax - stosl # [edi] <- return address of user code - sgdt 0x60(%rsp) # save GDT stack in argument space - movzwq 0x60(%rsp), %r10 # r10 <- GDT limit - lea ((ASM_PFX(InternalAsmThunk16) - L_SavedCr4) + 0xf)(%rcx), %r11 - andq $0xfffffffffffffff0, %r11 # r11 <- 16-byte aligned shadowed GDT table in real mode buffer - - movw %r10w, (SavedGdt - L_SavedCr4)(%rcx) # save the limit of shadowed GDT table - movq %r11, (SavedGdt - L_SavedCr4 + 0x2)(%rcx) # save the base address of shadowed GDT table - - movq 0x62(%rsp) ,%rsi # rsi <- the original GDT base address - xchg %r10, %rcx # save rcx to r10 and initialize rcx to be the limit of GDT table - incq %rcx # rcx <- the size of memory to copy - xchg %r11, %rdi # save rdi to r11 and initialize rdi to the base address of shadowed GDT table - rep - movsb # perform memory copy to shadow GDT table - movq %r10, %rcx # restore the orignal rcx before memory copy - movq %r11, %rdi # restore the original rdi before memory copy - - sidt 0x50(%rsp) - movq %cr0, %rax - .set LSavedCrDelta, L_SavedCr0 - L_SavedCr4 - movl %eax, (LSavedCrDelta)(%rcx) - andl $0x7ffffffe,%eax # clear PE, PG bits - movq %cr4, %rbp - movl %ebp, (%rcx) # save CR4 in SavedCr4 - andl $0xffffffcf,%ebp # clear PAE, PSE bits - movl %r8d, %esi # esi <- 16-bit stack segment - .byte 0x6a, DATA32 - popq %rdx - lgdt (_16Gdtr - L_SavedCr4)(%rcx) - movl %edx,%ss - pushfq - lea -8(%rdx), %edx - lea L_RetFromRealMode(%rip), %r8 - pushq %r8 - movl %cs, %r8d - movw %r8w, (L_SavedCs - L_SavedCr4)(%rcx) - movq %rsp, (L_SavedSp - L_SavedCr4)(%rcx) - .byte 0xff, 0x69 # jmp (_EntryPoint - L_SavedCr4)(%rcx) - .set Ltemp1, _EntryPoint - L_SavedCr4 - .byte Ltemp1 -L_RetFromRealMode: - popfq - lgdt 0x60(%rsp) # restore protected mode GDTR - lidt 0x50(%rsp) # restore protected mode IDTR - lea -IA32_REGS_SIZE(%rbp), %eax - .byte 0x0f, 0xa9 # pop gs - .byte 0x0f, 0xa1 # pop fs - - popq %rbx - movl %ebx, %ss - popq %rbx - movl %ebx, %es - popq %rbx - movl %ebx, %ds - - popq %rdi - popq %rsi - popq %rbx - popq %rbp - - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.nasm deleted file mode 100644 index 955e716..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Thunk16.nasm +++ /dev/null @@ -1,325 +0,0 @@ - -#include "BaseLibInternals.h" - -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Thunk.asm -; -; Abstract: -; -; Real mode thunk -; -;------------------------------------------------------------------------------ - -global ASM_PFX(m16Size) -global ASM_PFX(mThunk16Attr) -global ASM_PFX(m16Gdt) -global ASM_PFX(m16GdtrBase) -global ASM_PFX(mTransition) -global ASM_PFX(m16Start) - -struc IA32_REGS - - ._EDI: resd 1 - ._ESI: resd 1 - ._EBP: resd 1 - ._ESP: resd 1 - ._EBX: resd 1 - ._EDX: resd 1 - ._ECX: resd 1 - ._EAX: resd 1 - ._DS: resw 1 - ._ES: resw 1 - ._FS: resw 1 - ._GS: resw 1 - ._EFLAGS: resq 1 - ._EIP: resd 1 - ._CS: resw 1 - ._SS: resw 1 - .size: - -endstruc - -SECTION .data - -; -; These are global constant to convey information to C code. -; -ASM_PFX(m16Size) DW ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start) -ASM_PFX(mThunk16Attr) DW _BackFromUserCode.ThunkAttrEnd - 4 - ASM_PFX(m16Start) -ASM_PFX(m16Gdt) DW _NullSeg - ASM_PFX(m16Start) -ASM_PFX(m16GdtrBase) DW _16GdtrBase - ASM_PFX(m16Start) -ASM_PFX(mTransition) DW _EntryPoint - ASM_PFX(m16Start) - -SECTION .text - -ASM_PFX(m16Start): - -SavedGdt: - dw 0 - dq 0 - -;------------------------------------------------------------------------------ -; _BackFromUserCode() takes control in real mode after 'retf' has been executed -; by user code. It will be shadowed to somewhere in memory below 1MB. -;------------------------------------------------------------------------------ -_BackFromUserCode: - ; - ; The order of saved registers on the stack matches the order they appears - ; in IA32_REGS structure. This facilitates wrapper function to extract them - ; into that structure. - ; -BITS 16 - push ss - push cs - ; - ; Note: We can't use o32 on the next instruction because of a bug - ; in NASM 2.09.04 through 2.10rc1. - ; - call dword .Base ; push eip -.Base: - push dword 0 ; reserved high order 32 bits of EFlags - pushfd - cli ; disable interrupts - push gs - push fs - push es - push ds - pushad - mov edx, strict dword 0 -.ThunkAttrEnd: - test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 - jz .1 - mov ax, 2401h - int 15h - cli ; disable interrupts - jnc .2 -.1: - test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL - jz .2 - in al, 92h - or al, 2 - out 92h, al ; deactivate A20M# -.2: - xor eax, eax - mov ax, ss - lea ebp, [esp + IA32_REGS.size] - mov [bp - IA32_REGS.size + IA32_REGS._ESP], ebp - mov ebx, [bp - IA32_REGS.size + IA32_REGS._EIP] - shl eax, 4 ; shl eax, 4 - add ebp, eax ; add ebp, eax - mov eax, cs - shl eax, 4 - lea eax, [eax + ebx + (.X64JmpEnd - .Base)] - mov [cs:bx + (.X64JmpEnd - 6 - .Base)], eax - mov eax, strict dword 0 -.SavedCr4End: - mov cr4, eax -o32 lgdt [cs:bx + (SavedGdt - .Base)] - mov ecx, 0c0000080h - rdmsr - or ah, 1 - wrmsr - mov eax, strict dword 0 -.SavedCr0End: - mov cr0, eax - jmp 0:strict dword 0 -.X64JmpEnd: -BITS 64 - nop - mov rsp, strict qword 0 -.SavedSpEnd: - nop - ret - -_EntryPoint: - DD _ToUserCode - ASM_PFX(m16Start) - DW CODE16 -_16Gdtr: - DW GDT_SIZE - 1 -_16GdtrBase: - DQ 0 -_16Idtr: - DW (1 << 10) - 1 - DD 0 - -;------------------------------------------------------------------------------ -; _ToUserCode() takes control in real mode before passing control to user code. -; It will be shadowed to somewhere in memory below 1MB. -;------------------------------------------------------------------------------ -_ToUserCode: -BITS 16 - mov ss, dx ; set new segment selectors - mov ds, dx - mov es, dx - mov fs, dx - mov gs, dx - mov ecx, 0c0000080h - mov cr0, eax ; real mode starts at next instruction - rdmsr - and ah, ~1 - wrmsr - mov cr4, ebp - mov ss, si ; set up 16-bit stack segment - mov esp, ebx ; set up 16-bit stack pointer - call dword .Base ; push eip -.Base: - pop ebp ; ebp <- address of .Base - push word [dword esp + IA32_REGS.size + 2] - lea ax, [bp + (.RealMode - .Base)] - push ax - retf ; execution begins at next instruction -.RealMode: - -o32 lidt [cs:bp + (_16Idtr - .Base)] - - popad - pop ds - pop es - pop fs - pop gs - popfd - lea esp, [esp + 4] ; skip high order 32 bits of EFlags - -o32 retf ; transfer control to user code - -ALIGN 8 - -CODE16 equ _16Code - $ -DATA16 equ _16Data - $ -DATA32 equ _32Data - $ - -_NullSeg DQ 0 -_16Code: - DW -1 - DW 0 - DB 0 - DB 9bh - DB 8fh ; 16-bit segment, 4GB limit - DB 0 -_16Data: - DW -1 - DW 0 - DB 0 - DB 93h - DB 8fh ; 16-bit segment, 4GB limit - DB 0 -_32Data: - DW -1 - DW 0 - DB 0 - DB 93h - DB 0cfh ; 16-bit segment, 4GB limit - DB 0 - -GDT_SIZE equ $ - _NullSeg - -;------------------------------------------------------------------------------ -; IA32_REGISTER_SET * -; EFIAPI -; InternalAsmThunk16 ( -; IN IA32_REGISTER_SET *RegisterSet, -; IN OUT VOID *Transition -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalAsmThunk16) -ASM_PFX(InternalAsmThunk16): -BITS 64 - push rbp - push rbx - push rsi - push rdi - - mov ebx, ds - push rbx ; Save ds segment register on the stack - mov ebx, es - push rbx ; Save es segment register on the stack - mov ebx, ss - push rbx ; Save ss segment register on the stack - - push fs - push gs - mov rsi, rcx - movzx r8d, word [rsi + IA32_REGS._SS] - mov edi, [rsi + IA32_REGS._ESP] - lea rdi, [edi - (IA32_REGS.size + 4)] - imul eax, r8d, 16 ; eax <- r8d(stack segment) * 16 - mov ebx, edi ; ebx <- stack for 16-bit code - push IA32_REGS.size / 4 - add edi, eax ; edi <- linear address of 16-bit stack - pop rcx - rep movsd ; copy RegSet - lea ecx, [rdx + (_BackFromUserCode.SavedCr4End - ASM_PFX(m16Start))] - mov eax, edx ; eax <- transition code address - and edx, 0fh - shl eax, 12 ; segment address in high order 16 bits - lea ax, [rdx + (_BackFromUserCode - ASM_PFX(m16Start))] ; offset address - stosd ; [edi] <- return address of user code - - sgdt [rsp + 60h] ; save GDT stack in argument space - movzx r10, word [rsp + 60h] ; r10 <- GDT limit - lea r11, [rcx + (ASM_PFX(InternalAsmThunk16) - _BackFromUserCode.SavedCr4End) + 0xf] - and r11, ~0xf ; r11 <- 16-byte aligned shadowed GDT table in real mode buffer - - mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End)], r10w ; save the limit of shadowed GDT table - mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End) + 2], r11 ; save the base address of shadowed GDT table - - mov rsi, [rsp + 62h] ; rsi <- the original GDT base address - xchg rcx, r10 ; save rcx to r10 and initialize rcx to be the limit of GDT table - inc rcx ; rcx <- the size of memory to copy - xchg rdi, r11 ; save rdi to r11 and initialize rdi to the base address of shadowed GDT table - rep movsb ; perform memory copy to shadow GDT table - mov rcx, r10 ; restore the orignal rcx before memory copy - mov rdi, r11 ; restore the original rdi before memory copy - - sidt [rsp + 50h] ; save IDT stack in argument space - mov rax, cr0 - mov [rcx + (_BackFromUserCode.SavedCr0End - 4 - _BackFromUserCode.SavedCr4End)], eax - and eax, 7ffffffeh ; clear PE, PG bits - mov rbp, cr4 - mov [rcx - 4], ebp ; save CR4 in _BackFromUserCode.SavedCr4End - 4 - and ebp, ~30h ; clear PAE, PSE bits - mov esi, r8d ; esi <- 16-bit stack segment - push DATA32 - pop rdx ; rdx <- 32-bit data segment selector - lgdt [rcx + (_16Gdtr - _BackFromUserCode.SavedCr4End)] - mov ss, edx - pushfq - lea edx, [rdx + DATA16 - DATA32] - lea r8, [REL .RetFromRealMode] - push r8 - mov r8d, cs - mov [rcx + (_BackFromUserCode.X64JmpEnd - 2 - _BackFromUserCode.SavedCr4End)], r8w - mov [rcx + (_BackFromUserCode.SavedSpEnd - 8 - _BackFromUserCode.SavedCr4End)], rsp - jmp dword far [rcx + (_EntryPoint - _BackFromUserCode.SavedCr4End)] -.RetFromRealMode: - popfq - lgdt [rsp + 60h] ; restore protected mode GDTR - lidt [rsp + 50h] ; restore protected mode IDTR - lea eax, [rbp - IA32_REGS.size] - pop gs - pop fs - pop rbx - mov ss, ebx - pop rbx - mov es, ebx - pop rbx - mov ds, ebx - - pop rdi - pop rsi - pop rbx - pop rbp - - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.nasm deleted file mode 100644 index 6f7e03e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; Wbinvd.Asm -; -; Abstract: -; -; AsmWbinvd function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWbinvd ( -; VOID -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWbinvd) -ASM_PFX(AsmWbinvd): - wbinvd - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.nasm deleted file mode 100644 index 245d64e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr0.Asm -; -; Abstract: -; -; AsmWriteCr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr0 ( -; UINTN Cr0 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr0) -ASM_PFX(AsmWriteCr0): - mov cr0, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.nasm deleted file mode 100644 index b85864e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr2.Asm -; -; Abstract: -; -; AsmWriteCr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr2 ( -; UINTN Cr2 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr2) -ASM_PFX(AsmWriteCr2): - mov cr2, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.nasm deleted file mode 100644 index 3297fd9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr3.Asm -; -; Abstract: -; -; AsmWriteCr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr3 ( -; UINTN Cr3 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr3) -ASM_PFX(AsmWriteCr3): - mov cr3, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.nasm deleted file mode 100644 index 426e27e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteCr4.Asm -; -; Abstract: -; -; AsmWriteCr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteCr4 ( -; UINTN Cr4 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteCr4) -ASM_PFX(AsmWriteCr4): - mov cr4, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.nasm deleted file mode 100644 index e6ffa16..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr0.Asm -; -; Abstract: -; -; AsmWriteDr0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr0 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr0) -ASM_PFX(AsmWriteDr0): - mov dr0, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.nasm deleted file mode 100644 index 59db62d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr1.Asm -; -; Abstract: -; -; AsmWriteDr1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr1 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr1) -ASM_PFX(AsmWriteDr1): - mov dr1, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.nasm deleted file mode 100644 index c7562d8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr2.Asm -; -; Abstract: -; -; AsmWriteDr2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr2 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr2) -ASM_PFX(AsmWriteDr2): - mov dr2, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.nasm deleted file mode 100644 index 3b36fb6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr3.Asm -; -; Abstract: -; -; AsmWriteDr3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr3 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr3) -ASM_PFX(AsmWriteDr3): - mov dr3, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.nasm deleted file mode 100644 index 09277a4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr4.Asm -; -; Abstract: -; -; AsmWriteDr4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr4 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr4) -ASM_PFX(AsmWriteDr4): - ; - ; There's no obvious reason to access this register, since it's aliased to - ; DR6 when DE=0 or an exception generated when DE=1 - ; - DB 0xf, 0x23, 0xe1 - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.nasm deleted file mode 100644 index 9461613..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr5.Asm -; -; Abstract: -; -; AsmWriteDr5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr5 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr5) -ASM_PFX(AsmWriteDr5): - ; - ; There's no obvious reason to access this register, since it's aliased to - ; DR7 when DE=0 or an exception generated when DE=1 - ; - DB 0xf, 0x23, 0xe9 - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.nasm deleted file mode 100644 index 315bf9f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr6.Asm -; -; Abstract: -; -; AsmWriteDr6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr6 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr6) -ASM_PFX(AsmWriteDr6): - mov dr6, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.nasm deleted file mode 100644 index 5dc7613..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteDr7.Asm -; -; Abstract: -; -; AsmWriteDr7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINTN -; EFIAPI -; AsmWriteDr7 ( -; IN UINTN Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteDr7) -ASM_PFX(AsmWriteDr7): - mov dr7, rcx - mov rax, rcx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.nasm deleted file mode 100644 index b2671a3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteGdtr.Asm -; -; Abstract: -; -; AsmWriteGdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86WriteGdtr ( -; IN CONST IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86WriteGdtr) -ASM_PFX(InternalX86WriteGdtr): - lgdt [rcx] - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.nasm deleted file mode 100644 index 12d2e2d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteIdtr.Asm -; -; Abstract: -; -; AsmWriteIdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; InternalX86WriteIdtr ( -; IN CONST IA32_DESCRIPTOR *Idtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalX86WriteIdtr) -ASM_PFX(InternalX86WriteIdtr): - pushfq - cli - lidt [rcx] - popfq - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.nasm deleted file mode 100644 index f29e0a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.nasm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteLdtr.Asm -; -; Abstract: -; -; AsmWriteLdtr function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteLdtr ( -; IN UINT16 Ldtr -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteLdtr) -ASM_PFX(AsmWriteLdtr): - lldt cx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.nasm deleted file mode 100644 index 0fcd95d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm0.Asm -; -; Abstract: -; -; AsmWriteMm0 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm0 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm0) -ASM_PFX(AsmWriteMm0): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xc1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.nasm deleted file mode 100644 index ed76786..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm1.Asm -; -; Abstract: -; -; AsmWriteMm1 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm1 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm1) -ASM_PFX(AsmWriteMm1): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xc9 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.nasm deleted file mode 100644 index ccdcbbc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm2.Asm -; -; Abstract: -; -; AsmWriteMm2 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm2 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm2) -ASM_PFX(AsmWriteMm2): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xd1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.nasm deleted file mode 100644 index 7f6a6d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm3.Asm -; -; Abstract: -; -; AsmWriteMm3 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm3 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm3) -ASM_PFX(AsmWriteMm3): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xd9 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.nasm deleted file mode 100644 index 3ea63e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm4.Asm -; -; Abstract: -; -; AsmWriteMm4 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm4 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm4) -ASM_PFX(AsmWriteMm4): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xe1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.nasm deleted file mode 100644 index 4b99ed4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm5.Asm -; -; Abstract: -; -; AsmWriteMm5 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm5 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm5) -ASM_PFX(AsmWriteMm5): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xe9 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.nasm deleted file mode 100644 index 24a715b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm6.Asm -; -; Abstract: -; -; AsmWriteMm6 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm6 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm6) -ASM_PFX(AsmWriteMm6): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xf1 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.nasm deleted file mode 100644 index 0696c6d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMm7.Asm -; -; Abstract: -; -; AsmWriteMm7 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; AsmWriteMm7 ( -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMm7) -ASM_PFX(AsmWriteMm7): - ; - ; 64-bit MASM doesn't support MMX instructions, so use opcode here - ; - DB 0x48, 0xf, 0x6e, 0xf9 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.c deleted file mode 100644 index 7099e2a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.c +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - CpuBreakpoint function. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -void __writemsr (unsigned long Register, unsigned __int64 Value); - -#pragma intrinsic(__writemsr) - -/** - Write data to MSR. - - @param Index The register index of MSR. - @param Value Data wants to be written. - - @return Value written to MSR. - -**/ -UINT64 -EFIAPI -AsmWriteMsr64 ( - IN UINT32 Index, - IN UINT64 Value - ) -{ - __writemsr (Index, Value); - return Value; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.nasm deleted file mode 100644 index feec7e8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMsr64.Asm -; -; Abstract: -; -; AsmWriteMsr64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; AsmWriteMsr64 ( -; IN UINT32 Index, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteMsr64) -ASM_PFX(AsmWriteMsr64): - mov rax, rdx ; meanwhile, rax <- return value - shr rdx, 0x20 ; edx:eax contains the value to write - wrmsr - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteTr.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteTr.nasm deleted file mode 100644 index cfd552f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X64/WriteTr.nasm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2017, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteTr.nasm -; -; Abstract: -; -; Write TR register -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; AsmWriteTr ( -; UINT16 Selector -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(AsmWriteTr) -ASM_PFX(AsmWriteTr): - mov eax, ecx - ltr ax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging32.c deleted file mode 100644 index 77466b3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging32.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - IA-32/x64 AsmDisablePaging32() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Disables the 32-bit paging mode on the CPU. - - Disables the 32-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 32-paged protected - mode. This function is only available on IA-32. After the 32-bit paging mode - is disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be NULL. The function EntryPoint must never return. - - If the current execution mode is not 32-bit paged mode, then ASSERT(). - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit paged mode. - 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode. - 4) CR3 must point to valid page tables that guarantee that the pages for - this function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is disabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is disabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is - disabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is disabled. - -**/ -VOID -EFIAPI -AsmDisablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - ASSERT (EntryPoint != NULL); - ASSERT (NewStack != NULL); - InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging64.c deleted file mode 100644 index 4f248ce..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86DisablePaging64.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - IA-32/x64 AsmDisablePaging64() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Disables the 64-bit paging mode on the CPU. - - Disables the 64-bit paging mode on the CPU and returns to 32-bit protected - mode. This function assumes the current execution mode is 64-paging mode. - This function is only available on x64. After the 64-bit paging mode is - disabled, control is transferred to the function specified by EntryPoint - using the new stack specified by NewStack and passing in the parameters - specified by Context1 and Context2. Context1 and Context2 are optional and - may be 0. The function EntryPoint must never return. - - If the current execution mode is not 64-bit paged mode, then ASSERT(). - If EntryPoint is 0, then ASSERT(). - If NewStack is 0, then ASSERT(). - - @param Cs The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for 32-bit protected mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is disabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is disabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is disabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is disabled. - -**/ -VOID -EFIAPI -AsmDisablePaging64 ( - IN UINT16 Cs, - IN UINT32 EntryPoint, - IN UINT32 Context1, OPTIONAL - IN UINT32 Context2, OPTIONAL - IN UINT32 NewStack - ) -{ - ASSERT (EntryPoint != 0); - ASSERT (NewStack != 0); - InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging32.c deleted file mode 100644 index a596662..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging32.c +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - IA-32/x64 AsmEnablePaging32() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Enables the 32-bit paging mode on the CPU. - - Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode. This function is - only available on IA-32. After the 32-bit paging mode is enabled, control is - transferred to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - If the current execution mode is not 32-bit protected mode, then ASSERT(). - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - There are a number of constraints that must be followed before calling this - function: - 1) Interrupts must be disabled. - 2) The caller must be in 32-bit protected mode with flat descriptors. This - means all descriptors must have a base of 0 and a limit of 4GB. - 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat - descriptors. - 4) CR3 must point to valid page tables that will be used once the transition - is complete, and those page tables must guarantee that the pages for this - function and the stack are identity mapped. - - @param EntryPoint A pointer to function to call with the new stack after - paging is enabled. - @param Context1 A pointer to the context to pass into the EntryPoint - function as the first parameter after paging is enabled. - @param Context2 A pointer to the context to pass into the EntryPoint - function as the second parameter after paging is enabled. - @param NewStack A pointer to the new stack to use for the EntryPoint - function after paging is enabled. - -**/ -VOID -EFIAPI -AsmEnablePaging32 ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - ASSERT (EntryPoint != NULL); - ASSERT (NewStack != NULL); - InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging64.c deleted file mode 100644 index 4a96a84..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86EnablePaging64.c +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - IA-32/x64 AsmEnablePaging64() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Enables the 64-bit paging mode on the CPU. - - Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables - must be properly initialized prior to calling this service. This function - assumes the current execution mode is 32-bit protected mode with flat - descriptors. This function is only available on IA-32. After the 64-bit - paging mode is enabled, control is transferred to the function specified by - EntryPoint using the new stack specified by NewStack and passing in the - parameters specified by Context1 and Context2. Context1 and Context2 are - optional and may be 0. The function EntryPoint must never return. - - If the current execution mode is not 32-bit protected mode with flat - descriptors, then ASSERT(). - If EntryPoint is 0, then ASSERT(). - If NewStack is 0, then ASSERT(). - - @param Cs The 16-bit selector to load in the CS before EntryPoint - is called. The descriptor in the GDT that this selector - references must be setup for long mode. - @param EntryPoint The 64-bit virtual address of the function to call with - the new stack after paging is enabled. - @param Context1 The 64-bit virtual address of the context to pass into - the EntryPoint function as the first parameter after - paging is enabled. - @param Context2 The 64-bit virtual address of the context to pass into - the EntryPoint function as the second parameter after - paging is enabled. - @param NewStack The 64-bit virtual address of the new stack to use for - the EntryPoint function after paging is enabled. - -**/ -VOID -EFIAPI -AsmEnablePaging64 ( - IN UINT16 Cs, - IN UINT64 EntryPoint, - IN UINT64 Context1, OPTIONAL - IN UINT64 Context2, OPTIONAL - IN UINT64 NewStack - ) -{ - ASSERT (EntryPoint != 0); - ASSERT (NewStack != 0); - InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxRestore.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxRestore.c deleted file mode 100644 index 39ba95c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxRestore.c +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - IA-32/x64 AsmFxRestore() - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Restores the current floating point/SSE/SSE2 context from a buffer. - - Restores the current floating point/SSE/SSE2 state from the buffer specified - by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and x64. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-byte boundary, then ASSERT(). - If Buffer was not saved with AsmFxSave(), then ASSERT(). - - @param Buffer A pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -AsmFxRestore ( - IN CONST IA32_FX_BUFFER *Buffer - ) -{ - ASSERT (Buffer != NULL); - ASSERT (0 == ((UINTN)Buffer & 0xf)); - - // - // Check the flag recorded by AsmFxSave() - // - ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4])); - - InternalX86FxRestore (Buffer); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxSave.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxSave.c deleted file mode 100644 index 270b1fd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86FxSave.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - IA-32/x64 AsmFxSave() - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Save the current floating point/SSE/SSE2 context to a buffer. - - Saves the current floating point/SSE/SSE2 state to the buffer specified by - Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and x64. - - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-byte boundary, then ASSERT(). - - @param Buffer A pointer to a buffer to save the floating point/SSE/SSE2 context. - -**/ -VOID -EFIAPI -AsmFxSave ( - OUT IA32_FX_BUFFER *Buffer - ) -{ - ASSERT (Buffer != NULL); - ASSERT (0 == ((UINTN)Buffer & 0xf)); - - InternalX86FxSave (Buffer); - - // - // Mark one flag at end of Buffer, it will be check by AsmFxRestor() - // - *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86GetInterruptState.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86GetInterruptState.c deleted file mode 100644 index 51166e5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86GetInterruptState.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - IA-32/x64 GetInterruptState() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Retrieves the current CPU interrupt state. - - Returns TRUE is interrupts are currently enabled. Otherwise - returns FALSE. - - @retval TRUE CPU interrupts are enabled. - @retval FALSE CPU interrupts are disabled. - -**/ -BOOLEAN -EFIAPI -GetInterruptState ( - VOID - ) -{ - IA32_EFLAGS32 EFlags; - - EFlags.UintN = AsmReadEflags (); - return (BOOLEAN)(1 == EFlags.Bits.IF); -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86MemoryFence.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86MemoryFence.c deleted file mode 100644 index 8c3d094..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86MemoryFence.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - IA-32/x64 MemoryFence(). - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Used to serialize load and store operations. - - All loads and stores that proceed calls to this function are guaranteed to be - globally visible when this function returns. - -**/ -VOID -EFIAPI -MemoryFence ( - VOID - ) -{ - return; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Msr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Msr.c deleted file mode 100644 index 6e888a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Msr.c +++ /dev/null @@ -1,660 +0,0 @@ -/** @file - IA-32/x64 MSR functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "BaseLibInternals.h" - - -/** - Returns the lower 32-bits of a Machine Specific Register(MSR). - - Reads and returns the lower 32-bits of the MSR specified by Index. - No parameter checking is performed on Index, and some Index values may cause - CPU exceptions. The caller must either guarantee that Index is valid, or the - caller must set up exception handlers to catch the exceptions. This function - is only available on IA-32 and x64. - - @param Index The 32-bit MSR index to read. - - @return The lower 32 bits of the MSR identified by Index. - -**/ -UINT32 -EFIAPI -AsmReadMsr32 ( - IN UINT32 Index - ) -{ - return (UINT32)AsmReadMsr64 (Index); -} - -/** - Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value. - The upper 32-bits of the MSR are set to zero. - - Writes the 32-bit value specified by Value to the MSR specified by Index. The - upper 32-bits of the MSR write are set to zero. The 32-bit value written to - the MSR is returned. No parameter checking is performed on Index or Value, - and some of these may cause CPU exceptions. The caller must either guarantee - that Index and Value are valid, or the caller must establish proper exception - handlers. This function is only available on IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param Value The 32-bit value to write to the MSR. - - @return Value - -**/ -UINT32 -EFIAPI -AsmWriteMsr32 ( - IN UINT32 Index, - IN UINT32 Value - ) -{ - return (UINT32)AsmWriteMsr64 (Index, Value); -} - -/** - Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and - writes the result back to the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise OR - between the lower 32-bits of the read result and the value specified by - OrData, and writes the result to the 64-bit MSR specified by Index. The lower - 32-bits of the value written to the MSR is returned. No parameter checking is - performed on Index or OrData, and some of these may cause CPU exceptions. The - caller must either guarantee that Index and OrData are valid, or the caller - must establish proper exception handlers. This function is only available on - IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param OrData The value to OR with the read value from the MSR. - - @return The lower 32-bit value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrOr32 ( - IN UINT32 Index, - IN UINT32 OrData - ) -{ - return (UINT32)AsmMsrOr64 (Index, OrData); -} - -/** - Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes - the result back to the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between the - lower 32-bits of the read result and the value specified by AndData, and - writes the result to the 64-bit MSR specified by Index. The lower 32-bits of - the value written to the MSR is returned. No parameter checking is performed - on Index or AndData, and some of these may cause CPU exceptions. The caller - must either guarantee that Index and AndData are valid, or the caller must - establish proper exception handlers. This function is only available on IA-32 - and x64. - - @param Index The 32-bit MSR index to write. - @param AndData The value to AND with the read value from the MSR. - - @return The lower 32-bit value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrAnd32 ( - IN UINT32 Index, - IN UINT32 AndData - ) -{ - return (UINT32)AsmMsrAnd64 (Index, AndData); -} - -/** - Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR - on the lower 32-bits, and writes the result back to the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between the - lower 32-bits of the read result and the value specified by AndData - preserving the upper 32-bits, performs a bitwise OR between the - result of the AND operation and the value specified by OrData, and writes the - result to the 64-bit MSR specified by Address. The lower 32-bits of the value - written to the MSR is returned. No parameter checking is performed on Index, - AndData, or OrData, and some of these may cause CPU exceptions. The caller - must either guarantee that Index, AndData, and OrData are valid, or the - caller must establish proper exception handlers. This function is only - available on IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param AndData The value to AND with the read value from the MSR. - @param OrData The value to OR with the result of the AND operation. - - @return The lower 32-bit value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrAndThenOr32 ( - IN UINT32 Index, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData); -} - -/** - Reads a bit field of an MSR. - - Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. The caller must either guarantee that Index is valid, or the caller - must set up exception handlers to catch the exceptions. This function is only - available on IA-32 and x64. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Index The 32-bit MSR index to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The bit field read from the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrBitFieldRead32 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit); -} - -/** - Writes a bit field to an MSR. - - Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination MSR are preserved. The lower 32-bits of the MSR written is - returned. The caller must either guarantee that Index and the data written - is valid, or the caller must set up exception handlers to catch the exceptions. - This function is only available on IA-32 and x64. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The lower 32-bit of the value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrBitFieldWrite32 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - ASSERT (EndBit < sizeof (Value) * 8); - ASSERT (StartBit <= EndBit); - return (UINT32)AsmMsrBitFieldWrite64 (Index, StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit MSR specified by Index. The lower 32-bits of the value - written to the MSR are returned. Extra left bits in OrData are stripped. The - caller must either guarantee that Index and the data written is valid, or - the caller must set up exception handlers to catch the exceptions. This - function is only available on IA-32 and x64. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the MSR. - - @return The lower 32-bit of the value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrBitFieldOr32 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - ASSERT (EndBit < sizeof (OrData) * 8); - ASSERT (StartBit <= EndBit); - return (UINT32)AsmMsrBitFieldOr64 (Index, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between the - read result and the value specified by AndData, and writes the result to the - 64-bit MSR specified by Index. The lower 32-bits of the value written to the - MSR are returned. Extra left bits in AndData are stripped. The caller must - either guarantee that Index and the data written is valid, or the caller must - set up exception handlers to catch the exceptions. This function is only - available on IA-32 and x64. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the MSR. - - @return The lower 32-bit of the value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrBitFieldAnd32 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - ASSERT (EndBit < sizeof (AndData) * 8); - ASSERT (StartBit <= EndBit); - return (UINT32)AsmMsrBitFieldAnd64 (Index, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a - bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit MSR specified by Index. The - lower 32-bits of the value written to the MSR are returned. Extra left bits - in both AndData and OrData are stripped. The caller must either guarantee - that Index and the data written is valid, or the caller must set up exception - handlers to catch the exceptions. This function is only available on IA-32 - and x64. - - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the MSR. - @param OrData The value to OR with the result of the AND operation. - - @return The lower 32-bit of the value written to the MSR. - -**/ -UINT32 -EFIAPI -AsmMsrBitFieldAndThenOr32 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - ASSERT (EndBit < sizeof (AndData) * 8); - ASSERT (StartBit <= EndBit); - return (UINT32)AsmMsrBitFieldAndThenOr64 ( - Index, - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 64-bit MSR, performs a bitwise OR, and writes the result - back to the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit MSR specified by Index. The value written to the MSR is - returned. No parameter checking is performed on Index or OrData, and some of - these may cause CPU exceptions. The caller must either guarantee that Index - and OrData are valid, or the caller must establish proper exception handlers. - This function is only available on IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param OrData The value to OR with the read value from the MSR. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrOr64 ( - IN UINT32 Index, - IN UINT64 OrData - ) -{ - return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData); -} - -/** - Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the - 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between the - read result and the value specified by OrData, and writes the result to the - 64-bit MSR specified by Index. The value written to the MSR is returned. No - parameter checking is performed on Index or OrData, and some of these may - cause CPU exceptions. The caller must either guarantee that Index and OrData - are valid, or the caller must establish proper exception handlers. This - function is only available on IA-32 and x64. - - @param Index The 32-bit MSR index to write. - @param AndData The value to AND with the read value from the MSR. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrAnd64 ( - IN UINT32 Index, - IN UINT64 AndData - ) -{ - return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData); -} - -/** - Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between read - result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit MSR specified by Index. The value written - to the MSR is returned. No parameter checking is performed on Index, AndData, - or OrData, and some of these may cause CPU exceptions. The caller must either - guarantee that Index, AndData, and OrData are valid, or the caller must - establish proper exception handlers. This function is only available on IA-32 - and x64. - - @param Index The 32-bit MSR index to write. - @param AndData The value to AND with the read value from the MSR. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrAndThenOr64 ( - IN UINT32 Index, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData); -} - -/** - Reads a bit field of an MSR. - - Reads the bit field in the 64-bit MSR. The bit field is specified by the - StartBit and the EndBit. The value of the bit field is returned. The caller - must either guarantee that Index is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and x64. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Index The 32-bit MSR index to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read from the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrBitFieldRead64 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit); -} - -/** - Writes a bit field to an MSR. - - Writes Value to a bit field in a 64-bit MSR. The bit field is specified by - the StartBit and the EndBit. All other bits in the destination MSR are - preserved. The MSR written is returned. The caller must either guarantee - that Index and the data written is valid, or the caller must set up exception - handlers to catch the exceptions. This function is only available on IA-32 and x64. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrBitFieldWrite64 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return AsmWriteMsr64 ( - Index, - BitFieldWrite64 (AsmReadMsr64 (Index), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit MSR specified by Index. The value written to the MSR is - returned. Extra left bits in OrData are stripped. The caller must either - guarantee that Index and the data written is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and x64. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the bit field. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrBitFieldOr64 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return AsmWriteMsr64 ( - Index, - BitFieldOr64 (AsmReadMsr64 (Index), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND between the - read result and the value specified by AndData, and writes the result to the - 64-bit MSR specified by Index. The value written to the MSR is returned. - Extra left bits in AndData are stripped. The caller must either guarantee - that Index and the data written is valid, or the caller must set up exception - handlers to catch the exceptions. This function is only available on IA-32 - and x64. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the bit field. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrBitFieldAnd64 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return AsmWriteMsr64 ( - Index, - BitFieldAnd64 (AsmReadMsr64 (Index), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit MSR. - - Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by - a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit MSR specified by Index. The - value written to the MSR is returned. Extra left bits in both AndData and - OrData are stripped. The caller must either guarantee that Index and the data - written is valid, or the caller must set up exception handlers to catch the - exceptions. This function is only available on IA-32 and x64. - - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Index The 32-bit MSR index to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the bit field. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MSR. - -**/ -UINT64 -EFIAPI -AsmMsrBitFieldAndThenOr64 ( - IN UINT32 Index, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return AsmWriteMsr64 ( - Index, - BitFieldAndThenOr64 ( - AsmReadMsr64 (Index), - StartBit, - EndBit, - AndData, - OrData - ) - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86PatchInstruction.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86PatchInstruction.c deleted file mode 100644 index 18abe98..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86PatchInstruction.c +++ /dev/null @@ -1,89 +0,0 @@ -/** @file - IA-32/x64 PatchInstructionX86() - - Copyright (C) 2018, Intel Corporation. All rights reserved.
- Copyright (C) 2018, Red Hat, Inc. - - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT - WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "BaseLibInternals.h" - -/** - Patch the immediate operand of an IA32 or X64 instruction such that the byte, - word, dword or qword operand is encoded at the end of the instruction's - binary representation. - - This function should be used to update object code that was compiled with - NASM from assembly source code. Example: - - NASM source code: - - mov eax, strict dword 0 ; the imm32 zero operand will be patched - ASM_PFX(gPatchCr3): - mov cr3, eax - - C source code: - - X86_ASSEMBLY_PATCH_LABEL gPatchCr3; - PatchInstructionX86 (gPatchCr3, AsmReadCr3 (), 4); - - @param[out] InstructionEnd Pointer right past the instruction to patch. The - immediate operand to patch is expected to - comprise the trailing bytes of the instruction. - If InstructionEnd is closer to address 0 than - ValueSize permits, then ASSERT(). - - @param[in] PatchValue The constant to write to the immediate operand. - The caller is responsible for ensuring that - PatchValue can be represented in the byte, word, - dword or qword operand (as indicated through - ValueSize); otherwise ASSERT(). - - @param[in] ValueSize The size of the operand in bytes; must be 1, 2, - 4, or 8. ASSERT() otherwise. -**/ -VOID -EFIAPI -PatchInstructionX86 ( - OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd, - IN UINT64 PatchValue, - IN UINTN ValueSize - ) -{ - // - // The equality ((UINTN)InstructionEnd == ValueSize) would assume a zero-size - // instruction at address 0; forbid it. - // - 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); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86RdRand.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86RdRand.c deleted file mode 100644 index 5aaab4e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86RdRand.c +++ /dev/null @@ -1,79 +0,0 @@ -/** @file - IA-32/x64 AsmRdRandxx() - Generates random number through CPU RdRand instruction. - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseLibInternals.h" - -/** - Generates a 16-bit random number through RDRAND instruction. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - - **/ -BOOLEAN -EFIAPI -AsmRdRand16 ( - OUT UINT16 *Rand - ) -{ - ASSERT (Rand != NULL); - return InternalX86RdRand16 (Rand); -} - -/** - Generates a 32-bit random number through RDRAND instruction. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - -**/ -BOOLEAN -EFIAPI -AsmRdRand32 ( - OUT UINT32 *Rand - ) -{ - ASSERT (Rand != NULL); - return InternalX86RdRand32 (Rand); -} - -/** - Generates a 64-bit random number through RDRAND instruction. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the random result. - - @retval TRUE RDRAND call was successful. - @retval FALSE Failed attempts to call RDRAND. - -**/ -BOOLEAN -EFIAPI -AsmRdRand64 ( - OUT UINT64 *Rand - ) -{ - ASSERT (Rand != NULL); - return InternalX86RdRand64 (Rand); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadGdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadGdtr.c deleted file mode 100644 index d0a5919..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadGdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - IA-32/x64 AsmReadGdtr() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Reads the current Global Descriptor Table Register(GDTR) descriptor. - - Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and x64. - - If Gdtr is NULL, then ASSERT(). - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -AsmReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr - ) -{ - ASSERT (Gdtr != NULL); - InternalX86ReadGdtr (Gdtr); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadIdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadIdtr.c deleted file mode 100644 index 8a55011..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86ReadIdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - IA-32/x64 AsmReadIdtr() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Reads the current Interrupt Descriptor Table Register(IDTR) descriptor. - - Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and x64. - - If Idtr is NULL, then ASSERT(). - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -AsmReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr - ) -{ - ASSERT (Idtr != NULL); - InternalX86ReadIdtr (Idtr); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86SpeculationBarrier.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86SpeculationBarrier.c deleted file mode 100644 index eb763cd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86SpeculationBarrier.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - SpeculationBarrier() function for IA32 and x64. - - Copyright (C) 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT - WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -/** - Uses as a barrier to stop speculative execution. - - Ensures that no later instruction will execute speculatively, until all prior - instructions have completed. - -**/ -VOID -EFIAPI -SpeculationBarrier ( - VOID - ) -{ - AsmLfence (); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Thunk.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Thunk.c deleted file mode 100644 index 93e74cd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86Thunk.c +++ /dev/null @@ -1,268 +0,0 @@ -/** @file - Real Mode Thunk Functions for IA32 and x64. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#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; - -/** - Invokes 16-bit code in big real mode and returns the updated register set. - - This function transfers control to the 16-bit code specified by CS:EIP using - the stack specified by SS:ESP in RegisterSet. The updated registers are saved - on the real mode stack and the starting address of the save area is returned. - - @param RegisterSet Values of registers before invocation of 16-bit code. - @param Transition The pointer to the transition code under 1MB. - - @return The pointer to a IA32_REGISTER_SET structure containing the updated - register values. - -**/ -IA32_REGISTER_SET * -EFIAPI -InternalAsmThunk16 ( - IN IA32_REGISTER_SET *RegisterSet, - IN OUT VOID *Transition - ); - -/** - Retrieves the properties for 16-bit thunk functions. - - Computes the size of the buffer and stack below 1MB required to use the - AsmPrepareThunk16(), AsmThunk16() and AsmPrepareAndThunk16() functions. This - buffer size is returned in RealModeBufferSize, and the stack size is returned - in ExtraStackSize. If parameters are passed to the 16-bit real mode code, - then the actual minimum stack size is ExtraStackSize plus the maximum number - of bytes that need to be passed to the 16-bit real mode code. - - If RealModeBufferSize is NULL, then ASSERT(). - If ExtraStackSize is NULL, then ASSERT(). - - @param RealModeBufferSize A pointer to the size of the buffer below 1MB - required to use the 16-bit thunk functions. - @param ExtraStackSize A pointer to the extra size of stack below 1MB - that the 16-bit thunk functions require for - temporary storage in the transition to and from - 16-bit real mode. - -**/ -VOID -EFIAPI -AsmGetThunk16Properties ( - OUT UINT32 *RealModeBufferSize, - OUT UINT32 *ExtraStackSize - ) -{ - ASSERT (RealModeBufferSize != NULL); - ASSERT (ExtraStackSize != NULL); - - *RealModeBufferSize = m16Size; - - // - // Extra 4 bytes for return address, and another 4 bytes for mode transition - // - *ExtraStackSize = sizeof (IA32_DWORD_REGS) + 8; -} - -/** - Prepares all structures a code required to use AsmThunk16(). - - Prepares all structures and code required to use AsmThunk16(). - - This interface is limited to be used in either physical mode or virtual modes with paging enabled where the - virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1. - - If ThunkContext is NULL, then ASSERT(). - - @param ThunkContext A pointer to the context structure that describes the - 16-bit real mode code to call. - -**/ -VOID -EFIAPI -AsmPrepareThunk16 ( - IN OUT THUNK_CONTEXT *ThunkContext - ) -{ - IA32_SEGMENT_DESCRIPTOR *RealModeGdt; - - ASSERT (ThunkContext != NULL); - ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000); - ASSERT (ThunkContext->RealModeBufferSize >= m16Size); - ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000); - - CopyMem (ThunkContext->RealModeBuffer, &m16Start, m16Size); - - // - // Point RealModeGdt to the GDT to be used in transition - // - // RealModeGdt[0]: Reserved as NULL descriptor - // RealModeGdt[1]: Code Segment - // RealModeGdt[2]: Data Segment - // RealModeGdt[3]: Call Gate - // - RealModeGdt = (IA32_SEGMENT_DESCRIPTOR*)( - (UINTN)ThunkContext->RealModeBuffer + m16Gdt); - - // - // Update Code & Data Segment Descriptor - // - RealModeGdt[1].Bits.BaseLow = - (UINT32)(UINTN)ThunkContext->RealModeBuffer & ~0xf; - RealModeGdt[1].Bits.BaseMid = - (UINT32)(UINTN)ThunkContext->RealModeBuffer >> 16; - - // - // Update transition code entry point offset - // - *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mTransition) += - (UINT32)(UINTN)ThunkContext->RealModeBuffer & 0xf; - - // - // Update Segment Limits for both Code and Data Segment Descriptors - // - if ((ThunkContext->ThunkAttributes & THUNK_ATTRIBUTE_BIG_REAL_MODE) == 0) { - // - // Set segment limits to 64KB - // - RealModeGdt[1].Bits.LimitHigh = 0; - RealModeGdt[1].Bits.G = 0; - RealModeGdt[2].Bits.LimitHigh = 0; - RealModeGdt[2].Bits.G = 0; - } - - // - // Update GDTBASE for this thunk context - // - *(VOID**)((UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt; - - // - // Update Thunk Attributes - // - *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) = - ThunkContext->ThunkAttributes; -} - -/** - Transfers control to a 16-bit real mode entry point and returns the results. - - Transfers control to a 16-bit real mode entry point and returns the results. - AsmPrepareThunk16() must be called with ThunkContext before this function is used. - This function must be called with interrupts disabled. - - The register state from the RealModeState field of ThunkContext is restored just prior - to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState, - which is used to set the interrupt state when a 16-bit real mode entry point is called. - Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState. - The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to - the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function. - The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction, - so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment - and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry - point must exit with a RETF instruction. The register state is captured into RealModeState immediately - after the RETF instruction is executed. - - If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, - or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure - the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode. - - If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, - then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode. - This includes the base vectors, the interrupt masks, and the edge/level trigger mode. - - If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code - is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits. - - If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in - ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to - disable the A20 mask. - - If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in - ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails, - then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports. - - If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in - ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports. - - If ThunkContext is NULL, then ASSERT(). - If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT(). - If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in - ThunkAttributes, then ASSERT(). - - This interface is limited to be used in either physical mode or virtual modes with paging enabled where the - virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1. - - @param ThunkContext A pointer to the context structure that describes the - 16-bit real mode code to call. - -**/ -VOID -EFIAPI -AsmThunk16 ( - IN OUT THUNK_CONTEXT *ThunkContext - ) -{ - 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))); - - UpdatedRegs = InternalAsmThunk16 ( - ThunkContext->RealModeState, - ThunkContext->RealModeBuffer - ); - - CopyMem (ThunkContext->RealModeState, UpdatedRegs, sizeof (*UpdatedRegs)); -} - -/** - Prepares all structures and code for a 16-bit real mode thunk, transfers - control to a 16-bit real mode entry point, and returns the results. - - Prepares all structures and code for a 16-bit real mode thunk, transfers - control to a 16-bit real mode entry point, and returns the results. If the - caller only need to perform a single 16-bit real mode thunk, then this - service should be used. If the caller intends to make more than one 16-bit - real mode thunk, then it is more efficient if AsmPrepareThunk16() is called - once and AsmThunk16() can be called for each 16-bit real mode thunk. - - This interface is limited to be used in either physical mode or virtual modes with paging enabled where the - virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1. - - See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions. - - @param ThunkContext A pointer to the context structure that describes the - 16-bit real mode code to call. - -**/ -VOID -EFIAPI -AsmPrepareAndThunk16 ( - IN OUT THUNK_CONTEXT *ThunkContext - ) -{ - AsmPrepareThunk16 (ThunkContext); - AsmThunk16 (ThunkContext); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteGdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteGdtr.c deleted file mode 100644 index 7544e8a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteGdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - IA-32/x64 AsmWriteGdtr() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Writes the current Global Descriptor Table Register (GDTR) descriptor. - - Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and x64. - - If Gdtr is NULL, then ASSERT(). - - @param Gdtr The pointer to a GDTR descriptor. - -**/ -VOID -EFIAPI -AsmWriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr - ) -{ - ASSERT (Gdtr != NULL); - InternalX86WriteGdtr (Gdtr); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteIdtr.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteIdtr.c deleted file mode 100644 index 9060a92..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseLib/X86WriteIdtr.c +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - IA-32/x64 AsmWriteIdtr() - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "BaseLibInternals.h" - -/** - Writes the current Interrupt Descriptor Table Register(IDTR) descriptor. - - Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and x64. - - If Idtr is NULL, then ASSERT(). - - @param Idtr The pointer to a IDTR descriptor. - -**/ -VOID -EFIAPI -AsmWriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr - ) -{ - ASSERT (Idtr != NULL); - InternalX86WriteIdtr (Idtr); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf deleted file mode 100644 index e172080..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf +++ /dev/null @@ -1,57 +0,0 @@ -## @file -# Instance of Base Memory Library without assembly. -# -# Base Memory Library implementation - no ASM. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLib - MODULE_UNI_FILE = BaseMemoryLib.uni - FILE_GUID = fd44e603-002a-4b29-9f5f-529e815b6165 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - SetMem.c - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGeneric.c - MemLibGuid.c - CopyMem.c - MemLibInternals.h - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni deleted file mode 100644 index 458e262..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Base Memory Library without assembly. -// -// Base Memory Library implementation - no ASM. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library without assembly" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library implementation - no ASM." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c deleted file mode 100644 index c181c3d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer A pointer to the destination buffer to compare. - @param SourceBuffer A pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMem.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMem.c deleted file mode 100644 index 0bd481d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMem.c +++ /dev/null @@ -1,154 +0,0 @@ -/** @file - Implementation of the InternalMemCopyMem routine. This function is broken - out into its own source file so that it can be excluded from a build for a - particular platform easily if an optimized version is desired. - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
- Copyright (c) 2016, Linaro Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "MemLibInternals.h" - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer The target of the copy request. - @param SourceBuffer The place to copy from. - @param Length The number of bytes to copy. - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - // - // Declare the local variables that actually move the data elements as - // 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; - - if ((((UINTN)DestinationBuffer & 0x7) == 0) && (((UINTN)SourceBuffer & 0x7) == 0) && (Length >= 8)) { - if (SourceBuffer > DestinationBuffer) { - Destination64 = (UINT64*)DestinationBuffer; - Source64 = (CONST UINT64*)SourceBuffer; - while (Length >= 8) { - *(Destination64++) = *(Source64++); - Length -= 8; - } - - // Finish if there are still some bytes to copy - 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 and Source64 were aligned on a 64-bit boundary - // but if length is not a multiple of 8 bytes then they won't be - // anymore. - - Alignment = Length & 0x7; - if (Alignment != 0) { - Destination8 = (UINT8*)Destination64; - Source8 = (CONST UINT8*)Source64; - - while (Alignment-- != 0) { - *(--Destination8) = *(--Source8); - --Length; - } - Destination64 = (UINT64*)Destination8; - Source64 = (CONST UINT64*)Source8; - } - - while (Length > 0) { - *(--Destination64) = *(--Source64); - Length -= 8; - } - } - } else if ((((UINTN)DestinationBuffer & 0x3) == 0) && (((UINTN)SourceBuffer & 0x3) == 0) && (Length >= 4)) { - if (SourceBuffer > DestinationBuffer) { - Destination32 = (UINT32*)DestinationBuffer; - Source32 = (CONST UINT32*)SourceBuffer; - while (Length >= 4) { - *(Destination32++) = *(Source32++); - Length -= 4; - } - - // Finish if there are still some bytes to copy - 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 and Source32 were aligned on a 32-bit boundary - // but if length is not a multiple of 4 bytes then they won't be - // anymore. - - Alignment = Length & 0x3; - if (Alignment != 0) { - Destination8 = (UINT8*)Destination32; - Source8 = (CONST UINT8*)Source32; - - while (Alignment-- != 0) { - *(--Destination8) = *(--Source8); - --Length; - } - Destination32 = (UINT32*)Destination8; - Source32 = (CONST UINT32*)Source8; - } - - while (Length > 0) { - *(--Destination32) = *(--Source32); - Length -= 4; - } - } - } else { - if (SourceBuffer > DestinationBuffer) { - 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); - while (Length-- != 0) { - *(Destination8--) = *(Source8--); - } - } - } - return DestinationBuffer; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c deleted file mode 100644 index f27de29..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer A pointer to the destination buffer of the memory copy. - @param SourceBuffer A pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c deleted file mode 100644 index f16755b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c +++ /dev/null @@ -1,293 +0,0 @@ -/** @file - Architecture Independent Base Memory Library Implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT16*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT32*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT64*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer Memory to set. - @param Length The number of bytes to set. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - return InternalMemSetMem (Buffer, Length, 0); -} - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length Length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - 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; - } - return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer; -} - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - CONST UINT8 *Pointer; - - Pointer = (CONST UINT8*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - CONST UINT16 *Pointer; - - Pointer = (CONST UINT16*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - CONST UINT32 *Pointer; - - Pointer = (CONST UINT32*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - CONST UINT64 *Pointer; - - Pointer = (CONST UINT64*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - CONST UINT8 *BufferData; - UINTN Index; - - BufferData = Buffer; - for (Index = 0; Index < Length; Index++) { - if (BufferData[Index] != 0) { - return FALSE; - } - } - return TRUE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGuid.c deleted file mode 100644 index 9eb2832..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid A pointer to the destination GUID. - @param SourceGuid A pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibInternals.h deleted file mode 100644 index 87b4b64..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer Target of copy - @param SourceBuffer Place to copy from - @param Length The number of bytes to copy - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The calue to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c deleted file mode 100644 index 8e90816..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer, or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer, or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem.c deleted file mode 100644 index 49a5fde..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem.c +++ /dev/null @@ -1,87 +0,0 @@ -/** @file - Implementation of the EfiSetMem routine. This function is broken - out into its own source file so that it can be excluded from a - build for a particular platform easily if an optimized version - is desired. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
- Copyright (c) 2016, Linaro Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "MemLibInternals.h" - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - // - // Declare the local variables that actually move the data elements as - // 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; - - 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; - while (Length >= 8) { - *(Pointer64++) = Value64; - Length -= 8; - } - - // Finish with bytes if needed - 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; - while (Length >= 4) { - *(Pointer32++) = Value32; - Length -= 4; - } - - // Finish with bytes if needed - Pointer8 = (UINT8*)Pointer32; - } else { - Pointer8 = (UINT8*)Buffer; - } - while (Length-- > 0) { - *(Pointer8++) = Value; - } - return Buffer; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c deleted file mode 100644 index 7758e1f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf deleted file mode 100644 index e0af1d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf +++ /dev/null @@ -1,129 +0,0 @@ -## @file -# Instance of Base Memory Library using MMX registers. -# -# Base Memory Library that uses MMX registers for high performance. -# Optimized for use in DXE. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLibMmx - MODULE_UNI_FILE = BaseMemoryLibMmx.uni - FILE_GUID = d458a654-f64c-49db-b8d1-3821306bf1f6 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Packages] - MdePkg/MdePkg.dec - - -[Sources] - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGuid.c - MemLibInternals.h - -[Sources.Ia32] - Ia32/ScanMem64.nasm - Ia32/ScanMem64.S - Ia32/ScanMem32.nasm - Ia32/ScanMem32.S - Ia32/ScanMem16.nasm - Ia32/ScanMem16.S - Ia32/ScanMem8.nasm - Ia32/ScanMem8.S - Ia32/CompareMem.nasm - Ia32/CompareMem.S - Ia32/SetMem64.nasm - Ia32/SetMem64.S - Ia32/SetMem32.nasm - Ia32/SetMem32.S - Ia32/SetMem16.nasm - Ia32/SetMem16.S - Ia32/ZeroMem.nasm - Ia32/ZeroMem.S - Ia32/SetMem.nasm - Ia32/SetMem.S - Ia32/CopyMem.nasm - Ia32/CopyMem.S - Ia32/ScanMem64.nasm - Ia32/ScanMem32.nasm - Ia32/ScanMem16.nasm - Ia32/ScanMem8.nasm - Ia32/CompareMem.nasm - Ia32/SetMem64.nasm - Ia32/SetMem32.nasm - Ia32/SetMem16.nasm - Ia32/ZeroMem.nasm - Ia32/SetMem.nasm - Ia32/CopyMem.nasm - Ia32/IsZeroBuffer.nasm - -[Sources.X64] - X64/ZeroMem.nasm - X64/ScanMem64.nasm - X64/ScanMem32.nasm - X64/ScanMem16.nasm - X64/ScanMem8.nasm - X64/CompareMem.nasm - X64/SetMem64.nasm - X64/SetMem32.nasm - X64/SetMem16.nasm - X64/SetMem.nasm - X64/CopyMem.nasm - X64/ScanMem64.nasm - X64/ScanMem64.S - X64/ScanMem32.nasm - X64/ScanMem32.S - X64/ScanMem16.nasm - X64/ScanMem16.S - X64/ScanMem8.nasm - X64/ScanMem8.S - X64/CompareMem.nasm - X64/CompareMem.S - X64/SetMem64.nasm - X64/SetMem64.S - X64/SetMem32.nasm - X64/SetMem32.S - X64/SetMem16.nasm - X64/SetMem16.S - X64/ZeroMem.nasm - X64/ZeroMem.S - X64/SetMem.nasm - X64/SetMem.S - X64/CopyMem.nasm - X64/CopyMem.S - X64/IsZeroBuffer.nasm - - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni deleted file mode 100644 index 6bc43ba..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library using MMX registers. -// -// Base Memory Library that uses MMX registers for high performance. -// Optimized for use in DXE. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library using MMX registers" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library that uses MMX registers for high performance. Optimized for use in DXE." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c deleted file mode 100644 index 161171b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S deleted file mode 100644 index 1c9239e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.Asm -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.nasm deleted file mode 100644 index e8d1abd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.nasm +++ /dev/null @@ -1,57 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push esi - push edi - mov esi, [esp + 12] - mov edi, [esp + 16] - mov ecx, [esp + 20] - repe cmpsb - movzx eax, byte [esi - 1] - movzx edx, byte [edi - 1] - sub eax, edx - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S deleted file mode 100644 index 0c204a3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S +++ /dev/null @@ -1,86 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.asm -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi,%edx,), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorl %ecx, %ecx - subl %esi, %ecx - andl $7, %ecx # ecx + esi aligns on 8-byte boundary - jz L1 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx # edx <- remaining bytes to copy - rep - movsb -L1: - movl %edx, %ecx - andl $7, %edx - shrl $3, %ecx # ecx <- # of Qwords to copy - jz L_CopyBytes - pushl %eax - pushl %eax - movq %mm0, (%esp) # save mm0 -L2: - movq (%esi), %mm0 - movq %mm0, (%edi) - addl $8, %esi - addl $8, %edi - loop L2 - movq (%esp), %mm0 # restore mm0 - popl %ecx # stack cleanup - popl %ecx # stack cleanup - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- Last byte in Source - leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb - cld - movl 12(%esp), %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.nasm deleted file mode 100644 index 21e4427..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.nasm +++ /dev/null @@ -1,77 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push esi - push edi - mov esi, [esp + 16] ; esi <- Source - mov edi, [esp + 12] ; edi <- Destination - mov edx, [esp + 20] ; edx <- Count - lea eax, [esi + edx - 1] ; eax <- End of Source - cmp esi, edi - jae .0 - cmp eax, edi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -.0: - mov ecx, edx - and edx, 7 - shr ecx, 3 ; ecx <- # of Qwords to copy - jz @CopyBytes - push eax - push eax - movq [esp], mm0 ; save mm0 -.1: - movq mm0, [esi] - movq [edi], mm0 - add esi, 8 - add edi, 8 - loop .1 - movq mm0, [esp] ; restore mm0 - pop ecx ; stack cleanup - pop ecx ; stack cleanup - jmp @CopyBytes -@CopyBackward: - mov esi, eax ; esi <- Last byte in Source - lea edi, [edi + edx - 1] ; edi <- Last byte in Destination - std -@CopyBytes: - mov ecx, edx - rep movsb - cld - mov eax, [esp + 12] - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/IsZeroBuffer.nasm deleted file mode 100644 index cfd41a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push edi - mov edi, [esp + 8] ; edi <- Buffer - mov ecx, [esp + 12] ; ecx <- Length - mov edx, ecx ; edx <- ecx - shr ecx, 2 ; ecx <- number of dwords - and edx, 3 ; edx <- number of trailing bytes - xor eax, eax ; eax <- 0, also set ZF - repe scasd - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov ecx, edx - repe scasb - jnz @ReturnFalse - pop edi - mov eax, 1 ; return TRUE - ret -@ReturnFalse: - pop edi - xor eax, eax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S deleted file mode 100644 index c485543..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.nasm deleted file mode 100644 index 78d9f30..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasw - lea eax, [edi - 2] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S deleted file mode 100644 index a9b4975..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.nasm deleted file mode 100644 index bbacf38..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasd - lea eax, [edi - 4] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S deleted file mode 100644 index e23cf5f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S +++ /dev/null @@ -1,61 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.Asm -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.nasm deleted file mode 100644 index e994d4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.nasm +++ /dev/null @@ -1,63 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - cmp eax, [edi] - lea edi, [edi + 8] - loopne .0 - jne .1 - cmp edx, [edi - 4] - jecxz .1 - jne .0 -.1: - lea eax, [edi - 8] - cmovne eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S deleted file mode 100644 index afefaab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.Asm -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.nasm deleted file mode 100644 index d13c9c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov al, [esp + 16] - repne scasb - lea eax, [edi - 1] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S deleted file mode 100644 index 52b5da6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S +++ /dev/null @@ -1,66 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.asm -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movb 16(%esp), %al - movb %al, %ah - shrdl $16, %eax, %edx - shldl $16, %edx, %eax - movl 12(%esp), %ecx # ecx <- Count - movl 8(%esp), %edi # edi <- Buffer - movl %ecx, %edx - andl $7, %edx - shrl $3, %ecx # # of Qwords to set - jz L1 - addl $-16, %esp - movq %mm0, (%esp) # save mm0 - movq %mm1, 8(%esp) # save mm1 - movd %eax, %mm0 - movd %eax, %mm1 - psllq $32, %mm0 - por %mm1, %mm0 # fill mm0 with 8 Value's -L0: - movq %mm0, (%edi) - addl $8, %edi - loop L0 - movq (%esp), %mm0 # restore mm0 - movq 8(%esp), %mm1 # restore mm1 - addl $0x10, %esp # stack cleanup -L1: - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax # eax <- Buffer as return value - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm deleted file mode 100644 index ab71586..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm +++ /dev/null @@ -1,68 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.nasm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push edi - mov al, [esp + 16] - mov ah, al - shrd edx, eax, 16 - shld eax, edx, 16 - mov ecx, [esp + 12] ; ecx <- Count - mov edi, [esp + 8] ; edi <- Buffer - mov edx, ecx - and edx, 7 - shr ecx, 3 ; # of Qwords to set - jz @SetBytes - add esp, -0x10 - movq [esp], mm0 ; save mm0 - movq [esp + 8], mm1 ; save mm1 - movd mm0, eax - movd mm1, eax - psllq mm0, 32 - por mm0, mm1 ; fill mm0 with 8 Value's -.0: - movq [edi], mm0 - add edi, 8 - loop .0 - movq mm0, [esp] ; restore mm0 - movq mm1, [esp + 8] ; restore mm1 - add esp, 0x10 ; stack cleanup -@SetBytes: - mov ecx, edx - rep stosb - mov eax, [esp + 8] ; eax <- Buffer as return value - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S deleted file mode 100644 index af10605..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S +++ /dev/null @@ -1,59 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.asm -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - shrdl $16, %eax, %edx - shldl $16, %edx, %eax - movl 12(%esp), %edx - movl 8(%esp), %edi - movl %edx, %ecx - andl $3, %edx - shrl $2, %ecx - jz L1 - movd %eax, %mm0 - movd %eax, %mm1 - psllq $32, %mm0 - por %mm1, %mm0 -L0: - movq %mm0, (%edi) - addl $8, %edi - loop L0 -L1: - movl %edx, %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.nasm deleted file mode 100644 index 61d1ef0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.nasm +++ /dev/null @@ -1,61 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.nasm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push edi - mov eax, [esp + 16] - shrd edx, eax, 16 - shld eax, edx, 16 - mov edx, [esp + 12] - mov edi, [esp + 8] - mov ecx, edx - and edx, 3 - shr ecx, 2 - jz @SetWords - movd mm0, eax - movd mm1, eax - psllq mm0, 32 - por mm0, mm1 -.0: - movq [edi], mm0 - add edi, 8 - loop .0 -@SetWords: - mov ecx, edx - rep stosw - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S deleted file mode 100644 index acf273d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.asm -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - movl 4(%esp), %eax - movl 8(%esp), %ecx - movd 12(%esp), %mm0 - shrl %ecx - movl %eax, %edx - jz L1 - movq %mm0, %mm1 - psllq $32, %mm1 - por %mm1, %mm0 -L0: - movq %mm0, (%edx) - lea 8(%edx), %edx - loop L0 -L1: - jnc L2 - movd %mm0, (%edx) -L2: - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.nasm deleted file mode 100644 index 9289f33..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.nasm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - mov eax, [esp + 4] ; eax <- Buffer as return value - mov ecx, [esp + 8] ; ecx <- Count - movd mm0, dword [esp + 12] ; mm0 <- Value - shr ecx, 1 ; ecx <- number of qwords to set - mov edx, eax ; edx <- Buffer - jz @SetDwords - movq mm1, mm0 - psllq mm1, 32 - por mm0, mm1 -.0: - movq qword [edx], mm0 - lea edx, [edx + 8] ; use "lea" to avoid change in flags - loop .0 -@SetDwords: - jnc .1 - movd dword [edx], mm0 -.1: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S deleted file mode 100644 index be4b42b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.asm -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - movl 4(%esp), %eax - movl 8(%esp), %ecx - movq 12(%esp), %mm0 - movl %eax, %edx -L0: - movq %mm0, (%edx) - lea 8(%edx), %edx - loop L0 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.nasm deleted file mode 100644 index 13fa52f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.nasm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - mov eax, [esp + 4] - mov ecx, [esp + 8] - movq mm0, [esp + 12] - mov edx, eax -.0: - movq [edx], mm0 - add edx, 8 - loop .0 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S deleted file mode 100644 index ac92ec2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.asm -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - movl 8(%esp), %edi - movl 12(%esp), %ecx - movl %ecx, %edx - shrl $3, %ecx - jz L_ZeroBytes - pxor %mm0, %mm0 -L0: - movq %mm0, (%edi) - addl $8, %edi - loop L0 -L_ZeroBytes: - andl $7, %edx - xorl %eax, %eax - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.nasm deleted file mode 100644 index bcf7cf6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.nasm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push edi - mov edi, [esp + 8] - mov ecx, [esp + 12] - mov edx, ecx - shr ecx, 3 - jz @ZeroBytes - pxor mm0, mm0 -.0: - movq [edi], mm0 - add edi, 8 - loop .0 -@ZeroBytes: - and edx, 7 - xor eax, eax - mov ecx, edx - rep stosb - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h deleted file mode 100644 index ce1c17f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer The target of the copy request. - @param SourceBuffer The place to copy from. - @param Length The number of bytes to copy - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c deleted file mode 100644 index ff19a9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value Thevalue to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c deleted file mode 100644 index 7758e1f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S deleted file mode 100644 index 12fde1c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S +++ /dev/null @@ -1,59 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - pushq %rsi - pushq %rdi - movq %rcx, %rsi - movq %rdx, %rdi - movq %r8, %rcx - repe cmpsb - movzbq -1(%rsi), %rax - movzbq -1(%rdi), %rdx - subq %rdx, %rax - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.nasm deleted file mode 100644 index cb0d886..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.nasm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte [rsi - 1] - movzx rdx, byte [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S deleted file mode 100644 index aec628e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S +++ /dev/null @@ -1,74 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - pushq %rsi - pushq %rdi - movq %rdx, %rsi # rsi <- Source - movq %rcx, %rdi # rdi <- Destination - leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source - cmpq %rdi, %rsi - movq %rdi, %rax # rax <- Destination as return value - jae L0 - cmpq %rdi, %r9 - jae L_CopyBackward # Copy backward if overlapped -L0: - movq %r8, %rcx - andq $7, %r8 - shrq $3, %rcx # rcx <- # of Qwords to copy - jz L_CopyBytes - movd %mm0, %r10 # (Save mm0 in r10) -L1: - movq (%rsi), %mm0 - movntq %mm0, (%rdi) - addq $8, %rsi - addq $8, %rdi - loop L1 - mfence - movd %r10, %mm0 # (Restore mm0) - jmp L_CopyBytes -L_CopyBackward: - movq %r9, %rsi # rsi <- End of Source - leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination - std # set direction flag -L_CopyBytes: - movq %r8, %rcx - rep movsb # Copy bytes backward - cld - popq %rdi - popq %rsi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm deleted file mode 100644 index b3b9634..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm +++ /dev/null @@ -1,74 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; OUT VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- End of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae .0 - cmp r9, rdi - jae @CopyBackward ; Copy backward if overlapped -.0: - mov rcx, r8 - and r8, 7 - shr rcx, 3 ; rcx <- # of Qwords to copy - jz @CopyBytes - DB 0x49, 0xf, 0x7e, 0xc2 ; movd r10, mm0 (Save mm0 in r10) -.1: - DB 0xf, 0x6f, 0x6 ; movd mm0, [rsi] - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 - add rsi, 8 - add rdi, 8 - loop .1 - mfence - DB 0x49, 0xf, 0x6e, 0xc2 ; movd mm0, r10 (Restore mm0) - jmp @CopyBytes -@CopyBackward: - mov rsi, r9 ; rsi <- End of Source - lea rdi, [rdi + r8 - 1] ; rdi <- End of Destination - std ; set direction flag -@CopyBytes: - mov rcx, r8 - rep movsb ; Copy bytes backward - cld - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/IsZeroBuffer.nasm deleted file mode 100644 index 3b855a7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push rdi - mov rdi, rcx ; rdi <- Buffer - mov rcx, rdx ; rcx <- Length - shr rcx, 3 ; rcx <- number of qwords - and rdx, 7 ; rdx <- number of trailing bytes - xor rax, rax ; rax <- 0, also set ZF - repe scasq - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov rcx, rdx - repe scasb - jnz @ReturnFalse - pop rdi - mov rax, 1 ; return TRUE - ret -@ReturnFalse: - pop rdi - xor rax, rax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S deleted file mode 100644 index 718dd80..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasw - leaq -2(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.nasm deleted file mode 100644 index 9f0de63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S deleted file mode 100644 index b34d916..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasl - leaq -4(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.nasm deleted file mode 100644 index 5c9ae5d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S deleted file mode 100644 index 7d5f902..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S +++ /dev/null @@ -1,55 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasq - leaq -8(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.nasm deleted file mode 100644 index b98c6de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S deleted file mode 100644 index efd877b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasb - leaq -1(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.nasm deleted file mode 100644 index 8499795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx ; set rax to 0 if not found - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S deleted file mode 100644 index ba16ab2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S +++ /dev/null @@ -1,61 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push %rdi - movq %r8, %rax - movb %al, %ah - movd %rax, %mm0 - movq %rcx, %r8 - movq %r8, %rdi # rdi <- Buffer - movq %rdx, %rcx - andq $7, %rdx - shrq $3, %rcx - jz L_SetBytes - .byte 0x0f, 0x70, 0x0C0, 0x00 -L0: - movntq %mm0, (%rdi) - addq $8, %rdi - loop L0 - mfence -L_SetBytes: - movl %edx, %ecx - rep stosb - movq %r8, %rax - pop %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm deleted file mode 100644 index 1b50e5e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm +++ /dev/null @@ -1,60 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.nasm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; OUT VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rax, r8 - mov ah, al - DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax - mov r8, rcx - mov rdi, r8 ; rdi <- Buffer - mov rcx, rdx - and edx, 7 - shr rcx, 3 - jz @SetBytes - DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h -.0: - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 - add rdi, 8 - loop .0 - mfence -@SetBytes: - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S deleted file mode 100644 index 7d28278..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S +++ /dev/null @@ -1,60 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - pushq %rdi - movq %r8, %rax - movd %rax, %mm0 - movq %rcx, %r8 - movq %r8, %rdi - movq %rdx, %rcx - andl $3, %edx - shrq $2, %rcx - jz L_SetWords - .byte 0x0f, 0x70, 0x0C0, 0x00 -L0: - movntq %mm0, (%rdi) - addq $8, %rdi - loop L0 - mfence -L_SetWords: - movl %edx, %ecx - rep stosw - movq %r8, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm deleted file mode 100644 index 4343550..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm +++ /dev/null @@ -1,59 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.nasm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; OUT VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rax, r8 - DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax - mov r8, rcx - mov rdi, r8 - mov rcx, rdx - and edx, 3 - shr rcx, 2 - jz @SetWords - DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h -.0: - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 - add rdi, 8 - loop .0 - mfence -@SetWords: - mov ecx, edx - rep stosw - mov rax, r8 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S deleted file mode 100644 index b60e06a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S +++ /dev/null @@ -1,55 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - movd %r8, %mm0 # mm0 <- Value - movq %rcx, %rax # rax <- Buffer - xchgq %rdx, %rcx # rcx <- Count rdx <- Buffer - shrq $1, % rcx # rcx <- # of qwords to set - jz L_SetDwords - .byte 0x0f, 0x70, 0x0C0, 0x44 -L0: - movntq %mm0, (%rdx) - leaq 8(%rdx), %rdx # use "lea" to avoid flag changes - loop L0 - mfence -L_SetDwords: - jnc L1 - movd %mm0, (%rdx) -L1: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm deleted file mode 100644 index cf659b0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm +++ /dev/null @@ -1,53 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.nasm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value) - mov rax, rcx ; rax <- Buffer - xchg rcx, rdx ; rcx <- Count rdx <- Buffer - shr rcx, 1 ; rcx <- # of qwords to set - jz @SetDwords - DB 0xf, 0x70, 0xC0, 0x44 ; pshufw mm0, mm0, 44h -.0: - DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0 - lea rdx, [rdx + 8] ; use "lea" to avoid flag changes - loop .0 - mfence -@SetDwords: - jnc .1 - DB 0xf, 0x7e, 0x2 ; movd [rdx], mm0 -.1: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S deleted file mode 100644 index c8cbb9a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - movd %r8, %mm0 #Value - movq %rcx, %rax #rax <- Buffer - xchg %rdx, %rcx #rcx <- Count -L0: - movntq %mm0, (%rdx) - addq $8, %rdx - loop L0 - mfence - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm deleted file mode 100644 index f4aa51c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.nasm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value) - mov rax, rcx ; rax <- Buffer - xchg rcx, rdx ; rcx <- Count -.0: - DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0 - add rdx, 8 - loop .0 - mfence - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S deleted file mode 100644 index 1994f9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S +++ /dev/null @@ -1,57 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %rdi, %r8 - andq $7, %rdx - shrq $3, %rcx - jz L_ZeroBytes - pxor %mm0, %mm0 -L0: - movntq %mm0, (%rdi) - addq $8, %rdi - loop L0 - mfence -L_ZeroBytes: - xorl %eax, %eax - movl %edx, %ecx - rep stosb - movq %r8, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm deleted file mode 100644 index 9eb4d26..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm +++ /dev/null @@ -1,56 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.nasm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - mov rdi, rcx - mov rcx, rdx - mov r8, rdi - and edx, 7 - shr rcx, 3 - jz @ZeroBytes - DB 0xf, 0xef, 0xc0 ; pxor mm0, mm0 -.0: - DB 0xf, 0xe7, 7 ; movntq [rdi], mm0 - add rdi, 8 - loop .0 - DB 0xf, 0xae, 0xf0 ; mfence -@ZeroBytes: - xor eax, eax - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S deleted file mode 100644 index 8544c01..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) 2016, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - - .text - .align 5 -ASM_GLOBAL ASM_PFX(InternalMemCompareGuid) -ASM_PFX(InternalMemCompareGuid): - mov x2, xzr - ldp x3, x4, [x0] - cbz x1, 0f - ldp x1, x2, [x1] -0: cmp x1, x3 - ccmp x2, x4, #0, eq - cset w0, eq - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S deleted file mode 100644 index 7e5bf8a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (c) 2013, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// Assumptions: -// -// ARMv8-a, AArch64 -// - - -// Parameters and result. -#define src1 x0 -#define src2 x1 -#define limit x2 -#define result x0 - -// Internal variables. -#define data1 x3 -#define data1w w3 -#define data2 x4 -#define data2w w4 -#define diff x6 -#define endloop x7 -#define tmp1 x8 -#define tmp2 x9 -#define pos x11 -#define limit_wd x12 -#define mask x13 - - .p2align 6 -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - eor tmp1, src1, src2 - tst tmp1, #7 - b.ne .Lmisaligned8 - ands tmp1, src1, #7 - b.ne .Lmutual_align - add limit_wd, limit, #7 - lsr limit_wd, limit_wd, #3 - - // Start of performance-critical section -- one 64B cache line. -.Lloop_aligned: - ldr data1, [src1], #8 - ldr data2, [src2], #8 -.Lstart_realigned: - subs limit_wd, limit_wd, #1 - eor diff, data1, data2 // Non-zero if differences found. - csinv endloop, diff, xzr, ne // Last Dword or differences. - cbz endloop, .Lloop_aligned - // End of performance-critical section -- one 64B cache line. - - // Not reached the limit, must have found a diff. - cbnz limit_wd, .Lnot_limit - - // Limit % 8 == 0 => all bytes significant. - ands limit, limit, #7 - b.eq .Lnot_limit - - lsl limit, limit, #3 // Bits -> bytes. - mov mask, #~0 - lsl mask, mask, limit - bic data1, data1, mask - bic data2, data2, mask - - orr diff, diff, mask - -.Lnot_limit: - rev diff, diff - rev data1, data1 - rev data2, data2 - - // The MS-non-zero bit of DIFF marks either the first bit - // that is different, or the end of the significant data. - // Shifting left now will bring the critical information into the - // top bits. - clz pos, diff - lsl data1, data1, pos - lsl data2, data2, pos - - // But we need to zero-extend (char is unsigned) the value and then - // perform a signed 32-bit subtraction. - lsr data1, data1, #56 - sub result, data1, data2, lsr #56 - ret - -.Lmutual_align: - // Sources are mutually aligned, but are not currently at an - // alignment boundary. Round down the addresses and then mask off - // the bytes that precede the start point. - bic src1, src1, #7 - bic src2, src2, #7 - add limit, limit, tmp1 // Adjust the limit for the extra. - lsl tmp1, tmp1, #3 // Bytes beyond alignment -> bits. - ldr data1, [src1], #8 - neg tmp1, tmp1 // Bits to alignment -64. - ldr data2, [src2], #8 - mov tmp2, #~0 - - // Little-endian. Early bytes are at LSB. - lsr tmp2, tmp2, tmp1 // Shift (tmp1 & 63). - add limit_wd, limit, #7 - orr data1, data1, tmp2 - orr data2, data2, tmp2 - lsr limit_wd, limit_wd, #3 - b .Lstart_realigned - - .p2align 6 -.Lmisaligned8: - sub limit, limit, #1 -1: - // Perhaps we can do better than this. - ldrb data1w, [src1], #1 - ldrb data2w, [src2], #1 - subs limit, limit, #1 - ccmp data1w, data2w, #0, cs // NZCV = 0b0000. - b.eq 1b - sub result, data1, data2 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S deleted file mode 100644 index ec5f696..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S +++ /dev/null @@ -1,284 +0,0 @@ -// -// Copyright (c) 2012 - 2016, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// -// Copyright (c) 2015 ARM Ltd -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the company may not be used to endorse or promote -// products derived from this software without specific prior written -// permission. -// -// THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// Assumptions: -// -// ARMv8-a, AArch64, unaligned accesses. -// -// - -#define dstin x0 -#define src x1 -#define count x2 -#define dst x3 -#define srcend x4 -#define dstend x5 -#define A_l x6 -#define A_lw w6 -#define A_h x7 -#define A_hw w7 -#define B_l x8 -#define B_lw w8 -#define B_h x9 -#define C_l x10 -#define C_h x11 -#define D_l x12 -#define D_h x13 -#define E_l x14 -#define E_h x15 -#define F_l srcend -#define F_h dst -#define tmp1 x9 -#define tmp2 x3 - -#define L(l) .L ## l - -// Copies are split into 3 main cases: small copies of up to 16 bytes, -// medium copies of 17..96 bytes which are fully unrolled. Large copies -// of more than 96 bytes align the destination and use an unrolled loop -// processing 64 bytes per iteration. -// Small and medium copies read all data before writing, allowing any -// kind of overlap, and memmove tailcalls memcpy for these cases as -// well as non-overlapping copies. - -__memcpy: - prfm PLDL1KEEP, [src] - add srcend, src, count - add dstend, dstin, count - cmp count, 16 - b.ls L(copy16) - cmp count, 96 - b.hi L(copy_long) - - // Medium copies: 17..96 bytes. - sub tmp1, count, 1 - ldp A_l, A_h, [src] - tbnz tmp1, 6, L(copy96) - ldp D_l, D_h, [srcend, -16] - tbz tmp1, 5, 1f - ldp B_l, B_h, [src, 16] - ldp C_l, C_h, [srcend, -32] - stp B_l, B_h, [dstin, 16] - stp C_l, C_h, [dstend, -32] -1: - stp A_l, A_h, [dstin] - stp D_l, D_h, [dstend, -16] - ret - - .p2align 4 - // Small copies: 0..16 bytes. -L(copy16): - cmp count, 8 - b.lo 1f - ldr A_l, [src] - ldr A_h, [srcend, -8] - str A_l, [dstin] - str A_h, [dstend, -8] - ret - .p2align 4 -1: - tbz count, 2, 1f - ldr A_lw, [src] - ldr A_hw, [srcend, -4] - str A_lw, [dstin] - str A_hw, [dstend, -4] - ret - - // Copy 0..3 bytes. Use a branchless sequence that copies the same - // byte 3 times if count==1, or the 2nd byte twice if count==2. -1: - cbz count, 2f - lsr tmp1, count, 1 - ldrb A_lw, [src] - ldrb A_hw, [srcend, -1] - ldrb B_lw, [src, tmp1] - strb A_lw, [dstin] - strb B_lw, [dstin, tmp1] - strb A_hw, [dstend, -1] -2: ret - - .p2align 4 - // Copy 64..96 bytes. Copy 64 bytes from the start and - // 32 bytes from the end. -L(copy96): - ldp B_l, B_h, [src, 16] - ldp C_l, C_h, [src, 32] - ldp D_l, D_h, [src, 48] - ldp E_l, E_h, [srcend, -32] - ldp F_l, F_h, [srcend, -16] - stp A_l, A_h, [dstin] - stp B_l, B_h, [dstin, 16] - stp C_l, C_h, [dstin, 32] - stp D_l, D_h, [dstin, 48] - stp E_l, E_h, [dstend, -32] - stp F_l, F_h, [dstend, -16] - ret - - // Align DST to 16 byte alignment so that we don't cross cache line - // boundaries on both loads and stores. There are at least 96 bytes - // to copy, so copy 16 bytes unaligned and then align. The loop - // copies 64 bytes per iteration and prefetches one iteration ahead. - - .p2align 4 -L(copy_long): - and tmp1, dstin, 15 - bic dst, dstin, 15 - ldp D_l, D_h, [src] - sub src, src, tmp1 - add count, count, tmp1 // Count is now 16 too large. - ldp A_l, A_h, [src, 16] - stp D_l, D_h, [dstin] - ldp B_l, B_h, [src, 32] - ldp C_l, C_h, [src, 48] - ldp D_l, D_h, [src, 64]! - subs count, count, 128 + 16 // Test and readjust count. - b.ls 2f -1: - stp A_l, A_h, [dst, 16] - ldp A_l, A_h, [src, 16] - stp B_l, B_h, [dst, 32] - ldp B_l, B_h, [src, 32] - stp C_l, C_h, [dst, 48] - ldp C_l, C_h, [src, 48] - stp D_l, D_h, [dst, 64]! - ldp D_l, D_h, [src, 64]! - subs count, count, 64 - b.hi 1b - - // Write the last full set of 64 bytes. The remainder is at most 64 - // bytes, so it is safe to always copy 64 bytes from the end even if - // there is just 1 byte left. -2: - ldp E_l, E_h, [srcend, -64] - stp A_l, A_h, [dst, 16] - ldp A_l, A_h, [srcend, -48] - stp B_l, B_h, [dst, 32] - ldp B_l, B_h, [srcend, -32] - stp C_l, C_h, [dst, 48] - ldp C_l, C_h, [srcend, -16] - stp D_l, D_h, [dst, 64] - stp E_l, E_h, [dstend, -64] - stp A_l, A_h, [dstend, -48] - stp B_l, B_h, [dstend, -32] - stp C_l, C_h, [dstend, -16] - ret - - -// -// All memmoves up to 96 bytes are done by memcpy as it supports overlaps. -// Larger backwards copies are also handled by memcpy. The only remaining -// case is forward large copies. The destination is aligned, and an -// unrolled loop processes 64 bytes per iteration. -// - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - sub tmp2, dstin, src - cmp count, 96 - ccmp tmp2, count, 2, hi - b.hs __memcpy - - cbz tmp2, 3f - add dstend, dstin, count - add srcend, src, count - - // Align dstend to 16 byte alignment so that we don't cross cache line - // boundaries on both loads and stores. There are at least 96 bytes - // to copy, so copy 16 bytes unaligned and then align. The loop - // copies 64 bytes per iteration and prefetches one iteration ahead. - - and tmp2, dstend, 15 - ldp D_l, D_h, [srcend, -16] - sub srcend, srcend, tmp2 - sub count, count, tmp2 - ldp A_l, A_h, [srcend, -16] - stp D_l, D_h, [dstend, -16] - ldp B_l, B_h, [srcend, -32] - ldp C_l, C_h, [srcend, -48] - ldp D_l, D_h, [srcend, -64]! - sub dstend, dstend, tmp2 - subs count, count, 128 - b.ls 2f - nop -1: - stp A_l, A_h, [dstend, -16] - ldp A_l, A_h, [srcend, -16] - stp B_l, B_h, [dstend, -32] - ldp B_l, B_h, [srcend, -32] - stp C_l, C_h, [dstend, -48] - ldp C_l, C_h, [srcend, -48] - stp D_l, D_h, [dstend, -64]! - ldp D_l, D_h, [srcend, -64]! - subs count, count, 64 - b.hi 1b - - // Write the last full set of 64 bytes. The remainder is at most 64 - // bytes, so it is safe to always copy 64 bytes from the start even if - // there is just 1 byte left. -2: - ldp E_l, E_h, [src, 48] - stp A_l, A_h, [dstend, -16] - ldp A_l, A_h, [src, 32] - stp B_l, B_h, [dstend, -32] - ldp B_l, B_h, [src, 16] - stp C_l, C_h, [dstend, -48] - ldp C_l, C_h, [src] - stp D_l, D_h, [dstend, -64] - stp E_l, E_h, [dstin, 48] - stp A_l, A_h, [dstin, 32] - stp B_l, B_h, [dstin, 16] - stp C_l, C_h, [dstin] -3: ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S deleted file mode 100644 index 3fe772f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S +++ /dev/null @@ -1,161 +0,0 @@ -// -// Copyright (c) 2014, ARM Limited -// All rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the company nor the names of its contributors -// may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// Assumptions: -// -// ARMv8-a, AArch64 -// Neon Available. -// - -// Arguments and results. -#define srcin x0 -#define cntin x1 -#define chrin w2 - -#define result x0 - -#define src x3 -#define tmp x4 -#define wtmp2 w5 -#define synd x6 -#define soff x9 -#define cntrem x10 - -#define vrepchr v0 -#define vdata1 v1 -#define vdata2 v2 -#define vhas_chr1 v3 -#define vhas_chr2 v4 -#define vrepmask v5 -#define vend v6 - -// -// Core algorithm: -// -// For each 32-byte chunk we calculate a 64-bit syndrome value, with two bits -// per byte. For each tuple, bit 0 is set if the relevant byte matched the -// requested character and bit 1 is not used (faster than using a 32bit -// syndrome). Since the bits in the syndrome reflect exactly the order in which -// things occur in the original string, counting trailing zeros allows to -// identify exactly which byte has matched. -// - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - // Do not dereference srcin if no bytes to compare. - cbz cntin, .Lzero_length - // - // Magic constant 0x40100401 allows us to identify which lane matches - // the requested byte. - // - mov wtmp2, #0x0401 - movk wtmp2, #0x4010, lsl #16 - dup vrepchr.16b, chrin - // Work with aligned 32-byte chunks - bic src, srcin, #31 - dup vrepmask.4s, wtmp2 - ands soff, srcin, #31 - and cntrem, cntin, #31 - b.eq .Lloop - - // - // Input string is not 32-byte aligned. We calculate the syndrome - // value for the aligned 32 bytes block containing the first bytes - // and mask the irrelevant part. - // - - ld1 {vdata1.16b, vdata2.16b}, [src], #32 - sub tmp, soff, #32 - adds cntin, cntin, tmp - cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b - cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b - and vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b - and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b - addp vend.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128 - addp vend.16b, vend.16b, vend.16b // 128->64 - mov synd, vend.d[0] - // Clear the soff*2 lower bits - lsl tmp, soff, #1 - lsr synd, synd, tmp - lsl synd, synd, tmp - // The first block can also be the last - b.ls .Lmasklast - // Have we found something already? - cbnz synd, .Ltail - -.Lloop: - ld1 {vdata1.16b, vdata2.16b}, [src], #32 - subs cntin, cntin, #32 - cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b - cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b - // If we're out of data we finish regardless of the result - b.ls .Lend - // Use a fast check for the termination condition - orr vend.16b, vhas_chr1.16b, vhas_chr2.16b - addp vend.2d, vend.2d, vend.2d - mov synd, vend.d[0] - // We're not out of data, loop if we haven't found the character - cbz synd, .Lloop - -.Lend: - // Termination condition found, let's calculate the syndrome value - and vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b - and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b - addp vend.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128 - addp vend.16b, vend.16b, vend.16b // 128->64 - mov synd, vend.d[0] - // Only do the clear for the last possible block - b.hi .Ltail - -.Lmasklast: - // Clear the (32 - ((cntrem + soff) % 32)) * 2 upper bits - add tmp, cntrem, soff - and tmp, tmp, #31 - sub tmp, tmp, #32 - neg tmp, tmp, lsl #1 - lsl synd, synd, tmp - lsr synd, synd, tmp - -.Ltail: - // Count the trailing zeros using bit reversing - rbit synd, synd - // Compensate the last post-increment - sub src, src, #32 - // Check that we have found a character - cmp synd, #0 - // And count the leading zeros - clz synd, synd - // Compute the potential result - add result, src, synd, lsr #1 - // Select result or NULL - csel result, xzr, result, eq - ret - -.Lzero_length: - mov result, #0 - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S deleted file mode 100644 index 384fbdc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S +++ /dev/null @@ -1,247 +0,0 @@ -// -// Copyright (c) 2012 - 2016, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// -// Copyright (c) 2015 ARM Ltd -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the company may not be used to endorse or promote -// products derived from this software without specific prior written -// permission. -// -// THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// Assumptions: -// -// ARMv8-a, AArch64, unaligned accesses -// -// - -#define dstin x0 -#define count x1 -#define val x2 -#define valw w2 -#define dst x3 -#define dstend x4 -#define tmp1 x5 -#define tmp1w w5 -#define tmp2 x6 -#define tmp2w w6 -#define zva_len x7 -#define zva_lenw w7 - -#define L(l) .L ## l - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - dup v0.8H, valw - lsl count, count, #1 - b 0f - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - dup v0.4S, valw - lsl count, count, #2 - b 0f - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - dup v0.2D, val - lsl count, count, #3 - b 0f - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - movi v0.16B, #0 - b 0f - -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - dup v0.16B, valw -0: add dstend, dstin, count - mov val, v0.D[0] - - cmp count, 96 - b.hi L(set_long) - cmp count, 16 - b.hs L(set_medium) - - // Set 0..15 bytes. - tbz count, 3, 1f - str val, [dstin] - str val, [dstend, -8] - ret - nop -1: tbz count, 2, 2f - str valw, [dstin] - str valw, [dstend, -4] - ret -2: cbz count, 3f - strb valw, [dstin] - tbz count, 1, 3f - strh valw, [dstend, -2] -3: ret - - // Set 17..96 bytes. -L(set_medium): - str q0, [dstin] - tbnz count, 6, L(set96) - str q0, [dstend, -16] - tbz count, 5, 1f - str q0, [dstin, 16] - str q0, [dstend, -32] -1: ret - - .p2align 4 - // Set 64..96 bytes. Write 64 bytes from the start and - // 32 bytes from the end. -L(set96): - str q0, [dstin, 16] - stp q0, q0, [dstin, 32] - stp q0, q0, [dstend, -32] - ret - - .p2align 3 - nop -L(set_long): - bic dst, dstin, 15 - str q0, [dstin] - cmp count, 256 - ccmp val, 0, 0, cs - b.eq L(try_zva) -L(no_zva): - sub count, dstend, dst // Count is 16 too large. - add dst, dst, 16 - sub count, count, 64 + 16 // Adjust count and bias for loop. -1: stp q0, q0, [dst], 64 - stp q0, q0, [dst, -32] -L(tail64): - subs count, count, 64 - b.hi 1b -2: stp q0, q0, [dstend, -64] - stp q0, q0, [dstend, -32] - ret - - .p2align 3 -L(try_zva): - mrs tmp1, dczid_el0 - tbnz tmp1w, 4, L(no_zva) - and tmp1w, tmp1w, 15 - cmp tmp1w, 4 // ZVA size is 64 bytes. - b.ne L(zva_128) - - // Write the first and last 64 byte aligned block using stp rather - // than using DC ZVA. This is faster on some cores. -L(zva_64): - str q0, [dst, 16] - stp q0, q0, [dst, 32] - bic dst, dst, 63 - stp q0, q0, [dst, 64] - stp q0, q0, [dst, 96] - sub count, dstend, dst // Count is now 128 too large. - sub count, count, 128+64+64 // Adjust count and bias for loop. - add dst, dst, 128 - nop -1: dc zva, dst - add dst, dst, 64 - subs count, count, 64 - b.hi 1b - stp q0, q0, [dst, 0] - stp q0, q0, [dst, 32] - stp q0, q0, [dstend, -64] - stp q0, q0, [dstend, -32] - ret - - .p2align 3 -L(zva_128): - cmp tmp1w, 5 // ZVA size is 128 bytes. - b.ne L(zva_other) - - str q0, [dst, 16] - stp q0, q0, [dst, 32] - stp q0, q0, [dst, 64] - stp q0, q0, [dst, 96] - bic dst, dst, 127 - sub count, dstend, dst // Count is now 128 too large. - sub count, count, 128+128 // Adjust count and bias for loop. - add dst, dst, 128 -1: dc zva, dst - add dst, dst, 128 - subs count, count, 128 - b.hi 1b - stp q0, q0, [dstend, -128] - stp q0, q0, [dstend, -96] - stp q0, q0, [dstend, -64] - stp q0, q0, [dstend, -32] - ret - -L(zva_other): - mov tmp2w, 4 - lsl zva_lenw, tmp2w, tmp1w - add tmp1, zva_len, 64 // Max alignment bytes written. - cmp count, tmp1 - blo L(no_zva) - - sub tmp2, zva_len, 1 - add tmp1, dst, zva_len - add dst, dst, 16 - subs count, tmp1, dst // Actual alignment bytes to write. - bic tmp1, tmp1, tmp2 // Aligned dc zva start address. - beq 2f -1: stp q0, q0, [dst], 64 - stp q0, q0, [dst, -32] - subs count, count, 64 - b.hi 1b -2: mov dst, tmp1 - sub count, dstend, tmp1 // Remaining bytes to write. - subs count, count, zva_len - b.lo 4f -3: dc zva, dst - add dst, dst, zva_len - subs count, count, zva_len - b.hs 3b -4: add count, count, zva_len - b L(tail64) diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S deleted file mode 100644 index 78a4525..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) 2016, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - - .text - .thumb - .syntax unified - .align 5 - .type ASM_PFX(InternalMemCompareGuid), %function -ASM_GLOBAL ASM_PFX(InternalMemCompareGuid) -ASM_PFX(InternalMemCompareGuid): - push {r4, lr} - ldr r2, [r0] - ldr r3, [r0, #4] - ldr r4, [r0, #8] - ldr r0, [r0, #12] - cbz r1, 1f - ldr ip, [r1] - ldr lr, [r1, #4] - cmp r2, ip - it eq - cmpeq.n r3, lr - beq 0f - movs r0, #0 - pop {r4, pc} - -0: ldr r2, [r1, #8] - ldr r3, [r1, #12] - cmp r4, r2 - it eq - cmpeq.n r0, r3 - bne 2f - movs r0, #1 - pop {r4, pc} - -1: orrs r2, r2, r3 - orrs r4, r4, r0 - movs r0, #1 - orrs r2, r2, r4 -2: it ne - movne.n r0, #0 - pop {r4, pc} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.asm deleted file mode 100644 index 0373404..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.asm +++ /dev/null @@ -1,70 +0,0 @@ -; -; Copyright (c) 2016, Linaro Limited -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; * Neither the name of the Linaro nor the -; names of its contributors may be used to endorse or promote products -; derived from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; - - EXPORT InternalMemCompareGuid - THUMB - AREA CompareGuid, CODE, READONLY, CODEALIGN, ALIGN=5 - -InternalMemCompareGuid - push {r4, lr} - ldr r2, [r0] - ldr r3, [r0, #4] - ldr r4, [r0, #8] - ldr r0, [r0, #12] - cbz r1, L1 - ldr ip, [r1] - ldr lr, [r1, #4] - cmp r2, ip - it eq - cmpeq r3, lr - beq L0 - movs r0, #0 - pop {r4, pc} - -L0 - ldr r2, [r1, #8] - ldr r3, [r1, #12] - cmp r4, r2 - it eq - cmpeq r0, r3 - bne L2 - movs r0, #1 - pop {r4, pc} - -L1 - orrs r2, r2, r3 - orrs r4, r4, r0 - movs r0, #1 - orrs r2, r2, r4 - -L2 - it ne - movne r0, #0 - pop {r4, pc} - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S deleted file mode 100644 index 8e17760..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S +++ /dev/null @@ -1,139 +0,0 @@ -// -// Copyright (c) 2013 - 2016, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Linaro nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// Parameters and result. -#define src1 r0 -#define src2 r1 -#define limit r2 -#define result r0 - -// Internal variables. -#define data1 r3 -#define data2 r4 -#define limit_wd r5 -#define diff r6 -#define tmp1 r7 -#define tmp2 r12 -#define pos r8 -#define mask r14 - - .text - .thumb - .syntax unified - .align 5 - .type ASM_PFX(InternalMemCompareMem), %function -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push {r4-r8, lr} - eor tmp1, src1, src2 - tst tmp1, #3 - bne .Lmisaligned4 - ands tmp1, src1, #3 - bne .Lmutual_align - add limit_wd, limit, #3 - nop.w - lsr limit_wd, limit_wd, #2 - - // Start of performance-critical section -- one 32B cache line. -.Lloop_aligned: - ldr data1, [src1], #4 - ldr data2, [src2], #4 -.Lstart_realigned: - subs limit_wd, limit_wd, #1 - eor diff, data1, data2 // Non-zero if differences found. - cbnz diff, 0f - bne .Lloop_aligned - // End of performance-critical section -- one 32B cache line. - - // Not reached the limit, must have found a diff. -0: cbnz limit_wd, .Lnot_limit - - // Limit % 4 == 0 => all bytes significant. - ands limit, limit, #3 - beq .Lnot_limit - - lsl limit, limit, #3 // Bits -> bytes. - mov mask, #~0 - lsl mask, mask, limit - bic data1, data1, mask - bic data2, data2, mask - - orr diff, diff, mask - -.Lnot_limit: - rev diff, diff - rev data1, data1 - rev data2, data2 - - // The MS-non-zero bit of DIFF marks either the first bit - // that is different, or the end of the significant data. - // Shifting left now will bring the critical information into the - // top bits. - clz pos, diff - lsl data1, data1, pos - lsl data2, data2, pos - - // But we need to zero-extend (char is unsigned) the value and then - // perform a signed 32-bit subtraction. - lsr data1, data1, #28 - sub result, data1, data2, lsr #28 - pop {r4-r8, pc} - -.Lmutual_align: - // Sources are mutually aligned, but are not currently at an - // alignment boundary. Round down the addresses and then mask off - // the bytes that precede the start point. - bic src1, src1, #3 - bic src2, src2, #3 - add limit, limit, tmp1 // Adjust the limit for the extra. - lsl tmp1, tmp1, #3 // Bytes beyond alignment -> bits. - ldr data1, [src1], #4 - rsb tmp1, tmp1, #32 // Bits to alignment -32. - ldr data2, [src2], #4 - mov tmp2, #~0 - - // Little-endian. Early bytes are at LSB. - lsr tmp2, tmp2, tmp1 // Shift (tmp1 & 31). - add limit_wd, limit, #3 - orr data1, data1, tmp2 - orr data2, data2, tmp2 - lsr limit_wd, limit_wd, #2 - b .Lstart_realigned - -.Lmisaligned4: - sub limit, limit, #1 -1: - // Perhaps we can do better than this. - ldrb data1, [src1], #1 - ldrb data2, [src2], #1 - subs limit, limit, #1 - it cs - cmpcs.n data1, data2 - beq 1b - sub result, data1, data2 - pop {r4-r8, pc} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.asm deleted file mode 100644 index 4c72dcf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.asm +++ /dev/null @@ -1,140 +0,0 @@ -; -; Copyright (c) 2013 - 2016, Linaro Limited -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; * Neither the name of the Linaro nor the -; names of its contributors may be used to endorse or promote products -; derived from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; - -; Parameters and result. -#define src1 r0 -#define src2 r1 -#define limit r2 -#define result r0 - -; Internal variables. -#define data1 r3 -#define data2 r4 -#define limit_wd r5 -#define diff r6 -#define tmp1 r7 -#define tmp2 r12 -#define pos r8 -#define mask r14 - - EXPORT InternalMemCompareMem - THUMB - AREA CompareMem, CODE, READONLY - -InternalMemCompareMem - push {r4-r8, lr} - eor tmp1, src1, src2 - tst tmp1, #3 - bne Lmisaligned4 - ands tmp1, src1, #3 - bne Lmutual_align - add limit_wd, limit, #3 - nop.w - lsr limit_wd, limit_wd, #2 - - ; Start of performance-critical section -- one 32B cache line. -Lloop_aligned - ldr data1, [src1], #4 - ldr data2, [src2], #4 -Lstart_realigned - subs limit_wd, limit_wd, #1 - eor diff, data1, data2 ; Non-zero if differences found. - cbnz diff, L0 - bne Lloop_aligned - ; End of performance-critical section -- one 32B cache line. - - ; Not reached the limit, must have found a diff. -L0 - cbnz limit_wd, Lnot_limit - - // Limit % 4 == 0 => all bytes significant. - ands limit, limit, #3 - beq Lnot_limit - - lsl limit, limit, #3 // Bits -> bytes. - mov mask, #~0 - lsl mask, mask, limit - bic data1, data1, mask - bic data2, data2, mask - - orr diff, diff, mask - -Lnot_limit - rev diff, diff - rev data1, data1 - rev data2, data2 - - ; The MS-non-zero bit of DIFF marks either the first bit - ; that is different, or the end of the significant data. - ; Shifting left now will bring the critical information into the - ; top bits. - clz pos, diff - lsl data1, data1, pos - lsl data2, data2, pos - - ; But we need to zero-extend (char is unsigned) the value and then - ; perform a signed 32-bit subtraction. - lsr data1, data1, #28 - sub result, data1, data2, lsr #28 - pop {r4-r8, pc} - -Lmutual_align - ; Sources are mutually aligned, but are not currently at an - ; alignment boundary. Round down the addresses and then mask off - ; the bytes that precede the start point. - bic src1, src1, #3 - bic src2, src2, #3 - add limit, limit, tmp1 ; Adjust the limit for the extra. - lsl tmp1, tmp1, #2 ; Bytes beyond alignment -> bits. - ldr data1, [src1], #4 - neg tmp1, tmp1 ; Bits to alignment -32. - ldr data2, [src2], #4 - mov tmp2, #~0 - - ; Little-endian. Early bytes are at LSB. - lsr tmp2, tmp2, tmp1 ; Shift (tmp1 & 31). - add limit_wd, limit, #3 - orr data1, data1, tmp2 - orr data2, data2, tmp2 - lsr limit_wd, limit_wd, #2 - b Lstart_realigned - -Lmisaligned4 - sub limit, limit, #1 -L1 - // Perhaps we can do better than this. - ldrb data1, [src1], #1 - ldrb data2, [src2], #1 - subs limit, limit, #1 - it cs - cmpcs data1, data2 - beq L1 - sub result, data1, data2 - pop {r4-r8, pc} - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S deleted file mode 100644 index 85d6811..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S +++ /dev/null @@ -1,176 +0,0 @@ -#------------------------------------------------------------------------------ -# -# CopyMem() worker for ARM -# -# This file started out as C code that did 64 bit moves if the buffer was -# 32-bit aligned, else it does a byte copy. It also does a byte copy for -# any trailing bytes. It was updated to do 32-byte copies using stm/ldm. -# -# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2016, Linaro Ltd. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - - .text - .thumb - .syntax unified - -/** - Copy Length bytes from Source to Destination. Overlap is OK. - - This implementation - - @param Destination Target of copy - @param Source Place to copy from - @param Length Number of bytes to copy - - @return Destination - - -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -**/ - .type ASM_PFX(InternalMemCopyMem), %function -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push {r4-r11, lr} - // Save the input parameters in extra registers (r11 = destination, r14 = source, r12 = length) - mov r11, r0 - mov r10, r0 - mov r12, r2 - mov r14, r1 - - cmp r11, r1 - // If (dest < source) - bcc memcopy_check_optim_default - - // If (source + length < dest) - rsb r3, r1, r11 - cmp r12, r3 - bcc memcopy_check_optim_default - b memcopy_check_optim_overlap - -memcopy_check_optim_default: - // Check if we can use an optimized path ((length >= 32) && destination word-aligned && source word-aligned) for the memcopy (optimized path if r0 == 1) - tst r0, #0xF - it ne - movne.n r0, #0 - bne memcopy_default - tst r1, #0xF - it ne - movne.n r3, #0 - it eq - moveq.n r3, #1 - cmp r2, #31 - it ls - movls.n r0, #0 - bls memcopy_default - and r0, r3, #1 - b memcopy_default - -memcopy_check_optim_overlap: - // r10 = dest_end, r14 = source_end - add r10, r11, r12 - add r14, r12, r1 - - // Are we in the optimized case ((length >= 32) && dest_end word-aligned && source_end word-aligned) - cmp r2, #31 - it ls - movls.n r0, #0 - it hi - movhi.n r0, #1 - tst r10, #0xF - it ne - movne.n r0, #0 - tst r14, #0xF - it ne - movne.n r0, #0 - b memcopy_overlapped - -memcopy_overlapped_non_optim: - // We read 1 byte from the end of the source buffer - sub r3, r14, #1 - sub r12, r12, #1 - ldrb r3, [r3, #0] - sub r2, r10, #1 - cmp r12, #0 - // We write 1 byte at the end of the dest buffer - sub r10, r10, #1 - sub r14, r14, #1 - strb r3, [r2, #0] - bne memcopy_overlapped_non_optim - b memcopy_end - -// r10 = dest_end, r14 = source_end -memcopy_overlapped: - // Are we in the optimized case ? - cmp r0, #0 - beq memcopy_overlapped_non_optim - - // Optimized Overlapped - Read 32 bytes - sub r14, r14, #32 - sub r12, r12, #32 - cmp r12, #31 - ldmia r14, {r2-r9} - - // If length is less than 32 then disable optim - it ls - movls.n r0, #0 - - cmp r12, #0 - - // Optimized Overlapped - Write 32 bytes - sub r10, r10, #32 - stmia r10, {r2-r9} - - // while (length != 0) - bne memcopy_overlapped - b memcopy_end - -memcopy_default_non_optim: - // Byte copy - ldrb r3, [r14], #1 - sub r12, r12, #1 - strb r3, [r10], #1 - -memcopy_default: - cmp r12, #0 - beq memcopy_end - -// r10 = dest, r14 = source -memcopy_default_loop: - cmp r0, #0 - beq memcopy_default_non_optim - - // Optimized memcopy - Read 32 Bytes - sub r12, r12, #32 - cmp r12, #31 - ldmia r14!, {r2-r9} - - // If length is less than 32 then disable optim - it ls - movls.n r0, #0 - - cmp r12, #0 - - // Optimized memcopy - Write 32 Bytes - stmia r10!, {r2-r9} - - // while (length != 0) - bne memcopy_default_loop - -memcopy_end: - mov r0, r11 - pop {r4-r11, pc} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.asm deleted file mode 100644 index f544740..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.asm +++ /dev/null @@ -1,147 +0,0 @@ -;------------------------------------------------------------------------------ -; -; CopyMem() worker for ARM -; -; This file started out as C code that did 64 bit moves if the buffer was -; 32-bit aligned, else it does a byte copy. It also does a byte copy for -; any trailing bytes. It was updated to do 32-byte copies using stm/ldm. -; -; Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-; Copyright (c) 2016, Linaro Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT InternalMemCopyMem - AREA SetMem, CODE, READONLY - THUMB - -InternalMemCopyMem - stmfd sp!, {r4-r11, lr} - // Save the input parameters in extra registers (r11 = destination, r14 = source, r12 = length) - mov r11, r0 - mov r10, r0 - mov r12, r2 - mov r14, r1 - -memcopy_check_overlapped - cmp r11, r1 - // If (dest < source) - bcc memcopy_check_optim_default - - // If (source + length < dest) - rsb r3, r1, r11 - cmp r12, r3 - bcc memcopy_check_optim_default - b memcopy_check_optim_overlap - -memcopy_check_optim_default - // Check if we can use an optimized path ((length >= 32) && destination word-aligned && source word-aligned) for the memcopy (optimized path if r0 == 1) - tst r0, #0xF - movne r0, #0 - bne memcopy_default - tst r1, #0xF - movne r3, #0 - moveq r3, #1 - cmp r2, #31 - movls r0, #0 - andhi r0, r3, #1 - b memcopy_default - -memcopy_check_optim_overlap - // r10 = dest_end, r14 = source_end - add r10, r11, r12 - add r14, r12, r1 - - // Are we in the optimized case ((length >= 32) && dest_end word-aligned && source_end word-aligned) - cmp r2, #31 - movls r0, #0 - movhi r0, #1 - tst r10, #0xF - movne r0, #0 - tst r14, #0xF - movne r0, #0 - b memcopy_overlapped - -memcopy_overlapped_non_optim - // We read 1 byte from the end of the source buffer - sub r3, r14, #1 - sub r12, r12, #1 - ldrb r3, [r3, #0] - sub r2, r10, #1 - cmp r12, #0 - // We write 1 byte at the end of the dest buffer - sub r10, r10, #1 - sub r14, r14, #1 - strb r3, [r2, #0] - bne memcopy_overlapped_non_optim - b memcopy_end - -// r10 = dest_end, r14 = source_end -memcopy_overlapped - // Are we in the optimized case ? - cmp r0, #0 - beq memcopy_overlapped_non_optim - - // Optimized Overlapped - Read 32 bytes - sub r14, r14, #32 - sub r12, r12, #32 - cmp r12, #31 - ldmia r14, {r2-r9} - - // If length is less than 32 then disable optim - movls r0, #0 - - cmp r12, #0 - - // Optimized Overlapped - Write 32 bytes - sub r10, r10, #32 - stmia r10, {r2-r9} - - // while (length != 0) - bne memcopy_overlapped - b memcopy_end - -memcopy_default_non_optim - // Byte copy - ldrb r3, [r14], #1 - sub r12, r12, #1 - strb r3, [r10], #1 - -memcopy_default - cmp r12, #0 - beq memcopy_end - -// r10 = dest, r14 = source -memcopy_default_loop - cmp r0, #0 - beq memcopy_default_non_optim - - // Optimized memcopy - Read 32 Bytes - sub r12, r12, #32 - cmp r12, #31 - ldmia r14!, {r2-r9} - - // If length is less than 32 then disable optim - movls r0, #0 - - cmp r12, #0 - - // Optimized memcopy - Write 32 Bytes - stmia r10!, {r2-r9} - - // while (length != 0) - bne memcopy_default_loop - -memcopy_end - mov r0, r11 - ldmfd sp!, {r4-r11, pc} - - END - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c deleted file mode 100644 index b2942f3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c +++ /dev/null @@ -1,165 +0,0 @@ -/** @file - Implementation of GUID functions for ARM and AARCH64 - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- Copyright (c) 2016, Linaro Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Internal function to compare two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -InternalMemCompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ); - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - ASSERT (DestinationGuid != NULL); - ASSERT (SourceGuid != NULL); - - return InternalMemCopyMem (DestinationGuid, SourceGuid, sizeof (GUID)); -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - ASSERT (Guid1 != NULL); - ASSERT (Guid2 != NULL); - - return InternalMemCompareGuid (Guid1, Guid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (InternalMemCompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - ASSERT (Guid != NULL); - - return InternalMemCompareGuid (Guid, NULL); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S deleted file mode 100644 index 5502f28..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2010-2011, Linaro Limited -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of Linaro Limited nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -// -// Written by Dave Gilbert -// -// This memchr routine is optimised on a Cortex-A9 and should work on -// all ARMv7 processors. It has a fast past for short sizes, and has -// an optimised path for large data sets; the worst case is finding the -// match early in a large data set. -// - - -// 2011-02-07 david.gilbert@linaro.org -// Extracted from local git a5b438d861 -// 2011-07-14 david.gilbert@linaro.org -// Import endianness fix from local git ea786f1b -// 2011-12-07 david.gilbert@linaro.org -// Removed unneeded cbz from align loop - -// this lets us check a flag in a 00/ff byte easily in either endianness -#define CHARTSTMASK(c) 1<<(c*8) - - .text - .thumb - .syntax unified - - .type ASM_PFX(InternalMemScanMem8), %function -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - // r0 = start of memory to scan - // r1 = length - // r2 = character to look for - // returns r0 = pointer to character or NULL if not found - uxtb r2, r2 // Don't think we can trust the caller to actually pass a char - - cmp r1, #16 // If it's short don't bother with anything clever - blt 20f - - tst r0, #7 // If it's already aligned skip the next bit - beq 10f - - // Work up to an aligned point -5: - ldrb r3, [r0],#1 - subs r1, r1, #1 - cmp r3, r2 - beq 50f // If it matches exit found - tst r0, #7 - bne 5b // If not aligned yet then do next byte - -10: - // At this point, we are aligned, we know we have at least 8 bytes to work with - push {r4-r7} - orr r2, r2, r2, lsl #8 // expand the match word across to all bytes - orr r2, r2, r2, lsl #16 - bic r4, r1, #7 // Number of double words to work with - mvns r7, #0 // all F's - movs r3, #0 - -15: - ldmia r0!, {r5,r6} - subs r4, r4, #8 - eor r5, r5, r2 // Get it so that r5,r6 have 00's where the bytes match the target - eor r6, r6, r2 - uadd8 r5, r5, r7 // Parallel add 0xff - sets the GE bits for anything that wasn't 0 - sel r5, r3, r7 // bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION - uadd8 r6, r6, r7 // Parallel add 0xff - sets the GE bits for anything that wasn't 0 - sel r6, r5, r7 // chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION - cbnz r6, 60f - bne 15b // (Flags from the subs above) If not run out of bytes then go around again - - pop {r4-r7} - and r2, r2, #0xff // Get r2 back to a single character from the expansion above - and r1, r1, #7 // Leave the count remaining as the number after the double words have been done - -20: - cbz r1, 40f // 0 length or hit the end already then not found - -21: // Post aligned section, or just a short call - ldrb r3, [r0], #1 - subs r1, r1, #1 - eor r3, r3, r2 // r3 = 0 if match - doesn't break flags from sub - cbz r3, 50f - bne 21b // on r1 flags - -40: - movs r0, #0 // not found - bx lr - -50: - subs r0, r0, #1 // found - bx lr - -60: // We're here because the fast path found a hit - now we have to track down exactly which word it was - // r0 points to the start of the double word after the one that was tested - // r5 has the 00/ff pattern for the first word, r6 has the chained value - subs r0, r0, #3 - cmp r5, #0 - it eq - moveq.n r5, r6 // the end is in the 2nd word - it ne - subne.n r0, r0, #4 // or 2nd byte of 1st word - - // r0 currently points to the 3rd byte of the word containing the hit - tst r5, #CHARTSTMASK(0) // 1st character - bne 61f - adds r0, r0, #1 - tst r5, #CHARTSTMASK(1) // 2nd character - bne 61f - adds r0, r0 ,#1 - tst r5, #(3 << 15) // 2nd & 3rd character - // If not the 3rd must be the last one - it eq - addeq.n r0, r0, #1 - -61: - pop {r4-r7} - subs r0, r0, #1 - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.asm deleted file mode 100644 index bb489f1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.asm +++ /dev/null @@ -1,147 +0,0 @@ -; Copyright (c) 2010-2011, Linaro Limited -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; * Neither the name of Linaro Limited nor the names of its -; contributors may be used to endorse or promote products derived -; from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; - -; -; Written by Dave Gilbert -; -; This memchr routine is optimised on a Cortex-A9 and should work on -; all ARMv7 processors. It has a fast past for short sizes, and has -; an optimised path for large data sets; the worst case is finding the -; match early in a large data set. -; - - -; 2011-02-07 david.gilbert@linaro.org -; Extracted from local git a5b438d861 -; 2011-07-14 david.gilbert@linaro.org -; Import endianness fix from local git ea786f1b -; 2011-12-07 david.gilbert@linaro.org -; Removed unneeded cbz from align loop - -; this lets us check a flag in a 00/ff byte easily in either endianness -#define CHARTSTMASK(c) 1<<(c*8) - - EXPORT InternalMemScanMem8 - AREA ScanMem, CODE, READONLY - THUMB - -InternalMemScanMem8 - ; r0 = start of memory to scan - ; r1 = length - ; r2 = character to look for - ; returns r0 = pointer to character or NULL if not found - uxtb r2, r2 ; Don't think we can trust the caller to actually pass a char - - cmp r1, #16 ; If it's short don't bother with anything clever - blt L20 - - tst r0, #7 ; If it's already aligned skip the next bit - beq L10 - - ; Work up to an aligned point -L5 - ldrb r3, [r0],#1 - subs r1, r1, #1 - cmp r3, r2 - beq L50 ; If it matches exit found - tst r0, #7 - bne L5 ; If not aligned yet then do next byte - -L10 - ; At this point, we are aligned, we know we have at least 8 bytes to work with - push {r4-r7} - orr r2, r2, r2, lsl #8 ; expand the match word across to all bytes - orr r2, r2, r2, lsl #16 - bic r4, r1, #7 ; Number of double words to work with - mvns r7, #0 ; all F's - movs r3, #0 - -L15 - ldmia r0!, {r5,r6} - subs r4, r4, #8 - eor r5, r5, r2 ; Get it so that r5,r6 have 00's where the bytes match the target - eor r6, r6, r2 - uadd8 r5, r5, r7 ; Parallel add 0xff - sets the GE bits for anything that wasn't 0 - sel r5, r3, r7 ; bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION - uadd8 r6, r6, r7 ; Parallel add 0xff - sets the GE bits for anything that wasn't 0 - sel r6, r5, r7 ; chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION - cbnz r6, L60 - bne L15 ; (Flags from the subs above) If not run out of bytes then go around again - - pop {r4-r7} - and r2, r2, #0xff ; Get r2 back to a single character from the expansion above - and r1, r1, #7 ; Leave the count remaining as the number after the double words have been done - -L20 - cbz r1, L40 ; 0 length or hit the end already then not found - -L21 ; Post aligned section, or just a short call - ldrb r3, [r0], #1 - subs r1, r1, #1 - eor r3, r3, r2 ; r3 = 0 if match - doesn't break flags from sub - cbz r3, L50 - bne L21 ; on r1 flags - -L40 - movs r0, #0 ; not found - bx lr - -L50 - subs r0, r0, #1 ; found - bx lr - -L60 ; We're here because the fast path found a hit - now we have to track down exactly which word it was - ; r0 points to the start of the double word after the one that was tested - ; r5 has the 00/ff pattern for the first word, r6 has the chained value - cmp r5, #0 - itte eq - moveq r5, r6 ; the end is in the 2nd word - subeq r0, r0, #3 ; Points to 2nd byte of 2nd word - subne r0, r0, #7 ; or 2nd byte of 1st word - - ; r0 currently points to the 3rd byte of the word containing the hit - tst r5, #CHARTSTMASK(0) ; 1st character - bne L61 - adds r0, r0, #1 - tst r5, #CHARTSTMASK(1) ; 2nd character - ittt eq - addeq r0, r0 ,#1 - tsteq r5, #(3 << 15) ; 2nd & 3rd character - ; If not the 3rd must be the last one - addeq r0, r0, #1 - -L61 - pop {r4-r7} - subs r0, r0, #1 - bx lr - - END - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c deleted file mode 100644 index e48db72..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c +++ /dev/null @@ -1,142 +0,0 @@ -/** @file - Architecture Independent Base Memory Library Implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "../MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - CONST UINT16 *Pointer; - - Pointer = (CONST UINT16*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - CONST UINT32 *Pointer; - - Pointer = (CONST UINT32*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - CONST UINT64 *Pointer; - - Pointer = (CONST UINT64*)Buffer; - do { - if (*Pointer == Value) { - return Pointer; - } - ++Pointer; - } while (--Length != 0); - return NULL; -} - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - CONST UINT8 *BufferData; - UINTN Index; - - BufferData = Buffer; - for (Index = 0; Index < Length; Index++) { - if (BufferData[Index] != 0) { - return FALSE; - } - } - return TRUE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S deleted file mode 100644 index 35481b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S +++ /dev/null @@ -1,94 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2016, Linaro Ltd. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - - .text - .thumb - .syntax unified - .align 5 - .type ASM_PFX(InternalMemSetMem16), %function -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - uxth r2, r2 - lsl r1, r1, #1 - orr r2, r2, r2, lsl #16 - b 0f - - .type ASM_PFX(InternalMemSetMem32), %function -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - lsl r1, r1, #2 - b 0f - - .type ASM_PFX(InternalMemSetMem64), %function -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - lsl r1, r1, #3 - b 1f - - .align 5 - .type ASM_PFX(InternalMemSetMem), %function -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - uxtb r2, r2 - orr r2, r2, r2, lsl #8 - orr r2, r2, r2, lsl #16 - b 0f - - .type ASM_PFX(InternalMemZeroMem), %function -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - movs r2, #0 -0: mov r3, r2 - -1: push {r4, lr} - cmp r1, #16 // fewer than 16 bytes of input? - add r1, r1, r0 // r1 := dst + length - add lr, r0, #16 - blt 2f - bic lr, lr, #15 // align output pointer - - str r2, [r0] // potentially unaligned store of 4 bytes - str r3, [r0, #4] // potentially unaligned store of 4 bytes - str r2, [r0, #8] // potentially unaligned store of 4 bytes - str r3, [r0, #12] // potentially unaligned store of 4 bytes - beq 1f - -0: add lr, lr, #16 // advance the output pointer by 16 bytes - subs r4, r1, lr // past the output? - blt 3f // break out of the loop - strd r2, r3, [lr, #-16] // aligned store of 16 bytes - strd r2, r3, [lr, #-8] - bne 0b // goto beginning of loop -1: pop {r4, pc} - -2: subs r4, r1, lr -3: adds r4, r4, #16 - subs r1, r1, #8 - cmp r4, #4 // between 4 and 15 bytes? - blt 4f - cmp r4, #8 // between 8 and 15 bytes? - sub r4, lr, #16 - str r2, [r4] // overlapping store of 4 + (4 + 4) + 4 bytes - it gt - strgt.n r3, [r4, #4] - it gt - strgt.n r2, [r1] - str r3, [r1, #4] - pop {r4, pc} - -4: cmp r4, #2 // 2 or 3 bytes? - strb r2, [lr, #-16] // store 1 byte - it ge - strhge.n r2, [r1, #6] // store 2 bytes - pop {r4, pc} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.asm deleted file mode 100644 index 000c2a2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.asm +++ /dev/null @@ -1,96 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Linaro Ltd. All rights reserved.
-; -; This program and the accompanying materials are licensed and made available -; under the terms and conditions of the BSD License which accompanies this -; distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -;------------------------------------------------------------------------------ - - EXPORT InternalMemZeroMem - EXPORT InternalMemSetMem - EXPORT InternalMemSetMem16 - EXPORT InternalMemSetMem32 - EXPORT InternalMemSetMem64 - - AREA SetMem, CODE, READONLY, CODEALIGN, ALIGN=5 - THUMB - -InternalMemSetMem16 - uxth r2, r2 - lsl r1, r1, #1 - orr r2, r2, r2, lsl #16 - b B0 - -InternalMemSetMem32 - lsl r1, r1, #2 - b B0 - -InternalMemSetMem64 - lsl r1, r1, #3 - b B1 - - ALIGN 32 -InternalMemSetMem - uxtb r2, r2 - orr r2, r2, r2, lsl #8 - orr r2, r2, r2, lsl #16 - b B0 - -InternalMemZeroMem - movs r2, #0 -B0 - mov r3, r2 - -B1 - push {r4, lr} - cmp r1, #16 ; fewer than 16 bytes of input? - add r1, r1, r0 ; r1 := dst + length - add lr, r0, #16 - blt L2 - bic lr, lr, #15 ; align output pointer - - str r2, [r0] ; potentially unaligned store of 4 bytes - str r3, [r0, #4] ; potentially unaligned store of 4 bytes - str r2, [r0, #8] ; potentially unaligned store of 4 bytes - str r3, [r0, #12] ; potentially unaligned store of 4 bytes - beq L1 - -L0 - add lr, lr, #16 ; advance the output pointer by 16 bytes - subs r4, r1, lr ; past the output? - blt L3 ; break out of the loop - strd r2, r3, [lr, #-16] ; aligned store of 16 bytes - strd r2, r3, [lr, #-8] - bne L0 ; goto beginning of loop -L1 - pop {r4, pc} - -L2 - subs r4, r1, lr -L3 - adds r4, r4, #16 - subs r1, r1, #8 - cmp r4, #4 ; between 4 and 15 bytes? - blt L4 - cmp r4, #8 ; between 8 and 15 bytes? - str r2, [lr, #-16] ; overlapping store of 4 + (4 + 4) + 4 bytes - itt gt - strgt r3, [lr, #-12] - strgt r2, [r1] - str r3, [r1, #4] - pop {r4, pc} - -L4 - cmp r4, #2 ; 2 or 3 bytes? - strb r2, [lr, #-16] ; store 1 byte - it ge - strhge r2, [r1, #6] ; store 2 bytes - pop {r4, pc} - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf deleted file mode 100644 index baf313a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf +++ /dev/null @@ -1,152 +0,0 @@ -## @file -# Instance of Base Memory Library optimized for use in DXE phase. -# -# Base Memory Library that is optimized for use in DXE phase. -# Uses REP, MMX, XMM registers as required for best performance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLibOptDxe - MODULE_UNI_FILE = BaseMemoryLibOptDxe.uni - FILE_GUID = 02BD55C2-AB1D-4b75-B0FD-9A63AE09B31D - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - MemLibInternals.h - -[Sources.Ia32] - Ia32/ScanMem64.nasm - Ia32/ScanMem64.S - Ia32/ScanMem32.nasm - Ia32/ScanMem32.S - Ia32/ScanMem16.nasm - Ia32/ScanMem16.S - Ia32/ScanMem8.nasm - Ia32/ScanMem8.S - Ia32/CompareMem.nasm - Ia32/CompareMem.S - Ia32/ZeroMem.nasm - Ia32/ZeroMem.S - Ia32/SetMem64.nasm - Ia32/SetMem64.S - Ia32/SetMem32.nasm - Ia32/SetMem32.S - Ia32/SetMem16.nasm - Ia32/SetMem16.S - Ia32/SetMem.nasm - Ia32/SetMem.S - Ia32/CopyMem.nasm - Ia32/CopyMem.S - Ia32/ScanMem64.nasm - Ia32/ScanMem32.nasm - Ia32/ScanMem16.nasm - Ia32/ScanMem8.nasm - Ia32/CompareMem.nasm - Ia32/ZeroMem.nasm - Ia32/SetMem64.nasm - Ia32/SetMem32.nasm - Ia32/SetMem16.nasm - Ia32/SetMem.nasm - Ia32/CopyMem.nasm - Ia32/IsZeroBuffer.nasm - MemLibGuid.c - -[Sources.X64] - X64/ScanMem64.nasm - X64/ScanMem64.S - X64/ScanMem32.nasm - X64/ScanMem32.S - X64/ScanMem16.nasm - X64/ScanMem16.S - X64/ScanMem8.nasm - X64/ScanMem8.S - X64/CompareMem.nasm - X64/CompareMem.S - X64/ZeroMem.nasm - X64/ZeroMem.S - X64/SetMem64.nasm - X64/SetMem64.S - X64/SetMem32.nasm - X64/SetMem32.S - X64/SetMem16.nasm - X64/SetMem16.S - X64/SetMem.nasm - X64/SetMem.S - X64/CopyMem.nasm - X64/CopyMem.S - X64/IsZeroBuffer.nasm - MemLibGuid.c - -[Defines.ARM, Defines.AARCH64] - # - # The ARM implementations of this library may perform unaligned accesses, and - # may use DC ZVA instructions that are only allowed when the MMU and D-cache - # are on. Since SEC, PEI_CORE and PEIM modules may execute with the MMU off, - # omit them from the supported module types list for this library. - # - LIBRARY_CLASS = BaseMemoryLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER UEFI_APPLICATION - -[Sources.ARM] - Arm/ScanMem.S |GCC - Arm/SetMem.S |GCC - Arm/CopyMem.S |GCC - Arm/CompareMem.S |GCC - Arm/CompareGuid.S |GCC - - Arm/ScanMem.asm |RVCT - Arm/SetMem.asm |RVCT - Arm/CopyMem.asm |RVCT - Arm/CompareMem.asm |RVCT - Arm/CompareGuid.asm |RVCT - -[Sources.AARCH64] - AArch64/ScanMem.S - AArch64/SetMem.S - AArch64/CopyMem.S - AArch64/CompareMem.S - AArch64/CompareGuid.S - -[Sources.ARM, Sources.AARCH64] - Arm/ScanMemGeneric.c - Arm/MemLibGuid.c - -[Sources] - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni deleted file mode 100644 index bb0cd56..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library optimized for use in DXE phase. -// -// Base Memory Library that is optimized for use in DXE phase. -// Uses REP, MMX, XMM registers as required for best performance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Base Memory Library for DXE" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library that is optimized for use in DXE phase. Uses REP, MMX, XMM registers as required for best performance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c deleted file mode 100644 index 161171b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S deleted file mode 100644 index a430453..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.nasm deleted file mode 100644 index e8d1abd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.nasm +++ /dev/null @@ -1,57 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push esi - push edi - mov esi, [esp + 12] - mov edi, [esp + 16] - mov ecx, [esp + 20] - repe cmpsb - movzx eax, byte [esi - 1] - movzx edx, byte [edi - 1] - sub eax, edx - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S deleted file mode 100644 index dbd052b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S +++ /dev/null @@ -1,85 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi,%edx,), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L1 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx # edx <- remaining bytes to copy - rep - movsb -L1: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to copy - jz L_CopyBytes - addl $-16, %esp - movdqu %xmm0, (%esp) -L2: - movdqu (%esi), %xmm0 - movntdq %xmm0, (%edi) - addl $16, %esi - addl $16, %edi - loop L2 - mfence - movdqu (%esp),%xmm0 - addl $16, %esp # stack cleanup - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- Last byte in Source - leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.nasm deleted file mode 100644 index 6913874..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.nasm +++ /dev/null @@ -1,84 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push esi - push edi - mov esi, [esp + 16] ; esi <- Source - mov edi, [esp + 12] ; edi <- Destination - mov edx, [esp + 20] ; edx <- Count - lea eax, [esi + edx - 1] ; eax <- End of Source - cmp esi, edi - jae .0 - cmp eax, edi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -.0: - xor ecx, ecx - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - jz .1 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx ; edx <- remaining bytes to copy - rep movsb -.1: - mov ecx, edx - and edx, 15 - shr ecx, 4 ; ecx <- # of DQwords to copy - jz @CopyBytes - add esp, -16 - movdqu [esp], xmm0 ; save xmm0 -.2: - movdqu xmm0, [esi] ; esi may not be 16-bytes aligned - movntdq [edi], xmm0 ; edi should be 16-bytes aligned - add esi, 16 - add edi, 16 - loop .2 - mfence - movdqu xmm0, [esp] ; restore xmm0 - add esp, 16 ; stack cleanup - jmp @CopyBytes -@CopyBackward: - mov esi, eax ; esi <- Last byte in Source - lea edi, [edi + edx - 1] ; edi <- Last byte in Destination - std -@CopyBytes: - mov ecx, edx - rep movsb - cld - mov eax, [esp + 12] ; eax <- Destination as return value - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/IsZeroBuffer.nasm deleted file mode 100644 index cfd41a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push edi - mov edi, [esp + 8] ; edi <- Buffer - mov ecx, [esp + 12] ; ecx <- Length - mov edx, ecx ; edx <- ecx - shr ecx, 2 ; ecx <- number of dwords - and edx, 3 ; edx <- number of trailing bytes - xor eax, eax ; eax <- 0, also set ZF - repe scasd - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov ecx, edx - repe scasb - jnz @ReturnFalse - pop edi - mov eax, 1 ; return TRUE - ret -@ReturnFalse: - pop edi - xor eax, eax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S deleted file mode 100644 index c485543..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.nasm deleted file mode 100644 index 78d9f30..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasw - lea eax, [edi - 2] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S deleted file mode 100644 index 016ebd2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.nasm deleted file mode 100644 index bbacf38..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasd - lea eax, [edi - 4] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S deleted file mode 100644 index 6e42856..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S +++ /dev/null @@ -1,61 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.nasm deleted file mode 100644 index e994d4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.nasm +++ /dev/null @@ -1,63 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - cmp eax, [edi] - lea edi, [edi + 8] - loopne .0 - jne .1 - cmp edx, [edi - 4] - jecxz .1 - jne .0 -.1: - lea eax, [edi - 8] - cmovne eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S deleted file mode 100644 index 02bb27f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.nasm deleted file mode 100644 index d13c9c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov al, [esp + 16] - repne scasb - lea eax, [edi - 1] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S deleted file mode 100644 index ee0b659..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movl 12(%esp),%ecx - movb 16(%esp),%al - movb %al, %ah - shrd $16, %eax, %edx - shld $16, %edx, %eax - movl %ecx, %edx - movl 8(%esp),%edi - shr $2, %ecx - rep stosl - movl %edx, %ecx - andl $3, %ecx - rep stosb - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.nasm deleted file mode 100644 index 3a75363..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.nasm +++ /dev/null @@ -1,52 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push edi - mov ecx, [esp + 12] - mov al, [esp + 16] - mov ah, al - shrd edx, eax, 16 - shld eax, edx, 16 - mov edx, ecx - mov edi, [esp + 8] - shr ecx, 2 - rep stosd - mov ecx, edx - and ecx, 3 - rep stosb - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S deleted file mode 100644 index 8989bdd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.nasm deleted file mode 100644 index cfa4906..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosw - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S deleted file mode 100644 index b2c9a85..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.nasm deleted file mode 100644 index 78e09b3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosd - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S deleted file mode 100644 index f25dfe1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.nasm deleted file mode 100644 index d0afacb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - mov [edi + ecx*8 - 8], eax - mov [edi + ecx*8 - 4], edx - loop .0 - mov eax, edi - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S deleted file mode 100644 index 70cede6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.nasm deleted file mode 100644 index 31efb6a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push edi - xor eax, eax - mov edi, [esp + 8] - mov ecx, [esp + 12] - mov edx, ecx - shr ecx, 2 - and edx, 3 - push edi - rep stosd - mov ecx, edx - rep stosb - pop eax - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h deleted file mode 100644 index be7952e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer The target of the copy request. - @param SourceBuffer The place to copy from. - @param Length The number of bytes to copy. - - @return Destination. - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c deleted file mode 100644 index 613e667..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c +++ /dev/null @@ -1,100 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value -The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c deleted file mode 100644 index 7758e1f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S deleted file mode 100644 index eef1ccb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S +++ /dev/null @@ -1,59 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - pushq %rsi - pushq %rdi - movq %rcx, %rsi - movq %rdx, %rdi - movq %r8, %rcx - repe cmpsb - movzbq -1(%rsi) , %rax - movzbq -1(%rdi) , %rdx - sub %dl, %al - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.nasm deleted file mode 100644 index cb0d886..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.nasm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte [rsi - 1] - movzx rdx, byte [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S deleted file mode 100644 index 4d96623..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S +++ /dev/null @@ -1,82 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - pushq %rsi - pushq %rdi - movq %rdx, %rsi # rsi <- Source - movq %rcx, %rdi # rdi <- Destination - leaq -1(%rsi,%r8,), %r9 # r9 <- Last byte of Source - cmpq %rdi, %rsi - movq %rdi, %rax # rax <- Destination as return value - jae L0 # Copy forward if Source > Destination - cmpq %rdi, %r9 # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorq %rcx, %rcx - subq %rdi, %rcx # rcx <- -rdi - andq $15, %rcx # rcx + rsi should be 16 bytes aligned - jz L1 # skip if rcx == 0 - cmpq %r8, %rcx - cmova %r8, %rcx - subq %rcx, %r8 - rep movsb -L1: - movq %r8, %rcx - andq $15, %r8 - shrq $4, %rcx # rcx <- # of DQwords to copy - jz L_CopyBytes - movdqu %xmm0, 0x18(%rsp) # save xmm0 on stack -L2: - movdqu (%rsi), %xmm0 # rsi may not be 16-byte aligned - movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned - addq $16, %rsi - addq $16, %rdi - loop L2 - mfence - movdqa 0x18(%rsp), %xmm0 # restore xmm0 - jmp L_CopyBytes # copy remaining bytes -L_CopyBackward: - movq %r9, %rsi # rsi <- Last byte of Source - leaq -1(%rdi, %r8,), %rdi # rdi <- Last byte of Destination - std -L_CopyBytes: - movq %r8, %rcx - rep movsb - cld - popq %rdi - popq %rsi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.nasm deleted file mode 100644 index 9fe45d4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.nasm +++ /dev/null @@ -1,83 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- Last byte of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae .0 ; Copy forward if Source > Destination - cmp r9, rdi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -.0: - xor rcx, rcx - sub rcx, rdi ; rcx <- -rdi - and rcx, 15 ; rcx + rsi should be 16 bytes aligned - jz .1 ; skip if rcx == 0 - cmp rcx, r8 - cmova rcx, r8 - sub r8, rcx - rep movsb -.1: - mov rcx, r8 - and r8, 15 - shr rcx, 4 ; rcx <- # of DQwords to copy - jz @CopyBytes - movdqa [rsp + 0x18], xmm0 ; save xmm0 on stack -.2: - movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned - movntdq [rdi], xmm0 ; rdi should be 16-byte aligned - add rsi, 16 - add rdi, 16 - loop .2 - mfence - movdqa xmm0, [rsp + 0x18] ; restore xmm0 - jmp @CopyBytes ; copy remaining bytes -@CopyBackward: - mov rsi, r9 ; rsi <- Last byte of Source - lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination - std -@CopyBytes: - mov rcx, r8 - rep movsb - cld - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/IsZeroBuffer.nasm deleted file mode 100644 index 3b855a7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push rdi - mov rdi, rcx ; rdi <- Buffer - mov rcx, rdx ; rcx <- Length - shr rcx, 3 ; rcx <- number of qwords - and rdx, 7 ; rdx <- number of trailing bytes - xor rax, rax ; rax <- 0, also set ZF - repe scasq - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov rcx, rdx - repe scasb - jnz @ReturnFalse - pop rdi - mov rax, 1 ; return TRUE - ret -@ReturnFalse: - pop rdi - xor rax, rax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S deleted file mode 100644 index ea82f55..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasw - leaq -2(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.nasm deleted file mode 100644 index 9f0de63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S deleted file mode 100644 index 7ff1c08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasl - leaq -4(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.nasm deleted file mode 100644 index 5c9ae5d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S deleted file mode 100644 index 1948c16..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S +++ /dev/null @@ -1,55 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - movq %rdx, %rcx - repne scasq - leaq -8(%rdi), %rax - cmovnz %rcx, %rax - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.nasm deleted file mode 100644 index b98c6de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S deleted file mode 100644 index 688884f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasb - leaq -1(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.nasm deleted file mode 100644 index 8499795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx ; set rax to 0 if not found - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S deleted file mode 100644 index 7219c5c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S +++ /dev/null @@ -1,57 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - pushq %rdi - pushq %rbx - pushq %rcx # push Buffer - movq %r8, %rax # rax = Value - andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0 - movb %al, %ah # ah = al - movw %ax, %bx # bx = ax - shlq $0x10, %rax # rax = ax << 16 - movw %bx, %ax # ax = bx - movq %rax, %rbx # ebx = eax - shlq $0x20, %rax # rax = rax << 32 - orq %rbx, %rax # eax = ebx - movq %rcx, %rdi # rdi = Buffer - movq %rdx, %rcx # rcx = Count - shrq $3, %rcx # rcx = rcx / 8 - cld - rep stosq - movq %rdx, %rcx # rcx = rdx - andq $7, %rcx # rcx = rcx & 7 - rep stosb - popq %rax # rax = Buffer - popq %rbx - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.nasm deleted file mode 100644 index 48d69ab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.nasm +++ /dev/null @@ -1,62 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - push rbx - push rcx ; push Buffer - mov rax, r8 ; rax = Value - and rax, 0xff ; rax = lower 8 bits of r8, upper 56 bits are 0 - mov ah, al ; ah = al - mov bx, ax ; bx = ax - shl rax, 0x10 ; rax = ax << 16 - mov ax, bx ; ax = bx - mov rbx, rax ; ebx = eax - shl rax, 0x20 ; rax = rax << 32 - or rax, rbx ; eax = ebx - mov rdi, rcx ; rdi = Buffer - mov rcx, rdx ; rcx = Count - shr rcx, 3 ; rcx = rcx / 8 - cld - rep stosq - mov rcx, rdx ; rcx = rdx - and rcx, 7 ; rcx = rcx & 7 - rep stosb - pop rax ; rax = Buffer - pop rbx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S deleted file mode 100644 index d6f570f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchg %rdx, %rcx - rep stosw - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.nasm deleted file mode 100644 index d9a3d35..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - pop rax - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S deleted file mode 100644 index 7dba067..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosl - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.nasm deleted file mode 100644 index 6f97704..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - pop rax - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S deleted file mode 100644 index a94f038..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchg %rdx, %rcx - rep stosq - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.nasm deleted file mode 100644 index 9b0b8ac..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - push rcx - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - pop rax - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S deleted file mode 100644 index 38b8678..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S +++ /dev/null @@ -1,51 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - pushq %rdi - pushq %rcx - xorq %rax, %rax - movq %rcx, %rdi - movq %rdx, %rcx - shrq $3, %rcx - andq $7, %rdx - cld - rep stosq - movq %rdx, %rcx - rep stosb - popq %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.nasm deleted file mode 100644 index 12c1da9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.nasm +++ /dev/null @@ -1,50 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - push rcx ; push Buffer - xor rax, rax ; rax = 0 - mov rdi, rcx ; rdi = Buffer - mov rcx, rdx ; rcx = Count - shr rcx, 3 ; rcx = rcx / 8 - and rdx, 7 ; rdx = rdx & 7 - cld - rep stosq - mov rcx, rdx ; rcx = rdx - rep stosb - pop rax ; rax = Buffer - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf deleted file mode 100644 index ef3b909..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf +++ /dev/null @@ -1,130 +0,0 @@ -## @file -# Instance of Base Memory Library optimized for use in PEI phase. -# -# Base Memory Library that is optimized for use in PEI phase. -# Uses REP, MMX, XMM registers as required for best performance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLibOptPei - MODULE_UNI_FILE = BaseMemoryLibOptPei.uni - FILE_GUID = D6F43B1B-0F21-462b-B8B7-A033C3EB4261 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemLibInternals.h - -[Sources.Ia32] - Ia32/ScanMem64.nasm - Ia32/ScanMem64.S - Ia32/ScanMem32.nasm - Ia32/ScanMem32.S - Ia32/ScanMem16.nasm - Ia32/ScanMem16.S - Ia32/ScanMem8.nasm - Ia32/ScanMem8.S - Ia32/CompareMem.nasm - Ia32/CompareMem.S - Ia32/ZeroMem.nasm - Ia32/ZeroMem.S - Ia32/SetMem64.nasm - Ia32/SetMem64.S - Ia32/SetMem32.nasm - Ia32/SetMem32.S - Ia32/SetMem16.nasm - Ia32/SetMem16.S - Ia32/SetMem.nasm - Ia32/SetMem.S - Ia32/CopyMem.nasm - Ia32/CopyMem.S - Ia32/ScanMem64.nasm - Ia32/ScanMem32.nasm - Ia32/ScanMem16.nasm - Ia32/ScanMem8.nasm - Ia32/CompareMem.nasm - Ia32/ZeroMem.nasm - Ia32/SetMem64.nasm - Ia32/SetMem32.nasm - Ia32/SetMem16.nasm - Ia32/SetMem.nasm - Ia32/CopyMem.nasm - Ia32/IsZeroBuffer.nasm - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGuid.c - -[Sources.X64] - X64/ScanMem64.nasm - X64/ScanMem64.S - X64/ScanMem32.nasm - X64/ScanMem32.S - X64/ScanMem16.nasm - X64/ScanMem16.S - X64/ScanMem8.nasm - X64/ScanMem8.S - X64/CompareMem.nasm - X64/CompareMem.S - X64/ZeroMem.nasm - X64/ZeroMem.S - X64/SetMem64.nasm - X64/SetMem64.S - X64/SetMem32.nasm - X64/SetMem32.S - X64/SetMem16.nasm - X64/SetMem16.S - X64/SetMem.nasm - X64/SetMem.S - X64/CopyMem.nasm - X64/CopyMem.S - X64/IsZeroBuffer.nasm - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGuid.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.uni deleted file mode 100644 index dda230e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library optimized for use in PEI phase. -// -// Base Memory Library that is optimized for use in PEI phase. -// Uses REP, MMX, XMM registers as required for best performance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library optimized for use in the PEI phase" - -#string STR_MODULE_DESCRIPTION #language en-US "This is the Base Memory Library that is optimized for use in the PEI phase. It uses REP, MMX, XMM registers, as required for best performance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c deleted file mode 100644 index 161171b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S deleted file mode 100644 index a430453..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.nasm deleted file mode 100644 index e8d1abd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.nasm +++ /dev/null @@ -1,57 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push esi - push edi - mov esi, [esp + 12] - mov edi, [esp + 16] - mov ecx, [esp + 20] - repe cmpsb - movzx eax, byte [esi - 1] - movzx edx, byte [edi - 1] - sub eax, edx - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S deleted file mode 100644 index 1200675..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S +++ /dev/null @@ -1,62 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - cmpl %esi, %edi - je L_CopyDone - cmpl $0, %edx - je L_CopyDone - leal -1(%esi, %edx), %eax # eax <- End of Source - cmpl %edi, %esi - jae L_CopyBytes - cmpl %edi, %eax - jb L_CopyBytes # Copy backward if overlapped - movl %eax, %esi # esi <- End of Source - leal -1(%edi, %edx), %edi # edi <- End of Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb # Copy bytes backward - cld -L_CopyDone: - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.nasm deleted file mode 100644 index d7e62aa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.nasm +++ /dev/null @@ -1,62 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.Asm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push esi - push edi - mov esi, [esp+16] ; esi <- Source - mov edi, [esp+12] ; edi <- Destination - mov edx, [esp+20] ; edx <- Count - cmp esi, edi - je @CopyDone - cmp edx, 0 - je @CopyDone - lea eax, [esi + edx - 1] ; eax <- End of Source - cmp esi, edi - jae @CopyBytes - cmp eax, edi - jb @CopyBytes ; Copy backward if overlapped - mov esi, eax ; esi <- End of Source - lea edi, [edi + edx - 1] ; edi <- End of Destination - std -@CopyBytes: - mov ecx, edx - rep movsb ; Copy bytes backward - cld -@CopyDone: - mov eax, [esp + 12] ; eax <- Destination as return value - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/IsZeroBuffer.nasm deleted file mode 100644 index cfd41a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push edi - mov edi, [esp + 8] ; edi <- Buffer - mov ecx, [esp + 12] ; ecx <- Length - mov edx, ecx ; edx <- ecx - shr ecx, 2 ; ecx <- number of dwords - and edx, 3 ; edx <- number of trailing bytes - xor eax, eax ; eax <- 0, also set ZF - repe scasd - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov ecx, edx - repe scasb - jnz @ReturnFalse - pop edi - mov eax, 1 ; return TRUE - ret -@ReturnFalse: - pop edi - xor eax, eax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S deleted file mode 100644 index 9e383c2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.nasm deleted file mode 100644 index 78d9f30..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasw - lea eax, [edi - 2] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S deleted file mode 100644 index a9b4975..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.nasm deleted file mode 100644 index bbacf38..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasd - lea eax, [edi - 4] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S deleted file mode 100644 index 6e42856..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S +++ /dev/null @@ -1,61 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.nasm deleted file mode 100644 index e994d4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.nasm +++ /dev/null @@ -1,63 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - cmp eax, [edi] - lea edi, [edi + 8] - loopne .0 - jne .1 - cmp edx, [edi - 4] - jecxz .1 - jne .0 -.1: - lea eax, [edi - 8] - cmovne eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S deleted file mode 100644 index 02bb27f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.nasm deleted file mode 100644 index d13c9c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov al, [esp + 16] - repne scasb - lea eax, [edi - 1] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S deleted file mode 100644 index ee0b659..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movl 12(%esp),%ecx - movb 16(%esp),%al - movb %al, %ah - shrd $16, %eax, %edx - shld $16, %edx, %eax - movl %ecx, %edx - movl 8(%esp),%edi - shr $2, %ecx - rep stosl - movl %edx, %ecx - andl $3, %ecx - rep stosb - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.nasm deleted file mode 100644 index 3a75363..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.nasm +++ /dev/null @@ -1,52 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push edi - mov ecx, [esp + 12] - mov al, [esp + 16] - mov ah, al - shrd edx, eax, 16 - shld eax, edx, 16 - mov edx, ecx - mov edi, [esp + 8] - shr ecx, 2 - rep stosd - mov ecx, edx - and ecx, 3 - rep stosb - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S deleted file mode 100644 index 8989bdd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.nasm deleted file mode 100644 index cfa4906..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosw - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S deleted file mode 100644 index b2c9a85..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.nasm deleted file mode 100644 index 78e09b3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosd - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S deleted file mode 100644 index f25dfe1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.nasm deleted file mode 100644 index d0afacb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - mov [edi + ecx*8 - 8], eax - mov [edi + ecx*8 - 4], edx - loop .0 - mov eax, edi - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S deleted file mode 100644 index 70cede6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.nasm deleted file mode 100644 index 31efb6a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push edi - xor eax, eax - mov edi, [esp + 8] - mov ecx, [esp + 12] - mov edx, ecx - shr ecx, 2 - and edx, 3 - push edi - rep stosd - mov ecx, edx - rep stosb - pop eax - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h deleted file mode 100644 index 0c5bbe0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer The target of the copy request. - @param SourceBuffer The place to copy from. - @param Length The number of bytes to copy. - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c deleted file mode 100644 index c51b846..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S deleted file mode 100644 index 503127c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S +++ /dev/null @@ -1,59 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - pushq %rsi - pushq %rdi - movq %rcx, %rsi - movq %rdx, %rdi - movq %r8, %rcx - repe cmpsb - movzbq -1(%rsi) , %rax - movzbq -1(%rdi) , %rdx - subq %rdx, %rax - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.nasm deleted file mode 100644 index cb0d886..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.nasm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte [rsi - 1] - movzx rdx, byte [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S deleted file mode 100644 index e3a7aef..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S +++ /dev/null @@ -1,66 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - pushq %rsi - pushq %rdi - movq %rdx, %rsi # rsi <- Source - movq %rcx, %rdi # rdi <- Destination - leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source - cmpq %rdi, %rsi - movq %rdi, %rax # rax <- Destination as return value - jae _InternalMemCopyMem_al_0000 - cmpq %rdi, %r9 - jae _atSym_CopyBackward # Copy backward if overlapped -_InternalMemCopyMem_al_0000: - movq %r8, %rcx - andq $7, %r8 - shrq $3, %rcx - rep movsq # Copy as many Qwords as possible - jmp _atSym_CopyBytes -_atSym_CopyBackward: - movq %r9, %rsi # rsi <- End of Source - leaq -1(%rdi, %r8), %rdi # rdi <- End of Destination - std # set direction flag -_atSym_CopyBytes: - movq %r8, %rcx - rep movsb # Copy bytes backward - cld - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.nasm deleted file mode 100644 index b304123..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.Asm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- End of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae .0 - cmp r9, rdi - jae @CopyBackward ; Copy backward if overlapped -.0: - mov rcx, r8 - and r8, 7 - shr rcx, 3 - rep movsq ; Copy as many Qwords as possible - jmp @CopyBytes -@CopyBackward: - mov rsi, r9 ; rsi <- End of Source - lea rdi, [rdi + r8 - 1] ; esi <- End of Destination - std ; set direction flag -@CopyBytes: - mov rcx, r8 - rep movsb ; Copy bytes backward - cld - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/IsZeroBuffer.nasm deleted file mode 100644 index 3b855a7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push rdi - mov rdi, rcx ; rdi <- Buffer - mov rcx, rdx ; rcx <- Length - shr rcx, 3 ; rcx <- number of qwords - and rdx, 7 ; rdx <- number of trailing bytes - xor rax, rax ; rax <- 0, also set ZF - repe scasq - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov rcx, rdx - repe scasb - jnz @ReturnFalse - pop rdi - mov rax, 1 ; return TRUE - ret -@ReturnFalse: - pop rdi - xor rax, rax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S deleted file mode 100644 index 5bdf247..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasw - leaq -2(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.nasm deleted file mode 100644 index 9f0de63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S deleted file mode 100644 index 2aac851..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasl - leaq -4(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.nasm deleted file mode 100644 index 5c9ae5d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S deleted file mode 100644 index 21f0590..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasq - leaq -8(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.nasm deleted file mode 100644 index b98c6de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S deleted file mode 100644 index 5209983..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasb - leaq -1(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.nasm deleted file mode 100644 index 8499795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx ; set rax to 0 if not found - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S deleted file mode 100644 index b3804e5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - pushq %rdi - movq %r8, %rax # rax = Value - movq %rcx, %rdi # rdi = Buffer - xchgq %rdx, %rcx # rcx = Count, rdx = Buffer - rep stosb - movq %rdx, %rax # rax = Buffer - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.nasm deleted file mode 100644 index ae05517..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.nasm +++ /dev/null @@ -1,47 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - push rcx ; push Buffer - mov rax, r8 ; rax = Value - mov rdi, rcx ; rdi = Buffer - mov rcx, rdx ; rcx = Count - rep stosb - pop rax ; rax = Buffer - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S deleted file mode 100644 index 3434e86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosw - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.nasm deleted file mode 100644 index d9c0e54..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S deleted file mode 100644 index 7dba067..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosl - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.nasm deleted file mode 100644 index 4da3d33..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S deleted file mode 100644 index ad28243..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosq - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.nasm deleted file mode 100644 index 6f364d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S deleted file mode 100644 index e5cb074..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S +++ /dev/null @@ -1,50 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - pushq %rdi - pushq %rcx - xorq %rax, %rax - movq %rcx, %rdi - movq %rdx, %rcx - shrq $3, %rcx - andq $7, %rdx - rep stosq - movl %edx, %ecx - rep stosb - popq %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.nasm deleted file mode 100644 index 8e0a5e4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - push rcx - xor rax, rax - mov rdi, rcx - mov rcx, rdx - shr rcx, 3 - and rdx, 7 - rep stosq - mov ecx, edx - rep stosb - pop rax - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf deleted file mode 100644 index 2d0f0a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf +++ /dev/null @@ -1,127 +0,0 @@ -## @file -# Instance of Base Memory Library using REP string instructions. -# -# Base Memory Library that uses REP string instructions for -# high performance and small size. Optimized for use in PEI. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLibRepStr - MODULE_UNI_FILE = BaseMemoryLibRepStr.uni - FILE_GUID = e7884bf4-51a1-485b-982a-ff89129983bc - MODULE_TYPE = BASE - VERSION_STRING = 1.1 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemLibInternals.h - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGuid.c - -[Sources.Ia32] - Ia32/ScanMem64.nasm - Ia32/ScanMem64.S - Ia32/ScanMem32.nasm - Ia32/ScanMem32.S - Ia32/ScanMem16.nasm - Ia32/ScanMem16.S - Ia32/ScanMem8.nasm - Ia32/ScanMem8.S - Ia32/CompareMem.nasm - Ia32/CompareMem.S - Ia32/ZeroMem.nasm - Ia32/ZeroMem.S - Ia32/SetMem64.nasm - Ia32/SetMem64.S - Ia32/SetMem32.nasm - Ia32/SetMem32.S - Ia32/SetMem16.nasm - Ia32/SetMem16.S - Ia32/SetMem.nasm - Ia32/SetMem.S - Ia32/CopyMem.nasm - Ia32/CopyMem.S - Ia32/ScanMem64.nasm - Ia32/ScanMem32.nasm - Ia32/ScanMem16.nasm - Ia32/ScanMem8.nasm - Ia32/CompareMem.nasm - Ia32/ZeroMem.nasm - Ia32/SetMem64.nasm - Ia32/SetMem32.nasm - Ia32/SetMem16.nasm - Ia32/SetMem.nasm - Ia32/CopyMem.nasm - Ia32/IsZeroBuffer.nasm - -[Sources.X64] - X64/ScanMem64.nasm - X64/ScanMem64.S - X64/ScanMem32.nasm - X64/ScanMem32.S - X64/ScanMem16.nasm - X64/ScanMem16.S - X64/ScanMem8.nasm - X64/ScanMem8.S - X64/CompareMem.nasm - X64/CompareMem.S - X64/ZeroMem.nasm - X64/ZeroMem.S - X64/SetMem64.nasm - X64/SetMem64.S - X64/SetMem32.nasm - X64/SetMem32.S - X64/SetMem16.nasm - X64/SetMem16.S - X64/SetMem.nasm - X64/SetMem.S - X64/CopyMem.nasm - X64/CopyMem.S - X64/ScanMem64.nasm - X64/ScanMem32.nasm - X64/ScanMem16.nasm - X64/ScanMem8.nasm - X64/CompareMem.nasm - X64/ZeroMem.nasm - X64/SetMem64.nasm - X64/SetMem32.nasm - X64/SetMem16.nasm - X64/SetMem.nasm - X64/CopyMem.nasm - X64/IsZeroBuffer.nasm - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.uni deleted file mode 100644 index b6e1b5a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library using REP string instructions. -// -// Base Memory Library that uses REP string instructions for -// high performance and small size. Optimized for use in PEI. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library using REP string instructions" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library that uses REP string instructions for high performance and small size. Optimized for use in PEI." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c deleted file mode 100644 index 161171b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S deleted file mode 100644 index 1c9239e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.Asm -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.nasm deleted file mode 100644 index e8d1abd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.nasm +++ /dev/null @@ -1,57 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push esi - push edi - mov esi, [esp + 12] - mov edi, [esp + 16] - mov ecx, [esp + 20] - repe cmpsb - movzx eax, byte [esi - 1] - movzx edx, byte [edi - 1] - sub eax, edx - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S deleted file mode 100644 index 9276699..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S +++ /dev/null @@ -1,65 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.Asm -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi, %edx), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax - jae L_CopyBackward # Copy backward if overlapped -L0: - movl %edx, %ecx - andl $3, %edx - shrl $2, %ecx - rep - movsl # Copy as many Dwords as possible - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- End of Source - leal -1(%edi, %edx), %edi # edi <- End of Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb # Copy bytes backward - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.nasm deleted file mode 100644 index ff9931d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.nasm +++ /dev/null @@ -1,64 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.Asm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push esi - push edi - mov esi, [esp + 16] ; esi <- Source - mov edi, [esp + 12] ; edi <- Destination - mov edx, [esp + 20] ; edx <- Count - lea eax, [esi + edx - 1] ; eax <- End of Source - cmp esi, edi - jae .0 - cmp eax, edi - jae @CopyBackward ; Copy backward if overlapped -.0: - mov ecx, edx - and edx, 3 - shr ecx, 2 - rep movsd ; Copy as many Dwords as possible - jmp @CopyBytes -@CopyBackward: - mov esi, eax ; esi <- End of Source - lea edi, [edi + edx - 1] ; edi <- End of Destination - std -@CopyBytes: - mov ecx, edx - rep movsb ; Copy bytes backward - cld - mov eax, [esp + 12] ; eax <- Destination as return value - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/IsZeroBuffer.nasm deleted file mode 100644 index cfd41a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push edi - mov edi, [esp + 8] ; edi <- Buffer - mov ecx, [esp + 12] ; ecx <- Length - mov edx, ecx ; edx <- ecx - shr ecx, 2 ; ecx <- number of dwords - and edx, 3 ; edx <- number of trailing bytes - xor eax, eax ; eax <- 0, also set ZF - repe scasd - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov ecx, edx - repe scasb - jnz @ReturnFalse - pop edi - mov eax, 1 ; return TRUE - ret -@ReturnFalse: - pop edi - xor eax, eax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S deleted file mode 100644 index 42735ca..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - jz L0 - movl %ecx, %eax -L0: - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.nasm deleted file mode 100644 index 71171ee..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.nasm +++ /dev/null @@ -1,56 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasw - lea eax, [edi - 2] - jz .0 - mov eax, ecx -.0: - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S deleted file mode 100644 index a27be9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - jz L0 - movl %ecx, %eax -L0: - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.nasm deleted file mode 100644 index 9d1b028..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.nasm +++ /dev/null @@ -1,56 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasd - lea eax, [edi - 4] - jz .0 - mov eax, ecx -.0: - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S deleted file mode 100644 index 96c2d31..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S +++ /dev/null @@ -1,63 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.Asm -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - jz L2 - movl %ecx, %eax -L2: - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.nasm deleted file mode 100644 index 108263d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - cmp eax, [edi] - lea edi, [edi + 8] - loopne .0 - jne .1 - cmp edx, [edi - 4] - jecxz .1 - jne .0 -.1: - lea eax, [edi - 8] - jz .2 - mov eax, ecx -.2: - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S deleted file mode 100644 index 6fddf08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.Asm -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - jz L0 - movl %ecx, %eax -L0: - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.nasm deleted file mode 100644 index c6ecdfd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.nasm +++ /dev/null @@ -1,56 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov al, [esp + 16] - repne scasb - lea eax, [edi - 1] - jz .0 - mov eax, ecx -.0: - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S deleted file mode 100644 index 63065ea..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.Asm -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - - .code: - -ASM_GLOBAL ASM_PFX(InternalMemSetMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosb - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.nasm deleted file mode 100644 index c27207d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosb - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S deleted file mode 100644 index d32ce4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.Asm -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 16(%esp), %eax - movl 8(%esp), %edi - movl 12(%esp), %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.nasm deleted file mode 100644 index cfa4906..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosw - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S deleted file mode 100644 index 7fbe11d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.Asm -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 16(%esp),%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - rep - stosl - movl 8(%esp),%eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.nasm deleted file mode 100644 index 78e09b3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.nasm +++ /dev/null @@ -1,44 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push edi - mov eax, [esp + 16] - mov edi, [esp + 8] - mov ecx, [esp + 12] - rep stosd - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S deleted file mode 100644 index 9a0bb07..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.Asm -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - mov %eax, -8(%edi, %ecx, 8) - mov %edx, -4(%edi, %ecx, 8) - loop L0 - movl %edi, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.nasm deleted file mode 100644 index d0afacb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - mov [edi + ecx*8 - 8], eax - mov [edi + ecx*8 - 4], edx - loop .0 - mov eax, edi - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S deleted file mode 100644 index 33b31ad..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.Asm -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - xorl %eax,%eax - movl 8(%esp),%edi - movl 12(%esp),%ecx - movl %ecx,%edx - shrl $2,%ecx - andl $3,%edx - pushl %edi - rep - stosl - movl %edx,%ecx - rep - stosb - popl %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.nasm deleted file mode 100644 index 31efb6a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push edi - xor eax, eax - mov edi, [esp + 8] - mov ecx, [esp + 12] - mov edx, ecx - shr ecx, 2 - and edx, 3 - push edi - rep stosd - mov ecx, edx - rep stosb - pop eax - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h deleted file mode 100644 index 83b0f06..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer Target of copy - @param SourceBuffer Place to copy from - @param Length The number of bytes to copy - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c deleted file mode 100644 index 7758e1f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S deleted file mode 100644 index 435f29a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S +++ /dev/null @@ -1,59 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - pushq %rsi - pushq %rdi - movq %rcx, %rsi - movq %rdx, %rdi - movq %r8, %rcx - repe cmpsb - movzbq -1(%rsi) , %rax - movzbq -1(%rdi) , %rdx - subq %rdx, %rax - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.nasm deleted file mode 100644 index cb0d886..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.nasm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte [rsi - 1] - movzx rdx, byte [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S deleted file mode 100644 index 73f5964..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S +++ /dev/null @@ -1,66 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - pushq %rsi - pushq %rdi - movq %rdx, %rsi # rsi <- Source - movq %rcx, %rdi # rdi <- Destination - leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source - cmpq %rdi, %rsi - movq %rdi, %rax # rax <- Destination as return value - jae L0 - cmpq %rdi, %r9 - jae L_CopyBackward # Copy backward if overlapped -L0: - movq %r8, %rcx - andq $7, %r8 - shrq $3, %rcx - rep movsq # Copy as many Qwords as possible - jmp L_CopyBytes -L_CopyBackward: - movq %r9, %rsi # rsi <- End of Source - leaq -1(%rdi, %r8), %rdi # esi <- End of Destination - std # set direction flag -L_CopyBytes: - movq %r8, %rcx - rep movsb # Copy bytes backward - cld - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.nasm deleted file mode 100644 index b304123..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.Asm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- End of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae .0 - cmp r9, rdi - jae @CopyBackward ; Copy backward if overlapped -.0: - mov rcx, r8 - and r8, 7 - shr rcx, 3 - rep movsq ; Copy as many Qwords as possible - jmp @CopyBytes -@CopyBackward: - mov rsi, r9 ; rsi <- End of Source - lea rdi, [rdi + r8 - 1] ; esi <- End of Destination - std ; set direction flag -@CopyBytes: - mov rcx, r8 - rep movsb ; Copy bytes backward - cld - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/IsZeroBuffer.nasm deleted file mode 100644 index 3b855a7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/IsZeroBuffer.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push rdi - mov rdi, rcx ; rdi <- Buffer - mov rcx, rdx ; rcx <- Length - shr rcx, 3 ; rcx <- number of qwords - and rdx, 7 ; rdx <- number of trailing bytes - xor rax, rax ; rax <- 0, also set ZF - repe scasq - jnz @ReturnFalse ; ZF=0 means non-zero element found - mov rcx, rdx - repe scasb - jnz @ReturnFalse - pop rdi - mov rax, 1 ; return TRUE - ret -@ReturnFalse: - pop rdi - xor rax, rax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S deleted file mode 100644 index 5bdf247..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasw - leaq -2(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.nasm deleted file mode 100644 index 9f0de63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S deleted file mode 100644 index 2aac851..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasl - leaq -4(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.nasm deleted file mode 100644 index 5c9ae5d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S deleted file mode 100644 index 21f0590..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasq - leaq -8(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.nasm deleted file mode 100644 index b98c6de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S deleted file mode 100644 index 5209983..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasb - leaq -1(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.nasm deleted file mode 100644 index 8499795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx ; set rax to 0 if not found - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S deleted file mode 100644 index 059bb66..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - pushq %rdi - movq %r8, %rax # rax = Value - movq %rcx, %rdi # rdi = Buffer - xchgq %rdx, %rcx # rcx = Count, rdx = Buffer - rep stosb - movq %rdx, %rax # rax = Buffer - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.nasm deleted file mode 100644 index e80f671..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.Asm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rax, r8 ; rax = Value - mov rdi, rcx ; rdi = Buffer - xchg rcx, rdx ; rcx = Count, rdx = Buffer - rep stosb - mov rax, rdx ; rax = Buffer - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S deleted file mode 100644 index 3434e86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosw - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.nasm deleted file mode 100644 index d9c0e54..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.Asm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosw - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S deleted file mode 100644 index 7dba067..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosl - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.nasm deleted file mode 100644 index 4da3d33..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.nasm +++ /dev/null @@ -1,46 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.Asm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosd - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S deleted file mode 100644 index ad28243..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S +++ /dev/null @@ -1,46 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - pushq %rdi - movq %rcx, %rdi - movq %r8, %rax - xchgq %rdx, %rcx - rep stosq - movq %rdx, %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.nasm deleted file mode 100644 index 6f364d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.nasm +++ /dev/null @@ -1,45 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.Asm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - push rdi - mov rdi, rcx - mov rax, r8 - xchg rcx, rdx - rep stosq - mov rax, rdx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S deleted file mode 100644 index e5cb074..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S +++ /dev/null @@ -1,50 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - pushq %rdi - pushq %rcx - xorq %rax, %rax - movq %rcx, %rdi - movq %rdx, %rcx - shrq $3, %rcx - andq $7, %rdx - rep stosq - movl %edx, %ecx - rep stosb - popq %rax - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.nasm deleted file mode 100644 index 8e0a5e4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.nasm +++ /dev/null @@ -1,49 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.Asm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - push rcx - xor rax, rax - mov rdi, rcx - mov rcx, rdx - shr rcx, 3 - and rdx, 7 - rep stosq - mov ecx, edx - rep stosb - pop rax - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf deleted file mode 100644 index a6af7de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf +++ /dev/null @@ -1,126 +0,0 @@ -## @file -# Instance of Base Memory Library using SSE2 registers. -# -# Base Memory Library that uses SSE2 registers for high performance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseMemoryLibSse2 - MODULE_UNI_FILE = BaseMemoryLibSse2.uni - FILE_GUID = 65a18235-5096-4032-8c63-214f0249ce8d - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemLibInternals.h - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGuid.c - -[Sources.Ia32] - Ia32/ScanMem64.nasm - Ia32/ScanMem64.S - Ia32/ScanMem32.nasm - Ia32/ScanMem32.S - Ia32/ScanMem16.nasm - Ia32/ScanMem16.S - Ia32/ScanMem8.nasm - Ia32/ScanMem8.S - Ia32/CompareMem.nasm - Ia32/CompareMem.S - Ia32/ZeroMem.nasm - Ia32/ZeroMem.S - Ia32/SetMem64.nasm - Ia32/SetMem64.S - Ia32/SetMem32.nasm - Ia32/SetMem32.S - Ia32/SetMem16.nasm - Ia32/SetMem16.S - Ia32/SetMem.nasm - Ia32/SetMem.S - Ia32/CopyMem.nasm - Ia32/CopyMem.S - Ia32/ScanMem64.nasm - Ia32/ScanMem32.nasm - Ia32/ScanMem16.nasm - Ia32/ScanMem8.nasm - Ia32/CompareMem.nasm - Ia32/ZeroMem.nasm - Ia32/SetMem64.nasm - Ia32/SetMem32.nasm - Ia32/SetMem16.nasm - Ia32/SetMem.nasm - Ia32/CopyMem.nasm - Ia32/IsZeroBuffer.nasm - -[Sources.X64] - X64/ScanMem64.nasm - X64/ScanMem32.nasm - X64/ScanMem16.nasm - X64/ScanMem8.nasm - X64/CompareMem.nasm - X64/ZeroMem.nasm - X64/SetMem64.nasm - X64/SetMem32.nasm - X64/SetMem16.nasm - X64/SetMem.nasm - X64/CopyMem.nasm - X64/ScanMem64.nasm - X64/ScanMem64.S - X64/ScanMem32.nasm - X64/ScanMem32.S - X64/ScanMem16.nasm - X64/ScanMem16.S - X64/ScanMem8.nasm - X64/ScanMem8.S - X64/CompareMem.nasm - X64/CompareMem.S - X64/ZeroMem.nasm - X64/ZeroMem.S - X64/SetMem64.nasm - X64/SetMem64.S - X64/SetMem32.nasm - X64/SetMem32.S - X64/SetMem16.nasm - X64/SetMem16.S - X64/SetMem.nasm - X64/SetMem.S - X64/CopyMem.nasm - X64/CopyMem.S - X64/IsZeroBuffer.nasm - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.uni deleted file mode 100644 index 70155dc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Base Memory Library using SSE2 registers. -// -// Base Memory Library that uses SSE2 registers for high performance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library using SSE2 registers" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library that uses SSE2 registers for high performance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c deleted file mode 100644 index 161171b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S deleted file mode 100644 index 1c9239e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.Asm -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCompareMem): - push %esi - push %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - movl 20(%esp), %ecx - repe cmpsb - movzbl -1(%esi), %eax - movzbl -1(%edi), %edx - subl %edx, %eax - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.nasm deleted file mode 100644 index e8d1abd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.nasm +++ /dev/null @@ -1,57 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push esi - push edi - mov esi, [esp + 12] - mov edi, [esp + 16] - mov ecx, [esp + 20] - repe cmpsb - movzx eax, byte [esi - 1] - movzx edx, byte [edi - 1] - sub eax, edx - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S deleted file mode 100644 index 0716182..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S +++ /dev/null @@ -1,85 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.asm -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemCopyMem): - push %esi - push %edi - movl 16(%esp), %esi # esi <- Source - movl 12(%esp), %edi # edi <- Destination - movl 20(%esp), %edx # edx <- Count - leal -1(%esi,%edx,), %eax # eax <- End of Source - cmpl %edi, %esi - jae L0 - cmpl %edi, %eax # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L1 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx # edx <- remaining bytes to copy - rep - movsb -L1: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to copy - jz L_CopyBytes - addl $-16, %esp - movdqu %xmm0, (%esp) -L2: - movdqu (%esi), %xmm0 - movntdq %xmm0, (%edi) - addl $16, %esi - addl $16, %edi - loop L2 - mfence - movdqu (%esp),%xmm0 - addl $16, %esp # stack cleanup - jmp L_CopyBytes -L_CopyBackward: - movl %eax, %esi # esi <- Last byte in Source - leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination - std -L_CopyBytes: - movl %edx, %ecx - rep - movsb - cld - movl 12(%esp), %eax # eax <- Destination as return value - pop %edi - pop %esi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.nasm deleted file mode 100644 index 6913874..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.nasm +++ /dev/null @@ -1,84 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push esi - push edi - mov esi, [esp + 16] ; esi <- Source - mov edi, [esp + 12] ; edi <- Destination - mov edx, [esp + 20] ; edx <- Count - lea eax, [esi + edx - 1] ; eax <- End of Source - cmp esi, edi - jae .0 - cmp eax, edi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -.0: - xor ecx, ecx - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - jz .1 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx ; edx <- remaining bytes to copy - rep movsb -.1: - mov ecx, edx - and edx, 15 - shr ecx, 4 ; ecx <- # of DQwords to copy - jz @CopyBytes - add esp, -16 - movdqu [esp], xmm0 ; save xmm0 -.2: - movdqu xmm0, [esi] ; esi may not be 16-bytes aligned - movntdq [edi], xmm0 ; edi should be 16-bytes aligned - add esi, 16 - add edi, 16 - loop .2 - mfence - movdqu xmm0, [esp] ; restore xmm0 - add esp, 16 ; stack cleanup - jmp @CopyBytes -@CopyBackward: - mov esi, eax ; esi <- Last byte in Source - lea edi, [edi + edx - 1] ; edi <- Last byte in Destination - std -@CopyBytes: - mov ecx, edx - rep movsb - cld - mov eax, [esp + 12] ; eax <- Destination as return value - pop edi - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/IsZeroBuffer.nasm deleted file mode 100644 index e09ef85..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/IsZeroBuffer.nasm +++ /dev/null @@ -1,74 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push edi - mov edi, [esp + 8] ; edi <- Buffer - mov edx, [esp + 12] ; edx <- Length - xor ecx, ecx ; ecx <- 0 - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - jz @Is16BytesZero - cmp ecx, edx - cmova ecx, edx ; bytes before the 16-byte boundary - sub edx, ecx - xor eax, eax ; eax <- 0, also set ZF - repe scasb - jnz @ReturnFalse ; ZF=0 means non-zero element found -@Is16BytesZero: - mov ecx, edx - and edx, 15 - shr ecx, 4 - jz @IsBytesZero -.0: - pxor xmm0, xmm0 ; xmm0 <- 0 - pcmpeqb xmm0, [edi] ; check zero for 16 bytes - pmovmskb eax, xmm0 ; eax <- compare results - cmp eax, 0xffff - jnz @ReturnFalse - add edi, 16 - loop .0 -@IsBytesZero: - mov ecx, edx - xor eax, eax ; eax <- 0, also set ZF - repe scasb - jnz @ReturnFalse ; ZF=0 means non-zero element found - pop edi - mov eax, 1 ; return TRUE - ret -@ReturnFalse: - pop edi - xor eax, eax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S deleted file mode 100644 index c485543..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.Asm -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem16): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasw - leal -2(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.nasm deleted file mode 100644 index 78d9f30..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasw - lea eax, [edi - 2] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S deleted file mode 100644 index a9b4975..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.Asm -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem32): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movl 16(%esp), %eax - repne scasl - leal -4(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.nasm deleted file mode 100644 index bbacf38..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov eax, [esp + 16] - repne scasd - lea eax, [edi - 4] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S deleted file mode 100644 index e23cf5f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S +++ /dev/null @@ -1,61 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.Asm -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem64): - push %edi - movl 12(%esp), %ecx - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 8(%esp), %edi -L0: - cmpl (%edi), %eax - leal 8(%edi), %edi - loopne L0 - jne L1 - cmpl -4(%edi), %edx - jecxz L1 - jne L0 -L1: - leal -8(%edi), %eax - cmovne %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.nasm deleted file mode 100644 index e994d4a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.nasm +++ /dev/null @@ -1,63 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push edi - mov ecx, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov edi, [esp + 8] -.0: - cmp eax, [edi] - lea edi, [edi + 8] - loopne .0 - jne .1 - cmp edx, [edi - 4] - jecxz .1 - jne .0 -.1: - lea eax, [edi - 8] - cmovne eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S deleted file mode 100644 index afefaab..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.Asm -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemScanMem8): - push %edi - movl 12(%esp), %ecx - movl 8(%esp), %edi - movb 16(%esp), %al - repne scasb - leal -1(%edi), %eax - cmovnz %ecx, %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.nasm deleted file mode 100644 index d13c9c7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.nasm +++ /dev/null @@ -1,54 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push edi - mov ecx, [esp + 12] - mov edi, [esp + 8] - mov al, [esp + 16] - repne scasb - lea eax, [edi - 1] - cmovnz eax, ecx - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S deleted file mode 100644 index bcbe0cd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S +++ /dev/null @@ -1,76 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.asm -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - - #.MODEL flat,C - .xmm: - .code: - -#------------------------------------------------------------------------------ -# VOID * -# _mem_SetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push %edi - movl 12(%esp), %edx # edx <- Count - movl 8(%esp), %edi # edi <- Buffer - movb 16(%esp), %al # al <- Value - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - jz L0 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosb -L0: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx # ecx <- # of DQwords to set - jz L_SetBytes - movb %al, %ah # ax <- Value | (Value << 8) - addl $-16, %esp - movdqu %xmm0, (%esp) - movd %eax, %xmm0 - pshuflw $0, %xmm0, %xmm0 - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence - movdqu (%esp), %xmm0 - addl $16, %esp # stack cleanup -L_SetBytes: - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax # eax <- Buffer as return value - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.nasm deleted file mode 100644 index 2852ee5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.nasm +++ /dev/null @@ -1,73 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.nasm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push edi - mov edx, [esp + 12] ; edx <- Count - mov edi, [esp + 8] ; edi <- Buffer - mov al, [esp + 16] ; al <- Value - xor ecx, ecx - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - jz .0 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx - rep stosb -.0: - mov ecx, edx - and edx, 15 - shr ecx, 4 ; ecx <- # of DQwords to set - jz @SetBytes - mov ah, al ; ax <- Value | (Value << 8) - add esp, -16 - movdqu [esp], xmm0 ; save xmm0 - movd xmm0, eax - pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times - movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times -.1: - movntdq [edi], xmm0 ; edi should be 16-byte aligned - add edi, 16 - loop .1 - mfence - movdqu xmm0, [esp] ; restore xmm0 - add esp, 16 ; stack cleanup -@SetBytes: - mov ecx, edx - rep stosb - mov eax, [esp + 8] ; eax <- Buffer as return value - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S deleted file mode 100644 index 4269833..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S +++ /dev/null @@ -1,69 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.asm -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem16): - push %edi - movl 12(%esp), %edx - movl 8(%esp), %edi - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - movl 16(%esp), %eax - jz L0 - shrl %ecx - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosw -L0: - movl %edx, %ecx - andl $7, %edx - shrl $3, %ecx - jz L_SetWords - movd %eax, %xmm0 - pshuflw $0, %xmm0, %xmm0 - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_SetWords: - movl %edx, %ecx - rep - stosw - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.nasm deleted file mode 100644 index 3a79e79..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.nasm +++ /dev/null @@ -1,69 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.nasm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push edi - mov edx, [esp + 12] - mov edi, [esp + 8] - xor ecx, ecx - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - mov eax, [esp + 16] - jz .0 - shr ecx, 1 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx - rep stosw -.0: - mov ecx, edx - and edx, 7 - shr ecx, 3 - jz @SetWords - movd xmm0, eax - pshuflw xmm0, xmm0, 0 - movlhps xmm0, xmm0 -.1: - movntdq [edi], xmm0 ; edi should be 16-byte aligned - add edi, 16 - loop .1 - mfence -@SetWords: - mov ecx, edx - rep stosw - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S deleted file mode 100644 index 9e9c7e2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S +++ /dev/null @@ -1,68 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.asm -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem32): - push %edi - movl 12(%esp), %edx - movl 8(%esp), %edi - xorl %ecx, %ecx - subl %edi, %ecx - andl $15, %ecx # ecx + edi aligns on 16-byte boundary - movl 16(%esp), %eax - jz L0 - shrl $2, %ecx - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosl -L0: - movl %edx, %ecx - andl $3, %edx - shrl $2, %ecx - jz L_SetDwords - movd %eax, %xmm0 - pshufd $0, %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_SetDwords: - movl %edx, %ecx - rep - stosl - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.nasm deleted file mode 100644 index 7d2d9fb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.nasm +++ /dev/null @@ -1,68 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.nasm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push edi - mov edx, [esp + 12] - mov edi, [esp + 8] - xor ecx, ecx - sub ecx, edi - and ecx, 15 ; ecx + edi aligns on 16-byte boundary - mov eax, [esp + 16] - jz .0 - shr ecx, 2 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx - rep stosd -.0: - mov ecx, edx - and edx, 3 - shr ecx, 2 - jz @SetDwords - movd xmm0, eax - pshufd xmm0, xmm0, 0 -.1: - movntdq [edi], xmm0 - add edi, 16 - loop .1 - mfence -@SetDwords: - mov ecx, edx - rep stosd - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S deleted file mode 100644 index d5983e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S +++ /dev/null @@ -1,58 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemSetMem64): - movl 4(%esp), %eax - movl 8(%esp), %ecx - testb $8, %al - movl %eax, %edx - movq 0xc(%esp), %xmm0 - jz L1 - movq %xmm0, (%edx) - addl $8, %edx - decl %ecx -L1: - shrl %ecx - jz L_SetQwords - movlhps %xmm0, %xmm0 -L2: - movntdq %xmm0, (%edx) - leal 16(%edx), %edx - loop L2 - mfence -L_SetQwords: - jnc L3 - movq %xmm0, (%edx) -L3: - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.nasm deleted file mode 100644 index ace6274..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.nasm +++ /dev/null @@ -1,60 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.nasm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - mov eax, [esp + 4] ; eax <- Buffer - mov ecx, [esp + 8] ; ecx <- Count - test al, 8 - mov edx, eax - movq xmm0, qword [esp + 12] - jz .0 - movq qword [edx], xmm0 - add edx, 8 - dec ecx -.0: - shr ecx, 1 - jz @SetQwords - movlhps xmm0, xmm0 -.1: - movntdq [edx], xmm0 - lea edx, [edx + 16] - loop .1 - mfence -@SetQwords: - jnc .2 - movq qword [edx], xmm0 -.2: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S deleted file mode 100644 index 2a8c8b7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S +++ /dev/null @@ -1,65 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.asm -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_PFX(InternalMemZeroMem): - push %edi - movl 8(%esp), %edi - movl 12(%esp), %edx - xorl %ecx, %ecx - subl %edi, %ecx - xorl %eax, %eax - andl $15, %ecx - jz L0 - cmpl %edx, %ecx - cmova %edx, %ecx - subl %ecx, %edx - rep - stosb -L0: - movl %edx, %ecx - andl $15, %edx - shrl $4, %ecx - jz L_ZeroBytes - pxor %xmm0, %xmm0 -L1: - movntdq %xmm0, (%edi) - addl $16, %edi - loop L1 - mfence -L_ZeroBytes: - movl %edx, %ecx - rep - stosb - movl 8(%esp), %eax - pop %edi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.nasm deleted file mode 100644 index cee3618..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.nasm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push edi - mov edi, [esp + 8] - mov edx, [esp + 12] - xor ecx, ecx - sub ecx, edi - xor eax, eax - and ecx, 15 - jz .0 - cmp ecx, edx - cmova ecx, edx - sub edx, ecx - rep stosb -.0: - mov ecx, edx - and edx, 15 - shr ecx, 4 - jz @ZeroBytes - pxor xmm0, xmm0 -.1: - movntdq [edi], xmm0 - add edi, 16 - loop .1 - mfence -@ZeroBytes: - mov ecx, edx - rep stosb - mov eax, [esp + 8] - pop edi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h deleted file mode 100644 index e7afa23..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/MemLibInternals.h +++ /dev/null @@ -1,251 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include -#include -#include -#include - -/** - Copy Length bytes from Source to Destination. - - @param DestinationBuffer The target of the copy request. - @param SourceBuffer The place to copy from. - @param Length The number of bytes to copy. - - @return Destination - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Set Buffer to Value for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value of the set operation. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer Memory to set. - @param Length The number of bytes to set - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer. - @param SourceBuffer The second memory buffer. - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return A pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c deleted file mode 100644 index 8e6daa3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c deleted file mode 100644 index 7758e1f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c deleted file mode 100644 index 5273a86..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S deleted file mode 100644 index 503127c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S +++ /dev/null @@ -1,59 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CompareMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CompareMem.S -# -# Abstract: -# -# CompareMem function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# INTN -# EFIAPI -# InternalMemCompareMem ( -# IN CONST VOID *DestinationBuffer, -# IN CONST VOID *SourceBuffer, -# IN UINTN Length -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - pushq %rsi - pushq %rdi - movq %rcx, %rsi - movq %rdx, %rdi - movq %r8, %rcx - repe cmpsb - movzbq -1(%rsi) , %rax - movzbq -1(%rdi) , %rdx - subq %rdx, %rax - popq %rdi - popq %rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.nasm deleted file mode 100644 index cb0d886..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.nasm +++ /dev/null @@ -1,58 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CompareMem.Asm -; -; Abstract: -; -; CompareMem function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; INTN -; EFIAPI -; InternalMemCompareMem ( -; IN CONST VOID *DestinationBuffer, -; IN CONST VOID *SourceBuffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCompareMem) -ASM_PFX(InternalMemCompareMem): - push rsi - push rdi - mov rsi, rcx - mov rdi, rdx - mov rcx, r8 - repe cmpsb - movzx rax, byte [rsi - 1] - movzx rdx, byte [rdi - 1] - sub rax, rdx - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S deleted file mode 100644 index 7c07eda..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S +++ /dev/null @@ -1,83 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from CopyMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# CopyMem.S -# -# Abstract: -# -# CopyMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemCopyMem ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINTN Count -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - pushq %rsi - pushq %rdi - movq %rdx, %rsi # rsi <- Source - movq %rcx, %rdi # rdi <- Destination - leaq -1(%rsi, %r8,), %r9 # r9 <- Last byte of Source - cmpq %rdi, %rsi - movq %rdi, %rax # rax <- Destination as return value - jae L0 # Copy forward if Source > Destination - cmpq %rdi, %r9 # Overlapped? - jae L_CopyBackward # Copy backward if overlapped -L0: - xorq %rcx, %rcx - subq %rdi, %rcx # rcx <- -rdi - andq $15, %rcx # rcx + rsi should be 16 bytes aligned - jz L1 # skip if rcx == 0 - cmpq %r8, %rcx - cmova %r8, %rcx - subq %rcx, %r8 - rep movsb -L1: - movq %r8, %rcx - andq $15, %r8 - shrq $4, %rcx # rcx <- # of DQwords to copy - jz L_CopyBytes - movdqa %xmm0, 0x18(%rsp) # save xmm0 on stack -L2: - movdqu (%rsi), %xmm0 # rsi may not be 16-byte aligned - movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned - addq $16, %rsi - addq $16, %rdi - loop L2 - mfence - movdqa 0x18(%rsp), %xmm0 # restore xmm0 - jmp L_CopyBytes # copy remaining bytes -L_CopyBackward: - movq %r9, %rsi # rsi <- Last byte of Source - leaq -1(%rdi, %r8,), %rdi # rdi <- Last byte of Destination - std -L_CopyBytes: - movq %r8, %rcx - rep movsb - cld - popq %rdi - popq %rsi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.nasm deleted file mode 100644 index 9fe45d4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.nasm +++ /dev/null @@ -1,83 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; CopyMem.nasm -; -; Abstract: -; -; CopyMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; EFIAPI -; InternalMemCopyMem ( -; IN VOID *Destination, -; IN VOID *Source, -; IN UINTN Count -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemCopyMem) -ASM_PFX(InternalMemCopyMem): - push rsi - push rdi - mov rsi, rdx ; rsi <- Source - mov rdi, rcx ; rdi <- Destination - lea r9, [rsi + r8 - 1] ; r9 <- Last byte of Source - cmp rsi, rdi - mov rax, rdi ; rax <- Destination as return value - jae .0 ; Copy forward if Source > Destination - cmp r9, rdi ; Overlapped? - jae @CopyBackward ; Copy backward if overlapped -.0: - xor rcx, rcx - sub rcx, rdi ; rcx <- -rdi - and rcx, 15 ; rcx + rsi should be 16 bytes aligned - jz .1 ; skip if rcx == 0 - cmp rcx, r8 - cmova rcx, r8 - sub r8, rcx - rep movsb -.1: - mov rcx, r8 - and r8, 15 - shr rcx, 4 ; rcx <- # of DQwords to copy - jz @CopyBytes - movdqa [rsp + 0x18], xmm0 ; save xmm0 on stack -.2: - movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned - movntdq [rdi], xmm0 ; rdi should be 16-byte aligned - add rsi, 16 - add rdi, 16 - loop .2 - mfence - movdqa xmm0, [rsp + 0x18] ; restore xmm0 - jmp @CopyBytes ; copy remaining bytes -@CopyBackward: - mov rsi, r9 ; rsi <- Last byte of Source - lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination - std -@CopyBytes: - mov rcx, r8 - rep movsb - cld - pop rdi - pop rsi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/IsZeroBuffer.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/IsZeroBuffer.nasm deleted file mode 100644 index 3d5b6a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/IsZeroBuffer.nasm +++ /dev/null @@ -1,76 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; IsZeroBuffer.nasm -; -; Abstract: -; -; IsZeroBuffer function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; BOOLEAN -; EFIAPI -; InternalMemIsZeroBuffer ( -; IN CONST VOID *Buffer, -; IN UINTN Length -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemIsZeroBuffer) -ASM_PFX(InternalMemIsZeroBuffer): - push rdi - mov rdi, rcx ; rdi <- Buffer - xor rcx, rcx ; rcx <- 0 - sub rcx, rdi - and rcx, 15 ; rcx + rdi aligns on 16-byte boundary - jz @Is16BytesZero - cmp rcx, rdx ; Length already in rdx - cmova rcx, rdx ; bytes before the 16-byte boundary - sub rdx, rcx - xor rax, rax ; rax <- 0, also set ZF - repe scasb - jnz @ReturnFalse ; ZF=0 means non-zero element found -@Is16BytesZero: - mov rcx, rdx - and rdx, 15 - shr rcx, 4 - jz @IsBytesZero -.0: - pxor xmm0, xmm0 ; xmm0 <- 0 - pcmpeqb xmm0, [rdi] ; check zero for 16 bytes - pmovmskb eax, xmm0 ; eax <- compare results - ; nasm doesn't support 64-bit destination - ; for pmovmskb - cmp eax, 0xffff - jnz @ReturnFalse - add rdi, 16 - loop .0 -@IsBytesZero: - mov rcx, rdx - xor rax, rax ; rax <- 0, also set ZF - repe scasb - jnz @ReturnFalse ; ZF=0 means non-zero element found - pop rdi - mov rax, 1 ; return TRUE - ret -@ReturnFalse: - pop rdi - xor rax, rax - ret ; return FALSE - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S deleted file mode 100644 index 5bdf247..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem16.S -# -# Abstract: -# -# ScanMem16 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem16 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT16 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasw - leaq -2(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.nasm deleted file mode 100644 index 9f0de63..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem16.Asm -; -; Abstract: -; -; ScanMem16 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem16 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT16 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem16) -ASM_PFX(InternalMemScanMem16): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasw - lea rax, [rdi - 2] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S deleted file mode 100644 index 9979e97..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem32.S -# -# Abstract: -# -# ScanMem32 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem32 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasl - leaq -4(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.nasm deleted file mode 100644 index 5c9ae5d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem32.Asm -; -; Abstract: -; -; ScanMem32 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem32 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem32) -ASM_PFX(InternalMemScanMem32): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasd - lea rax, [rdi - 4] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S deleted file mode 100644 index 4c994b9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem64.S -# -# Abstract: -# -# ScanMem64 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem64 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT64 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasq - leaq -8(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.nasm deleted file mode 100644 index b98c6de..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem64.Asm -; -; Abstract: -; -; ScanMem64 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem64 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT64 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem64) -ASM_PFX(InternalMemScanMem64): - push rdi - mov rdi, rcx - mov rax, r8 - mov rcx, rdx - repne scasq - lea rax, [rdi - 8] - cmovnz rax, rcx - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S deleted file mode 100644 index 1bb04aa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S +++ /dev/null @@ -1,56 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ScanMem8.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ScanMem8.S -# -# Abstract: -# -# ScanMem8 function -# -# Notes: -# -# The following BaseMemoryLib instances contain the same copy of this file: -# -# BaseMemoryLibRepStr -# BaseMemoryLibMmx -# BaseMemoryLibSse2 -# BaseMemoryLibOptDxe -# BaseMemoryLibOptPei -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# CONST VOID * -# EFIAPI -# InternalMemScanMem8 ( -# IN CONST VOID *Buffer, -# IN UINTN Length, -# IN UINT8 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - pushq %rdi - movq %rcx, %rdi - movq %rdx, %rcx - movq %r8, %rax - repne scasb - leaq -1(%rdi), %rax - cmovnz %rcx, %rax # set rax to 0 if not found - popq %rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.nasm deleted file mode 100644 index 8499795..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.nasm +++ /dev/null @@ -1,55 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ScanMem8.Asm -; -; Abstract: -; -; ScanMem8 function -; -; Notes: -; -; The following BaseMemoryLib instances contain the same copy of this file: -; -; BaseMemoryLibRepStr -; BaseMemoryLibMmx -; BaseMemoryLibSse2 -; BaseMemoryLibOptDxe -; BaseMemoryLibOptPei -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; CONST VOID * -; EFIAPI -; InternalMemScanMem8 ( -; IN CONST VOID *Buffer, -; IN UINTN Length, -; IN UINT8 Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemScanMem8) -ASM_PFX(InternalMemScanMem8): - push rdi - mov rdi, rcx - mov rcx, rdx - mov rax, r8 - repne scasb - lea rax, [rdi - 1] - cmovnz rax, rcx ; set rax to 0 if not found - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S deleted file mode 100644 index 25012d4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S +++ /dev/null @@ -1,72 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem.S -# -# Abstract: -# -# SetMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT8 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - pushq %rdi - movq %rcx, %rdi # rdi <- Buffer - movb %r8b, %al # al <- Value - movq %rdi, %r9 # r9 <- Buffer as return value - xorq %rcx, %rcx - subq %rdi, %rcx - andq $15, %rcx # rcx + rdi aligns on 16-byte boundary - jz L0 - cmpq %rdx, %rcx - cmova %rdx, %rcx - subq %rcx, %rdx - rep stosb -L0: - movq %rdx, %rcx - andq $15, %rdx - shrq $4, %rcx - jz L_SetBytes - movb %al, %ah # ax <- Value repeats twice - movdqa %xmm0, 0x10(%rsp) # save xmm0 - movd %eax, %xmm0 # xmm0[0..16] <- Value repeats twice - pshuflw $0, %xmm0, %xmm0 # xmm0[0..63] <- Value repeats 8 times - movlhps %xmm0, %xmm0 # xmm0 <- Value repeats 16 times -L1: - movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned - add $16, %rdi - loop L1 - mfence - movdqa 0x10(%rsp), %xmm0 # restore xmm0 -L_SetBytes: - movl %edx, %ecx # high 32 bits of rcx are always zero - rep stosb - movq %r9, %rax # rax <- Return value - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.nasm deleted file mode 100644 index fddf4c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.nasm +++ /dev/null @@ -1,71 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem.nasm -; -; Abstract: -; -; SetMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem) -ASM_PFX(InternalMemSetMem): - push rdi - mov rdi, rcx ; rdi <- Buffer - mov al, r8b ; al <- Value - mov r9, rdi ; r9 <- Buffer as return value - xor rcx, rcx - sub rcx, rdi - and rcx, 15 ; rcx + rdi aligns on 16-byte boundary - jz .0 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosb -.0: - mov rcx, rdx - and rdx, 15 - shr rcx, 4 - jz @SetBytes - mov ah, al ; ax <- Value repeats twice - movdqa [rsp + 0x10], xmm0 ; save xmm0 - movd xmm0, eax ; xmm0[0..16] <- Value repeats twice - pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times - movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times -.1: - movntdq [rdi], xmm0 ; rdi should be 16-byte aligned - add rdi, 16 - loop .1 - mfence - movdqa xmm0, [rsp + 0x10] ; restore xmm0 -@SetBytes: - mov ecx, edx ; high 32 bits of rcx are always zero - rep stosb - mov rax, r9 ; rax <- Return value - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S deleted file mode 100644 index e6bdc14..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S +++ /dev/null @@ -1,70 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem16.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem16.S -# -# Abstract: -# -# SetMem16 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem16 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT16 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - pushq %rdi - movq %rcx, %rdi - movq %rdi, %r9 - xorq %rcx, %rcx - subq %rdi, %rcx - andq $15, %rcx - movq %r8, %rax - jz L0 - shrq $1, %rcx - cmpq %rdx, %rcx - cmova %rdx, %rcx - subq %rcx, %rdx - rep stosw -L0: - movq %rdx, %rcx - andl $7, %edx - shrq $3, %rcx - jz L_SetWords - movd %eax, %xmm0 - pshuflw $0, %xmm0, %xmm0 - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%rdi) - addq $16, %rdi - loop L1 - mfence -L_SetWords: - movl %edx, %ecx - rep stosw - movq %r9, %rax - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm deleted file mode 100644 index f2e61e8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm +++ /dev/null @@ -1,69 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem16.nasm -; -; Abstract: -; -; SetMem16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem16 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT16 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem16) -ASM_PFX(InternalMemSetMem16): - push rdi - mov rdi, rcx - mov r9, rdi - xor rcx, rcx - sub rcx, rdi - and rcx, 15 - mov rax, r8 - jz .0 - shr rcx, 1 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosw -.0: - mov rcx, rdx - and edx, 7 - shr rcx, 3 - jz @SetWords - movd xmm0, eax - pshuflw xmm0, xmm0, 0 - movlhps xmm0, xmm0 -.1: - movntdq [rdi], xmm0 - add rdi, 16 - loop .1 - mfence -@SetWords: - mov ecx, edx - rep stosw - mov rax, r9 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S deleted file mode 100644 index e0abd71..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S +++ /dev/null @@ -1,69 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem32.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem32.S -# -# Abstract: -# -# SetMem32 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# EFIAPI -# InternalMemSetMem32 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT32 Value -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - pushq %rdi - movq %rcx, %rdi - movq %rdi, %r9 - xorq %rcx, %rcx - subq %rdi, %rcx - andq $15, %rcx - movq %r8, %rax - jz L0 - shrq $2, %rcx - cmpq %rdx, %rcx - cmova %rdx, %rcx - subq %rcx, %rdx - rep stosl -L0: - movq %rdx, %rcx - andl $3, %edx - shrq $2, %rcx - jz L_SetDwords - movd %eax, %xmm0 - pshufd $0, %xmm0, %xmm0 -L1: - movntdq %xmm0, (%rdi) - addq $16, %rdi - loop L1 - mfence -L_SetDwords: - movl %edx, %ecx - rep stosl - movq %r9, %rax - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.nasm deleted file mode 100644 index d4ecf17..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.nasm +++ /dev/null @@ -1,68 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem32.nasm -; -; Abstract: -; -; SetMem32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem32 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT8 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem32) -ASM_PFX(InternalMemSetMem32): - push rdi - mov rdi, rcx - mov r9, rdi - xor rcx, rcx - sub rcx, rdi - and rcx, 15 - mov rax, r8 - jz .0 - shr rcx, 2 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosd -.0: - mov rcx, rdx - and edx, 3 - shr rcx, 2 - jz @SetDwords - movd xmm0, eax - pshufd xmm0, xmm0, 0 -.1: - movntdq [rdi], xmm0 - add rdi, 16 - loop .1 - mfence -@SetDwords: - mov ecx, edx - rep stosd - mov rax, r9 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S deleted file mode 100644 index de48ff2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S +++ /dev/null @@ -1,60 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from SetMem64.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# SetMem64.S -# -# Abstract: -# -# SetMem64 function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemSetMem64 ( -# IN VOID *Buffer, -# IN UINTN Count, -# IN UINT64 Value -# ) -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - movq %rcx, %rax # rax <- Buffer - xchgq %rdx, %rcx # rcx <- Count & rdx <- Buffer - testb $8, %dl - movd %r8, %xmm0 - jz L0 - movq %r8, (%rdx) - addq $8, %rdx - decq %rcx -L0: - shrq $1, %rcx - jz L_SetQwords - movlhps %xmm0, %xmm0 -L1: - movntdq %xmm0, (%rdx) - leaq 16(%rdx), %rdx - loop L1 - mfence -L_SetQwords: - jnc L2 - movq %r8, (%rdx) -L2: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.nasm deleted file mode 100644 index f543693..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.nasm +++ /dev/null @@ -1,59 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; SetMem64.nasm -; -; Abstract: -; -; SetMem64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemSetMem64 ( -; IN VOID *Buffer, -; IN UINTN Count, -; IN UINT64 Value -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemSetMem64) -ASM_PFX(InternalMemSetMem64): - mov rax, rcx ; rax <- Buffer - xchg rcx, rdx ; rcx <- Count & rdx <- Buffer - test dl, 8 - movq xmm0, r8 - jz .0 - mov [rdx], r8 - add rdx, 8 - dec rcx -.0: - shr rcx, 1 - jz @SetQwords - movlhps xmm0, xmm0 -.1: - movntdq [rdx], xmm0 - lea rdx, [rdx + 16] - loop .1 - mfence -@SetQwords: - jnc .2 - mov [rdx], r8 -.2: - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S deleted file mode 100644 index 7cf7a26..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S +++ /dev/null @@ -1,65 +0,0 @@ -# -# ConvertAsm.py: Automatically generated from ZeroMem.asm -# -#------------------------------------------------------------------------------ -# -# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# Module Name: -# -# ZeroMem.S -# -# Abstract: -# -# ZeroMem function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID * -# InternalMemZeroMem ( -# IN VOID *Buffer, -# IN UINTN Count -# ); -#------------------------------------------------------------------------------ -ASM_GLOBAL ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - pushq %rdi - movq %rcx, %rdi - xorq %rcx, %rcx - xorl %eax, %eax - subq %rdi, %rcx - andq $15, %rcx - movq %rdi, %r8 - jz L0 - cmpq %rdx, %rcx - cmova %rdx, %rcx - subq %rcx, %rdx - rep stosb -L0: - movq %rdx, %rcx - andl $15, %edx - shrq $4, %rcx - jz L_ZeroBytes - pxor %xmm0, %xmm0 -L1: - movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned - addq $16, %rdi - loop L1 - mfence -L_ZeroBytes: - movl %edx, %ecx - rep stosb - movq %r8, %rax - popq %rdi - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.nasm deleted file mode 100644 index 1dd0a14..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.nasm +++ /dev/null @@ -1,65 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ZeroMem.nasm -; -; Abstract: -; -; ZeroMem function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID * -; InternalMemZeroMem ( -; IN VOID *Buffer, -; IN UINTN Count -; ) -;------------------------------------------------------------------------------ -global ASM_PFX(InternalMemZeroMem) -ASM_PFX(InternalMemZeroMem): - push rdi - mov rdi, rcx - xor rcx, rcx - xor eax, eax - sub rcx, rdi - and rcx, 15 - mov r8, rdi - jz .0 - cmp rcx, rdx - cmova rcx, rdx - sub rdx, rcx - rep stosb -.0: - mov rcx, rdx - and edx, 15 - shr rcx, 4 - jz @ZeroBytes - pxor xmm0, xmm0 -.1: - movntdq [rdi], xmm0 ; rdi should be 16-byte aligned - add rdi, 16 - loop .1 - mfence -@ZeroBytes: - mov ecx, edx - rep stosb - mov rax, r8 - pop rdi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c deleted file mode 100644 index 3089c1d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c +++ /dev/null @@ -1,1454 +0,0 @@ -/** @file - An OrderedCollectionLib instance that provides a red-black tree - implementation, and allocates and releases tree nodes with - MemoryAllocationLib. - - This library instance is useful when a fast associative container is needed. - Worst case time complexity is O(log n) for Find(), Next(), Prev(), Min(), - Max(), Insert(), and Delete(), where "n" is the number of elements in the - tree. Complete ordered traversal takes O(n) time. - - The implementation is also useful as a fast priority queue. - - Copyright (C) 2014, Red Hat, Inc. - Copyright (c) 2014, Intel Corporation. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License that accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT - WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include - -typedef enum { - RedBlackTreeRed, - RedBlackTreeBlack -} RED_BLACK_TREE_COLOR; - -// -// Incomplete types and convenience typedefs are present in the library class -// 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; - -struct ORDERED_COLLECTION { - 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; -}; - - -/** - Retrieve the user structure linked by the specified tree node. - - Read-only operation. - - @param[in] Node Pointer to the tree node whose associated user structure we - want to retrieve. The caller is responsible for passing a - non-NULL argument. - - @return Pointer to user structure linked by Node. -**/ -VOID * -EFIAPI -OrderedCollectionUserStruct ( - IN CONST RED_BLACK_TREE_NODE *Node - ) -{ - return Node->UserStruct; -} - -/** - A slow function that asserts that the tree is a valid red-black tree, and - that it orders user structures correctly. - - Read-only operation. - - This function uses the stack for recursion and is not recommended for - "production use". - - @param[in] Tree The tree to validate. -**/ -VOID -RedBlackTreeValidate ( - IN CONST RED_BLACK_TREE *Tree - ); - - -/** - Allocate and initialize the RED_BLACK_TREE structure. - - Allocation occurs via MemoryAllocationLib's AllocatePool() function. - - @param[in] UserStructCompare This caller-provided function will be used to - order two user structures linked into the - tree, during the insertion procedure. - - @param[in] KeyCompare This caller-provided function will be used to - order the standalone search key against user - structures linked into the tree, during the - lookup procedure. - - @retval NULL If allocation failed. - - @return Pointer to the allocated, initialized RED_BLACK_TREE structure, - otherwise. -**/ -RED_BLACK_TREE * -EFIAPI -OrderedCollectionInit ( - IN RED_BLACK_TREE_USER_COMPARE UserStructCompare, - IN RED_BLACK_TREE_KEY_COMPARE KeyCompare - ) -{ - RED_BLACK_TREE *Tree; - - Tree = AllocatePool (sizeof *Tree); - if (Tree == NULL) { - return NULL; - } - - Tree->Root = NULL; - Tree->UserStructCompare = UserStructCompare; - Tree->KeyCompare = KeyCompare; - - if (FeaturePcdGet (PcdValidateOrderedCollection)) { - RedBlackTreeValidate (Tree); - } - return Tree; -} - - -/** - Check whether the tree is empty (has no nodes). - - Read-only operation. - - @param[in] Tree The tree to check for emptiness. - - @retval TRUE The tree is empty. - - @retval FALSE The tree is not empty. -**/ -BOOLEAN -EFIAPI -OrderedCollectionIsEmpty ( - IN CONST RED_BLACK_TREE *Tree - ) -{ - return (BOOLEAN)(Tree->Root == NULL); -} - - -/** - Uninitialize and release an empty RED_BLACK_TREE structure. - - Read-write operation. - - Release occurs via MemoryAllocationLib's FreePool() function. - - It is the caller's responsibility to delete all nodes from the tree before - calling this function. - - @param[in] Tree The empty tree to uninitialize and release. -**/ -VOID -EFIAPI -OrderedCollectionUninit ( - 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. - - Read-only operation. - - @param[in] Tree The tree to search for StandaloneKey. - - @param[in] StandaloneKey The key to locate among the user structures linked - into Tree. StandaloneKey will be passed to - Tree->KeyCompare(). - - @retval NULL StandaloneKey could not be found. - - @return The tree node that links to the user structure matching - StandaloneKey, otherwise. -**/ -RED_BLACK_TREE_NODE * -EFIAPI -OrderedCollectionFind ( - IN CONST RED_BLACK_TREE *Tree, - IN CONST VOID *StandaloneKey - ) -{ - RED_BLACK_TREE_NODE *Node; - - Node = Tree->Root; - while (Node != NULL) { - 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. - - Read-only operation. - - @param[in] Tree The tree to return the minimum node of. The user structure - linked by the minimum node compares less than all other user - structures in the tree. - - @retval NULL If Tree is empty. - - @return The tree node that links the minimum user structure, otherwise. -**/ -RED_BLACK_TREE_NODE * -EFIAPI -OrderedCollectionMin ( - IN CONST RED_BLACK_TREE *Tree - ) -{ - 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. - - Read-only operation. - - @param[in] Tree The tree to return the maximum node of. The user structure - linked by the maximum node compares greater than all other - user structures in the tree. - - @retval NULL If Tree is empty. - - @return The tree node that links the maximum user structure, otherwise. -**/ -RED_BLACK_TREE_NODE * -EFIAPI -OrderedCollectionMax ( - IN CONST RED_BLACK_TREE *Tree - ) -{ - 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. - - Read-only operation. - - @param[in] Node The node to get the successor node of. - - @retval NULL If Node is NULL, or Node is the maximum node of its containing - tree (ie. Node has no successor node). - - @return The tree node linking the least user structure that is greater - than the one linked by Node, otherwise. -**/ -RED_BLACK_TREE_NODE * -EFIAPI -OrderedCollectionNext ( - IN CONST RED_BLACK_TREE_NODE *Node - ) -{ - RED_BLACK_TREE_NODE *Walk; - CONST RED_BLACK_TREE_NODE *Child; - - if (Node == NULL) { - return NULL; - } - - // - // If Node has a right subtree, then the successor is the minimum node of - // that subtree. - // - Walk = Node->Right; - if (Walk != NULL) { - while (Walk->Left != NULL) { - Walk = Walk->Left; - } - return Walk; - } - - // - // Otherwise we have to ascend as long as we're our parent's right child (ie. - // ascending to the left). - // - Child = Node; - Walk = Child->Parent; - while (Walk != NULL && Child == Walk->Right) { - Child = Walk; - Walk = Child->Parent; - } - return Walk; -} - - -/** - Get the tree node of the greatest user structure that is less than the one - linked by Node. - - Read-only operation. - - @param[in] Node The node to get the predecessor node of. - - @retval NULL If Node is NULL, or Node is the minimum node of its containing - tree (ie. Node has no predecessor node). - - @return The tree node linking the greatest user structure that is less - than the one linked by Node, otherwise. -**/ -RED_BLACK_TREE_NODE * -EFIAPI -OrderedCollectionPrev ( - IN CONST RED_BLACK_TREE_NODE *Node - ) -{ - RED_BLACK_TREE_NODE *Walk; - CONST RED_BLACK_TREE_NODE *Child; - - if (Node == NULL) { - return NULL; - } - - // - // If Node has a left subtree, then the predecessor is the maximum node of - // that subtree. - // - Walk = Node->Left; - if (Walk != NULL) { - while (Walk->Right != NULL) { - Walk = Walk->Right; - } - return Walk; - } - - // - // Otherwise we have to ascend as long as we're our parent's left child (ie. - // ascending to the right). - // - Child = Node; - Walk = Child->Parent; - while (Walk != NULL && Child == Walk->Left) { - Child = Walk; - Walk = Child->Parent; - } - return Walk; -} - - -/** - Rotate tree nodes around Pivot to the right. - - Parent Parent - | | - Pivot LeftChild - / . . \_ - LeftChild Node1 ---> Node2 Pivot - . \ / . - Node2 LeftRightChild LeftRightChild Node1 - - The ordering Node2 < LeftChild < LeftRightChild < Pivot < Node1 is kept - intact. Parent (if any) is either at the left extreme or the right extreme of - this ordering, and that relation is also kept intact. - - Edges marked with a dot (".") don't change during rotation. - - Internal read-write operation. - - @param[in,out] Pivot The tree node to rotate other nodes right around. It - is the caller's responsibility to ensure that - Pivot->Left is not NULL. - - @param[out] NewRoot If Pivot has a parent node on input, then the - function updates Pivot's original parent on output - according to the rotation, and NewRoot is not - accessed. - - If Pivot has no parent node on input (ie. Pivot is - the root of the tree), then the function stores the - new root node of the tree in NewRoot. -**/ -VOID -RedBlackTreeRotateRight ( - 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; - - Parent = Pivot->Parent; - LeftChild = Pivot->Left; - LeftRightChild = LeftChild->Right; - - Pivot->Left = LeftRightChild; - if (LeftRightChild != NULL) { - LeftRightChild->Parent = Pivot; - } - LeftChild->Parent = Parent; - if (Parent == NULL) { - *NewRoot = LeftChild; - } else { - if (Pivot == Parent->Left) { - Parent->Left = LeftChild; - } else { - Parent->Right = LeftChild; - } - } - LeftChild->Right = Pivot; - Pivot->Parent = LeftChild; -} - - -/** - Rotate tree nodes around Pivot to the left. - - Parent Parent - | | - Pivot RightChild - . \ / . - Node1 RightChild ---> Pivot Node2 - /. . \_ - RightLeftChild Node2 Node1 RightLeftChild - - The ordering Node1 < Pivot < RightLeftChild < RightChild < Node2 is kept - intact. Parent (if any) is either at the left extreme or the right extreme of - this ordering, and that relation is also kept intact. - - Edges marked with a dot (".") don't change during rotation. - - Internal read-write operation. - - @param[in,out] Pivot The tree node to rotate other nodes left around. It - is the caller's responsibility to ensure that - Pivot->Right is not NULL. - - @param[out] NewRoot If Pivot has a parent node on input, then the - function updates Pivot's original parent on output - according to the rotation, and NewRoot is not - accessed. - - If Pivot has no parent node on input (ie. Pivot is - the root of the tree), then the function stores the - new root node of the tree in NewRoot. -**/ -VOID -RedBlackTreeRotateLeft ( - 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; - - Parent = Pivot->Parent; - RightChild = Pivot->Right; - RightLeftChild = RightChild->Left; - - Pivot->Right = RightLeftChild; - if (RightLeftChild != NULL) { - RightLeftChild->Parent = Pivot; - } - RightChild->Parent = Parent; - if (Parent == NULL) { - *NewRoot = RightChild; - } else { - if (Pivot == Parent->Left) { - Parent->Left = RightChild; - } else { - Parent->Right = RightChild; - } - } - RightChild->Left = Pivot; - Pivot->Parent = RightChild; -} - - -/** - Insert (link) a user structure into the tree. - - Read-write operation. - - This function allocates the new tree node with MemoryAllocationLib's - AllocatePool() function. - - @param[in,out] Tree The tree to insert UserStruct into. - - @param[out] Node The meaning of this optional, output-only - parameter depends on the return value of the - function. - - When insertion is successful (RETURN_SUCCESS), - Node is set on output to the new tree node that - now links UserStruct. - - When insertion fails due to lack of memory - (RETURN_OUT_OF_RESOURCES), Node is not changed. - - When insertion fails due to key collision (ie. - another user structure is already in the tree that - compares equal to UserStruct), with return value - RETURN_ALREADY_STARTED, then Node is set on output - to the node that links the colliding user - structure. This enables "find-or-insert" in one - function call, or helps with later removal of the - colliding element. - - @param[in] UserStruct The user structure to link into the tree. - UserStruct is ordered against in-tree user - structures with the Tree->UserStructCompare() - function. - - @retval RETURN_SUCCESS Insertion successful. A new tree node has - been allocated, linking UserStruct. The new - tree node is reported back in Node (if the - caller requested it). - - Existing RED_BLACK_TREE_NODE pointers into - Tree remain valid. For example, on-going - iterations in the caller can continue with - OrderedCollectionNext() / - OrderedCollectionPrev(), and they will - return the new node at some point if user - structure order dictates it. - - @retval RETURN_OUT_OF_RESOURCES AllocatePool() failed to allocate memory for - the new tree node. The tree has not been - changed. Existing RED_BLACK_TREE_NODE - pointers into Tree remain valid. - - @retval RETURN_ALREADY_STARTED A user structure has been found in the tree - that compares equal to UserStruct. The node - linking the colliding user structure is - reported back in Node (if the caller - requested it). The tree has not been - changed. Existing RED_BLACK_TREE_NODE - pointers into Tree remain valid. -**/ -RETURN_STATUS -EFIAPI -OrderedCollectionInsert ( - 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; - - Tmp = Tree->Root; - Parent = NULL; - Result = 0; - - // - // First look for a collision, saving the last examined node for the case - // when there's no collision. - // - while (Tmp != NULL) { - Result = Tree->UserStructCompare (UserStruct, Tmp->UserStruct); - if (Result == 0) { - break; - } - Parent = Tmp; - Tmp = (Result < 0) ? Tmp->Left : Tmp->Right; - } - - if (Tmp != NULL) { - if (Node != NULL) { - *Node = Tmp; - } - Status = RETURN_ALREADY_STARTED; - goto Done; - } - - // - // no collision, allocate a new node - // - Tmp = AllocatePool (sizeof *Tmp); - if (Tmp == NULL) { - Status = RETURN_OUT_OF_RESOURCES; - goto Done; - } - if (Node != NULL) { - *Node = Tmp; - } - - // - // reference the user structure from the node - // - Tmp->UserStruct = UserStruct; - - // - // Link the node as a child to the correct side of the parent. - // If there's no parent, the new node is the root node in the tree. - // - Tmp->Parent = Parent; - Tmp->Left = NULL; - Tmp->Right = NULL; - if (Parent == NULL) { - Tree->Root = Tmp; - Tmp->Color = RedBlackTreeBlack; - Status = RETURN_SUCCESS; - goto Done; - } - if (Result < 0) { - Parent->Left = Tmp; - } else { - Parent->Right = Tmp; - } - Tmp->Color = RedBlackTreeRed; - - // - // Red-black tree properties: - // - // #1 Each node is either red or black (RED_BLACK_TREE_NODE.Color). - // - // #2 Each leaf (ie. a pseudo-node pointed-to by a NULL valued - // RED_BLACK_TREE_NODE.Left or RED_BLACK_TREE_NODE.Right field) is black. - // - // #3 Each red node has two black children. - // - // #4 For any node N, and for any leaves L1 and L2 reachable from N, the - // paths N..L1 and N..L2 contain the same number of black nodes. - // - // #5 The root node is black. - // - // By replacing a leaf with a red node above, only property #3 may have been - // broken. (Note that this is the only edge across which property #3 might - // not hold in the entire tree.) Restore property #3. - // - - NewRoot = Tree->Root; - while (Tmp != NewRoot && Parent->Color == RedBlackTreeRed) { - 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 - // property #3.) - // - // Due to property #5, Tmp's parent cannot be the root node, hence Tmp's - // grandparent exists. - // - // Tmp's grandparent is black, because property #3 is only broken between - // Tmp and Tmp's parent. - // - GrandParent = Parent->Parent; - - if (Parent == GrandParent->Left) { - Uncle = GrandParent->Right; - if (Uncle != NULL && Uncle->Color == RedBlackTreeRed) { - // - // GrandParent (black) - // / \_ - // Parent (red) Uncle (red) - // | - // Tmp (red) - // - - Parent->Color = RedBlackTreeBlack; - Uncle->Color = RedBlackTreeBlack; - GrandParent->Color = RedBlackTreeRed; - - // - // GrandParent (red) - // / \_ - // Parent (black) Uncle (black) - // | - // Tmp (red) - // - // We restored property #3 between Tmp and Tmp's parent, without - // breaking property #4. However, we may have broken property #3 - // between Tmp's grandparent and Tmp's great-grandparent (if any), so - // repeat the loop for Tmp's grandparent. - // - // If Tmp's grandparent has no parent, then the loop will terminate, - // 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; - Parent = Tmp->Parent; - } else { - // - // Tmp's uncle is black (satisfied by the case too when Tmp's uncle is - // NULL, see property #2). - // - - if (Tmp == Parent->Right) { - // - // GrandParent (black): D - // / \_ - // Parent (red): A Uncle (black): E - // \_ - // Tmp (red): B - // \_ - // black: C - // - // Rotate left, pivoting on node A. This keeps the breakage of - // property #3 in the same spot, and keeps other properties intact - // (because both Tmp and its parent are red). - // - Tmp = Parent; - RedBlackTreeRotateLeft (Tmp, &NewRoot); - Parent = Tmp->Parent; - - // - // With the rotation we reached the same configuration as if Tmp had - // been a left child to begin with. - // - // GrandParent (black): D - // / \_ - // Parent (red): B Uncle (black): E - // / \_ - // Tmp (red): A black: C - // - ASSERT (GrandParent == Parent->Parent); - } - - Parent->Color = RedBlackTreeBlack; - GrandParent->Color = RedBlackTreeRed; - - // - // Property #3 is now restored, but we've broken property #4. Namely, - // paths going through node E now see a decrease in black count, while - // paths going through node B don't. - // - // GrandParent (red): D - // / \_ - // Parent (black): B Uncle (black): E - // / \_ - // Tmp (red): A black: C - // - - RedBlackTreeRotateRight (GrandParent, &NewRoot); - - // - // Property #4 has been restored for node E, and preserved for others. - // - // Parent (black): B - // / \_ - // Tmp (red): A [GrandParent] (red): D - // / \_ - // black: C [Uncle] (black): E - // - // This configuration terminates the loop because Tmp's parent is now - // black. - // - } - } else { - // - // Symmetrical to the other branch. - // - Uncle = GrandParent->Left; - if (Uncle != NULL && Uncle->Color == RedBlackTreeRed) { - Parent->Color = RedBlackTreeBlack; - Uncle->Color = RedBlackTreeBlack; - GrandParent->Color = RedBlackTreeRed; - Tmp = GrandParent; - Parent = Tmp->Parent; - } else { - if (Tmp == Parent->Left) { - Tmp = Parent; - RedBlackTreeRotateRight (Tmp, &NewRoot); - Parent = Tmp->Parent; - ASSERT (GrandParent == Parent->Parent); - } - Parent->Color = RedBlackTreeBlack; - GrandParent->Color = RedBlackTreeRed; - RedBlackTreeRotateLeft (GrandParent, &NewRoot); - } - } - } - - NewRoot->Color = RedBlackTreeBlack; - 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). - - This is a convenience shorthand. - - param[in] Node The node to check. Node may be NULL, corresponding to a leaf. - - @return If Node is NULL or colored black. -**/ -BOOLEAN -NodeIsNullOrBlack ( - 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. - - Read-write operation. - - @param[in,out] Tree The tree to delete Node from. - - @param[in] Node The tree node to delete from Tree. The caller is - responsible for ensuring that Node belongs to - Tree, and that Node is non-NULL and valid. Node is - typically an earlier return value, or output - parameter, of: - - - OrderedCollectionFind(), for deleting a node by - user structure key, - - - OrderedCollectionMin() / OrderedCollectionMax(), - for deleting the minimum / maximum node, - - - OrderedCollectionNext() / - OrderedCollectionPrev(), for deleting a node - found during an iteration, - - - OrderedCollectionInsert() with return value - RETURN_ALREADY_STARTED, for deleting a node - whose linked user structure caused collision - during insertion. - - Given a non-empty Tree, Tree->Root is also a valid - Node argument (typically used for simplicity in - loops that empty the tree completely). - - Node is released with MemoryAllocationLib's - FreePool() function. - - Existing RED_BLACK_TREE_NODE pointers (ie. - iterators) *different* from Node remain valid. For - example: - - - OrderedCollectionNext() / - OrderedCollectionPrev() iterations in the caller - can be continued from Node, if - OrderedCollectionNext() or - OrderedCollectionPrev() is called on Node - *before* OrderedCollectionDelete() is. That is, - fetch the successor / predecessor node first, - then delete Node. - - - On-going iterations in the caller that would - have otherwise returned Node at some point, as - dictated by user structure order, will correctly - reflect the absence of Node after - OrderedCollectionDelete() is called - mid-iteration. - - @param[out] UserStruct If the caller provides this optional output-only - parameter, then on output it is set to the user - structure originally linked by Node (which is now - freed). - - This is a convenience that may save the caller a - OrderedCollectionUserStruct() invocation before - calling OrderedCollectionDelete(), in order to - retrieve the user structure being unlinked. -**/ -VOID -EFIAPI -OrderedCollectionDelete ( - 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; - - NewRoot = Tree->Root; - OrigLeftChild = Node->Left, - OrigRightChild = Node->Right, - OrigParent = Node->Parent; - - if (UserStruct != NULL) { - *UserStruct = Node->UserStruct; - } - - // - // After this block, no matter which branch we take: - // - Child will point to the unique (or NULL) original child of the node that - // we will have unlinked, - // - Parent will point to the *position* of the original parent of the node - // that we will have unlinked. - // - 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; - ColorOfUnlinked = Node->Color; - - if (Child != NULL) { - Child->Parent = Parent; - } - if (OrigParent == NULL) { - NewRoot = Child; - } else { - if (Node == OrigParent->Left) { - OrigParent->Left = Child; - } else { - OrigParent->Right = Child; - } - } - } else { - // - // Node has two children. We unlink Node's successor, and then link it into - // Node's place, keeping Node's original color. This preserves ordering - // because: - // - Node's left subtree is less than Node, hence less than Node's - // successor. - // - Node's right subtree is greater than Node. Node's successor is the - // minimum of that subtree, hence Node's successor is less than Node's - // right subtree with its minimum removed. - // - Node's successor is in Node's subtree, hence it falls on the same side - // of Node's parent as Node itself. The relinking doesn't change this - // relation. - // - RED_BLACK_TREE_NODE *ToRelink; - - ToRelink = OrigRightChild; - if (ToRelink->Left == NULL) { - // - // OrigRightChild itself is Node's successor, it has no left child: - // - // OrigParent - // | - // Node: B - // / \_ - // OrigLeftChild: A OrigRightChild: E <--- Parent, ToRelink - // \_ - // F <--- Child - // - Parent = OrigRightChild; - Child = OrigRightChild->Right; - } else { - do { - ToRelink = ToRelink->Left; - } while (ToRelink->Left != NULL); - - // - // Node's successor is the minimum of OrigRightChild's proper subtree: - // - // OrigParent - // | - // Node: B - // / \_ - // OrigLeftChild: A OrigRightChild: E <--- Parent - // / - // C <--- ToRelink - // \_ - // D <--- Child - Parent = ToRelink->Parent; - Child = ToRelink->Right; - - // - // Unlink Node's successor (ie. ToRelink): - // - // OrigParent - // | - // Node: B - // / \_ - // OrigLeftChild: A OrigRightChild: E <--- Parent - // / - // D <--- Child - // - // C <--- ToRelink - // - Parent->Left = Child; - if (Child != NULL) { - Child->Parent = Parent; - } - - // - // We start to link Node's unlinked successor into Node's place: - // - // OrigParent - // | - // Node: B C <--- ToRelink - // / \_ - // OrigLeftChild: A OrigRightChild: E <--- Parent - // / - // D <--- Child - // - // - // - ToRelink->Right = OrigRightChild; - OrigRightChild->Parent = ToRelink; - } - - // - // The rest handles both cases, attaching ToRelink (Node's original - // successor) to OrigLeftChild and OrigParent. - // - // Parent, - // OrigParent ToRelink OrigParent - // | | | - // Node: B | Node: B Parent - // v | - // OrigRightChild: E C <--- ToRelink | - // / \ / \ v - // OrigLeftChild: A F OrigLeftChild: A OrigRightChild: E - // ^ / - // | D <--- Child - // Child - // - ToRelink->Left = OrigLeftChild; - OrigLeftChild->Parent = ToRelink; - - // - // Node's color must be preserved in Node's original place. - // - ColorOfUnlinked = ToRelink->Color; - ToRelink->Color = Node->Color; - - // - // Finish linking Node's unlinked successor into Node's place. - // - // Parent, - // Node: B ToRelink Node: B - // | - // OrigParent | OrigParent Parent - // | v | | - // OrigRightChild: E C <--- ToRelink | - // / \ / \ v - // OrigLeftChild: A F OrigLeftChild: A OrigRightChild: E - // ^ / - // | D <--- Child - // Child - // - ToRelink->Parent = OrigParent; - if (OrigParent == NULL) { - NewRoot = ToRelink; - } else { - if (Node == OrigParent->Left) { - OrigParent->Left = ToRelink; - } else { - OrigParent->Right = ToRelink; - } - } - } - - FreePool (Node); - - // - // If the node that we unlinked from its original spot (ie. Node itself, or - // Node's successor), was red, then we broke neither property #3 nor property - // #4: we didn't create any red-red edge between Child and Parent, and we - // didn't change the black count on any path. - // - if (ColorOfUnlinked == RedBlackTreeBlack) { - // - // However, if the unlinked node was black, then we have to transfer its - // "black-increment" to its unique child (pointed-to by Child), lest we - // break property #4 for its ancestors. - // - // If Child is red, we can simply color it black. If Child is black - // already, we can't technically transfer a black-increment to it, due to - // property #1. - // - // In the following loop we ascend searching for a red node to color black, - // or until we reach the root (in which case we can drop the - // black-increment). Inside the loop body, Child has a black value of 2, - // transitorily breaking property #1 locally, but maintaining property #4 - // globally. - // - // 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; - - if (Child == Parent->Left) { - Sibling = Parent->Right; - // - // Sibling can never be NULL (ie. a leaf). - // - // If Sibling was NULL, then the black count on the path from Parent to - // Sibling would equal Parent's black value, plus 1 (due to property - // #2). Whereas the black count on the path from Parent to any leaf via - // Child would be at least Parent's black value, plus 2 (due to Child's - // black value of 2). This would clash with property #4. - // - // (Sibling can be black of course, but it has to be an internal node. - // Internality allows Sibling to have children, bumping the black - // counts of paths that go through it.) - // - ASSERT (Sibling != NULL); - if (Sibling->Color == RedBlackTreeRed) { - // - // Sibling's red color implies its children (if any), node C and node - // E, are black (property #3). It also implies that Parent is black. - // - // grandparent grandparent - // | | - // Parent,b:B b:D - // / \ / \_ - // Child,2b:A Sibling,r:D ---> Parent,r:B b:E - // /\ /\_ - // b:C b:E Child,2b:A Sibling,b:C - // - Sibling->Color = RedBlackTreeBlack; - Parent->Color = RedBlackTreeRed; - RedBlackTreeRotateLeft (Parent, &NewRoot); - Sibling = Parent->Right; - // - // Same reasoning as above. - // - ASSERT (Sibling != NULL); - } - - // - // Sibling is black, and not NULL. (Ie. Sibling is a black internal - // node.) - // - ASSERT (Sibling->Color == RedBlackTreeBlack); - LeftNephew = Sibling->Left; - RightNephew = Sibling->Right; - if (NodeIsNullOrBlack (LeftNephew) && - 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 - // value 1) becomes red, Child (black value 2) becomes singly-black, - // and Parent will have to be examined if it can eat the - // black-increment. - // - // Sibling is allowed to become red because both of its children are - // black (property #3). - // - // grandparent Parent - // | | - // Parent,x:B Child,x:B - // / \ / \_ - // Child,2b:A Sibling,b:D ---> b:A r:D - // /\ /\_ - // LeftNephew,b:C RightNephew,b:E b:C b:E - // - Sibling->Color = RedBlackTreeRed; - Child = Parent; - Parent = Parent->Parent; - // - // Continue ascending. - // - } else { - // - // At least one nephew is red. - // - if (NodeIsNullOrBlack (RightNephew)) { - // - // Since the right nephew is black, the left nephew is red. Due to - // property #3, LeftNephew has two black children, hence node E is - // black. - // - // Together with the rotation, this enables us to color node F red - // (because property #3 will be satisfied). We flip node D to black - // to maintain property #4. - // - // grandparent grandparent - // | | - // Parent,x:B Parent,x:B - // /\ /\_ - // Child,2b:A Sibling,b:F ---> Child,2b:A Sibling,b:D - // /\ / \_ - // LeftNephew,r:D RightNephew,b:G b:C RightNephew,r:F - // /\ /\_ - // b:C b:E b:E b:G - // - LeftNephew->Color = RedBlackTreeBlack; - Sibling->Color = RedBlackTreeRed; - RedBlackTreeRotateRight (Sibling, &NewRoot); - Sibling = Parent->Right; - RightNephew = Sibling->Right; - // - // These operations ensure that... - // - } - // - // ... RightNephew is definitely red here, plus Sibling is (still) - // black and non-NULL. - // - ASSERT (RightNephew != NULL); - ASSERT (RightNephew->Color == RedBlackTreeRed); - ASSERT (Sibling != NULL); - ASSERT (Sibling->Color == RedBlackTreeBlack); - // - // In this case we can flush the extra black-increment immediately, - // restoring property #1 for Child (node A): we color RightNephew - // (node E) from red to black. - // - // In order to maintain property #4, we exchange colors between - // Parent and Sibling (nodes B and D), and rotate left around Parent - // (node B). The transformation doesn't change the black count - // increase incurred by each partial path, eg. - // - ascending from node A: 2 + x == 1 + 1 + x - // - ascending from node C: y + 1 + x == y + 1 + x - // - ascending from node E: 0 + 1 + x == 1 + x - // - // The color exchange is valid, because even if x stands for red, - // both children of node D are black after the transformation - // (preserving property #3). - // - // grandparent grandparent - // | | - // Parent,x:B x:D - // / \ / \_ - // Child,2b:A Sibling,b:D ---> b:B b:E - // / \ / \_ - // y:C RightNephew,r:E b:A y:C - // - // - Sibling->Color = Parent->Color; - Parent->Color = RedBlackTreeBlack; - RightNephew->Color = RedBlackTreeBlack; - RedBlackTreeRotateLeft (Parent, &NewRoot); - Child = NewRoot; - // - // This terminates the loop. - // - } - } else { - // - // Mirrors the other branch. - // - Sibling = Parent->Left; - ASSERT (Sibling != NULL); - if (Sibling->Color == RedBlackTreeRed) { - Sibling->Color = RedBlackTreeBlack; - Parent->Color = RedBlackTreeRed; - RedBlackTreeRotateRight (Parent, &NewRoot); - Sibling = Parent->Left; - ASSERT (Sibling != NULL); - } - - ASSERT (Sibling->Color == RedBlackTreeBlack); - RightNephew = Sibling->Right; - LeftNephew = Sibling->Left; - if (NodeIsNullOrBlack (RightNephew) && - NodeIsNullOrBlack (LeftNephew)) { - Sibling->Color = RedBlackTreeRed; - Child = Parent; - Parent = Parent->Parent; - } else { - if (NodeIsNullOrBlack (LeftNephew)) { - RightNephew->Color = RedBlackTreeBlack; - Sibling->Color = RedBlackTreeRed; - RedBlackTreeRotateLeft (Sibling, &NewRoot); - 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; - LeftNephew->Color = RedBlackTreeBlack; - RedBlackTreeRotateRight (Parent, &NewRoot); - Child = NewRoot; - } - } - } - - if (Child != NULL) { - Child->Color = RedBlackTreeBlack; - } - } - - Tree->Root = NewRoot; - - if (FeaturePcdGet (PcdValidateOrderedCollection)) { - RedBlackTreeValidate (Tree); - } -} - - -/** - Recursively check the red-black tree properties #1 to #4 on a node. - - @param[in] Node The root of the subtree to validate. - - @retval The black-height of Node's parent. -**/ -UINT32 -RedBlackTreeRecursiveCheck ( - IN CONST RED_BLACK_TREE_NODE *Node - ) -{ - UINT32 LeftHeight; - UINT32 RightHeight; - - // - // property #2 - // - if (Node == NULL) { - return 1; - } - - // - // property #1 - // - ASSERT (Node->Color == RedBlackTreeRed || Node->Color == RedBlackTreeBlack); - - // - // property #3 - // - if (Node->Color == RedBlackTreeRed) { - ASSERT (NodeIsNullOrBlack (Node->Left)); - ASSERT (NodeIsNullOrBlack (Node->Right)); - } - - // - // property #4 - // - 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. - - Read-only operation. - - This function uses the stack for recursion and is not recommended for - "production use". - - @param[in] Tree The tree to validate. -**/ -VOID -RedBlackTreeValidate ( - IN CONST RED_BLACK_TREE *Tree - ) -{ - 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)); - - // - // property #5 - // - ASSERT (NodeIsNullOrBlack (Tree->Root)); - - // - // check the other properties - // - BlackHeight = RedBlackTreeRecursiveCheck (Tree->Root) - 1; - - // - // forward ordering - // - Last = OrderedCollectionMin (Tree); - ForwardCount = (Last != NULL); - for (Node = OrderedCollectionNext (Last); Node != NULL; - Node = OrderedCollectionNext (Last)) { - ASSERT (Tree->UserStructCompare (Last->UserStruct, Node->UserStruct) < 0); - Last = Node; - ++ForwardCount; - } - - // - // backward ordering - // - Last = OrderedCollectionMax (Tree); - BackwardCount = (Last != NULL); - for (Node = OrderedCollectionPrev (Last); Node != NULL; - Node = OrderedCollectionPrev (Last)) { - ASSERT (Tree->UserStructCompare (Last->UserStruct, Node->UserStruct) > 0); - Last = Node; - ++BackwardCount; - } - - ASSERT (ForwardCount == BackwardCount); - - DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p BlackHeight=%Ld Count=%Ld\n", - __FUNCTION__, Tree, (INT64)BlackHeight, (INT64)ForwardCount)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf deleted file mode 100644 index bc4ab56..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf +++ /dev/null @@ -1,51 +0,0 @@ -## @file -# An OrderedCollectionLib instance that provides a red-black tree -# implementation, and allocates and releases tree nodes with -# MemoryAllocationLib. -# -# This library instance is useful when a fast associative container is needed. -# Worst case time complexity is O(log n) for Find(), Next(), Prev(), Min(), -# Max(), Insert(), and Delete(), where "n" is the number of elements in the -# tree. Complete ordered traversal takes O(n) time. -# -# The implementation is also useful as a fast priority queue. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# Copyright (C) 2014, Red Hat, Inc. -# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License that accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR -# IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseOrderedCollectionRedBlackTreeLib - MODULE_UNI_FILE = BaseOrderedCollectionRedBlackTreeLib.uni - FILE_GUID = 699F73C3-0058-484C-A9E5-61189276A985 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = OrderedCollectionLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseOrderedCollectionRedBlackTreeLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - MemoryAllocationLib - -[FeaturePcd] - gEfiMdePkgTokenSpaceGuid.PcdValidateOrderedCollection ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.uni deleted file mode 100644 index 73f1fb4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.uni +++ /dev/null @@ -1,31 +0,0 @@ -// /** @file -// An OrderedCollectionLib instance that provides a red-black tree -// -// implementation, and allocates and releases tree nodes with -// MemoryAllocationLib. -// -// This library instance is useful when a fast associative container is needed. -// Worst case time complexity is O(log n) for Find(), Next(), Prev(), Min(), -// Max(), Insert(), and Delete(), where "n" is the number of elements in the -// tree. Complete ordered traversal takes O(n) time. -// -// The implementation is also useful as a fast priority queue. -// -// Copyright (C) 2014, Red Hat, Inc. -// -// This program and the accompanying materials are licensed and made available -// under the terms and conditions of the BSD License that accompanies this -// distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR -// IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "An OrderedCollectionLib instance that provides a red-black tree implementation." - -#string STR_MODULE_DESCRIPTION #language en-US "An OrderedCollectionLib instance that provides a red-black tree implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf deleted file mode 100644 index abc8680..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# Instance of PCD Library without support of dynamic PCD entries. -# -# PCD Library that only provides access to Feature Flag, Fixed At Build, -# and Binary Patch typed PCD entries. Access to Dynamic PCD entries is ignored. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePcdLibNull - MODULE_UNI_FILE = BasePcdLibNull.uni - FILE_GUID = 40096a3a-5c2a-4fbc-aef7-5475dd7ab334 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PcdLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PcdLib.c - -[LibraryClasses] - DebugLib - BaseMemoryLib - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.uni deleted file mode 100644 index a51c8bd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PCD Library without support of dynamic PCD entries. -// -// PCD Library that only provides access to Feature Flag, Fixed At Build, -// and Binary Patch typed PCD entries. Access to Dynamic PCD entries is ignored. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCD Library without support of dynamic PCD entries" - -#string STR_MODULE_DESCRIPTION #language en-US "PCD Library that only provides access to Feature Flag, Fixed At Build, and Binary Patch typed PCD entries. Access to Dynamic PCD entries is ignored." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c deleted file mode 100644 index 907aeed..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ /dev/null @@ -1,1480 +0,0 @@ -/** @file - A emptry template implementation of PCD Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include - - -/** - This function provides a means by which SKU support can be established in the PCD infrastructure. - - Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. - - @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and - set values associated with a PCD token. - - @return Return the SKU ID that just be set. - -**/ -UINTN -EFIAPI -LibPcdSetSku ( - IN UINTN SkuId - ) -{ - ASSERT (FALSE); - - return 0; -} - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 8-bit value for the token specified by TokenNumber. - -**/ -UINT8 -EFIAPI -LibPcdGet8 ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 16-bit value for the token specified by TokenNumber. - -**/ -UINT16 -EFIAPI -LibPcdGet16 ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 32-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 32-bit value for the token specified by TokenNumber. - -**/ -UINT32 -EFIAPI -LibPcdGet32 ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 64-bit value for the token specified by TokenNumber. - -**/ -UINT64 -EFIAPI -LibPcdGet64 ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the pointer to the buffer of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the pointer to the token specified by TokenNumber. - -**/ -VOID * -EFIAPI -LibPcdGetPtr ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the Boolean value of the token specified by TokenNumber. - -**/ -BOOLEAN -EFIAPI -LibPcdGetBool ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve the size of a given PCD token. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the size of the token specified by TokenNumber. - -**/ -UINTN -EFIAPI -LibPcdGetSize ( - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT8. - -**/ -UINT8 -EFIAPI -LibPcdGetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT16. - -**/ -UINT16 -EFIAPI -LibPcdGetEx16 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - Returns the 32-bit value for the token specified by TokenNumber and Guid. - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT32. - -**/ -UINT32 -EFIAPI -LibPcdGetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT64. - -**/ -UINT64 -EFIAPI -LibPcdGetEx64 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the pointer to the buffer of token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the VOID* pointer. - -**/ -VOID * -EFIAPI -LibPcdGetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the BOOLEAN. - -**/ -BOOLEAN -EFIAPI -LibPcdGetExBool ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to retrieve the size of a given PCD token. - - Returns the size of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the size. - -**/ -UINTN -EFIAPI -LibPcdGetExSize ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSet8 ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSet16 ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSet32 ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSet64 ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value - specified by Buffer and SizeOfBuffer. Buffer is returned. - If SizeOfBuffer is greater than the maximum size support by TokenNumber, - then set SizeOfBuffer to the maximum size supported by TokenNumber and - return NULL to indicate that the set operation was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and NULL must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pointer for the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetPtr ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (FALSE); - - return NULL; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetBool ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (FALSE); - - return FALSE; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSetEx16 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSetEx64 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size - supported by TokenNumber and return NULL to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pinter to the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); - - return NULL; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The Boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetExBool ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (FALSE); - - return FALSE; -} -#endif - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet8S ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet16S ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet32S ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet64S ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetPtrS ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetBoolS ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx8S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx16S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx32S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx64S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid Pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExPtrS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExBoolS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (FALSE); - - return RETURN_INVALID_PARAMETER; -} - -/** - Set up a notification function that is called when a specified token is set. - - When the token specified by TokenNumber and Guid is set, - then notification function specified by NotificationFunction is called. - If Guid is NULL, then the default token space is used. - - If NotificationFunction is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates which - namespace to set a value from. If NULL, then the default - token space is used. - @param[in] TokenNumber The PCD token number to monitor. - @param[in] NotificationFunction The function to call when the token - specified by Guid and TokenNumber is set. - -**/ -VOID -EFIAPI -LibPcdCallbackOnSet ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - ASSERT (FALSE); -} - - - -/** - Disable a notification function that was established with LibPcdCallbackonSet(). - - Disable a notification function that was previously established with LibPcdCallbackOnSet(). - - If NotificationFunction is NULL, then ASSERT(). - If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, - and NotificationFunction, then ASSERT(). - - @param[in] Guid Specify the GUID token space. - @param[in] TokenNumber Specify the token number. - @param[in] NotificationFunction The callback function to be unregistered. - -**/ -VOID -EFIAPI -LibPcdCancelCallback ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - ASSERT (FALSE); -} - - - -/** - Retrieves the next token in a token space. - - Retrieves the next PCD token number from the token space specified by Guid. - If Guid is NULL, then the default token space is used. If TokenNumber is 0, - then the first token number is returned. Otherwise, the token number that - follows TokenNumber in the token space is returned. If TokenNumber is the last - token number in the token space, then 0 is returned. - - If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates which namespace - to set a value from. If NULL, then the default token space is used. - @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD - token number. - - @return The next valid token number. - -**/ -UINTN -EFIAPI -LibPcdGetNextToken ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber - ) -{ - ASSERT (FALSE); - - return 0; -} - - - -/** - Used to retrieve the list of available PCD token space GUIDs. - - Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces - in the platform. - If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned. - If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned. - - @param TokenSpaceGuid The pointer to a PCD token space GUID. - - @return The next valid token namespace. - -**/ -GUID * -EFIAPI -LibPcdGetNextTokenSpace ( - IN CONST GUID *TokenSpaceGuid - ) -{ - ASSERT (FALSE); - - return NULL; -} - - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer that was set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtr ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return (VOID *) Buffer; -} - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrS ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return RETURN_SUCCESS; -} - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtrAndSize ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return (VOID *) Buffer; -} - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrAndSizeS ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return RETURN_SUCCESS; -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the default token space specified, then ASSERT(). - - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfo ( - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - ASSERT (FALSE); -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfoEx ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - ASSERT (FALSE); -} - -/** - Retrieve the currently set SKU Id. - - @return The currently set SKU Id. If the platform has not set at a SKU Id, then the - default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU - Id is returned. -**/ -UINTN -EFIAPI -LibPcdGetSku ( - VOID - ) -{ - ASSERT (FALSE); - - return 0; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf deleted file mode 100644 index dbddf8d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# Instance of PCI CF8 Library using I/O ports 0xCF8 and 0xCFC. -# -# PCI CF8 Library that uses I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles. -# Layers on top of an I/O Library instance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciCf8Lib - MODULE_UNI_FILE = BasePciCf8Lib.uni - FILE_GUID = 472ab06d-9810-4c00-bb7f-dad1828fc1ab - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciCf8Lib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciCf8Lib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - IoLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.uni deleted file mode 100644 index 6e44ffd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PCI CF8 Library using I/O ports 0xCF8 and 0xCFC. -// -// PCI CF8 Library that uses I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles. -// Layers on top of an I/O Library instance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI CF8 Library using I/O ports 0xCF8 and 0xCFC" - -#string STR_MODULE_DESCRIPTION #language en-US "PCI CF8 Library that uses I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles. Layers on top of an I/O Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c deleted file mode 100644 index 5e2239b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c +++ /dev/null @@ -1,1784 +0,0 @@ -/** @file - PCI CF8 Library functions that use I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles. - Layers on top of an I/O Library instance. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -// -// Declare I/O Ports used to perform PCI Confguration Cycles -// -#define PCI_CONFIGURATION_ADDRESS_PORT 0xCF8 -#define PCI_CONFIGURATION_DATA_PORT 0xCFC - -/** - Convert a PCI Library address to PCI CF8 formatted address. - - Declare macro to convert PCI Library address to PCI CF8 formatted address. - Bit fields of PCI Library and CF8 formatted address is as follows: - PCI Library formatted address CF8 Formatted Address - ============================= ====================== - Bits 00..11 Register Bits 00..07 Register - Bits 12..14 Function Bits 08..10 Function - Bits 15..19 Device Bits 11..15 Device - Bits 20..27 Bus Bits 16..23 Bus - Bits 28..31 Reserved(MBZ) Bits 24..30 Reserved(MBZ) - Bits 31..31 Must be 1 - - @param A The address to convert. - - @retval The coverted address. - -**/ -#define PCI_TO_CF8_ADDRESS(A) \ - ((UINT32) ((((A) >> 4) & 0x00ffff00) | ((A) & 0xfc) | 0x80000000)) - -/** - Assert the validity of a PCI CF8 address. A valid PCI CF8 address should contain 1's - only in the low 28 bits, excluding bits 08..11. - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A,M) \ - ASSERT (((A) & (~0xffff0ff | (M))) == 0) - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciCf8RegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - return RETURN_SUCCESS; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8Read8 ( - IN UINTN Address - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8Write8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8Or8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8And8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8AndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - AndData, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8BitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8BitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8BitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8BitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciCf8BitFieldAndThenOr8( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT8 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - AndData, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8Read16 ( - IN UINTN Address - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8Write16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8Or16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8And16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8AndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - AndData, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8BitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8BitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8BitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8BitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciCf8BitFieldAndThenOr16( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT16 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - InterruptState = SaveAndDisableInterrupts (); - 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), - StartBit, - EndBit, - AndData, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8Read32 ( - IN UINTN Address - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - 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); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8Write32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoWrite32 ( - PCI_CONFIGURATION_DATA_PORT, - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8Or32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoOr32 ( - PCI_CONFIGURATION_DATA_PORT, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8And32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoAnd32 ( - PCI_CONFIGURATION_DATA_PORT, - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8AndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoAndThenOr32 ( - PCI_CONFIGURATION_DATA_PORT, - AndData, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8BitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoBitFieldRead32 ( - PCI_CONFIGURATION_DATA_PORT, - StartBit, - EndBit - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8BitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoBitFieldWrite32 ( - PCI_CONFIGURATION_DATA_PORT, - StartBit, - EndBit, - Value - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8BitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoBitFieldOr32 ( - PCI_CONFIGURATION_DATA_PORT, - StartBit, - EndBit, - OrData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8BitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); - Result = IoBitFieldAnd32 ( - PCI_CONFIGURATION_DATA_PORT, - StartBit, - EndBit, - AndData - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If the register specified by Address >= 0x100, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciCf8BitFieldAndThenOr32( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - BOOLEAN InterruptState; - UINT32 AddressPort; - UINT32 Result; - - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - InterruptState = SaveAndDisableInterrupts (); - 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 - ); - IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); - SetInterruptState (InterruptState); - return Result; -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If the register specified by StartAddress >= 0x100, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size read from StartAddress. - -**/ -UINTN -EFIAPI -PciCf8ReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); - - 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 = PciCf8Read8 (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) PciCf8Read16 (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) PciCf8Read32 (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) PciCf8Read16 (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 = PciCf8Read8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If the register specified by StartAddress >= 0x100, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciCf8WriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); - - 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 - // - PciCf8Write8 (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 - // - PciCf8Write16 (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 - // - PciCf8Write32 (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 - // - PciCf8Write16 (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 - // - PciCf8Write8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf deleted file mode 100644 index 9f8cc48..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf +++ /dev/null @@ -1,46 +0,0 @@ -## @file -# Instance of PCI Express Library using the 256 MB PCI Express MMIO window. -# -# PCI Express Library that uses the 256 MB PCI Express MMIO window to perform -# PCI Configuration cycles. Layers on top of an I/O Library instance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciExpressLib - MODULE_UNI_FILE = BasePciExpressLib.uni - FILE_GUID = 287e50f4-a188-4699-b907-3e4080ca5688 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciExpressLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciExpressLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - DebugLib - IoLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.uni deleted file mode 100644 index b04bd0e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PCI Express Library using the 256 MB PCI Express MMIO window. -// -// PCI Express Library that uses the 256 MB PCI Express MMIO window to perform -// PCI Configuration cycles. Layers on top of an I/O Library instance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI Express Library using the 256 MB PCI Express MMIO window" - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Express Library that uses the 256 MB PCI Express MMIO window to perform PCI Configuration cycles. Layers on top of an I/O Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/PciExpressLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/PciExpressLib.c deleted file mode 100644 index cd34bf4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciExpressLib/PciExpressLib.c +++ /dev/null @@ -1,1419 +0,0 @@ -/** @file - Functions in this library instance make use of MMIO functions in IoLib to - access memory mapped PCI configuration space. - - All assertions for I/O operations are handled in MMIO functions in the IoLib - Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include -#include - - -/** - Assert the validity of a PCI address. A valid PCI address should contain 1's - only in the low 28 bits. - - @param A The address to validate. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A) \ - ASSERT (((A) & ~0xfffffff) == 0) - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration - registers associated with that PCI device may be accessed after SetVirtualAddressMap() - is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciExpressRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return RETURN_UNSUPPORTED; -} - -/** - Gets the base address of PCI Express. - - This internal functions retrieves PCI Express Base Address via a PCD entry - PcdPciExpressBaseAddress. - - @return The base address of PCI Express. - -**/ -VOID* -GetPciExpressBaseAddress ( - VOID - ) -{ - return (VOID*)(UINTN) PcdGet64 (PcdPciExpressBaseAddress); -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressRead8 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioRead8 ((UINTN) GetPciExpressBaseAddress () + Address); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioWrite8 ((UINTN) GetPciExpressBaseAddress () + Address, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioOr8 ((UINTN) GetPciExpressBaseAddress () + Address, OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAnd8 ((UINTN) GetPciExpressBaseAddress () + Address, AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAndThenOr8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldRead8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldWrite8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldOr8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAnd8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAndThenOr8 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressRead16 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioRead16 ((UINTN) GetPciExpressBaseAddress () + Address); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioWrite16 ((UINTN) GetPciExpressBaseAddress () + Address, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioOr16 ((UINTN) GetPciExpressBaseAddress () + Address, OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAnd16 ((UINTN) GetPciExpressBaseAddress () + Address, AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAndThenOr16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldRead16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldWrite16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldOr16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAnd16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAndThenOr16 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressRead32 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioRead32 ((UINTN) GetPciExpressBaseAddress () + Address); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioWrite32 ((UINTN) GetPciExpressBaseAddress () + Address, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioOr32 ((UINTN) GetPciExpressBaseAddress () + Address, OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAnd32 ((UINTN) GetPciExpressBaseAddress () + Address, AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioAndThenOr32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldRead32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldWrite32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldOr32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAnd32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return MmioBitFieldAndThenOr32 ( - (UINTN) GetPciExpressBaseAddress () + Address, - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size read data from StartAddress. - -**/ -UINTN -EFIAPI -PciExpressReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - 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; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciExpressWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - 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/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf deleted file mode 100644 index 2afc1dc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file -# Instance of PCI Library based on PCI CF8 Library. -# -# PCI Library that uses I/O ports 0xCF8 and 0xCFC to perform -# PCI Configuration cycles. Layers on top of one PCI CF8 Library instance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciLibCf8 - MODULE_UNI_FILE = BasePciLibCf8.uni - FILE_GUID = 28bde99c-e8a7-4e3e-9a8a-e66cd64f31c6 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PciCf8Lib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.uni deleted file mode 100644 index 1f1e5fd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PCI Library based on PCI CF8 Library. -// -// PCI Library that uses I/O ports 0xCF8 and 0xCFC to perform -// PCI Configuration cycles. Layers on top of one PCI CF8 Library instance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI Library based on PCI CF8 Library" - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Library that uses I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles. Layers on top of one PCI CF8 Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/PciLib.c deleted file mode 100644 index 47aa21a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibCf8/PciLib.c +++ /dev/null @@ -1,1138 +0,0 @@ -/** @file - PCI Library functions that use I/O ports 0xCF8 and 0xCFC to perform - PCI Configuration cycles. Layers on top of one PCI CF8 Library instance. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - return PciCf8RegisterForRuntimeAccess (Address); -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciRead8 ( - IN UINTN Address - ) -{ - return PciCf8Read8 (Address); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return PciCf8Write8 (Address, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return PciCf8Or8 (Address, OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return PciCf8And8 (Address, AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciCf8AndThenOr8 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciCf8BitFieldRead8 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciCf8BitFieldWrite8 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciCf8BitFieldOr8 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciCf8BitFieldAnd8 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciCf8BitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciRead16 ( - IN UINTN Address - ) -{ - return PciCf8Read16 (Address); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return PciCf8Write16 (Address, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return PciCf8Or16 (Address, OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return PciCf8And16 (Address, AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciCf8AndThenOr16 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciCf8BitFieldRead16 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciCf8BitFieldWrite16 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciCf8BitFieldOr16 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciCf8BitFieldAnd16 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciCf8BitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciRead32 ( - IN UINTN Address - ) -{ - return PciCf8Read32 (Address); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return PciCf8Write32 (Address, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return PciCf8Or32 (Address, OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return PciCf8And32 (Address, AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciCf8AndThenOr32 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciCf8BitFieldRead32 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciCf8BitFieldWrite32 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciCf8BitFieldOr32 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciCf8BitFieldAnd32 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciCf8BitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - return PciCf8ReadBuffer (StartAddress, Size, Buffer); -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - return PciCf8WriteBuffer (StartAddress, Size, Buffer); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf deleted file mode 100644 index d223a1d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# Instance of PCI Library based on PCI Express Library. -# -# PCI Library that uses the 256 MB PCI Express MMIO window to perform PCI -# Configuration cycles. Layers on one PCI Express Library instance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciLibPciExpress - MODULE_UNI_FILE = BasePciLibPciExpress.uni - FILE_GUID = 8987081e-daeb-44a9-8bef-a195b22d9417 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - PciLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PciExpressLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.uni deleted file mode 100644 index a811604..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PCI Library based on PCI Express Library. -// -// PCI Library that uses the 256 MB PCI Express MMIO window to perform PCI -// Configuration cycles. Layers on one PCI Express Library instance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI Library based on PCI Express Library" - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Library that uses the 256 MB PCI Express MMIO window to perform PCI Configuration cycles. Layers on an PCI Express Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/PciLib.c deleted file mode 100644 index 74657b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciLibPciExpress/PciLib.c +++ /dev/null @@ -1,1138 +0,0 @@ -/** @file - PCI Library functions that use the 256 MB PCI Express MMIO window to perform PCI - Configuration cycles. Layers on PCI Express Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - return PciExpressRegisterForRuntimeAccess (Address); -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciRead8 ( - IN UINTN Address - ) -{ - return PciExpressRead8 (Address); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return PciExpressWrite8 (Address, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return PciExpressOr8 (Address, OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return PciExpressAnd8 (Address, AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciExpressAndThenOr8 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciExpressBitFieldRead8 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciExpressBitFieldWrite8 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciExpressBitFieldOr8 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciExpressBitFieldAnd8 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciExpressBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciRead16 ( - IN UINTN Address - ) -{ - return PciExpressRead16 (Address); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return PciExpressWrite16 (Address, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return PciExpressOr16 (Address, OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return PciExpressAnd16 (Address, AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciExpressAndThenOr16 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciExpressBitFieldRead16 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciExpressBitFieldWrite16 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciExpressBitFieldOr16 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciExpressBitFieldAnd16 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciExpressBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciRead32 ( - IN UINTN Address - ) -{ - return PciExpressRead32 (Address); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return PciExpressWrite32 (Address, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return PciExpressOr32 (Address, OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return PciExpressAnd32 (Address, AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciExpressAndThenOr32 (Address, AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return PciExpressBitFieldRead32 (Address, StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciExpressBitFieldWrite32 (Address, StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciExpressBitFieldOr32 (Address, StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciExpressBitFieldAnd32 (Address, StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciExpressBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - return PciExpressReadBuffer (StartAddress, Size, Buffer); -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - return PciExpressWriteBuffer (StartAddress, Size, Buffer); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf deleted file mode 100644 index c280f84..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# Instance of PCI SegmentInfo Library. -# -# Default PCI Segment Information Library that shouldn't be used by real platform. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciSegmentInfoLibNull - MODULE_UNI_FILE = BasePciSegmentInfoLibNull.uni - FILE_GUID = 36B28584-C6AE-4B1B-A473-A51618EE525A - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentInfoLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciSegmentInfoLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PcdLib - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni deleted file mode 100644 index 25e8cce..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni +++ /dev/null @@ -1,20 +0,0 @@ -// /** @file -// Instance of PCI SegmentInfo Library. -// -// Default PCI Segment Information Library that shouldn't be used by real platform. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Default instance of PCI SegmentInfo Library." - -#string STR_MODULE_DESCRIPTION #language en-US "Default PCI Segment Information Library that shouldn't be used by real platform." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c deleted file mode 100644 index 36a7a3b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - Default PCI Segment Information Library that returns one segment whose - segment base address equals to PcdPciExpressBaseAddress. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Return an array of PCI_SEGMENT_INFO holding the segment information. - - Note: The returned array/buffer is owned by callee. - - @param Count Return the count of segments. - - @retval A callee owned array holding the segment information. -**/ -PCI_SEGMENT_INFO * -GetPciSegmentInfo ( - UINTN *Count - ) -{ - ASSERT (FALSE); - *Count = 0; - return NULL; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf deleted file mode 100644 index 6586b85..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# Instance of PCI Segment Library based on PCI Library. -# -# PCI Segment Library that layers on top of the PCI Library which only -# supports segment 0 PCI configuration access. -# -# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciSegmentLibPci - MODULE_UNI_FILE = BasePciSegmentLibPci.uni - FILE_GUID = AABF95D6-F40C-405F-8360-6A59794B8040 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciSegmentLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - PciLib - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.uni deleted file mode 100644 index b6d4ef6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of PCI Segment Library based on PCI Library. -// -// PCI Segment Library that layers on top of the PCI Library which only -// supports segment 0 PCI configuration access. -// -// Copyright (c) 2016, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI Segment Library based on PCI Library." - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Segment Library that layers on top of the PCI Library which only supports segment 0 PCI configuration access." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c deleted file mode 100644 index 735d598..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c +++ /dev/null @@ -1,1290 +0,0 @@ -/** @file - PCI Segment Library that layers on top of the PCI Library which only - supports segment 0 PCI configuration access. - - Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include - -/** - Assert the validity of a PCI Segment address. - A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 - and the segment should be 0. - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ - ASSERT (((A) & (0xfffffffff0000000ULL | (M))) == 0) - -/** - Convert the PCI Segment library address to PCI library address. - - @param A The address to convert. -**/ -#define PCI_SEGMENT_TO_PCI_ADDRESS(A) ((UINTN) (UINT32) A) - -/** - Register a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - If any reserved bits in Address are set, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciSegmentRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - return PciRegisterForRuntimeAccess (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 8-bit PCI configuration register specified by Address. - -**/ -UINT8 -EFIAPI -PciSegmentRead8 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return PciRead8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentWrite8 ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentOr8 ( - IN UINT64 Address, - IN UINT8 OrData - ) -{ - return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8) (PciSegmentRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAnd8 ( - IN UINT64 Address, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, - followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAndThenOr8 ( - IN UINT64 Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldRead8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldWrite8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldWrite8 (PciSegmentRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldOr8 (PciSegmentRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAnd8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAnd8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAndThenOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAndThenOr8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 16-bit PCI configuration register specified by Address. - -**/ -UINT16 -EFIAPI -PciSegmentRead16 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return PciRead16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -PciSegmentWrite16 ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return PciWrite16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentOr16 ( - IN UINT64 Address, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAnd16 ( - IN UINT64 Address, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, - followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAndThenOr16 ( - IN UINT64 Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldRead16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldWrite16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldWrite16 (PciSegmentRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldOr16 (PciSegmentRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAnd16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAnd16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAndThenOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAndThenOr16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 32-bit PCI configuration register specified by Address. - -**/ -UINT32 -EFIAPI -PciSegmentRead32 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return PciRead32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT32 -EFIAPI -PciSegmentWrite32 ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return PciWrite32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentOr32 ( - IN UINT64 Address, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAnd32 ( - IN UINT64 Address, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, - followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAndThenOr32 ( - IN UINT64 Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldRead32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldWrite32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldWrite32 (PciSegmentRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldOr32 (PciSegmentRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - - Reads the 32-bit PCI configuration register specified by Address, performs a bitwise - AND between the read result and the value specified by AndData, and writes the result - to the 32-bit PCI configuration register specified by Address. The value written to - the PCI configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in AndData are stripped. - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAnd32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAnd32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAndThenOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAndThenOr32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciSegmentReadBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciSegmentRead16 (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 = PciSegmentRead8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return The parameter of Size. - -**/ -UINTN -EFIAPI -PciSegmentWriteBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*) Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*) Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*) Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf deleted file mode 100644 index 9195f94..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf +++ /dev/null @@ -1,38 +0,0 @@ -## @file -# Null PE/Coff Extra Action library instances with empty functions. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeCoffExtraActionLibNull - MODULE_UNI_FILE = PeCoffExtraActionLibNull.uni - FILE_GUID = 0EB84DA1-267A-40b4-8347-1F48694C8B47 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeCoffExtraActionLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PeCoffExtraActionLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLib.c deleted file mode 100644 index b4cdebc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLib.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Null PE/Coff Extra Action library instances with empty functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Performs additional actions after a PE/COFF image has been loaded and relocated. - - If ImageContext is NULL, then ASSERT(). - - @param ImageContext The pointer to the image context structure that describes the - PE/COFF image that has already been loaded and relocated. - -**/ -VOID -EFIAPI -PeCoffLoaderRelocateImageExtraAction ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext - ) -{ - ASSERT (ImageContext != NULL); -} - -/** - Performs additional actions just before a PE/COFF image is unloaded. Any resources - that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed. - - If ImageContext is NULL, then ASSERT(). - - @param ImageContext The pointer to the image context structure that describes the - PE/COFF image that is being unloaded. - -**/ -VOID -EFIAPI -PeCoffLoaderUnloadImageExtraAction ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext - ) -{ - ASSERT (ImageContext != NULL); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLibNull.uni deleted file mode 100644 index 27af386..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffExtraActionLibNull/PeCoffExtraActionLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Null PE/Coff Extra Action library instances with empty functions. -// -// Null PE/Coff Extra Action library instances with empty functions. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Null PE/Coff Extra Action library instances with empty functions" - -#string STR_MODULE_DESCRIPTION #language en-US "Null PE/Coff Extra Action library instances with empty functions." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf deleted file mode 100644 index bea61c2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file -# PE/COFF Entry Point Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePeCoffGetEntryPointLib - MODULE_UNI_FILE = BasePeCoffGetEntryPointLib.uni - FILE_GUID = be490364-73d2-420d-950e-f6450ca75dfb - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeCoffGetEntryPointLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PeCoffGetEntryPoint.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.uni deleted file mode 100644 index a94dac8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// PE/COFF Entry Point Library implementation. -// -// PE/COFF Entry Point Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PE/COFF Entry Point Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "PE/COFF Entry Point Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c deleted file mode 100644 index 13b3f45..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c +++ /dev/null @@ -1,388 +0,0 @@ -/** @file - Provides the services to get the entry point to a PE/COFF image that has either been - loaded into memory or is executing at it's linked address. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include - -#include - -#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 - into system memory with the PE/COFF Loader Library functions. - - Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry - point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then - return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS. - If Pe32Data is NULL, then ASSERT(). - If EntryPoint is NULL, then ASSERT(). - - @param Pe32Data The pointer to the PE/COFF image that is loaded in system memory. - @param EntryPoint The pointer to entry point to the PE/COFF image to return. - - @retval RETURN_SUCCESS EntryPoint was returned. - @retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image. - -**/ -RETURN_STATUS -EFIAPI -PeCoffLoaderGetEntryPoint ( - IN VOID *Pe32Data, - OUT VOID **EntryPoint - ) -{ - EFI_IMAGE_DOS_HEADER *DosHdr; - EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; - - ASSERT (Pe32Data != NULL); - ASSERT (EntryPoint != NULL); - - 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 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff)); - } else { - // - // DOS image header is not present, so PE header is at the image base. - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; - } - - // - // Calculate the entry point relative to the start of the image. - // 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); - return RETURN_SUCCESS; - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - *EntryPoint = (VOID *)((UINTN)Pe32Data + (UINTN)(Hdr.Pe32->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff)); - return RETURN_SUCCESS; - } - - return RETURN_UNSUPPORTED; -} - - -/** - Returns the machine type of a PE/COFF image. - - Returns the machine type from the PE/COFF image specified by Pe32Data. - If Pe32Data is NULL, then ASSERT(). - - @param Pe32Data The pointer to the PE/COFF image that is loaded in system - memory. - - @return Machine type or zero if not a valid image. - -**/ -UINT16 -EFIAPI -PeCoffLoaderGetMachineType ( - IN VOID *Pe32Data - ) -{ - EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; - EFI_IMAGE_DOS_HEADER *DosHdr; - - ASSERT (Pe32Data != NULL); - - 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 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff)); - } else { - // - // DOS image header is not present, so PE header is at the image base. - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; - } - - if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { - return Hdr.Te->Machine; - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - return Hdr.Pe32->FileHeader.Machine; - } - - return 0x0000; -} - -/** - Returns a pointer to the PDB file name for a PE/COFF image that has been - loaded into system memory with the PE/COFF Loader Library functions. - - Returns the PDB file name for the PE/COFF image specified by Pe32Data. If - the PE/COFF image specified by Pe32Data is not a valid, then NULL is - returned. If the PE/COFF image specified by Pe32Data does not contain a - debug directory entry, then NULL is returned. If the debug directory entry - in the PE/COFF image specified by Pe32Data does not contain a PDB file name, - then NULL is returned. - If Pe32Data is NULL, then ASSERT(). - - @param Pe32Data The pointer to the PE/COFF image that is loaded in system - memory. - - @return The PDB file name for the PE/COFF image specified by Pe32Data or NULL - if it cannot be retrieved. - -**/ -VOID * -EFIAPI -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; - - ASSERT (Pe32Data != NULL); - - TEImageAdjust = 0; - DirectoryEntry = NULL; - DebugEntry = NULL; - NumberOfRvaAndSizes = 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 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff)); - } else { - // - // DOS image header is not present, so PE header is at the image base. - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; - } - - 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); - } - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - // - // NOTE: We use Machine field to identify PE32/PE32+, instead of Magic. - // It is due to backward-compatibility, for some system might - // 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; - } - - if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // 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); - } 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); - } - - if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) { - DirectoryEntry = NULL; - DebugEntry = NULL; - } - } else { - return NULL; - } - - if (DebugEntry == NULL || DirectoryEntry == NULL) { - return NULL; - } - - // - // Scan the directory to find the debug entry. - // - for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) { - if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { - if (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; - } - } - } - } - - return NULL; -} - -/** - Returns the size of the PE/COFF headers - - Returns the size of the PE/COFF header specified by Pe32Data. - If Pe32Data is NULL, then ASSERT(). - - @param Pe32Data The pointer to the PE/COFF image that is loaded in system - memory. - - @return Size of PE/COFF header in bytes or zero if not a valid image. - -**/ -UINT32 -EFIAPI -PeCoffGetSizeOfHeaders ( - IN VOID *Pe32Data - ) -{ - EFI_IMAGE_DOS_HEADER *DosHdr; - EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; - UINTN SizeOfHeaders; - - ASSERT (Pe32Data != NULL); - - 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 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff)); - } else { - // - // DOS image header is not present, so PE header is at the image base. - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; - } - - if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { - SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize; - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders; - } else { - SizeOfHeaders = 0; - } - - return (UINT32) SizeOfHeaders; -} - -/** - Returns PE/COFF image base is loaded in system memory where the input address is in. - - On DEBUG build, searches the PE/COFF image base forward the input address and - returns it. - - @param Address Address located in one PE/COFF image. - - @retval 0 RELEASE build or cannot find the PE/COFF image base. - @retval others PE/COFF image base found. - -**/ -UINTN -EFIAPI -PeCoffSearchImageBase ( - IN UINTN Address - ) -{ - UINTN Pe32Data; - - Pe32Data = 0; - - DEBUG_CODE ( - 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)) - ) { - break; - } - } - - // - // Not found the image base, check the previous aligned address - // - Pe32Data -= PE_COFF_IMAGE_ALIGN_SIZE; - } - ); - - return Pe32Data; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c deleted file mode 100644 index ad24eb4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c +++ /dev/null @@ -1,250 +0,0 @@ -/** @file - Specific relocation fixups for ARM architecture. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BasePeCoffLibInternals.h" -#include - - -/** - Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and - return the immediate data encoded in the instruction. - - @param Instruction Pointer to ARM MOVT or MOVW immediate instruction - - @return Immediate address encoded in the instruction - -**/ -UINT16 -ThumbMovtImmediateAddress ( - IN UINT16 *Instruction - ) -{ - UINT32 Movt; - UINT16 Address; - - // Thumb2 is two 16-bit instructions working together. Not a single 32-bit instruction - // Example MOVT R0, #0 is 0x0000f2c0 or 0xf2c0 0x0000 - Movt = (*Instruction << 16) | (*(Instruction + 1)); - - // imm16 = imm4:i:imm3:imm8 - // imm4 -> Bit19:Bit16 - // i -> Bit26 - // imm3 -> Bit14:Bit12 - // imm8 -> Bit7:Bit0 - Address = (UINT16)(Movt & 0x000000ff); // imm8 - Address |= (UINT16)((Movt >> 4) & 0x0000f700); // imm4 imm3 - Address |= (((Movt & BIT26) != 0) ? BIT11 : 0); // i - return Address; -} - - -/** - Update an ARM MOVT or MOVW immediate instruction immediate data. - - @param Instruction Pointer to ARM MOVT or MOVW immediate instruction - @param Address New addres to patch into the instruction -**/ -VOID -ThumbMovtImmediatePatch ( - IN OUT UINT16 *Instruction, - IN UINT16 Address - ) -{ - UINT16 Patch; - - // First 16-bit chunk of instruciton - Patch = ((Address >> 12) & 0x000f); // imm4 - Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i - // Mask out instruction bits and or in address - *(Instruction) = (*Instruction & ~0x040f) | Patch; - - // Second 16-bit chunk of instruction - Patch = Address & 0x000000ff; // imm8 - Patch |= ((Address << 4) & 0x00007000); // imm3 - // Mask out instruction bits and or in address - Instruction++; - *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. - - @param Instructions Pointer to ARM MOVW/MOVT insturction pair - - @return Immediate address encoded in the instructions - -**/ -UINT32 -ThumbMovwMovtImmediateAddress ( - IN UINT16 *Instructions - ) -{ - UINT16 *Word; - UINT16 *Top; - - Word = Instructions; // MOVW - Top = Word + 2; // MOVT - - return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word); -} - - -/** - Update an ARM MOVW/MOVT immediate instruction instruction pair. - - @param Instructions Pointer to ARM MOVW/MOVT instruction pair - @param Address New addres to patch into the instructions -**/ -VOID -ThumbMovwMovtImmediatePatch ( - IN OUT UINT16 *Instructions, - IN UINT32 Address - ) -{ - UINT16 *Word; - UINT16 *Top; - - Word = Instructions; // MOVW - Top = Word + 2; // MOVT - - ThumbMovtImmediatePatch (Word, (UINT16)(Address & 0xffff)); - ThumbMovtImmediatePatch (Top, (UINT16)(Address >> 16)); -} - - - -/** - Performs an ARM-based specific relocation fixup and is a no-op on other - instruction sets. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeCoffLoaderRelocateImageEx ( - IN UINT16 *Reloc, - IN OUT CHAR8 *Fixup, - IN OUT CHAR8 **FixupData, - IN UINT64 Adjust - ) -{ - UINT16 *Fixup16; - UINT32 FixupVal; - - 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); - } - break; - - case EFI_IMAGE_REL_BASED_ARM_MOV32A: - ASSERT (FALSE); - // break omitted - ARM instruction encoding not implemented - default: - return RETURN_UNSUPPORTED; - } - - return RETURN_SUCCESS; -} - -/** - 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 - loading and relocating of the image type. It's up to the caller to support - the entry point. - - @param Machine Machine type from the PE Header. - - @return TRUE if this PE/COFF loader can load the image - -**/ -BOOLEAN -PeCoffLoaderImageFormatSupported ( - IN UINT16 Machine - ) -{ - if ((Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) || (Machine == IMAGE_FILE_MACHINE_EBC)) { - return TRUE; - } - - return FALSE; -} - -/** - Performs an ARM-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 - space for runtime calls. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeHotRelocateImageEx ( - IN UINT16 *Reloc, - IN OUT CHAR8 *Fixup, - IN OUT CHAR8 **FixupData, - IN UINT64 Adjust - ) -{ - UINT16 *Fixup16; - UINT32 FixupVal; - - 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); - // break omitted - ARM instruction encoding not implemented - default: - DEBUG ((EFI_D_ERROR, "PeHotRelocateEx:unknown fixed type\n")); - return RETURN_UNSUPPORTED; - } - - return RETURN_SUCCESS; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c deleted file mode 100644 index 3885abe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ /dev/null @@ -1,1949 +0,0 @@ -/** @file - Base PE/COFF loader supports loading any PE32/PE32+ or TE image, but - only supports relocating IA32, x64, IPF, and EBC images. - - Caution: This file requires additional review when modified. - This library will have external input - PE/COFF image. - This external input must be validated carefully to avoid security issue like - buffer overflow, integer overflow. - - The basic guideline is that caller need provide ImageContext->ImageRead () with the - necessary data range check, to make sure when this library reads PE/COFF image, the - PE image buffer is always in valid range. - This library will also do some additional check for PE header fields. - - PeCoffLoaderGetPeHeader() routine will do basic check for PE/COFF header. - PeCoffLoaderGetImageInfo() routine will do basic check for whole PE/COFF image. - - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BasePeCoffLibInternals.h" - -/** - Adjust some fields in section header for TE image. - - @param SectionHeader Pointer to the section header. - @param TeStrippedOffset Size adjust for the TE image. - -**/ -VOID -PeCoffLoaderAdjustOffsetForTeImage ( - EFI_IMAGE_SECTION_HEADER *SectionHeader, - UINT32 TeStrippedOffset - ) -{ - SectionHeader->VirtualAddress -= TeStrippedOffset; - SectionHeader->PointerToRawData -= TeStrippedOffset; -} - -/** - Retrieves the PE or TE Header from a PE/COFF or TE image. - - Caution: This function may receive untrusted input. - PE/COFF image is external input, so this routine will - also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, - SizeOfHeader, Section Data Region and Security Data Region be in PE image range. - - @param ImageContext The context of the image being loaded. - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @retval RETURN_SUCCESS The PE or TE Header is read. - @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function. - -**/ -RETURN_STATUS -PeCoffLoaderGetPeHeader ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, - 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; - EFI_IMAGE_SECTION_HEADER SectionHeader; - - // - // Read the DOS image header to check for its existence - // - Size = sizeof (EFI_IMAGE_DOS_HEADER); - ReadSize = Size; - 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; - } - - ImageContext->PeCoffHeaderOffset = 0; - if (DosHdr.e_magic == EFI_IMAGE_DOS_SIGNATURE) { - // - // DOS image header is present, so read the PE header after the DOS image - // header - // - ImageContext->PeCoffHeaderOffset = DosHdr.e_lfanew; - } - - // - // Read the PE/COFF Header. For PE32 (32-bit) this will read in too much - // data, but that should not hurt anything. Hdr.Pe32->OptionalHeader.Magic - // 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); - ReadSize = Size; - 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; - } - - // - // 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); - // - // 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; - - // - // Check the StrippedSize. - // - if (sizeof (EFI_TE_IMAGE_HEADER) >= (UINT32)Hdr.Te->StrippedSize) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // Check the SizeOfHeaders field. - // - if (Hdr.Te->BaseOfCode <= Hdr.Te->StrippedSize) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // Read last byte of Hdr.Te->SizeOfHeaders from the file. - // - Size = 1; - ReadSize = Size; - 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; - } - - // - // 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)) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - ImageContext->IsTeImage = FALSE; - ImageContext->Machine = Hdr.Pe32->FileHeader.Machine; - - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // 1. Check OptionalHeader.NumberOfRvaAndSizes filed. - // - if (EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES < Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // 2. Check the FileHeader.SizeOfOptionalHeader field. - // OptionalHeader.NumberOfRvaAndSizes is not bigger than 16, so - // OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY) will not overflow. - // - 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)) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + Hdr.Pe32->FileHeader.SizeOfOptionalHeader; - // - // 3. Check the FileHeader.NumberOfSections field. - // - if (Hdr.Pe32->OptionalHeader.SizeOfImage <= SectionHeaderOffset) { - 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; - } - - // - // 4. Check the OptionalHeader.SizeOfHeaders field. - // - if (Hdr.Pe32->OptionalHeader.SizeOfHeaders <= SectionHeaderOffset) { - 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; - } - - // - // 4.2 Read last byte of Hdr.Pe32.OptionalHeader.SizeOfHeaders from the file. - // - Size = 1; - ReadSize = Size; - 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; - } - - // - // Check the EFI_IMAGE_DIRECTORY_ENTRY_SECURITY data. - // Read the last byte to make sure the data is in the image region. - // The DataDirectory array begin with 1, not 0, so here use < to compare not <=. - // - if (EFI_IMAGE_DIRECTORY_ENTRY_SECURITY < Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes) { - if (Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size != 0) { - // - // 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) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // Read last byte of section header from file - // - 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 - ); - if (RETURN_ERROR (Status) || (Size != ReadSize)) { - ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; - if (Size != ReadSize) { - Status = RETURN_UNSUPPORTED; - } - return Status; - } - } - } - - // - // 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; - - } else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) { - // - // 1. Check FileHeader.NumberOfRvaAndSizes filed. - // - if (EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES < Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - // - // 2. Check the FileHeader.SizeOfOptionalHeader field. - // OptionalHeader.NumberOfRvaAndSizes is not bigger than 16, so - // OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY) will not overflow. - // - 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)) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + Hdr.Pe32Plus->FileHeader.SizeOfOptionalHeader; - // - // 3. Check the FileHeader.NumberOfSections field. - // - if (Hdr.Pe32Plus->OptionalHeader.SizeOfImage <= SectionHeaderOffset) { - 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; - } - - // - // 4. Check the OptionalHeader.SizeOfHeaders field. - // - if (Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders <= SectionHeaderOffset) { - 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; - } - - // - // 4.2 Read last byte of Hdr.Pe32Plus.OptionalHeader.SizeOfHeaders from the file. - // - Size = 1; - ReadSize = Size; - 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; - } - - // - // Check the EFI_IMAGE_DIRECTORY_ENTRY_SECURITY data. - // Read the last byte to make sure the data is in the image region. - // The DataDirectory array begin with 1, not 0, so here use < to compare not <=. - // - if (EFI_IMAGE_DIRECTORY_ENTRY_SECURITY < Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes) { - if (Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size != 0) { - // - // 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) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // Read last byte of section header from file - // - 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 - ); - if (RETURN_ERROR (Status) || (Size != ReadSize)) { - ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; - if (Size != ReadSize) { - Status = RETURN_UNSUPPORTED; - } - return Status; - } - } - } - - // - // 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; - } else { - ImageContext->ImageError = IMAGE_ERROR_INVALID_MACHINE_TYPE; - return RETURN_UNSUPPORTED; - } - } else { - ImageContext->ImageError = IMAGE_ERROR_INVALID_MACHINE_TYPE; - return RETURN_UNSUPPORTED; - } - - if (!PeCoffLoaderImageFormatSupported (ImageContext->Machine)) { - // - // If the PE/COFF loader does not support the image type return - // unsupported. This library can support lots of types of images - // this does not mean the user of this library can call the entry - // point of the image. - // - return RETURN_UNSUPPORTED; - } - - // - // Check each section field. - // - if (ImageContext->IsTeImage) { - 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); - } - - for (Index = 0; Index < NumberOfSections; Index++) { - // - // Read section header from file - // - Size = sizeof (EFI_IMAGE_SECTION_HEADER); - ReadSize = Size; - 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; - } - - // - // Adjust some field in Section Header for TE image. - // - if (ImageContext->IsTeImage) { - PeCoffLoaderAdjustOffsetForTeImage (&SectionHeader, (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER)); - } - - if (SectionHeader.SizeOfRawData > 0) { - // - // Section data should bigger than the Pe header. - // - if (SectionHeader.VirtualAddress < ImageContext->SizeOfHeaders || - SectionHeader.PointerToRawData < ImageContext->SizeOfHeaders) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // Check the member data to avoid overflow. - // - if ((UINT32) (~0) - SectionHeader.PointerToRawData < SectionHeader.SizeOfRawData) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - - // - // 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; - ReadSize = Size; - 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; - } - } - - // - // Check next section. - // - SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER); - } - - return RETURN_SUCCESS; -} - - -/** - Retrieves information about a PE/COFF image. - - Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize, - DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and - DebugDirectoryEntryRva fields of the ImageContext structure. - If ImageContext is NULL, then return RETURN_INVALID_PARAMETER. - If the PE/COFF image accessed through the ImageRead service in the ImageContext - structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED. - If any errors occur while computing the fields of ImageContext, - then the error status is returned in the ImageError field of ImageContext. - If the image is a TE image, then SectionAlignment is set to 0. - The ImageRead and Handle fields of ImageContext structure must be valid prior - to invoking this service. - - Caution: This function may receive untrusted input. - PE/COFF image is external input, so this routine will - also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, - SizeOfHeader, Section Data Region and Security Data Region be in PE image range. - - @param ImageContext The pointer to the image context structure that describes the PE/COFF - image that needs to be examined by this function. - - @retval RETURN_SUCCESS The information on the PE/COFF image was collected. - @retval RETURN_INVALID_PARAMETER ImageContext is NULL. - @retval RETURN_UNSUPPORTED The PE/COFF image is not supported. - -**/ -RETURN_STATUS -EFIAPI -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; - - if (ImageContext == NULL) { - return RETURN_INVALID_PARAMETER; - } - // - // Assume success - // - ImageContext->ImageError = IMAGE_ERROR_SUCCESS; - - Hdr.Union = &HdrData; - Status = PeCoffLoaderGetPeHeader (ImageContext, Hdr); - if (RETURN_ERROR (Status)) { - return Status; - } - - // - // Retrieve the base address of the image - // - if (!(ImageContext->IsTeImage)) { - TeStrippedOffset = 0; - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - ImageContext->ImageAddress = Hdr.Pe32->OptionalHeader.ImageBase; - } else { - // - // Use PE32+ offset - // - ImageContext->ImageAddress = Hdr.Pe32Plus->OptionalHeader.ImageBase; - } - } else { - TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER); - ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + TeStrippedOffset); - } - - // - // Initialize the alternate destination address to 0 indicating that it - // should not be used. - // - ImageContext->DestinationAddress = 0; - - // - // Initialize the debug codeview pointer. - // - ImageContext->DebugDirectoryEntryRva = 0; - ImageContext->CodeView = NULL; - ImageContext->PdbPointer = NULL; - - // - // Three cases with regards to relocations: - // - Image has base relocs, RELOCS_STRIPPED==0 => image is relocatable - // - Image has no base relocs, RELOCS_STRIPPED==1 => Image is not relocatable - // - Image has no base relocs, RELOCS_STRIPPED==0 => Image is relocatable but - // has no base relocs to apply - // Obviously having base relocations with RELOCS_STRIPPED==1 is invalid. - // - // Look at the file header to determine if relocations have been stripped, and - // save this information in the image context for later use. - // - if ((!(ImageContext->IsTeImage)) && ((Hdr.Pe32->FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0)) { - ImageContext->RelocationsStripped = TRUE; - } else if ((ImageContext->IsTeImage) && (Hdr.Te->DataDirectory[0].Size == 0) && (Hdr.Te->DataDirectory[0].VirtualAddress == 0)) { - ImageContext->RelocationsStripped = TRUE; - } else { - ImageContext->RelocationsStripped = FALSE; - } - - if (!(ImageContext->IsTeImage)) { - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes; - DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]); - } else { - // - // Use PE32+ offset - // - NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes; - DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]); - } - - if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) { - - DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress; - - // - // Determine the file offset of the debug directory... This means we walk - // the sections to find which section contains the RVA of the debug - // directory - // - DebugDirectoryEntryFileOffset = 0; - - SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + - sizeof (UINT32) + - sizeof (EFI_IMAGE_FILE_HEADER) + - Hdr.Pe32->FileHeader.SizeOfOptionalHeader; - - for (Index = 0; Index < Hdr.Pe32->FileHeader.NumberOfSections; Index++) { - // - // Read section header from file - // - Size = sizeof (EFI_IMAGE_SECTION_HEADER); - ReadSize = Size; - 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) { - - DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva - SectionHeader.VirtualAddress + SectionHeader.PointerToRawData; - break; - } - - SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER); - } - - if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { - // - // Read next debug directory entry - // - Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - ReadSize = Size; - 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; - } - - // - // From PeCoff spec, when DebugEntry.RVA == 0 means this debug info will not load into memory. - // Here we will always load EFI_IMAGE_DEBUG_TYPE_CODEVIEW type debug info. so need adjust the - // 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->ImageSize += DebugEntry.SizeOfData; - } - - return RETURN_SUCCESS; - } - } - } - } - } else { - - DebugDirectoryEntry = &Hdr.Te->DataDirectory[1]; - DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress; - SectionHeaderOffset = (UINTN)(sizeof (EFI_TE_IMAGE_HEADER)); - - DebugDirectoryEntryFileOffset = 0; - - for (Index = 0; Index < Hdr.Te->NumberOfSections;) { - // - // Read section header from file - // - Size = sizeof (EFI_IMAGE_SECTION_HEADER); - ReadSize = Size; - 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) { - DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva - - SectionHeader.VirtualAddress + - SectionHeader.PointerToRawData - - TeStrippedOffset; - - // - // 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) { - SectionHeaderOffset += (Hdr.Te->NumberOfSections - 1 - Index) * sizeof (EFI_IMAGE_SECTION_HEADER); - Index = Hdr.Te->NumberOfSections - 1; - continue; - } - } - - // - // In Te image header there is not a field to describe the ImageSize. - // Actually, the ImageSize equals the RVA plus the VirtualSize of - // the last section mapped into memory (Must be rounded up to - // a multiple of Section Alignment). Per the PE/COFF specification, the - // section headers in the Section Table must appear in order of the RVA - // values for the corresponding sections. So the ImageSize can be determined - // by the RVA and the VirtualSize of the last section header in the - // Section Table. - // - if ((++Index) == (UINTN)Hdr.Te->NumberOfSections) { - ImageContext->ImageSize = (SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) - TeStrippedOffset; - } - - SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER); - } - - if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { - // - // Read next debug directory entry - // - Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - ReadSize = Size; - 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); - return RETURN_SUCCESS; - } - } - } - } - - return RETURN_SUCCESS; -} - - -/** - Converts an image address to the loaded address. - - @param ImageContext The context of the image being loaded. - @param Address The address to be converted to the loaded address. - @param TeStrippedOffset Stripped offset for TE image. - - @return The converted address or NULL if the address can not be converted. - -**/ -VOID * -PeCoffLoaderImageAddress ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, - IN UINTN Address, - IN UINTN TeStrippedOffset - ) -{ - // - // Make sure that Address and ImageSize is correct for the loaded image. - // - if (Address >= ImageContext->ImageSize + TeStrippedOffset) { - ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS; - return NULL; - } - - return (CHAR8 *)((UINTN) ImageContext->ImageAddress + Address - TeStrippedOffset); -} - -/** - Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage(). - - If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of - ImageContext as the relocation base address. Otherwise, use the DestinationAddress field - of ImageContext as the relocation base address. The caller must allocate the relocation - fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function. - - The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, - ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, - DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of - the ImageContext structure must be valid prior to invoking this service. - - If ImageContext is NULL, then ASSERT(). - - Note that if the platform does not maintain coherency between the instruction cache(s) and the data - cache(s) in hardware, then the caller is responsible for performing cache maintenance operations - prior to transferring control to a PE/COFF image that is loaded using this library. - - @param ImageContext The pointer to the image context structure that describes the PE/COFF - image that is being relocated. - - @retval RETURN_SUCCESS The PE/COFF image was relocated. - Extended status information is in the ImageError field of ImageContext. - @retval RETURN_LOAD_ERROR The image in not a valid PE/COFF image. - Extended status information is in the ImageError field of ImageContext. - @retval RETURN_UNSUPPORTED A relocation record type is not supported. - Extended status information is in the ImageError field of ImageContext. - -**/ -RETURN_STATUS -EFIAPI -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; - - ASSERT (ImageContext != NULL); - - // - // Assume success - // - ImageContext->ImageError = IMAGE_ERROR_SUCCESS; - - // - // If there are no relocation entries, then we are done - // - if (ImageContext->RelocationsStripped) { - // Applies additional environment specific actions to relocate fixups - // to a PE/COFF image if needed - PeCoffLoaderRelocateImageExtraAction (ImageContext); - return RETURN_SUCCESS; - } - - // - // If the destination address is not 0, use that rather than the - // image address as the relocation target. - // - if (ImageContext->DestinationAddress != 0) { - BaseAddress = ImageContext->DestinationAddress; - } else { - BaseAddress = ImageContext->ImageAddress; - } - - if (!(ImageContext->IsTeImage)) { - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset); - TeStrippedOffset = 0; - - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - Adjust = (UINT64)BaseAddress - Hdr.Pe32->OptionalHeader.ImageBase; - if (Adjust != 0) { - Hdr.Pe32->OptionalHeader.ImageBase = (UINT32)BaseAddress; - } - - NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes; - RelocDir = &Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC]; - } else { - // - // Use PE32+ offset - // - 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]; - } - - // - // Find the relocation block - // Per the PE/COFF spec, you can't assume that a given data directory - // is present in the image. You have to check the NumberOfRvaAndSizes in - // the optional header to verify a desired directory entry is there. - // - if ((NumberOfRvaAndSizes < EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC)) { - 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)); - if (Adjust != 0) { - Hdr.Te->ImageBase = (UINT64) (BaseAddress - TeStrippedOffset); - } - - // - // Find the relocation block - // - RelocDir = &Hdr.Te->DataDirectory[0]; - } - - 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) { - ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION; - return RETURN_LOAD_ERROR; - } - } else { - // - // Set base and end to bypass processing below. - // - RelocBase = RelocBaseEnd = NULL; - } - RelocBaseOrg = RelocBase; - - // - // If Adjust is not zero, then apply fix ups to the image - // - if (Adjust != 0) { - // - // 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)); - // - // Add check for RelocBase->SizeOfBlock field. - // - if (RelocBase->SizeOfBlock == 0) { - 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); - 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; - return RETURN_LOAD_ERROR; - } - - // - // Run this relocation record - // - 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_HIGH: - Fixup16 = (UINT16 *) Fixup; - *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16))); - 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); - } - 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); - } - 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; - } - } - - // - // Next relocation record - // - Reloc += 1; - } - - // - // Next reloc block - // - 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; - } - } - - // Applies additional environment specific actions to relocate fixups - // to a PE/COFF image if needed - PeCoffLoaderRelocateImageExtraAction (ImageContext); - - return RETURN_SUCCESS; -} - -/** - Loads a PE/COFF image into memory. - - Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer - specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate - the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function. - The EntryPoint, FixupDataSize, CodeView, PdbPointer and HiiResourceData fields of ImageContext are computed. - The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize, - DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva - fields of the ImageContext structure must be valid prior to invoking this service. - - If ImageContext is NULL, then ASSERT(). - - Note that if the platform does not maintain coherency between the instruction cache(s) and the data - cache(s) in hardware, then the caller is responsible for performing cache maintenance operations - prior to transferring control to a PE/COFF image that is loaded using this library. - - @param ImageContext The pointer to the image context structure that describes the PE/COFF - image that is being loaded. - - @retval RETURN_SUCCESS The PE/COFF image was loaded into the buffer specified by - the ImageAddress and ImageSize fields of ImageContext. - Extended status information is in the ImageError field of ImageContext. - @retval RETURN_BUFFER_TOO_SMALL The caller did not provide a large enough buffer. - Extended status information is in the ImageError field of ImageContext. - @retval RETURN_LOAD_ERROR The PE/COFF image is an EFI Runtime image with no relocations. - Extended status information is in the ImageError field of ImageContext. - @retval RETURN_INVALID_PARAMETER The image address is invalid. - Extended status information is in the ImageError field of ImageContext. - -**/ -RETURN_STATUS -EFIAPI -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; - - ASSERT (ImageContext != NULL); - - // - // Assume success - // - ImageContext->ImageError = IMAGE_ERROR_SUCCESS; - - // - // Copy the provided context information into our local version, get what we - // can from the original image, and then use that to make sure everything - // is legit. - // - CopyMem (&CheckContext, ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT)); - - Status = PeCoffLoaderGetImageInfo (&CheckContext); - if (RETURN_ERROR (Status)) { - return Status; - } - - // - // Make sure there is enough allocated space for the image being loaded - // - if (ImageContext->ImageSize < CheckContext.ImageSize) { - ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_SIZE; - return RETURN_BUFFER_TOO_SMALL; - } - if (ImageContext->ImageAddress == 0) { - // - // Image cannot be loaded into 0 address. - // - 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. - // - if (CheckContext.RelocationsStripped) { - // - // If the image does not contain relocations and it is a runtime driver - // then return an error. - // - if (CheckContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) { - 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. - // - if (CheckContext.ImageAddress != ImageContext->ImageAddress) { - ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS; - return RETURN_INVALID_PARAMETER; - } - } - // - // Make sure the allocated space has the proper section alignment - // - if (!(ImageContext->IsTeImage)) { - if ((ImageContext->ImageAddress & (CheckContext.SectionAlignment - 1)) != 0) { - ImageContext->ImageError = IMAGE_ERROR_INVALID_SECTION_ALIGNMENT; - 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 - ); - - 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); - 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); - } - - if (RETURN_ERROR (Status)) { - ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; - return RETURN_LOAD_ERROR; - } - - // - // Load each section of the image - // - Section = FirstSection; - for (Index = 0; Index < NumberOfSections; Index++) { - // - // Read the section - // - Size = (UINTN) Section->Misc.VirtualSize; - if ((Size == 0) || (Size > Section->SizeOfRawData)) { - Size = (UINTN) Section->SizeOfRawData; - } - - // - // Compute sections address - // - Base = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress, TeStrippedOffset); - End = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress + Section->Misc.VirtualSize - 1, TeStrippedOffset); - - // - // If the size of the section is non-zero and the base address or end address resolved to 0, then fail. - // - if ((Size > 0) && ((Base == NULL) || (End == NULL))) { - ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED; - return RETURN_LOAD_ERROR; - } - - if (Section->SizeOfRawData > 0) { - Status = ImageContext->ImageRead ( - ImageContext->Handle, - Section->PointerToRawData - TeStrippedOffset, - &Size, - Base - ); - if (RETURN_ERROR (Status)) { - ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; - return Status; - } - } - - // - // If raw size is less then virtual size, zero fill the remaining - // - - if (Size < Section->Misc.VirtualSize) { - ZeroMem (Base + Size, Section->Misc.VirtualSize - Size); - } - - // - // Next Section - // - Section += 1; - } - - // - // Get image's entry point - // - if (!(ImageContext->IsTeImage)) { - // - // Sizes of AddressOfEntryPoint are different so we need to do this safely - // - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress ( - ImageContext, - (UINTN)Hdr.Pe32->OptionalHeader.AddressOfEntryPoint, - 0 - ); - } else { - // - // Use PE32+ offset - // - ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress ( - ImageContext, - (UINTN)Hdr.Pe32Plus->OptionalHeader.AddressOfEntryPoint, - 0 - ); - } - } else { - ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress ( - ImageContext, - (UINTN)Hdr.Te->AddressOfEntryPoint, - TeStrippedOffset - ); - } - - // - // Determine the size of the fixup data - // - // Per the PE/COFF spec, you can't assume that a given data directory - // is present in the image. You have to check the NumberOfRvaAndSizes in - // the optional header to verify a desired directory entry is there. - // - if (!(ImageContext->IsTeImage)) { - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes; - 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]; - } - - // - // Must use UINT64 here, because there might a case that 32bit loader to load 64bit image. - // - if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) { - ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINT64); - } else { - ImageContext->FixupDataSize = 0; - } - } else { - 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. - // - ImageContext->FixupData = NULL; - - // - // Load the Codeview information if present - // - if (ImageContext->DebugDirectoryEntryRva != 0) { - DebugEntry = PeCoffLoaderImageAddress ( - 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) { - Section--; - if ((UINTN)Section->SizeOfRawData < Section->Misc.VirtualSize) { - TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize; - } else { - TempDebugEntryRva = Section->VirtualAddress + Section->SizeOfRawData; - } - } - - if (TempDebugEntryRva != 0) { - ImageContext->CodeView = PeCoffLoaderImageAddress (ImageContext, TempDebugEntryRva, TeStrippedOffset); - if (ImageContext->CodeView == NULL) { - ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION; - return RETURN_LOAD_ERROR; - } - - if (DebugEntry->RVA == 0) { - Size = DebugEntry->SizeOfData; - Status = ImageContext->ImageRead ( - 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 - // in original PE image. - // - - if (RETURN_ERROR (Status)) { - ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; - return RETURN_LOAD_ERROR; - } - - 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; - - 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; - } - ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY); - break; - - default: - break; - } - } - } - - // - // Get Image's HII resource section - // - ImageContext->HiiResourceData = 0; - if (!(ImageContext->IsTeImage)) { - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes; - 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]; - } - - 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); - if (Offset > DirectoryEntry->Size) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1); - - for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index++) { - if (ResourceDirectoryEntry->u1.s.NameIsString) { - // - // Check the ResourceDirectoryEntry->u1.s.NameOffset before use it. - // - if (ResourceDirectoryEntry->u1.s.NameOffset >= DirectoryEntry->Size) { - 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') { - // - // Resource Type "HII" found - // - if (ResourceDirectoryEntry->u2.s.DataIsDirectory) { - // - // Move to next level - resource Name - // - if (ResourceDirectoryEntry->u2.s.OffsetToDirectory >= DirectoryEntry->Size) { - 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); - if (Offset > DirectoryEntry->Size) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1); - - if (ResourceDirectoryEntry->u2.s.DataIsDirectory) { - // - // Move to next level - resource Language - // - if (ResourceDirectoryEntry->u2.s.OffsetToDirectory >= DirectoryEntry->Size) { - 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); - if (Offset > DirectoryEntry->Size) { - ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED; - return RETURN_UNSUPPORTED; - } - ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1); - } - } - - // - // Now it ought to be resource Data - // - if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) { - if (ResourceDirectoryEntry->u2.OffsetToData >= DirectoryEntry->Size) { - 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); - break; - } - } - } - ResourceDirectoryEntry++; - } - } - } - } - - return Status; -} - - -/** - Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI - runtime. - - This function reapplies relocation fixups to the PE/COFF image specified by ImageBase - and ImageSize so the image will execute correctly when the PE/COFF image is mapped - to the address specified by VirtualImageBase. RelocationData must be identical - to the FiuxupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure - after this PE/COFF image was relocated with PeCoffLoaderRelocateImage(). - - Note that if the platform does not maintain coherency between the instruction cache(s) and the data - cache(s) in hardware, then the caller is responsible for performing cache maintenance operations - prior to transferring control to a PE/COFF image that is loaded using this library. - - @param ImageBase The base address of a PE/COFF image that has been loaded - and relocated into system memory. - @param VirtImageBase The request virtual address that the PE/COFF image is to - be fixed up for. - @param ImageSize The size, in bytes, of the PE/COFF image. - @param RelocationData A pointer to the relocation data that was collected when the PE/COFF - image was relocated using PeCoffLoaderRelocateImage(). - -**/ -VOID -EFIAPI -PeCoffLoaderRelocateImageForRuntime ( - 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) { - return; - } - - OldBase = (CHAR8 *)((UINTN)ImageBase); - NewBase = (CHAR8 *)((UINTN)VirtImageBase); - Adjust = (UINTN) NewBase - (UINTN) OldBase; - - ImageContext.ImageAddress = ImageBase; - ImageContext.ImageSize = ImageSize; - - // - // Find the image's relocate dir info - // - DosHdr = (EFI_IMAGE_DOS_HEADER *)OldBase; - if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { - // - // Valid DOS header so get address of PE header - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(((CHAR8 *)DosHdr) + DosHdr->e_lfanew); - } else { - // - // No Dos header so assume image starts with PE header. - // - Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)OldBase; - } - - if (Hdr.Pe32->Signature != EFI_IMAGE_NT_SIGNATURE) { - // - // Not a valid PE image so Exit - // - return ; - } - - if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // - // Use PE32 offset - // - NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes; - 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]); - } - - // - // Find the relocation block - // - // Per the PE/COFF spec, you can't assume that a given data directory - // 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; - RelocBaseEnd = NULL; - if (NumberOfRvaAndSizes > 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 - ); - } - if (RelocBase == NULL || RelocBaseEnd == NULL || (UINTN) RelocBaseEnd < (UINTN) RelocBase) { - // - // relocation block is not valid, just return - // - return; - } - } else { - // - // Cannot find relocations, cannot continue to relocate the image, ASSERT for this invalid image. - // - ASSERT (FALSE); - return ; - } - - // - // ASSERT for the invalid image when RelocBase and RelocBaseEnd are both NULL. - // - ASSERT (RelocBase != NULL && RelocBaseEnd != NULL); - - if (Adjust != 0) { - // - // Run the whole relocation block. And re-fixup data that has not been - // modified. The FixupData is used to see if the image has been modified - // since it was relocated. This is so data sections that have been updated - // by code will not be fixed up, since that would set them back to - // defaults. - // - FixupData = RelocationData; - RelocBaseOrig = RelocBase; - while ((UINTN) RelocBase < (UINTN) RelocBaseEnd) { - // - // Add check for RelocBase->SizeOfBlock field. - // - if ((RelocBase->SizeOfBlock == 0) || (RelocBase->SizeOfBlock > RelocDir->Size)) { - // - // Data invalid, cannot continue to relocate the image, just return. - // - return; - } - - Reloc = (UINT16 *) ((UINT8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION)); - RelocEnd = (UINT16 *) ((UINT8 *) RelocBase + RelocBase->SizeOfBlock); - if ((UINTN)RelocEnd > (UINTN)RelocBaseOrig + RelocDir->Size) { - return; - } - - FixupBase = PeCoffLoaderImageAddress (&ImageContext, RelocBase->VirtualAddress, 0); - if (FixupBase == NULL) { - return; - } - - // - // Run this relocation record - // - 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_HIGH: - Fixup16 = (UINT16 *) Fixup; - if (*(UINT16 *) FixupData == *Fixup16) { - *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16))); - } - - FixupData = FixupData + sizeof (UINT16); - break; - - case EFI_IMAGE_REL_BASED_LOW: - Fixup16 = (UINT16 *) Fixup; - if (*(UINT16 *) FixupData == *Fixup16) { - *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) Adjust & 0xffff)); - } - - 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; - } - - 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; - } - - FixupData = FixupData + sizeof (UINT64); - break; - - 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; - } - } -} - - -/** - Reads contents of a PE/COFF image from a buffer in system memory. - - This is the default implementation of a PE_COFF_LOADER_READ_FILE function - that assumes FileHandle pointer to the beginning of a PE/COFF image. - This function reads contents of the PE/COFF image that starts at the system memory - address specified by FileHandle. The read operation copies ReadSize bytes from the - PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer. - The size of the buffer actually read is returned in ReadSize. - - The caller must make sure the FileOffset and ReadSize within the file scope. - - If FileHandle is NULL, then ASSERT(). - If ReadSize is NULL, then ASSERT(). - If Buffer is NULL, then ASSERT(). - - @param FileHandle The pointer to base of the input stream - @param FileOffset Offset into the PE/COFF image to begin the read operation. - @param ReadSize On input, the size in bytes of the requested read operation. - On output, the number of bytes actually read. - @param Buffer Output buffer that contains the data read from the PE/COFF image. - - @retval RETURN_SUCCESS Data is read from FileOffset from the Handle into - the buffer. -**/ -RETURN_STATUS -EFIAPI -PeCoffLoaderImageReadFromMemory ( - IN VOID *FileHandle, - IN UINTN FileOffset, - IN OUT UINTN *ReadSize, - OUT VOID *Buffer - ) -{ - ASSERT (ReadSize != NULL); - ASSERT (FileHandle != NULL); - ASSERT (Buffer != NULL); - - CopyMem (Buffer, ((UINT8 *)FileHandle) + FileOffset, *ReadSize); - return RETURN_SUCCESS; -} - -/** - Unloads a loaded PE/COFF image from memory and releases its taken resource. - Releases any environment specific resources that were allocated when the image - specified by ImageContext was loaded using PeCoffLoaderLoadImage(). - - For NT32 emulator, the PE/COFF image loaded by system needs to release. - For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded, - this function can simply return RETURN_SUCCESS. - - If ImageContext is NULL, then ASSERT(). - - @param ImageContext The pointer to the image context structure that describes the PE/COFF - image to be unloaded. - - @retval RETURN_SUCCESS The PE/COFF image was unloaded successfully. -**/ -RETURN_STATUS -EFIAPI -PeCoffLoaderUnloadImage ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext - ) -{ - // - // Applies additional environment specific actions to unload a - // PE/COFF image if needed - // - PeCoffLoaderUnloadImageExtraAction (ImageContext); - return RETURN_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf deleted file mode 100644 index 11a4d03..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf +++ /dev/null @@ -1,56 +0,0 @@ -## @file -# PE/COFF Loader Library implementation. -# The IPF version library supports loading IPF and EBC PE/COFF image. -# The IA32 version library support loading IA32, X64 and EBC PE/COFF images. -# The X64 version library support loading IA32, X64 and EBC PE/COFF images. -# -# Caution: This module requires additional review when modified. -# This library will have external input - PE/COFF image. -# This external input must be validated carefully to avoid security issue like -# buffer overflow, integer overflow. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePeCoffLib - MODULE_UNI_FILE = BasePeCoffLib.uni - FILE_GUID = 556f5d10-7309-4af4-b80a-8196bd60946f - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeCoffLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - BasePeCoffLibInternals.h - BasePeCoff.c - -[Sources.IA32, Sources.X64, Sources.EBC, Sources.AARCH64] - PeCoffLoaderEx.c - -[Sources.ARM] - Arm/PeCoffLoaderEx.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - PeCoffExtraActionLib - BaseMemoryLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni deleted file mode 100644 index e78d680..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.uni +++ /dev/null @@ -1,29 +0,0 @@ -// /** @file -// PE/COFF Loader Library implementation. -// -// The IPF version library supports loading IPF and EBC PE/COFF image. -// The IA32 version library support loading IA32, X64 and EBC PE/COFF images. -// The X64 version library support loading IA32, X64 and EBC PE/COFF images. -// -// Caution: This module requires additional review when modified. -// This library will have external input - PE/COFF image. -// This external input must be validated carefully to avoid security issue like -// buffer overflow, integer overflow. -// -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PE/COFF Loader Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "The IPF version library supports loading IPF and EBC PE/COFF images. The IA32 version library support loading IA32, X64 and EBC PE/COFF images. The X64 version library support loading IA32, X64 and EBC PE/COFF images. Caution: This module requires additional review when modified. This library will have external input: PE/COFF image. This external input must be validated carefully to avoid security issues like buffer overflow and integer overflow." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h deleted file mode 100644 index a2feecd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h +++ /dev/null @@ -1,133 +0,0 @@ -/** @file - Declaration of internal functions in PE/COFF Lib. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __BASE_PECOFF_LIB_INTERNALS__ -#define __BASE_PECOFF_LIB_INTERNALS__ - -#include -#include -#include -#include -#include -#include - - - -/** - Performs an Itanium-based specific relocation fixup and is a no-op on other - instruction sets. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeCoffLoaderRelocateImageEx ( - 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 - space for runtime calls. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeHotRelocateImageEx ( - 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 - loading and relocating of the image type. It's up to the caller to support - the entry point. - - @param Machine Machine type from the PE Header. - - @return TRUE if this PE/COFF loader can load the image - -**/ -BOOLEAN -PeCoffLoaderImageFormatSupported ( - IN UINT16 Machine - ); - -/** - Retrieves the magic value from the PE/COFF header. - - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32 - @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+ - -**/ -UINT16 -PeCoffLoaderGetPeHeaderMagicValue ( - IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ); - -/** - Retrieves the PE or TE Header from a PE/COFF or TE image. - - @param ImageContext The context of the image being loaded. - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @retval RETURN_SUCCESS The PE or TE Header is read. - @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function. - -**/ -RETURN_STATUS -PeCoffLoaderGetPeHeader ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, - OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ); - -/** - Converts an image address to the loaded address. - - @param ImageContext The context of the image being loaded. - @param Address The address to be converted to the loaded address. - @param TeStrippedOffset Stripped offset for TE image. - - @return The converted address or NULL if the address can not be converted. - -**/ -VOID * -PeCoffLoaderImageAddress ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, - IN UINTN Address, - IN UINTN TeStrippedOffset - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c deleted file mode 100644 index e21fb99..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c +++ /dev/null @@ -1,90 +0,0 @@ -/** @file - Specific relocation fixups for none Itanium architecture. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BasePeCoffLibInternals.h" - - -/** - Performs an Itanium-based specific relocation fixup and is a no-op on other - instruction sets. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeCoffLoaderRelocateImageEx ( - IN UINT16 *Reloc, - IN OUT CHAR8 *Fixup, - IN OUT CHAR8 **FixupData, - IN UINT64 Adjust - ) -{ - return RETURN_UNSUPPORTED; -} - -/** - 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 - loading and relocating of the image type. It's up to the caller to support - the entry point. - - The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images. - - @param Machine The machine type from the PE Header. - - @return TRUE if this PE/COFF loader can load the image - -**/ -BOOLEAN -PeCoffLoaderImageFormatSupported ( - IN UINT16 Machine - ) -{ - if ((Machine == IMAGE_FILE_MACHINE_I386) || (Machine == IMAGE_FILE_MACHINE_X64) || - (Machine == IMAGE_FILE_MACHINE_EBC) || (Machine == IMAGE_FILE_MACHINE_ARM64)) { - return TRUE; - } - - return FALSE; -} - -/** - 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 - space for runtime calls. - - @param Reloc The pointer to the relocation record. - @param Fixup The pointer to the address to fix up. - @param FixupData The pointer to a buffer to log the fixups. - @param Adjust The offset to adjust the fixup. - - @return Status code. - -**/ -RETURN_STATUS -PeHotRelocateImageEx ( - IN UINT16 *Reloc, - IN OUT CHAR8 *Fixup, - IN OUT CHAR8 **FixupData, - IN UINT64 Adjust - ) -{ - return RETURN_UNSUPPORTED; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf deleted file mode 100644 index 10fd330..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Instance of Performance Library with empty functions. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePerformanceLibNull - MODULE_UNI_FILE = BasePerformanceLibNull.uni - FILE_GUID = FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PerformanceLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PerformanceLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - PcdLib - DebugLib - - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.uni deleted file mode 100644 index 3194683..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Performance Library with empty functions. -// -// Instance of Performance Library with empty functions. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Performance Library with empty functions" - -#string STR_MODULE_DESCRIPTION #language en-US "Instance of Performance Library with empty functions." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c deleted file mode 100644 index 8bfc796..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c +++ /dev/null @@ -1,361 +0,0 @@ -/** @file - Base Performance Library which provides no service. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - - -#include -#include -#include - -/** - Creates a record for the beginning of a performance measurement. - - Creates a record that contains the Handle, Token, and Module. - If TimeStamp is not zero, then TimeStamp is added to the record as the start time. - If TimeStamp is zero, then this function reads the current time stamp - and adds that time stamp value to the record as the start time. - - @param Handle The pointer to environment specific context used - to identify the component being measured. - @param Token The pointer to a Null-terminated ASCII string - that identifies the component being measured. - @param Module The pointer to a Null-terminated ASCII string - that identifies the module being measured. - @param TimeStamp 64-bit time stamp. - - @retval RETURN_SUCCESS The start of the measurement was recorded. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement. - @retval RETURN_DEVICE_ERROR A device error reading the time stamp. - -**/ -RETURN_STATUS -EFIAPI -StartPerformanceMeasurement ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp - ) -{ - return RETURN_SUCCESS; -} - -/** - Fills in the end time of a performance measurement. - - Looks up the record that matches Handle, Token, and Module. - If the record can not be found then return RETURN_NOT_FOUND. - If the record is found and TimeStamp is not zero, - then TimeStamp is added to the record as the end time. - If the record is found and TimeStamp is zero, then this function reads - the current time stamp and adds that time stamp value to the record as the end time. - - @param Handle The pointer to environment specific context used - to identify the component being measured. - @param Token The pointer to a Null-terminated ASCII string - that identifies the component being measured. - @param Module The pointer to a Null-terminated ASCII string - that identifies the module being measured. - @param TimeStamp 64-bit time stamp. - - @retval RETURN_SUCCESS The end of the measurement was recorded. - @retval RETURN_NOT_FOUND The specified measurement record could not be found. - @retval RETURN_DEVICE_ERROR A device error reading the time stamp. - -**/ -RETURN_STATUS -EFIAPI -EndPerformanceMeasurement ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp - ) -{ - return RETURN_SUCCESS; -} - -/** - Attempts to retrieve a performance measurement log entry from the performance measurement log. - It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx, - and then eliminate the Identifier. - - Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is - zero on entry, then an attempt is made to retrieve the first entry from the performance log, - and the key for the second entry in the log is returned. If the performance log is empty, - then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance - log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is - returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is - retrieved and an implementation specific non-zero key value that specifies the end of the performance - log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry - is retrieved and zero is returned. In the cases where a performance log entry can be returned, - the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp. - If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT(). - If Handle is NULL, then ASSERT(). - If Token is NULL, then ASSERT(). - If Module is NULL, then ASSERT(). - If StartTimeStamp is NULL, then ASSERT(). - If EndTimeStamp is NULL, then ASSERT(). - - @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve. - 0, then the first performance measurement log entry is retrieved. - On exit, the key of the next performance lof entry entry. - @param Handle The pointer to environment specific context used to identify the component - being measured. - @param Token The pointer to a Null-terminated ASCII string that identifies the component - being measured. - @param Module The pointer to a Null-terminated ASCII string that identifies the module - being measured. - @param StartTimeStamp The pointer to the 64-bit time stamp that was recorded when the measurement - was started. - @param EndTimeStamp The pointer to the 64-bit time stamp that was recorded when the measurement - was ended. - - @return The key for the next performance log entry (in general case). - -**/ -UINTN -EFIAPI -GetPerformanceMeasurement ( - IN UINTN LogEntryKey, - OUT CONST VOID **Handle, - OUT CONST CHAR8 **Token, - OUT CONST CHAR8 **Module, - OUT UINT64 *StartTimeStamp, - OUT UINT64 *EndTimeStamp - ) -{ - ASSERT (Handle != NULL); - ASSERT (Token != NULL); - ASSERT (Module != NULL); - ASSERT (StartTimeStamp != NULL); - ASSERT (EndTimeStamp != NULL); - - return 0; -} - -/** - Creates a record for the beginning of a performance measurement. - - Creates a record that contains the Handle, Token, Module and Identifier. - If TimeStamp is not zero, then TimeStamp is added to the record as the start time. - If TimeStamp is zero, then this function reads the current time stamp - and adds that time stamp value to the record as the start time. - - @param Handle Pointer to environment specific context used - to identify the component being measured. - @param Token Pointer to a Null-terminated ASCII string - that identifies the component being measured. - @param Module Pointer to a Null-terminated ASCII string - that identifies the module being measured. - @param TimeStamp 64-bit time stamp. - @param Identifier 32-bit identifier. If the value is 0, the created record - is same as the one created by StartPerformanceMeasurement. - - @retval RETURN_SUCCESS The start of the measurement was recorded. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement. - @retval RETURN_DEVICE_ERROR A device error reading the time stamp. - -**/ -RETURN_STATUS -EFIAPI -StartPerformanceMeasurementEx ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp, - IN UINT32 Identifier - ) -{ - return RETURN_SUCCESS; -} - -/** - Fills in the end time of a performance measurement. - - Looks up the record that matches Handle, Token, Module and Identifier. - If the record can not be found then return RETURN_NOT_FOUND. - If the record is found and TimeStamp is not zero, - then TimeStamp is added to the record as the end time. - If the record is found and TimeStamp is zero, then this function reads - the current time stamp and adds that time stamp value to the record as the end time. - - @param Handle Pointer to environment specific context used - to identify the component being measured. - @param Token Pointer to a Null-terminated ASCII string - that identifies the component being measured. - @param Module Pointer to a Null-terminated ASCII string - that identifies the module being measured. - @param TimeStamp 64-bit time stamp. - @param Identifier 32-bit identifier. If the value is 0, the found record - is same as the one found by EndPerformanceMeasurement. - - @retval RETURN_SUCCESS The end of the measurement was recorded. - @retval RETURN_NOT_FOUND The specified measurement record could not be found. - @retval RETURN_DEVICE_ERROR A device error reading the time stamp. - -**/ -RETURN_STATUS -EFIAPI -EndPerformanceMeasurementEx ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp, - IN UINT32 Identifier - ) -{ - return RETURN_SUCCESS; -} - -/** - Attempts to retrieve a performance measurement log entry from the performance measurement log. - It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement, - and then assign the Identifier with 0. - - Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is - zero on entry, then an attempt is made to retrieve the first entry from the performance log, - and the key for the second entry in the log is returned. If the performance log is empty, - then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance - log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is - returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is - retrieved and an implementation specific non-zero key value that specifies the end of the performance - log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry - is retrieved and zero is returned. In the cases where a performance log entry can be returned, - the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier. - If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT(). - If Handle is NULL, then ASSERT(). - If Token is NULL, then ASSERT(). - If Module is NULL, then ASSERT(). - If StartTimeStamp is NULL, then ASSERT(). - If EndTimeStamp is NULL, then ASSERT(). - If Identifier is NULL, then ASSERT(). - - @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve. - 0, then the first performance measurement log entry is retrieved. - On exit, the key of the next performance lof entry entry. - @param Handle Pointer to environment specific context used to identify the component - being measured. - @param Token Pointer to a Null-terminated ASCII string that identifies the component - being measured. - @param Module Pointer to a Null-terminated ASCII string that identifies the module - being measured. - @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement - was started. - @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement - was ended. - @param Identifier Pointer to the 32-bit identifier that was recorded. - - @return The key for the next performance log entry (in general case). - -**/ -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 - ) -{ - ASSERT (Handle != NULL); - ASSERT (Token != NULL); - ASSERT (Module != NULL); - ASSERT (StartTimeStamp != NULL); - ASSERT (EndTimeStamp != NULL); - ASSERT (Identifier != NULL); - - return 0; -} - -/** - Returns TRUE if the performance measurement macros are enabled. - - This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of - PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of - PcdPerformanceLibraryPropertyMask is set. - @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of - PcdPerformanceLibraryPropertyMask is clear. - -**/ -BOOLEAN -EFIAPI -PerformanceMeasurementEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0); -} - -/** - Create performance record with event description and a timestamp. - - @param CallerIdentifier - Image handle or pointer to caller ID GUID - @param Guid - Pointer to a GUID - @param String - Pointer to a string describing the measurement - @param Address - Pointer to a location in memory relevant to the measurement - @param Identifier - Performance identifier describing the type of measurement - - @retval RETURN_SUCCESS - Successfully created performance record - @retval RETURN_OUT_OF_RESOURCES - Ran out of space to store the records - @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL - pointer or invalid PerfId - -**/ -RETURN_STATUS -EFIAPI -LogPerformanceMeasurement ( - IN CONST VOID *CallerIdentifier,OPTIONAL - IN CONST VOID *Guid, OPTIONAL - IN CONST CHAR8 *String, OPTIONAL - IN UINT64 Address, OPTIONAL - IN UINT32 Identifier - ) -{ - return RETURN_SUCCESS; -} - -/** - Check whether the specified performance measurement can be logged. - - This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set - and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set. - - @param Type - Type of the performance measurement entry. - - @retval TRUE The performance measurement can be logged. - @retval FALSE The performance measurement can NOT be logged. - -**/ -BOOLEAN -EFIAPI -LogPerformanceMeasurementEnabled ( - 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) { - return TRUE; - } - return FALSE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf deleted file mode 100644 index 97ceb4d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf +++ /dev/null @@ -1,50 +0,0 @@ -## @file -# Instance of Post Code Library based on Debug Library. -# -# Post Code Library that uses DebugLib service to send PostCode. -# It layers on top of a Debug Library instance. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePostCodeLibDebug - MODULE_UNI_FILE = BasePostCodeLibDebug.uni - FILE_GUID = 19e3bbba-beb1-43e8-b32d-9acbb22c7639 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PostCodeLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - - -[Sources] - PostCode.c - - -[Packages] - MdePkg/MdePkg.dec - - - -[LibraryClasses] - PcdLib - DebugLib - - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.uni deleted file mode 100644 index 9a26925..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Post Code Library based on Debug Library. -// -// Post Code Library that uses DebugLib service to send PostCode. -// It layers on top of a Debug Library instance. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Post Code Library based on Debug Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Post Code Library that uses the DebugLib service to send PostCode. It layers on top of a Debug Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/PostCode.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/PostCode.c deleted file mode 100644 index e9cf568..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibDebug/PostCode.c +++ /dev/null @@ -1,127 +0,0 @@ -/** @file - The instance of Post Code Library that layers on top of a Debug Library instance. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include - -/** - Sends an 32-bit value to a POST card. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - Some implementations of this library function may perform I/O operations - directly to a POST card device. Other implementations may send Value to - ReportStatusCode(), and the status code reporting mechanism will eventually - display the 32-bit value on the status reporting device. - - PostCode() must actively prevent recursion. If PostCode() is called while - processing another any other Post Code Library function, then - PostCode() must return Value immediately. - - @param Value The 32-bit value to write to the POST card. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCode ( - IN UINT32 Value - ) -{ - DEBUG((EFI_D_INFO, "POST %08x\n", Value)); - return Value; -} - - -/** - Sends an 32-bit value to a POST and associated ASCII string. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - If Description is not NULL, then the ASCII string specified by Description is - also passed to the handler that displays the POST card value. Some - implementations of this library function may perform I/O operations directly - to a POST card device. Other implementations may send Value to ReportStatusCode(), - and the status code reporting mechanism will eventually display the 32-bit - value on the status reporting device. - - PostCodeWithDescription()must actively prevent recursion. If - PostCodeWithDescription() is called while processing another any other Post - Code Library function, then PostCodeWithDescription() must return Value - immediately. - - @param Value The 32-bit value to write to the POST card. - @param Description The pointer to an ASCII string that is a description of the - POST code value. This is an optional parameter that may - be NULL. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCodeWithDescription ( - IN UINT32 Value, - IN CONST CHAR8 *Description OPTIONAL - ) -{ - DEBUG((EFI_D_INFO, "POST %08x - %s\n", Value, Description)); - return Value; -} - - -/** - Returns TRUE if POST Codes are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if POST code descriptions are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeDescriptionEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf deleted file mode 100644 index c88eb90..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Instance of Post Code Library using I/O port 0x80. -# -# Post Code Library that writes post code values to I/O port 0x80. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePostCodeLibPort80 - MODULE_UNI_FILE = BasePostCodeLibPort80.uni - FILE_GUID = b6e9a733-eb75-41b6-b30c-009bcf3801c8 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PostCodeLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PostCode.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - IoLib - PcdLib - DebugLib - - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdPort80DataWidth ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.uni deleted file mode 100644 index c86bf7c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Post Code Library using I/O port 0x80. -// -// Post Code Library that writes post code values to I/O port 0x80. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Post Code Library using I/O port 0x80" - -#string STR_MODULE_DESCRIPTION #language en-US "Post Code Library that writes post code values to I/O port 0x80." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c deleted file mode 100644 index 625a718..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePostCodeLibPort80/PostCode.c +++ /dev/null @@ -1,145 +0,0 @@ -/** @file - Post Code Library instance that writes post code values to I/O port 0x80. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -/** - Sends an 32-bit value to a POST card. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - Some implementations of this library function may perform I/O operations - directly to a POST card device. Other implementations may send Value to - ReportStatusCode(), and the status code reporting mechanism will eventually - display the 32-bit value on the status reporting device. - - PostCode() must actively prevent recursion. If PostCode() is called while - processing another any other Post Code Library function, then - PostCode() must return Value immediately. - - @param Value The 32-bit value to write to the POST card. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCode ( - IN UINT32 Value - ) -{ - 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; - } - - return Value; -} - - -/** - Sends an 32-bit value to a POST and associated ASCII string. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - If Description is not NULL, then the ASCII string specified by Description is - also passed to the handler that displays the POST card value. Some - implementations of this library function may perform I/O operations directly - to a POST card device. Other implementations may send Value to ReportStatusCode(), - and the status code reporting mechanism will eventually display the 32-bit - value on the status reporting device. - - PostCodeWithDescription()must actively prevent recursion. If - PostCodeWithDescription() is called while processing another any other Post - Code Library function, then PostCodeWithDescription() must return Value - immediately. - - @param Value The 32-bit value to write to the POST card. - @param Description The pointer to an ASCII string that is a description of the - POST code value. This is an optional parameter that may - be NULL. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCodeWithDescription ( - IN UINT32 Value, - IN CONST CHAR8 *Description OPTIONAL - ) -{ - PostCode (Value); - return Value; -} - - -/** - Returns TRUE if POST Codes are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if POST code descriptions are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeDescriptionEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf deleted file mode 100644 index 70f7f22..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf +++ /dev/null @@ -1,50 +0,0 @@ -## @file -# Print Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePrintLib - MODULE_UNI_FILE = BasePrintLib.uni - FILE_GUID = a86fbfca-0183-4eeb-aa8a-762e3b7da1f3 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PrintLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - - -[Sources] - PrintLibInternal.h - PrintLibInternal.c - PrintLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - BaseLib - PcdLib - - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## SOMETIMES_CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.uni deleted file mode 100644 index 75fec00..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Print Library implementation. -// -// Print Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Print Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "Print Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLib.c deleted file mode 100644 index f0f59e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLib.c +++ /dev/null @@ -1,961 +0,0 @@ -/** @file - Base Print Library instance implementation. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "PrintLibInternal.h" - -// -// Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker() -// when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored. -// A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some -// compilers define VA_LIST to be a structure. -// -VA_LIST gNullVaList; - -#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0) - -/** - Produces a Null-terminated Unicode string in an output buffer based on - a Null-terminated Unicode format string and a VA_LIST argument list. - - This function is similar as vsnprintf_s defined in C11. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on the - contents of the format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param Marker VA_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeVSPrint ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - IN VA_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (StartOfBuffer); - ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker, NULL); -} - -/** - Produces a Null-terminated Unicode string in an output buffer based on - a Null-terminated Unicode format string and a BASE_LIST argument list. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on the - contents of the format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param Marker BASE_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeBSPrint ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - IN BASE_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (StartOfBuffer); - ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker); -} - -/** - Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated - Unicode format string and variable argument list. - - This function is similar as snprintf_s defined in C11. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list based on the contents of the format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param ... Variable argument list whose contents are accessed based on the - format string specified by FormatString. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeSPrint ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN NumberOfPrinted; - - VA_START (Marker, FormatString); - NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); - VA_END (Marker); - return NumberOfPrinted; -} - -/** - Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated - ASCII format string and a VA_LIST argument list. - - This function is similar as vsnprintf_s defined in C11. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on the - contents of the format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param Marker VA_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeVSPrintAsciiFormat ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - IN VA_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (StartOfBuffer); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, Marker, NULL); -} - -/** - Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated - ASCII format string and a BASE_LIST argument list. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on the - contents of the format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param Marker BASE_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeBSPrintAsciiFormat ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - IN BASE_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (StartOfBuffer); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker); -} - -/** - Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated - ASCII format string and variable argument list. - - This function is similar as snprintf_s defined in C11. - - Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer - and BufferSize. - The Unicode string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list based on the contents of the - format string. - The number of Unicode characters in the produced output buffer is returned not including - the Null-terminator. - - If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and BufferSize > - (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output - buffer is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - Unicode string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param ... Variable argument list whose contents are accessed based on the - format string specified by FormatString. - - @return The number of Unicode characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeSPrintAsciiFormat ( - OUT CHAR16 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN NumberOfPrinted; - - VA_START (Marker, FormatString); - NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); - VA_END (Marker); - return NumberOfPrinted; -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function is deprecated for security reason. - - Converts a decimal value to a Null-terminated Unicode string. - - Converts the decimal number specified by Value to a Null-terminated Unicode - string specified by Buffer containing at most Width characters. No padding of spaces - is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. - The number of Unicode characters in Buffer is returned not including the Null-terminator. - If the conversion contains more than Width characters, then only the first - Width characters are returned, and the total number of characters - required to perform the conversion is returned. - Additional conversion parameters are specified in Flags. - - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas - are inserted every 3rd digit starting from the right. - If RADIX_HEX is set in Flags, then the output buffer will be - formatted in hexadecimal format. - If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the Null-terminator - add up to Width characters. - If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If unsupported bits are set in Flags, then ASSERT(). - If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). - If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() - - @param Buffer The pointer to the output buffer for the produced Null-terminated - Unicode string. - @param Flags The bitmask of flags that specify left justification, zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of Unicode characters to place in Buffer, not including - the Null-terminator. - - @return The number of Unicode characters in Buffer not including the Null-terminator. - -**/ -UINTN -EFIAPI -UnicodeValueToString ( - IN OUT CHAR16 *Buffer, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width - ) -{ - ASSERT_UNICODE_BUFFER(Buffer); - return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2); -} - -#endif - -/** - Converts a decimal value to a Null-terminated Unicode string. - - Converts the decimal number specified by Value to a Null-terminated Unicode - string specified by Buffer containing at most Width characters. No padding of - spaces is ever performed. If Width is 0 then a width of - MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than - Width characters, then only the first Width characters are placed in Buffer. - Additional conversion parameters are specified in Flags. - - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and - commas are inserted every 3rd digit starting from the right. - If RADIX_HEX is set in Flags, then the output buffer will be formatted in - hexadecimal format. - If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in - Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then - Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the - Null-terminator add up to Width characters. - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If an error would be returned, then the function will also ASSERT(). - - @param Buffer The pointer to the output buffer for the produced - Null-terminated Unicode string. - @param BufferSize The size of Buffer in bytes, including the - Null-terminator. - @param Flags The bitmask of flags that specify left justification, - zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of Unicode characters to place in - Buffer, not including the Null-terminator. - - @retval RETURN_SUCCESS The decimal value is converted. - @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted - value. - @retval RETURN_INVALID_PARAMETER If Buffer is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and BufferSize is greater than - (PcdMaximumUnicodeStringLength * - sizeof (CHAR16) + 1). - If unsupported bits are set in Flags. - If both COMMA_TYPE and RADIX_HEX are set in - Flags. - If Width >= MAXIMUM_VALUE_CHARACTERS. - -**/ -RETURN_STATUS -EFIAPI -UnicodeValueToStringS ( - IN OUT CHAR16 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width - ) -{ - ASSERT_UNICODE_BUFFER(Buffer); - return BasePrintLibConvertValueToStringS ((CHAR8 *)Buffer, BufferSize, Flags, Value, Width, 2); -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - ASCII format string and a VA_LIST argument list. - - This function is similar as vsnprintf_s defined in C11. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on - the contents of the format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param Marker VA_LIST marker for the variable argument list. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiVSPrint ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - IN VA_LIST Marker - ) -{ - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, Marker, NULL); -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - ASCII format string and a BASE_LIST argument list. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on - the contents of the format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param Marker BASE_LIST marker for the variable argument list. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiBSPrint ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - IN BASE_LIST Marker - ) -{ - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker); -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - ASCII format string and variable argument list. - - This function is similar as snprintf_s defined in C11. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list based on the contents of the - format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than - PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated ASCII format string. - @param ... Variable argument list whose contents are accessed based on the - format string specified by FormatString. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiSPrint ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR8 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN NumberOfPrinted; - - VA_START (Marker, FormatString); - NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); - VA_END (Marker); - return NumberOfPrinted; -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - Unicode format string and a VA_LIST argument list. - - This function is similar as vsnprintf_s defined in C11. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on - the contents of the format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param Marker VA_LIST marker for the variable argument list. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiVSPrintUnicodeFormat ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - IN VA_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker, NULL); -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - Unicode format string and a BASE_LIST argument list. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list specified by Marker based on - the contents of the format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param Marker BASE_LIST marker for the variable argument list. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiBSPrintUnicodeFormat ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - IN BASE_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker); -} - -/** - Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated - Unicode format string and variable argument list. - - This function is similar as snprintf_s defined in C11. - - Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer - and BufferSize. - The ASCII string is produced by parsing the format string specified by FormatString. - Arguments are pulled from the variable argument list based on the contents of the - format string. - The number of ASCII characters in the produced output buffer is returned not including - the Null-terminator. - - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is - unmodified and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and BufferSize > - (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer - is unmodified and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then - ASSERT(). Also, the output buffer is unmodified and 0 is returned. - - If BufferSize is 0, then no output buffer is produced and 0 is returned. - - @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated - ASCII string. - @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. - @param FormatString A Null-terminated Unicode format string. - @param ... Variable argument list whose contents are accessed based on the - format string specified by FormatString. - - @return The number of ASCII characters in the produced output buffer not including the - Null-terminator. - -**/ -UINTN -EFIAPI -AsciiSPrintUnicodeFormat ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN CONST CHAR16 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN NumberOfPrinted; - - VA_START (Marker, FormatString); - NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); - VA_END (Marker); - return NumberOfPrinted; -} - - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function is deprecated for security reason. - - Converts a decimal value to a Null-terminated ASCII string. - - Converts the decimal number specified by Value to a Null-terminated ASCII string - specified by Buffer containing at most Width characters. No padding of spaces - is ever performed. - If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. - The number of ASCII characters in Buffer is returned not including the Null-terminator. - If the conversion contains more than Width characters, then only the first Width - characters are returned, and the total number of characters required to perform - the conversion is returned. - Additional conversion parameters are specified in Flags. - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas - are inserted every 3rd digit starting from the right. - If RADIX_HEX is set in Flags, then the output buffer will be - formatted in hexadecimal format. - If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the Null-terminator - add up to Width characters. - - If Buffer is NULL, then ASSERT(). - If unsupported bits are set in Flags, then ASSERT(). - If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). - If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() - - @param Buffer The pointer to the output buffer for the produced Null-terminated - ASCII string. - @param Flags The bitmask of flags that specify left justification, zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of ASCII characters to place in Buffer, not including - the Null-terminator. - - @return The number of ASCII characters in Buffer not including the Null-terminator. - -**/ -UINTN -EFIAPI -AsciiValueToString ( - OUT CHAR8 *Buffer, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width - ) -{ - return BasePrintLibConvertValueToString (Buffer, Flags, Value, Width, 1); -} - -#endif - -/** - Converts a decimal value to a Null-terminated Ascii string. - - Converts the decimal number specified by Value to a Null-terminated Ascii - string specified by Buffer containing at most Width characters. No padding of - spaces is ever performed. If Width is 0 then a width of - MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than - Width characters, then only the first Width characters are placed in Buffer. - Additional conversion parameters are specified in Flags. - - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and - commas are inserted every 3rd digit starting from the right. - If RADIX_HEX is set in Flags, then the output buffer will be formatted in - hexadecimal format. - If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in - Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then - Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the - Null-terminator add up to Width characters. - - If an error would be returned, then the function will ASSERT(). - - @param Buffer The pointer to the output buffer for the produced - Null-terminated Ascii string. - @param BufferSize The size of Buffer in bytes, including the - Null-terminator. - @param Flags The bitmask of flags that specify left justification, - zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of Ascii characters to place in - Buffer, not including the Null-terminator. - - @retval RETURN_SUCCESS The decimal value is converted. - @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted - value. - @retval RETURN_INVALID_PARAMETER If Buffer is NULL. - If PcdMaximumAsciiStringLength is not - zero, and BufferSize is greater than - PcdMaximumAsciiStringLength. - If unsupported bits are set in Flags. - If both COMMA_TYPE and RADIX_HEX are set in - Flags. - If Width >= MAXIMUM_VALUE_CHARACTERS. - -**/ -RETURN_STATUS -EFIAPI -AsciiValueToStringS ( - IN OUT CHAR8 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width - ) -{ - return BasePrintLibConvertValueToStringS (Buffer, BufferSize, Flags, Value, Width, 1); -} - -/** - Returns the number of characters that would be produced by if the formatted - output were produced not including the Null-terminator. - - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - If FormatString is NULL, then ASSERT() and 0 is returned. - If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more - than PcdMaximumUnicodeStringLength Unicode characters not including the - Null-terminator, then ASSERT() and 0 is returned. - - @param[in] FormatString A Null-terminated Unicode format string. - @param[in] Marker VA_LIST marker for the variable argument list. - - @return The number of characters that would be produced, not including the - Null-terminator. -**/ -UINTN -EFIAPI -SPrintLength ( - IN CONST CHAR16 *FormatString, - IN VA_LIST Marker - ) -{ - ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL); -} - -/** - Returns the number of characters that would be produced by if the formatted - output were produced not including the Null-terminator. - - If FormatString is NULL, then ASSERT() and 0 is returned. - If PcdMaximumAsciiStringLength is not zero, and FormatString contains more - than PcdMaximumAsciiStringLength Ascii characters not including the - Null-terminator, then ASSERT() and 0 is returned. - - @param[in] FormatString A Null-terminated ASCII format string. - @param[in] Marker VA_LIST marker for the variable argument list. - - @return The number of characters that would be produced, not including the - Null-terminator. -**/ -UINTN -EFIAPI -SPrintLengthAsciiFormat ( - 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/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c deleted file mode 100644 index 0a8cfe3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ /dev/null @@ -1,1269 +0,0 @@ -/** @file - Print Library internal worker functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "PrintLibInternal.h" - -#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 SAFE_PRINT_CONSTRAINT_CHECK(Expression, RetVal) \ - do { \ - ASSERT (Expression); \ - if (!(Expression)) { \ - return RetVal; \ - } \ - } 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 * CONST mStatusString[] = { - "Success", // RETURN_SUCCESS = 0 - "Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH = 1 - "Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE = 2 - "Warning Write Failure", // RETURN_WARN_WRITE_FAILURE = 3 - "Warning Buffer Too Small", // RETURN_WARN_BUFFER_TOO_SMALL = 4 - "Warning Stale Data", // RETURN_WARN_STALE_DATA = 5 - "Load Error", // RETURN_LOAD_ERROR = 1 | MAX_BIT - "Invalid Parameter", // RETURN_INVALID_PARAMETER = 2 | MAX_BIT - "Unsupported", // RETURN_UNSUPPORTED = 3 | MAX_BIT - "Bad Buffer Size", // RETURN_BAD_BUFFER_SIZE = 4 | MAX_BIT - "Buffer Too Small", // RETURN_BUFFER_TOO_SMALL, = 5 | MAX_BIT - "Not Ready", // RETURN_NOT_READY = 6 | MAX_BIT - "Device Error", // RETURN_DEVICE_ERROR = 7 | MAX_BIT - "Write Protected", // RETURN_WRITE_PROTECTED = 8 | MAX_BIT - "Out of Resources", // RETURN_OUT_OF_RESOURCES = 9 | MAX_BIT - "Volume Corrupt", // RETURN_VOLUME_CORRUPTED = 10 | MAX_BIT - "Volume Full", // RETURN_VOLUME_FULL = 11 | MAX_BIT - "No Media", // RETURN_NO_MEDIA = 12 | MAX_BIT - "Media changed", // RETURN_MEDIA_CHANGED = 13 | MAX_BIT - "Not Found", // RETURN_NOT_FOUND = 14 | MAX_BIT - "Access Denied", // RETURN_ACCESS_DENIED = 15 | MAX_BIT - "No Response", // RETURN_NO_RESPONSE = 16 | MAX_BIT - "No mapping", // RETURN_NO_MAPPING = 17 | MAX_BIT - "Time out", // RETURN_TIMEOUT = 18 | MAX_BIT - "Not started", // RETURN_NOT_STARTED = 19 | MAX_BIT - "Already started", // RETURN_ALREADY_STARTED = 20 | MAX_BIT - "Aborted", // RETURN_ABORTED = 21 | MAX_BIT - "ICMP Error", // RETURN_ICMP_ERROR = 22 | MAX_BIT - "TFTP Error", // RETURN_TFTP_ERROR = 23 | MAX_BIT - "Protocol Error", // RETURN_PROTOCOL_ERROR = 24 | MAX_BIT - "Incompatible Version", // RETURN_INCOMPATIBLE_VERSION = 25 | MAX_BIT - "Security Violation", // RETURN_SECURITY_VIOLATION = 26 | MAX_BIT - "CRC Error", // RETURN_CRC_ERROR = 27 | MAX_BIT - "End of Media", // RETURN_END_OF_MEDIA = 28 | MAX_BIT - "Reserved (29)", // RESERVED = 29 | MAX_BIT - "Reserved (30)", // RESERVED = 30 | MAX_BIT - "End of File", // RETURN_END_OF_FILE = 31 | MAX_BIT - "Invalid Language", // RETURN_INVALID_LANGUAGE = 32 | MAX_BIT - "Compromised Data" // RETURN_COMPROMISED_DATA = 33 | MAX_BIT -}; - - -/** - Internal function that places the character into the Buffer. - - Internal function that places ASCII or Unicode character into the Buffer. - - @param Buffer The buffer to place the Unicode or ASCII string. - @param EndBuffer The end of the input Buffer. No characters will be - placed after that. - @param Length The count of character to be placed into Buffer. - (Negative value indicates no buffer fill.) - @param Character The character to be placed into Buffer. - @param Increment The character increment in Buffer. - - @return Buffer. - -**/ -CHAR8 * -BasePrintLibFillBuffer ( - 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; - if (Increment != 1) { - *(Buffer + 1) = (CHAR8)(Character >> 8); - } - Buffer += Increment; - } - - return Buffer; -} - -/** - Internal function that convert a number to a string in Buffer. - - Print worker function that converts a decimal or hexadecimal number to an ASCII string in Buffer. - - @param Buffer Location to place the ASCII string of Value. - @param Value The value to convert to a Decimal or Hexadecimal string in Buffer. - @param Radix Radix of the value - - @return A pointer to the end of buffer filled with ASCII string. - -**/ -CHAR8 * -BasePrintLibValueToString ( - IN OUT CHAR8 *Buffer, - IN INT64 Value, - IN UINTN Radix - ) -{ - UINT32 Remainder; - - // - // Loop to convert one digit at a time in reverse order - // - *Buffer = 0; - do { - Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder); - *(++Buffer) = mHexStr[Remainder]; - } while (Value != 0); - - // - // Return pointer of the end of filled buffer. - // - return Buffer; -} - -/** - Internal function that converts a decimal value to a Null-terminated string. - - Converts the decimal number specified by Value to a Null-terminated - string specified by Buffer containing at most Width characters. - If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. - The total number of characters placed in Buffer is returned. - If the conversion contains more than Width characters, then only the first - Width characters are returned, and the total number of characters - required to perform the conversion is returned. - Additional conversion parameters are specified in Flags. - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas - are inserted every 3rd digit starting from the right. - If Value is < 0, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the Null-terminator - add up to Width characters. - - If Buffer is NULL, then ASSERT(). - If unsupported bits are set in Flags, then ASSERT(). - If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() - - @param Buffer The pointer to the output buffer for the produced Null-terminated - string. - @param Flags The bitmask of flags that specify left justification, zero pad, - and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of characters to place in Buffer, not including - the Null-terminator. - @param Increment The character increment in Buffer. - - @return Total number of characters required to perform the conversion. - -**/ -UINTN -BasePrintLibConvertValueToString ( - IN OUT CHAR8 *Buffer, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width, - IN UINTN Increment - ) -{ - CHAR8 *OriginalBuffer; - CHAR8 *EndBuffer; - CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS]; - CHAR8 *ValueBufferPtr; - UINTN Count; - UINTN Digits; - UINTN Index; - UINTN Radix; - - // - // Make sure Buffer is not NULL and Width < MAXIMUM - // - ASSERT (Buffer != NULL); - ASSERT (Width < MAXIMUM_VALUE_CHARACTERS); - // - // Make sure Flags can only contain supported bits. - // - ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO | RADIX_HEX)) == 0); - - // - // If both COMMA_TYPE and RADIX_HEX are set, then ASSERT () - // - ASSERT (((Flags & COMMA_TYPE) == 0) || ((Flags & RADIX_HEX) == 0)); - - OriginalBuffer = Buffer; - - // - // 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 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. - // - EndBuffer = Buffer + Width * Increment; - - // - // Convert decimal negative - // - if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) { - Value = -Value; - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment); - Width--; - } - - // - // Count the length of the value string. - // - Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16; - ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix); - Count = ValueBufferPtr - ValueBuffer; - - // - // Append Zero - // - if ((Flags & PREFIX_ZERO) != 0) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment); - } - - // - // Print Comma type for every 3 characters - // - Digits = Count % 3; - if (Digits != 0) { - Digits = 3 - Digits; - } - for (Index = 0; Index < Count; Index++) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, *ValueBufferPtr--, Increment); - if ((Flags & COMMA_TYPE) != 0) { - Digits++; - if (Digits == 3) { - Digits = 0; - if ((Index + 1) < Count) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment); - } - } - } - } - - // - // Print Null-terminator - // - BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment); - - return ((Buffer - OriginalBuffer) / Increment); -} - -/** - Internal function that converts a decimal value to a Null-terminated string. - - Converts the decimal number specified by Value to a Null-terminated string - specified by Buffer containing at most Width characters. If Width is 0 then a - width of MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more - than Width characters, then only the first Width characters are placed in - Buffer. Additional conversion parameters are specified in Flags. - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and - commas are inserted every 3rd digit starting from the right. - If Value is < 0, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional - '-' sign character, '0' characters, digit characters for Value, and the - Null-terminator add up to Width characters. - - If an error would be returned, the function will ASSERT(). - - @param Buffer The pointer to the output buffer for the produced - Null-terminated string. - @param BufferSize The size of Buffer in bytes, including the - Null-terminator. - @param Flags The bitmask of flags that specify left justification, - zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of characters to place in Buffer, - not including the Null-terminator. - @param Increment The character increment in Buffer. - - @retval RETURN_SUCCESS The decimal value is converted. - @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted - value. - @retval RETURN_INVALID_PARAMETER If Buffer is NULL. - If Increment is 1 and - PcdMaximumAsciiStringLength is not zero, - BufferSize is greater than - PcdMaximumAsciiStringLength. - If Increment is not 1 and - PcdMaximumUnicodeStringLength is not zero, - BufferSize is greater than - (PcdMaximumUnicodeStringLength * - sizeof (CHAR16) + 1). - If unsupported bits are set in Flags. - If both COMMA_TYPE and RADIX_HEX are set in - Flags. - If Width >= MAXIMUM_VALUE_CHARACTERS. - -**/ -RETURN_STATUS -BasePrintLibConvertValueToStringS ( - IN OUT CHAR8 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width, - IN UINTN Increment - ) -{ - CHAR8 *EndBuffer; - CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS]; - CHAR8 *ValueBufferPtr; - UINTN Count; - UINTN Digits; - UINTN Index; - UINTN Radix; - - // - // 1. Buffer shall not be a null pointer. - // - SAFE_PRINT_CONSTRAINT_CHECK ((Buffer != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. BufferSize shall not be greater than (RSIZE_MAX * sizeof (CHAR16)) for - // Unicode output string or shall not be greater than ASCII_RSIZE_MAX for - // Ascii output string. - // - if (Increment == 1) { - // - // Ascii output string - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - } else { - // - // Unicode output string - // - if (RSIZE_MAX != 0) { - SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= RSIZE_MAX * sizeof (CHAR16) + 1), RETURN_INVALID_PARAMETER); - } - } - - // - // 3. Flags shall be set properly. - // - SAFE_PRINT_CONSTRAINT_CHECK (((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO | RADIX_HEX)) == 0), RETURN_INVALID_PARAMETER); - SAFE_PRINT_CONSTRAINT_CHECK ((((Flags & COMMA_TYPE) == 0) || ((Flags & RADIX_HEX) == 0)), RETURN_INVALID_PARAMETER); - - // - // 4. Width shall be smaller than MAXIMUM_VALUE_CHARACTERS. - // - SAFE_PRINT_CONSTRAINT_CHECK ((Width < MAXIMUM_VALUE_CHARACTERS), RETURN_INVALID_PARAMETER); - - // - // 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 is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. - // - if (Width == 0) { - Width = MAXIMUM_VALUE_CHARACTERS - 1; - } - - // - // Count the characters of the output string. - // - Count = 0; - Radix = ((Flags & RADIX_HEX) == 0)? 10 : 16; - - if ((Flags & PREFIX_ZERO) != 0) { - Count = Width; - } else { - if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) { - Count++; // minus sign - ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, -Value, Radix); - } else { - ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix); - } - Digits = ValueBufferPtr - ValueBuffer; - Count += Digits; - - if ((Flags & COMMA_TYPE) != 0) { - Count += (Digits - 1) / 3; // commas - } - } - - Width = MIN (Count, Width); - - // - // 5. BufferSize shall be large enough to hold the converted string. - // - SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize >= (Width + 1) * Increment), RETURN_BUFFER_TOO_SMALL); - - // - // Set the tag for the end of the input Buffer. - // - EndBuffer = Buffer + Width * Increment; - - // - // Convert decimal negative - // - if ((Value < 0) && ((Flags & RADIX_HEX) == 0)) { - Value = -Value; - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, '-', Increment); - Width--; - } - - // - // Count the length of the value string. - // - ValueBufferPtr = BasePrintLibValueToString (ValueBuffer, Value, Radix); - Count = ValueBufferPtr - ValueBuffer; - - // - // Append Zero - // - if ((Flags & PREFIX_ZERO) != 0) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Count, '0', Increment); - } - - // - // Print Comma type for every 3 characters - // - Digits = Count % 3; - if (Digits != 0) { - Digits = 3 - Digits; - } - for (Index = 0; Index < Count; Index++) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, *ValueBufferPtr--, Increment); - if ((Flags & COMMA_TYPE) != 0) { - Digits++; - if (Digits == 3) { - Digits = 0; - if ((Index + 1) < Count) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', Increment); - } - } - } - } - - // - // Print Null-terminator - // - BasePrintLibFillBuffer (Buffer, EndBuffer + Increment, 1, 0, Increment); - - return RETURN_SUCCESS; -} - -/** - Worker function that produces a Null-terminated string in an output buffer - based on a Null-terminated format string and a VA_LIST argument list. - - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus - this is the main print working routine. - - If COUNT_ONLY_NO_PRINT is set in Flags, Buffer will not be modified at all. - - @param[out] Buffer The character buffer to print the results of the - parsing of Format into. - @param[in] BufferSize The maximum number of characters to put into - buffer. - @param[in] Flags Initial flags value. - Can only have FORMAT_UNICODE, OUTPUT_UNICODE, - and COUNT_ONLY_NO_PRINT set. - @param[in] Format A Null-terminated format string. - @param[in] VaListMarker VA_LIST style variable argument list consumed by - processing Format. - @param[in] BaseListMarker BASE_LIST style variable argument list consumed - by processing Format. - - @return The number of characters printed not including the Null-terminator. - If COUNT_ONLY_NO_PRINT was set returns the same, but without any - modification to Buffer. - -**/ -UINTN -BasePrintLibSPrintMarker ( - OUT CHAR8 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN CONST CHAR8 *Format, - IN VA_LIST VaListMarker, OPTIONAL - 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; - - // - // If you change this code be sure to match the 2 versions of this function. - // Nearly identical logic is found in the BasePrintLib and - // DxePrintLibPrint2Protocol (both PrintLib instances). - // - - // - // 1. Buffer shall not be a null pointer when both BufferSize > 0 and - // COUNT_ONLY_NO_PRINT is not set in Flags. - // - if ((BufferSize > 0) && ((Flags & COUNT_ONLY_NO_PRINT) == 0)) { - SAFE_PRINT_CONSTRAINT_CHECK ((Buffer != NULL), 0); - } - - // - // 2. Format shall not be a null pointer when BufferSize > 0 or when - // COUNT_ONLY_NO_PRINT is set in Flags. - // - if ((BufferSize > 0) || ((Flags & COUNT_ONLY_NO_PRINT) != 0)) { - SAFE_PRINT_CONSTRAINT_CHECK ((Format != NULL), 0); - } - - // - // 3. BufferSize shall not be greater than RSIZE_MAX for Unicode output or - // ASCII_RSIZE_MAX for Ascii output. - // - if ((Flags & OUTPUT_UNICODE) != 0) { - 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; - } - - // - // 4. Format shall not contain more than RSIZE_MAX Unicode characters or - // ASCII_RSIZE_MAX Ascii characters. - // - if ((Flags & FORMAT_UNICODE) != 0) { - if (RSIZE_MAX != 0) { - SAFE_PRINT_CONSTRAINT_CHECK ((StrnLenS ((CHAR16 *)Format, RSIZE_MAX + 1) <= RSIZE_MAX), 0); - } - BytesPerFormatCharacter = 2; - 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; - } - - if ((Flags & COUNT_ONLY_NO_PRINT) != 0) { - if (BufferSize == 0) { - Buffer = NULL; - } - } else { - // - // We can run without a Buffer for counting only. - // - if (BufferSize == 0) { - return 0; - } - } - - LengthToReturn = 0; - EndBuffer = NULL; - OriginalBuffer = NULL; - - // - // Reserve space for the Null terminator. - // - if (Buffer != NULL) { - BufferSize--; - OriginalBuffer = Buffer; - - // - // Set the tag for the end of the input Buffer. - // - EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter; - } - - // - // Get the first character from the format string - // - FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask; - - // - // Loop until the end of the format string is reached or the output buffer is full - // - while (FormatCharacter != 0) { - 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); - - // - // Set the default width to zero, and the default precision to 1 - // - Width = 0; - Precision = 1; - Prefix = 0; - Comma = FALSE; - ZeroPad = FALSE; - Count = 0; - 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; - 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 '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. - // - 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; - } - } - // - // Convert Value to a reversed string - // - 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 = ""; - } - // - // Set the default precision for string to be zero if not specified. - // - if ((Flags & PRECISION) == 0) { - Precision = 0; - } - 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 = ""; - } 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 = ""; - } 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 = mStatusString [Index + WARNING_STATUS_NUMBER]; - } - } else { - Index = Status; - if (Index <= WARNING_STATUS_NUMBER) { - ArgumentString = mStatusString [Index]; - } - } - if (ArgumentString == ValueBuffer) { - BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status); - } - 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; - - 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; - 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; - BytesPerArgumentCharacter = 2; - } else { - ArgumentMask = 0xff; - BytesPerArgumentCharacter = 1; - } - if ((Flags & ARGUMENT_REVERSED) != 0) { - BytesPerArgumentCharacter = -BytesPerArgumentCharacter; - } else { - // - // Compute the number of characters in ArgumentString and store it in Count - // 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++) { - ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask; - if (ArgumentCharacter == 0) { - break; - } - } - } - - if (Precision < Count) { - Precision = Count; - } - - // - // Pad before the string - // - if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) { - LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter); - if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter); - } - } - - if (ZeroPad) { - if (Prefix != 0) { - LengthToReturn += (1 * BytesPerOutputCharacter); - 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) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, '0', BytesPerOutputCharacter); - } - } else { - LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter); - 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) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter); - } - } - } - - // - // Output the Prefix character if it is present - // - Index = 0; - if (Prefix != 0) { - Index++; - } - - // - // Copy the string into the output buffer performing the required type conversions - // - while (Index < Count && - (ArgumentString[0] != '\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) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ArgumentCharacter, BytesPerOutputCharacter); - } - ArgumentString += BytesPerArgumentCharacter; - Index++; - if (Comma) { - Digits++; - if (Digits == 3) { - Digits = 0; - Index++; - if (Index < Count) { - LengthToReturn += (1 * BytesPerOutputCharacter); - if ((Flags & COUNT_ONLY_NO_PRINT) == 0 && Buffer != NULL) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', BytesPerOutputCharacter); - } - } - } - } - } - - // - // Pad after the string - // - 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) { - Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter); - } - } - - // - // Get the next character from the format string - // - Format += BytesPerFormatCharacter; - - // - // Get the next character from the format string - // - FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask; - } - - if ((Flags & COUNT_ONLY_NO_PRINT) != 0) { - return (LengthToReturn / BytesPerOutputCharacter); - } - - ASSERT (Buffer != NULL); - // - // Null terminate the Unicode or ASCII string - // - BasePrintLibFillBuffer (Buffer, EndBuffer + BytesPerOutputCharacter, 1, 0, BytesPerOutputCharacter); - - return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter); -} - -/** - Worker function that produces a Null-terminated string in an output buffer - based on a Null-terminated format string and variable argument list. - - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus - this is the main print working routine - - @param StartOfBuffer The character buffer to print the results of the parsing - of Format into. - @param BufferSize The maximum number of characters to put into buffer. - Zero means no limit. - @param Flags Initial flags value. - Can only have FORMAT_UNICODE and OUTPUT_UNICODE set - @param FormatString A Null-terminated format string. - @param ... The variable argument list. - - @return The number of characters printed. - -**/ -UINTN -EFIAPI -BasePrintLibSPrint ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN CONST CHAR8 *FormatString, - ... - ) -{ - VA_LIST Marker; - UINTN NumberOfPrinted; - - VA_START (Marker, FormatString); - NumberOfPrinted = BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL); - VA_END (Marker); - return NumberOfPrinted; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.h deleted file mode 100644 index d2603d3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.h +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - Base Print Library instance Internal Functions definition. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __PRINT_LIB_INTERNAL_H__ -#define __PRINT_LIB_INTERNAL_H__ - -#include -#include -#include -#include -#include - - -// -// 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 - -// -// 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; -} TIME; - -/** - Worker function that produces a Null-terminated string in an output buffer - based on a Null-terminated format string and a VA_LIST argument list. - - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus - this is the main print working routine. - - If COUNT_ONLY_NO_PRINT is set in Flags, Buffer will not be modified at all. - - @param[out] Buffer The character buffer to print the results of the - parsing of Format into. - @param[in] BufferSize The maximum number of characters to put into - buffer. - @param[in] Flags Initial flags value. - Can only have FORMAT_UNICODE, OUTPUT_UNICODE, - and COUNT_ONLY_NO_PRINT set. - @param[in] Format A Null-terminated format string. - @param[in] VaListMarker VA_LIST style variable argument list consumed by - processing Format. - @param[in] BaseListMarker BASE_LIST style variable argument list consumed - by processing Format. - - @return The number of characters printed not including the Null-terminator. - If COUNT_ONLY_NO_PRINT was set returns the same, but without any - modification to Buffer. - -**/ -UINTN -BasePrintLibSPrintMarker ( - OUT CHAR8 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN CONST CHAR8 *Format, - IN VA_LIST VaListMarker, OPTIONAL - IN BASE_LIST BaseListMarker OPTIONAL - ); - -/** - Worker function that produces a Null-terminated string in an output buffer - based on a Null-terminated format string and variable argument list. - - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus - this is the main print working routine - - @param StartOfBuffer The character buffer to print the results of the parsing - of Format into. - @param BufferSize The maximum number of characters to put into buffer. - Zero means no limit. - @param Flags Initial flags value. - Can only have FORMAT_UNICODE and OUTPUT_UNICODE set - @param FormatString Null-terminated format string. - @param ... The variable argument list. - - @return The number of characters printed. - -**/ -UINTN -EFIAPI -BasePrintLibSPrint ( - OUT CHAR8 *StartOfBuffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN CONST CHAR8 *FormatString, - ... - ); - -/** - Internal function that places the character into the Buffer. - - Internal function that places ASCII or Unicode character into the Buffer. - - @param Buffer Buffer to place the Unicode or ASCII string. - @param EndBuffer The end of the input Buffer. No characters will be - placed after that. - @param Length The count of character to be placed into Buffer. - (Negative value indicates no buffer fill.) - @param Character The character to be placed into Buffer. - @param Increment The character increment in Buffer. - - @return Buffer Buffer filled with the input Character. - -**/ -CHAR8 * -BasePrintLibFillBuffer ( - OUT CHAR8 *Buffer, - IN CHAR8 *EndBuffer, - IN INTN Length, - IN UINTN Character, - IN INTN Increment - ); - -/** - Internal function that convert a number to a string in Buffer. - - Print worker function that converts a decimal or hexadecimal number to an ASCII string in Buffer. - - @param Buffer Location to place the ASCII string of Value. - @param Value The value to convert to a Decimal or Hexadecimal string in Buffer. - @param Radix Radix of the value - - @return A pointer to the end of buffer filled with ASCII string. - -**/ -CHAR8 * -BasePrintLibValueToString ( - IN OUT CHAR8 *Buffer, - IN INT64 Value, - IN UINTN Radix - ); - -/** - Internal function that converts a decimal value to a Null-terminated string. - - Converts the decimal number specified by Value to a Null-terminated - string specified by Buffer containing at most Width characters. - If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. - The total number of characters placed in Buffer is returned. - If the conversion contains more than Width characters, then only the first - Width characters are returned, and the total number of characters - required to perform the conversion is returned. - Additional conversion parameters are specified in Flags. - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas - are inserted every 3rd digit starting from the right. - If Value is < 0, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional '-' - sign character, '0' characters, digit characters for Value, and the Null-terminator - add up to Width characters. - - If Buffer is NULL, then ASSERT(). - If unsupported bits are set in Flags, then ASSERT(). - If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() - - @param Buffer The pointer to the output buffer for the produced Null-terminated - string. - @param Flags The bitmask of flags that specify left justification, zero pad, - and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of characters to place in Buffer, not including - the Null-terminator. - @param Increment Character increment in Buffer. - - @return Total number of characters required to perform the conversion. - -**/ -UINTN -BasePrintLibConvertValueToString ( - IN OUT CHAR8 *Buffer, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width, - IN UINTN Increment - ); - -/** - Internal function that converts a decimal value to a Null-terminated string. - - Converts the decimal number specified by Value to a Null-terminated string - specified by Buffer containing at most Width characters. If Width is 0 then a - width of MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more - than Width characters, then only the first Width characters are placed in - Buffer. Additional conversion parameters are specified in Flags. - The Flags bit LEFT_JUSTIFY is always ignored. - All conversions are left justified in Buffer. - If Width is 0, PREFIX_ZERO is ignored in Flags. - If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and - commas are inserted every 3rd digit starting from the right. - If Value is < 0, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional - '-' sign character, '0' characters, digit characters for Value, and the - Null-terminator add up to Width characters. - - If an error would be returned, the function will ASSERT(). - - @param Buffer The pointer to the output buffer for the produced - Null-terminated string. - @param BufferSize The size of Buffer in bytes, including the - Null-terminator. - @param Flags The bitmask of flags that specify left justification, - zero pad, and commas. - @param Value The 64-bit signed value to convert to a string. - @param Width The maximum number of characters to place in Buffer, - not including the Null-terminator. - @param Increment The character increment in Buffer. - - @retval RETURN_SUCCESS The decimal value is converted. - @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted - value. - @retval RETURN_INVALID_PARAMETER If Buffer is NULL. - If Increment is 1 and - PcdMaximumAsciiStringLength is not zero, - BufferSize is greater than - PcdMaximumAsciiStringLength. - If Increment is not 1 and - PcdMaximumUnicodeStringLength is not zero, - BufferSize is greater than - (PcdMaximumUnicodeStringLength * - sizeof (CHAR16) + 1). - If unsupported bits are set in Flags. - If both COMMA_TYPE and RADIX_HEX are set in - Flags. - If Width >= MAXIMUM_VALUE_CHARACTERS. - -**/ -RETURN_STATUS -BasePrintLibConvertValueToStringS ( - IN OUT CHAR8 *Buffer, - IN UINTN BufferSize, - IN UINTN Flags, - IN INT64 Value, - IN UINTN Width, - IN UINTN Increment - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c deleted file mode 100644 index e9416b2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c +++ /dev/null @@ -1,392 +0,0 @@ -/** @file - Null Base Report Status Code Library instance with empty functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Converts a status code to an 8-bit POST code value. - - Converts the status code specified by CodeType and Value to an 8-bit POST code - and returns the 8-bit POST code in PostCode. If CodeType is an - EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode - are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits - 24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned. - - If PostCode is NULL, then ASSERT(). - - @param CodeType The type of status code being converted. - @param Value The status code value being converted. - @param PostCode A pointer to the 8-bit POST code value to return. - - @retval TRUE The status code specified by CodeType and Value was converted - to an 8-bit POST code and returned in PostCode. - @retval FALSE The status code specified by CodeType and Value could not be - converted to an 8-bit POST code value. - -**/ -BOOLEAN -EFIAPI -CodeTypeToPostCode ( - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value, - OUT UINT8 *PostCode - ) -{ - ASSERT (PostCode != NULL); - - return FALSE; -} - - -/** - Extracts ASSERT() information from a status code structure. - - Converts the status code specified by CodeType, Value, and Data to the ASSERT() - arguments specified by Filename, Description, and LineNumber. If CodeType is - an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and - Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract - Filename, Description, and LineNumber from the optional data area of the - status code buffer specified by Data. The optional data area of Data contains - a Null-terminated ASCII string for the FileName, followed by a Null-terminated - ASCII string for the Description, followed by a 32-bit LineNumber. If the - ASSERT() information could be extracted from Data, then return TRUE. - Otherwise, FALSE is returned. - - If Data is NULL, then ASSERT(). - If Filename is NULL, then ASSERT(). - If Description is NULL, then ASSERT(). - If LineNumber is NULL, then ASSERT(). - - @param CodeType The type of status code being converted. - @param Value The status code value being converted. - @param Data The pointer to the status code data buffer. - @param Filename The pointer to the source file name that generated the ASSERT(). - @param Description The pointer to the description of the ASSERT(). - @param LineNumber The pointer to the source line number that generated the ASSERT(). - - @retval TRUE The status code specified by CodeType, Value, and Data was - converted ASSERT() arguments specified by Filename, Description, - and LineNumber. - @retval FALSE The status code specified by CodeType, Value, and Data could - not be converted to ASSERT() arguments. - -**/ -BOOLEAN -EFIAPI -ReportStatusCodeExtractAssertInfo ( - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value, - IN CONST EFI_STATUS_CODE_DATA *Data, - OUT CHAR8 **Filename, - OUT CHAR8 **Description, - OUT UINT32 *LineNumber - ) -{ - return FALSE; -} - - -/** - Extracts DEBUG() information from a status code structure. - - Converts the status code specified by Data to the DEBUG() arguments specified - by ErrorLevel, Marker, and Format. If type GUID in Data is - EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and - Format from the optional data area of the status code buffer specified by Data. - The optional data area of Data contains a 32-bit ErrorLevel followed by Marker - which is 12 UINTN parameters, followed by a Null-terminated ASCII string for - the Format. If the DEBUG() information could be extracted from Data, then - return TRUE. Otherwise, FALSE is returned. - - If Data is NULL, then ASSERT(). - If ErrorLevel is NULL, then ASSERT(). - If Marker is NULL, then ASSERT(). - If Format is NULL, then ASSERT(). - - @param Data The pointer to the status code data buffer. - @param ErrorLevel The pointer to the error level mask for a debug message. - @param Marker The pointer to the variable argument list associated with Format. - @param Format The pointer to a Null-terminated ASCII format string of a - debug message. - - @retval TRUE The status code specified by Data was converted DEBUG() arguments - specified by ErrorLevel, Marker, and Format. - @retval FALSE The status code specified by Data could not be converted to - DEBUG() arguments. - -**/ -BOOLEAN -EFIAPI -ReportStatusCodeExtractDebugInfo ( - IN CONST EFI_STATUS_CODE_DATA *Data, - OUT UINT32 *ErrorLevel, - OUT BASE_LIST *Marker, - OUT CHAR8 **Format - ) -{ - ASSERT (Data != NULL); - ASSERT (ErrorLevel != NULL); - ASSERT (Marker != NULL); - ASSERT (Format != NULL); - - return FALSE; -} - - -/** - Reports a status code. - - Reports the status code specified by the parameters Type and Value. Status - code also require an instance, caller ID, and extended data. This function - passed in a zero instance, NULL extended data, and a caller ID of - gEfiCallerIdGuid, which is the GUID for the module. - - ReportStatusCode()must actively prevent recursion. If ReportStatusCode() - is called while processing another any other Report Status Code Library function, - then ReportStatusCode() must return immediately. - - @param Type The status code type. - @param Value The status code value. - - @retval EFI_SUCCESS The status code was reported. - @retval EFI_DEVICE_ERROR There status code could not be reported due to a - device error. - @retval EFI_UNSUPPORTED The report status code is not supported. - -**/ -EFI_STATUS -EFIAPI -ReportStatusCode ( - IN EFI_STATUS_CODE_TYPE Type, - IN EFI_STATUS_CODE_VALUE Value - ) -{ - return EFI_SUCCESS; -} - - -/** - Reports a status code with a Device Path Protocol as the extended data. - - Allocates and fills in the extended data section of a status code with the - Device Path Protocol specified by DevicePath. This function is responsible - for allocating a buffer large enough for the standard header and the device - path. The standard header is filled in with a GUID of - gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero - instance and a caller ID of gEfiCallerIdGuid. - - ReportStatusCodeWithDevicePath()must actively prevent recursion. If - ReportStatusCodeWithDevicePath() is called while processing another any other - Report Status Code Library function, then ReportStatusCodeWithDevicePath() - must return EFI_DEVICE_ERROR immediately. - - If DevicePath is NULL, then ASSERT(). - - @param Type Status code type. - @param Value Status code value. - @param DevicePath The pointer to the Device Path Protocol to be reported. - - @retval EFI_SUCCESS The status code was reported with the extended - data specified by DevicePath. - @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the - extended data section. - @retval EFI_UNSUPPORTED The report status code is not supported - -**/ -EFI_STATUS -EFIAPI -ReportStatusCodeWithDevicePath ( - IN EFI_STATUS_CODE_TYPE Type, - IN EFI_STATUS_CODE_VALUE Value, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - ASSERT (DevicePath != NULL); - - return EFI_SUCCESS; -} - - -/** - Reports a status code with an extended data buffer. - - Allocates and fills in the extended data section of a status code with the - extended data specified by ExtendedData and ExtendedDataSize. ExtendedData - is assumed to be one of the data structures specified in Related Definitions. - These data structure do not have the standard header, so this function is - responsible for allocating a buffer large enough for the standard header and - the extended data passed into this function. The standard header is filled - in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported - with a zero instance and a caller ID of gEfiCallerIdGuid. - - ReportStatusCodeWithExtendedData()must actively prevent recursion. If - ReportStatusCodeWithExtendedData() is called while processing another any other - Report Status Code Library function, then ReportStatusCodeWithExtendedData() - must return EFI_DEVICE_ERROR immediately. - - If ExtendedData is NULL, then ASSERT(). - If ExtendedDataSize is 0, then ASSERT(). - - @param Type Status code type. - @param Value Status code value. - @param ExtendedData The pointer to the extended data buffer to be reported. - @param ExtendedDataSize The size, in bytes, of the extended data buffer to - be reported. - - @retval EFI_SUCCESS The status code was reported with the extended - data specified by ExtendedData and ExtendedDataSize. - @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the - extended data section. - @retval EFI_UNSUPPORTED The report status code is not supported. - -**/ -EFI_STATUS -EFIAPI -ReportStatusCodeWithExtendedData ( - IN EFI_STATUS_CODE_TYPE Type, - IN EFI_STATUS_CODE_VALUE Value, - IN CONST VOID *ExtendedData, - IN UINTN ExtendedDataSize - ) -{ - ASSERT (ExtendedData != NULL); - ASSERT (ExtendedDataSize != 0); - return EFI_SUCCESS; -} - - -/** - Reports a status code with full parameters. - - The function reports a status code. If ExtendedData is NULL and ExtendedDataSize - is 0, then an extended data buffer is not reported. If ExtendedData is not - NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated. - ExtendedData is assumed not have the standard status code header, so this function - is responsible for allocating a buffer large enough for the standard header and - the extended data passed into this function. The standard header is filled in - with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a - GUID of gEfiStatusCodeSpecificDataGuid is used. The status code is reported with - an instance specified by Instance and a caller ID specified by CallerId. If - CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used. - - ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx() - is called while processing another any other Report Status Code Library function, - then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately. - - If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT(). - If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT(). - - @param Type The status code type. - @param Value The status code value. - @param Instance Status code instance number. - @param CallerId The pointer to a GUID that identifies the caller of this - function. If this parameter is NULL, then a caller - ID of gEfiCallerIdGuid is used. - @param ExtendedDataGuid The pointer to the GUID for the extended data buffer. - If this parameter is NULL, then a the status code - standard header is filled in with - gEfiStatusCodeSpecificDataGuid. - @param ExtendedData The pointer to the extended data buffer. This is an - optional parameter that may be NULL. - @param ExtendedDataSize The size, in bytes, of the extended data buffer. - - @retval EFI_SUCCESS The status code was reported. - @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate - the extended data section if it was specified. - @retval EFI_UNSUPPORTED The report status code is not supported. - -**/ -EFI_STATUS -EFIAPI -ReportStatusCodeEx ( - IN EFI_STATUS_CODE_TYPE Type, - IN EFI_STATUS_CODE_VALUE Value, - IN UINT32 Instance, - IN CONST EFI_GUID *CallerId OPTIONAL, - IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL, - IN CONST VOID *ExtendedData OPTIONAL, - IN UINTN ExtendedDataSize - ) -{ - return EFI_SUCCESS; -} - - -/** - Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled - - This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED - bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is set. - @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -ReportProgressCodeEnabled ( - VOID - ) -{ - return FALSE; -} - - -/** - Returns TRUE if status codes of type EFI_ERROR_CODE are enabled - - This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED - bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is set. - @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -ReportErrorCodeEnabled ( - VOID - ) -{ - return FALSE; -} - - -/** - Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled - - This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED - bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is set. - @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdReportStatusCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -ReportDebugCodeEnabled ( - VOID - ) -{ - return FALSE; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf deleted file mode 100644 index 92a28ed..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# Report Status Code Library with empty functions. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseReportStatusCodeLibNull - MODULE_UNI_FILE = BaseReportStatusCodeLibNull.uni - FILE_GUID = 1DE0B8C2-FFB6-4bdf-97F5-0FFB33979038 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ReportStatusCodeLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseReportStatusCodeLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.uni deleted file mode 100644 index 50818f3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Report Status Code Library with empty functions. -// -// Report Status Code Library with empty functions. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Report Status Code Library with empty functions" - -#string STR_MODULE_DESCRIPTION #language en-US "Report Status Code Library with empty functions." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRng.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRng.c deleted file mode 100644 index b21c54a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRng.c +++ /dev/null @@ -1,189 +0,0 @@ -/** @file - Random number generator services that uses RdRand instruction access - to provide high-quality random numbers. - -Copyright (c) 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -// -// Bit mask used to determine if RdRand instruction is supported. -// -#define RDRAND_MASK BIT30 - -// -// Limited retry number when valid random data is returned. -// Uses the recommended value defined in Section 7.3.17 of "Intel 64 and IA-32 -// Architectures Software Developer's Mannual". -// -#define RDRAND_RETRY_LIMIT 10 - -/** - The constructor function checks whether or not RDRAND instruction is supported - by the host hardware. - - The constructor function checks whether or not RDRAND instruction is supported. - It will ASSERT() if RDRAND instruction is not supported. - It will always return RETURN_SUCCESS. - - @retval RETURN_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -RETURN_STATUS -EFIAPI -BaseRngLibConstructor ( - VOID - ) -{ - UINT32 RegEcx; - - // - // Determine RDRAND support by examining bit 30 of the ECX register returned by - // CPUID. A value of 1 indicates that processor support RDRAND instruction. - // - AsmCpuid (1, 0, 0, &RegEcx, 0); - ASSERT ((RegEcx & RDRAND_MASK) == RDRAND_MASK); - - return RETURN_SUCCESS; -} - -/** - Generates a 16-bit random number. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the 16-bit random value. - - @retval TRUE Random number generated successfully. - @retval FALSE Failed to generate the random number. - -**/ -BOOLEAN -EFIAPI -GetRandomNumber16 ( - OUT UINT16 *Rand - ) -{ - UINT32 Index; - - ASSERT (Rand != NULL); - - // - // A loop to fetch a 16 bit random value with a retry count limit. - // - for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) { - if (AsmRdRand16 (Rand)) { - return TRUE; - } - } - - return FALSE; -} - -/** - Generates a 32-bit random number. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the 32-bit random value. - - @retval TRUE Random number generated successfully. - @retval FALSE Failed to generate the random number. - -**/ -BOOLEAN -EFIAPI -GetRandomNumber32 ( - OUT UINT32 *Rand - ) -{ - UINT32 Index; - - ASSERT (Rand != NULL); - - // - // A loop to fetch a 32 bit random value with a retry count limit. - // - for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) { - if (AsmRdRand32 (Rand)) { - return TRUE; - } - } - - return FALSE; -} - -/** - Generates a 64-bit random number. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the 64-bit random value. - - @retval TRUE Random number generated successfully. - @retval FALSE Failed to generate the random number. - -**/ -BOOLEAN -EFIAPI -GetRandomNumber64 ( - OUT UINT64 *Rand - ) -{ - UINT32 Index; - - ASSERT (Rand != NULL); - - // - // A loop to fetch a 64 bit random value with a retry count limit. - // - for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) { - if (AsmRdRand64 (Rand)) { - return TRUE; - } - } - - return FALSE; -} - -/** - Generates a 128-bit random number. - - if Rand is NULL, then ASSERT(). - - @param[out] Rand Buffer pointer to store the 128-bit random value. - - @retval TRUE Random number generated successfully. - @retval FALSE Failed to generate the random number. - -**/ -BOOLEAN -EFIAPI -GetRandomNumber128 ( - OUT UINT64 *Rand - ) -{ - ASSERT (Rand != NULL); - - // - // Read first 64 bits - // - if (!GetRandomNumber64 (Rand)) { - return FALSE; - } - - // - // Read second 64 bits - // - return GetRandomNumber64 (++Rand); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.inf deleted file mode 100644 index 0d5a2a2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# Instance of RNG (Random Number Generator) Library. -# -# BaseRng Library that uses CPU RdRand instruction access to provide -# high-quality random numbers. -# -# Copyright (c) 2015, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseRngLib - MODULE_UNI_FILE = BaseRngLib.uni - FILE_GUID = 626440D8-1971-41D9-9AB2-FB25F4AE79BC - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = RngLib - CONSTRUCTOR = BaseRngLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources.Ia32, Sources.X64] - BaseRng.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.uni deleted file mode 100644 index db36a38..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseRngLib/BaseRngLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of RNG (Random Number Generator) Library. -// -// BaseRng Library that uses CPU RdRand instruction access to provide -// high-quality random numbers. -// -// Copyright (c) 2015, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of RNG Library" - -#string STR_MODULE_DESCRIPTION #language en-US "BaseRng Library that uses CPU RdRand instruction access to provide high-quality random numbers" - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf deleted file mode 100644 index ebf0540..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# BootScriptLib instance that always produces NOP operation. -# -# This library is primarily used by platform that does not support ACPI S3 -# resume. All the library interfaces simply return EFI_SUCCESS without -# performing any operation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3BootScriptLibNull - MODULE_UNI_FILE = BaseS3BootScriptLibNull.uni - FILE_GUID = 9A6DC1AC-94C0-43b1-8714-4C70FD58A815 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3BootScriptLib - - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BootScriptLib.c - - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.uni deleted file mode 100644 index 169a95a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// BootScriptLib instance that always produces NOP operation. -// -// This library is primarily used by platform that does not support ACPI S3 -// resume. All the library interfaces simply return EFI_SUCCESS without -// performing any operation. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "BootScriptLib instance that always produces NOP operation" - -#string STR_MODULE_DESCRIPTION #language en-US "This library is primarily used by a platform that does not support ACPI S3 resume. All the library interfaces simply return EFI_SUCCESS without performing any operation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c deleted file mode 100644 index 8925fc9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c +++ /dev/null @@ -1,568 +0,0 @@ -/** @file - Null function implementation for EFI S3 boot script. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The - full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include -#include - -/** - Save I/O write to boot script - - @param Width the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The base address of the I/O operations. - @param Count The number of I/O operations to perform. - @param Buffer The source buffer from which to write data. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveIoWrite ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINT64 Address, - IN UINTN Count, - IN VOID *Buffer - ) -{ - return RETURN_SUCCESS; -} - -/** - Adds a record for an I/O modify operation into a S3 boot script table - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The base address of the I/O operations. - @param Data A pointer to the data to be OR-ed. - @param DataMask A pointer to the data mask to be AND-ed with the data read from the register - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveIoReadWrite ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINT64 Address, - IN VOID *Data, - IN VOID *DataMask - ) -{ - return RETURN_SUCCESS; -} - -/** - Adds a record for a memory write operation into a specified boot script table. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The base address of the memory operations - @param Count The number of memory operations to perform. - @param Buffer The source buffer from which to write the data. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveMemWrite ( - 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. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The base address of the memory operations. Address needs alignment if required - @param Data A pointer to the data to be OR-ed. - @param DataMask A pointer to the data mask to be AND-ed with the data read from the register. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveMemReadWrite ( - 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. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The address within the PCI configuration space. - @param Count The number of PCI operations to perform. - @param Buffer The source buffer from which to write the data. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSavePciCfgWrite ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - 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. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Address The address within the PCI configuration space. - @param Data A pointer to the data to be OR-ed.The size depends on Width. - @param DataMask A pointer to the data mask to be AND-ed. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN__SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSavePciCfgReadWrite ( - 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. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Segment The PCI segment number for Address. - @param Address The address within the PCI configuration space. - @param Count The number of PCI operations to perform. - @param Buffer The source buffer from which to write the data. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSavePciCfg2Write ( - 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. - - @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH. - @param Segment The PCI segment number for Address. - @param Address The address within the PCI configuration space. - @param Data A pointer to the data to be OR-ed. The size depends on Width. - @param DataMask A pointer to the data mask to be AND-ed. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSavePciCfg2ReadWrite ( - 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. - - @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC. - @param Operation Indicates which particular SMBus protocol it will use to execute the SMBus - transactions. - @param Length A pointer to signify the number of bytes that this operation will do. - @param Buffer Contains the value of data to execute to the SMBUS slave device. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveSmbusExecute ( - 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. - - @param Duration Duration in microseconds of the stall - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveStall ( - IN UINTN Duration - ) -{ - return RETURN_SUCCESS; -} -/** - Adds a record for dispatching specified arbitrary code into a specified boot script table. - - @param EntryPoint Entry point of the code to be dispatched. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveDispatch ( - IN VOID *EntryPoint - ) -{ - return RETURN_SUCCESS; -} -/** - Adds a record for dispatching specified arbitrary code into a specified boot script table. - - @param EntryPoint Entry point of the code to be dispatched. - @param Context Argument to be passed into the EntryPoint of the code to be dispatched. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveDispatch2 ( - IN VOID *EntryPoint, - IN VOID *Context - ) -{ - return RETURN_SUCCESS; -} - -/** - Adds a record for memory reads of the memory location and continues when the exit criteria is - satisfied or after a defined duration. - - Please aware, below interface is different with PI specification, Vol 5: - EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE. - "Duration" below is microseconds, while "Delay" in PI specification means - the number of 100ns units to poll. - - @param Width The width of the memory operations. - @param Address The base address of the memory operations. - @param BitMask A pointer to the bit mask to be AND-ed with the data read from the register. - @param BitValue A pointer to the data value after to be Masked. - @param Duration Duration in microseconds of the stall. - @param LoopTimes The times of the register polling. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. - -**/ -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 - ) -{ - return RETURN_SUCCESS; -} - -/** - Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only - used for debugging script issues. - - @param InformationLength Length of the data in bytes - @param Information Information to be logged in the boot scrpit - - @retval RETURN_UNSUPPORTED If entering runtime, this method will not support. - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveInformation ( - 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. - - @param Width The width of the I/O operations. - @param Address The base address of the I/O operations. - @param Data The comparison value used for the polling exit criteria. - @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero - in Data are ignored when polling the memory address. - @param Delay The number of 100ns units to poll. Note that timer available may be of poorer - granularity so the delay may be longer. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveIoPoll ( - 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. - - @param Width The width of the I/O operations. - @param Address The address within the PCI configuration space. - @param Data The comparison value used for the polling exit criteria. - @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero - in Data are ignored when polling the memory address - @param Delay The number of 100ns units to poll. Note that timer available may be of poorer - granularity so the delay may be longer. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSavePciPoll ( - 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. - - @param Width The width of the I/O operations. - @param Segment The PCI segment number for Address. - @param Address The address within the PCI configuration space. - @param Data The comparison value used for the polling exit criteria. - @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero - in Data are ignored when polling the memory address - @param Delay The number of 100ns units to poll. Note that timer available may be of poorer - granularity so the delay may be longer. - - @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation. - @retval RETURN_SUCCESS Opcode is added. - @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE - EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as - Zero, or else, assert. - -**/ -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 - ) -{ - return RETURN_SUCCESS; -} -/** - Save ASCII string information specified by Buffer to - boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE - - @param String the ascii string to store into the S3 boot script table - - @retval RETURN_NOT_FOUND BootScriptSave Protocol not exist. - @retval RETURN_SUCCESS BootScriptSave Protocol exist, always returns RETURN_SUCCESS - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptSaveInformationAsciiString ( - 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 - EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things: - 1. Closes the specified boot script table - 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table. - Once this function is called, the table maintained by the library will be destroyed - after it is copied into the allocated pool. - 3. Any attempts to add a script record after calling this function will cause a new table - to be created by the library. - 4. The base address of the allocated pool will be returned in Address. Note that after - using the boot script table, the CALLER is responsible for freeing the pool that is allocated - by this function. - - In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not - necessary to provide this API in BootScriptLib. To provides this API for now is only to meet - the requirement from Framework Spec. - - If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out - how to get the script to run on an S3 resume because the boot script maintained by the lib will be - destroyed. - - @return the base address of the new copy of the boot script table. - -**/ -UINT8* -EFIAPI -S3BootScriptCloseTable ( - VOID - ) -{ - return 0; -} -/** - Executes the S3 boot script table. - - @param RETURN_SUCCESS The boot script table was executed successfully. - @param RETURN_UNSUPPORTED Invalid script table or opcode. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptExecute ( - VOID - ) -{ - return RETURN_SUCCESS; -} -/** - Move the last boot script entry to the position - - @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position - in the boot script table specified by Position. If Position is NULL or points to - NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end - of the table (if FALSE). - @param Position On entry, specifies the position in the boot script table where the opcode will be - inserted, either before or after, depending on BeforeOrAfter. On exit, specifies - the position of the inserted opcode in the boot script table. - - @retval RETURN_OUT_OF_RESOURCES The table is not available. - @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table. - @retval RETURN_SUCCESS Opcode is inserted. -**/ -RETURN_STATUS -EFIAPI -S3BootScriptMoveLastOpcode ( - 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. - - @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) - or after (FALSE) the position in the boot script table - specified by Position. - @param CreateIfNotFound Specifies whether the label will be created if the label - does not exists (TRUE) or not (FALSE). - @param Position On entry, specifies the position in the boot script table - where the opcode will be inserted, either before or after, - depending on BeforeOrAfter. On exit, specifies the position - of the inserted opcode in the boot script table. - @param Label Points to the label which will be inserted in the boot script table. - - @retval EFI_SUCCESS The operation succeeded. A record was added into the - specified script table. - @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported. - If the opcode is unknow or not supported because of the PCD - Feature Flags. - @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script. - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptLabel ( - 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 - @param Position2 The positions in the boot script table to compare - @param RelativePosition On return, points to the result of the comparison - - @retval EFI_SUCCESS The operation succeeded. A record was added into the - specified script table. - @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported. - If the opcode is unknow or not supported because of the PCD - Feature Flags. - @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script. - -**/ -RETURN_STATUS -EFIAPI -S3BootScriptCompare ( - IN UINT8 *Position1, - IN UINT8 *Position2, - OUT UINTN *RelativePosition - ) -{ - return RETURN_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf deleted file mode 100644 index 5b73d61..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf +++ /dev/null @@ -1,46 +0,0 @@ -## @file -# Instance of S3 I/O Library based on I/O and S3 BootScript Library. -# -# S3 I/O and MMIO Library Services that do I/O and also -# enable the I/O operatation to be replayed during an S3 resume. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3IoLib - MODULE_UNI_FILE = BaseS3IoLib.uni - FILE_GUID = B13F938E-47DF-4516-A397-8927A4E42B61 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3IoLib - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - S3IoLib.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - IoLib - S3BootScriptLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.uni deleted file mode 100644 index 04dbb20..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of S3 I/O Library based on I/O and S3 BootScript Library. -// -// S3 I/O and MMIO Library Services that do I/O and also -// enable the I/O operatation to be replayed during an S3 resume. -// -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 I/O Library based on I/O and S3 BootScript Library" - -#string STR_MODULE_DESCRIPTION #language en-US "S3 I/O and MMIO Library Services that do I/O and also enable the I/O operation to be replayed during an S3 resume." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/S3IoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/S3IoLib.c deleted file mode 100644 index acb9b45..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3IoLib/S3IoLib.c +++ /dev/null @@ -1,3312 +0,0 @@ -/** @file - I/O and MMIO Library Services that do I/O and also enable the I/O operatation - to be replayed during an S3 resume. - - Copyright (c) 2006 -2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The - full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - - -/** - Saves an I/O port value to the boot script. - - This internal worker function saves an I/O port value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Width The width of I/O port. - @param Port The I/O port to write. - @param Buffer The buffer containing value. - -**/ -VOID -InternalSaveIoWriteValueToBootScript ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINTN Port, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSaveIoWrite ( - Width, - Port, - 1, - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); -} - -/** - Saves an 8-bit I/O port value to the boot script. - - This internal worker function saves an 8-bit I/O port value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT8 -InternalSaveIoWrite8ValueToBootScript ( - IN UINTN Port, - IN UINT8 Value - ) -{ - InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint8, Port, &Value); - - return Value; -} - -/** - Reads an 8-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -S3IoRead8 ( - IN UINTN Port - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoRead8 (Port)); -} - -/** - Writes an 8-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -S3IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoWrite8 (Port, Value)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise OR, and writes the - result back to the 8-bit I/O port and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoOr8 ( - IN UINTN Port, - IN UINT8 OrData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoOr8 (Port, OrData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back - to the 8-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoAnd8 ( - IN UINTN Port, - IN UINT8 AndData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoAnd8 (Port, AndData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit I/O port and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoAndThenOr8 ( - IN UINTN Port, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoAndThenOr8 (Port, AndData, OrData)); -} - -/** - Reads a bit field of an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in an 8-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -S3IoBitFieldRead8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldRead8 (Port, StartBit, EndBit)); -} - -/** - Writes a bit field to an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoBitFieldWrite8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldWrite8 (Port, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 8-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoBitFieldOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldOr8 (Port, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 8-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoBitFieldAnd8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldAnd8 (Port, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 8-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -S3IoBitFieldAndThenOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldAndThenOr8 (Port, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 16-bit I/O port value to the boot script. - - This internal worker function saves a 16-bit I/O port value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT16 -InternalSaveIoWrite16ValueToBootScript ( - IN UINTN Port, - IN UINT16 Value - ) -{ - InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint16, Port, &Value); - - return Value; -} - -/** - Reads a 16-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -S3IoRead16 ( - IN UINTN Port - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoRead16 (Port)); -} - -/** - Writes a 16-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -S3IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoWrite16 (Port, Value)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise OR, and writes the - result back to the 16-bit I/O port and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoOr16 ( - IN UINTN Port, - IN UINT16 OrData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoOr16 (Port, OrData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back - to the 16-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoAnd16 ( - IN UINTN Port, - IN UINT16 AndData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoAnd16 (Port, AndData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit I/O port and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoAndThenOr16 ( - IN UINTN Port, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoAndThenOr16 (Port, AndData, OrData)); -} - -/** - Reads a bit field of an I/O register saves the value in the S3 script to be - replayed on S3 resume. - - Reads the bit field in a 16-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -S3IoBitFieldRead16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldRead16 (Port, StartBit, EndBit)); -} - -/** - Writes a bit field to an I/O register and saves the value in the S3 script - to be replayed on S3 resume. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoBitFieldWrite16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldWrite16 (Port, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 16-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoBitFieldOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldOr16 (Port, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 16-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoBitFieldAnd16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldAnd16 (Port, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port and saves the value in the S3 script to be replayed on S3 - resume. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 16-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -S3IoBitFieldAndThenOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldAndThenOr16 (Port, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 32-bit I/O port value to the boot script. - - This internal worker function saves a 32-bit I/O port value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT32 -InternalSaveIoWrite32ValueToBootScript ( - IN UINTN Port, - IN UINT32 Value - ) -{ - InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint32, Port, &Value); - - return Value; -} - -/** - Reads a 32-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -S3IoRead32 ( - IN UINTN Port - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoRead32 (Port)); -} - -/** - Writes a 32-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -S3IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoWrite32 (Port, Value)); -} - -/** - Reads a 32-bit I/O port, performs a bitwise OR, and writes the - result back to the 32-bit I/O port and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoOr32 ( - IN UINTN Port, - IN UINT32 OrData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoOr32 (Port, OrData)); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back - to the 32-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoAnd32 ( - IN UINTN Port, - IN UINT32 AndData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoAnd32 (Port, AndData)); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit I/O port and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoAndThenOr32 ( - IN UINTN Port, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoAndThenOr32 (Port, AndData, OrData)); -} - -/** - Reads a bit field of an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in a 32-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -S3IoBitFieldRead32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldRead32 (Port, StartBit, EndBit)); -} - -/** - Writes a bit field to an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoBitFieldWrite32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldWrite32 (Port, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 32-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoBitFieldOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldOr32 (Port, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 32-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoBitFieldAnd32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldAnd32 (Port, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port and saves the value in the S3 script to be replayed on S3 - resume. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 32-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -S3IoBitFieldAndThenOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldAndThenOr32 (Port, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 64-bit I/O port value to the boot script. - - This internal worker function saves a 64-bit I/O port value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT64 -InternalSaveIoWrite64ValueToBootScript ( - IN UINTN Port, - IN UINT64 Value - ) -{ - InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint64, Port, &Value); - - return Value; -} - -/** - Reads a 64-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -S3IoRead64 ( - IN UINTN Port - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoRead64 (Port)); -} - -/** - Writes a 64-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT64 -EFIAPI -S3IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoWrite64 (Port, Value)); -} - -/** - Reads a 64-bit I/O port, performs a bitwise OR, and writes the - result back to the 64-bit I/O port and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoOr64 ( - IN UINTN Port, - IN UINT64 OrData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoOr64 (Port, OrData)); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back - to the 64-bit I/O port and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoAnd64 ( - IN UINTN Port, - IN UINT64 AndData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoAnd64 (Port, AndData)); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit I/O port and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoAndThenOr64 ( - IN UINTN Port, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoAndThenOr64 (Port, AndData, OrData)); -} - -/** - Reads a bit field of an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in a 64-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -S3IoBitFieldRead64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldRead64 (Port, StartBit, EndBit)); -} - -/** - Writes a bit field to an I/O register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value New value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoBitFieldWrite64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldWrite64 (Port, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoBitFieldOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldOr64 (Port, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit port and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoBitFieldAnd64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldAnd64 (Port, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit port and saves the value in the S3 script to be replayed on S3 - resume. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -S3IoBitFieldAndThenOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return InternalSaveIoWrite64ValueToBootScript (Port, IoBitFieldAndThenOr64 (Port, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves an MMIO register value to the boot script. - - This internal worker function saves an MMIO register value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Width The width of MMIO register. - @param Address The MMIO register to write. - @param Buffer The buffer containing value. - -**/ -VOID -InternalSaveMmioWriteValueToBootScript ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINTN Address, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSaveMemWrite ( - Width, - Address, - 1, - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); -} - -/** - Saves an 8-bit MMIO register value to the boot script. - - This internal worker function saves an 8-bit MMIO register value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT8 -InternalSaveMmioWrite8ValueToBootScript ( - IN UINTN Address, - IN UINT8 Value - ) -{ - InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value); - - return Value; -} - -/** - Reads an 8-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -S3MmioRead8 ( - IN UINTN Address - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioRead8 (Address)); -} - -/** - Writes an 8-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return The value written the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioWrite8 (Address, Value)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise OR, and writes the - result back to the 8-bit MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioOr8 (Address, OrData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result - back to the 8-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAnd8 (Address, AndData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit MMIO register and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 8-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAndThenOr8 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a MMIO register and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in an 8-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -S3MmioBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldRead8 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to an MMIO register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 8-bit register is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldWrite8 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit MMIO register and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldOr8 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 8-bit MMIO register and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldAnd8 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 8-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 8-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -S3MmioBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 16-bit MMIO register value to the boot script. - - This internal worker function saves a 16-bit MMIO register value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT16 -InternalSaveMmioWrite16ValueToBootScript ( - IN UINTN Address, - IN UINT16 Value - ) -{ - InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value); - - return Value; -} - -/** - Reads a 16-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -S3MmioRead16 ( - IN UINTN Address - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioRead16 (Address)); -} - -/** - Writes a 16-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized and saves the value in the S3 script to be - replayed on S3 resume. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return The value written the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioWrite16 (Address, Value)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise OR, and writes the - result back to the 16-bit MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioOr16 (Address, OrData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result - back to the 16-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioAnd16 (Address, AndData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 16-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioAndThenOr16 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a MMIO register and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in a 16-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -S3MmioBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldRead16 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a MMIO register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 16-bit register is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldWrite16 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldOr16 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 16-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldAnd16 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 16-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 16-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -S3MmioBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 32-bit MMIO register value to the boot script. - - This internal worker function saves a 32-bit MMIO register value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT32 -InternalSaveMmioWrite32ValueToBootScript ( - IN UINTN Address, - IN UINT32 Value - ) -{ - InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value); - - return Value; -} - -/** - Reads a 32-bit MMIO register saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -S3MmioRead32 ( - IN UINTN Address - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioRead32 (Address)); -} - -/** - Writes a 32-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return The value written the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioWrite32 (Address, Value)); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise OR, and writes the - result back to the 32-bit MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioOr32 (Address, OrData)); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result - back to the 32-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioAnd32 (Address, AndData)); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 32-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioAndThenOr32 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Reads the bit field in a 32-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -S3MmioBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldRead32 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 32-bit register is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldWrite32 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldOr32 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 32-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldAnd32 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 32-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 32-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -S3MmioBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 64-bit MMIO register value to the boot script. - - This internal worker function saves a 64-bit MMIO register value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT64 -InternalSaveMmioWrite64ValueToBootScript ( - IN UINTN Address, - IN UINT64 Value - ) -{ - InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint64, Address, &Value); - - return Value; -} - -/** - Reads a 64-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -S3MmioRead64 ( - IN UINTN Address - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioRead64 (Address)); -} - -/** - Writes a 64-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return The value written the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioWrite64 (Address, Value)); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise OR, and writes the - result back to the 64-bit MMIO register and saves the value in the S3 script - to be replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioOr64 ( - IN UINTN Address, - IN UINT64 OrData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioOr64 (Address, OrData)); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result - back to the 64-bit MMIO register and saves the value in the S3 script to be - replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioAnd64 ( - IN UINTN Address, - IN UINT64 AndData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioAnd64 (Address, AndData)); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 64-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioAndThenOr64 ( - IN UINTN Address, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioAndThenOr64 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a MMIO register saves the value in the S3 script to - be replayed on S3 resume. - - Reads the bit field in a 64-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -S3MmioBitFieldRead64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldRead64 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a MMIO register and saves the value in the S3 script to - be replayed on S3 resume. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 64-bit register is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value New value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioBitFieldWrite64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldWrite64 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MMIO register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioBitFieldOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldOr64 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 64-bit MMIO register and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioBitFieldAnd64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldAnd64 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 64-bit MMIO register and saves the value in the S3 script to be replayed - on S3 resume. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 64-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -S3MmioBitFieldAndThenOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return InternalSaveMmioWrite64ValueToBootScript (Address, MmioBitFieldAndThenOr64 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Copy data from MMIO region to system memory by using 8-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 8-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - - @param StartAddress Starting address for the MMIO region to be copied from. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT8 * -EFIAPI -S3MmioReadBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioReadBuffer8 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint8, - StartAddress, - Length / sizeof (UINT8), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 16-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 16-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied from. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT16 * -EFIAPI -S3MmioReadBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioReadBuffer16 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint16, - StartAddress, - Length / sizeof (UINT16), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 32-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 32-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied from. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT32 * -EFIAPI -S3MmioReadBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioReadBuffer32 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint32, - StartAddress, - Length / sizeof (UINT32), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 64-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 64-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied from. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT64 * -EFIAPI -S3MmioReadBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioReadBuffer64 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint64, - StartAddress, - Length / sizeof (UINT64), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - 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. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 8-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - - @param StartAddress Starting address for the MMIO region to be copied to. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT8 * -EFIAPI -S3MmioWriteBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioWriteBuffer8 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint8, - StartAddress, - Length / sizeof (UINT8), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - -/** - Copy data from system memory to MMIO region by using 16-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 16-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied to. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT16 * -EFIAPI -S3MmioWriteBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioWriteBuffer16 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint16, - StartAddress, - Length / sizeof (UINT16), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - 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. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 32-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied to. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT32 * -EFIAPI -S3MmioWriteBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioWriteBuffer32 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint32, - StartAddress, - Length / sizeof (UINT32), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - -/** - Copy data from system memory to MMIO region by using 64-bit access - and saves the value in the S3 script to be replayed on S3 resume. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 64-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress Starting address for the MMIO region to be copied to. - @param Length Size in bytes of the copy. - @param Buffer Pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT64 * -EFIAPI -S3MmioWriteBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - RETURN_STATUS Status; - - ReturnBuffer = MmioWriteBuffer64 (StartAddress, Length, Buffer); - - Status = S3BootScriptSaveMemWrite ( - S3BootScriptWidthUint64, - StartAddress, - Length / sizeof (UINT64), - ReturnBuffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return ReturnBuffer; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf deleted file mode 100644 index 48a3c99..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -## @file -# Instance of S3 PCI Library based on PCI and S3 BootScript Library. -# -# S3 PCI Services that perform PCI Configuration cycles and -# also enable the PCI operation to be replayed during an S3 resume. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3PciLib - MODULE_UNI_FILE = BaseS3PciLib.uni - FILE_GUID = F66B6BD2-513F-441d-B367-2D5BD4998A50 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3PciLib - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - S3PciLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - PciLib - S3BootScriptLib - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.uni deleted file mode 100644 index a577b11..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of S3 PCI Library based on PCI and S3 BootScript Library. -// -// S3 PCI Services that perform PCI Configuration cycles and -// also enable the PCI operation to be replayed during an S3 resume. -// -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 PCI Library based on PCI and S3 BootScript Library" - -#string STR_MODULE_DESCRIPTION #language en-US "S3 PCI Services that perform PCI Configuration cycles and also enable the PCI operation to be replayed during an S3 resume." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/S3PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/S3PciLib.c deleted file mode 100644 index 8eede55..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciLib/S3PciLib.c +++ /dev/null @@ -1,1269 +0,0 @@ -/** @file - PCI configuration Library Services that do PCI configuration and also enable - the PCI operations to be replayed during an S3 resume. This library class - maps directly on top of the PciLib class. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The - full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -#define PCILIB_TO_COMMON_ADDRESS(Address) \ - ((((UINTN) ((Address>>20) & 0xff)) << 24) + (((UINTN) ((Address>>15) & 0x1f)) << 16) + (((UINTN) ((Address>>12) & 0x07)) << 8) + ((UINTN) (Address & 0xfff ))) - -/** - Saves a PCI configuration value to the boot script. - - This internal worker function saves a PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Width The width of PCI configuration. - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Buffer The buffer containing value. - -**/ -VOID -InternalSavePciWriteValueToBootScript ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINTN Address, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfgWrite ( - Width, - PCILIB_TO_COMMON_ADDRESS(Address), - 1, - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); -} - -/** - Saves an 8-bit PCI configuration value to the boot script. - - This internal worker function saves an 8-bit PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT8 -InternalSavePciWrite8ValueToBootScript ( - IN UINTN Address, - IN UINT8 Value - ) -{ - InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value); - - return Value; -} - -/** - Reads an 8-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciRead8 ( - IN UINTN Address - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciRead8 (Address)); -} - -/** - Writes an 8-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciWrite8 (Address, Value)); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciOr8 (Address, OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciAnd8 (Address, AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciAndThenOr8 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldRead8 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldWrite8 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port and saves the value - in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldOr8 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldAnd8 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in an 8-bit Address, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 16-bit PCI configuration value to the boot script. - - This internal worker function saves a 16-bit PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return Value. - -**/ -UINT16 -InternalSavePciWrite16ValueToBootScript ( - IN UINTN Address, - IN UINT16 Value - ) -{ - InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value); - - return Value; -} - -/** - Reads a 16-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciRead16 ( - IN UINTN Address - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciRead16 (Address)); -} - -/** - Writes a 16-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciWrite16 (Address, Value)); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciOr16 (Address, OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciAnd16 (Address, AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciAndThenOr16 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldRead16 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldWrite16 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port and saves the value - in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldOr16 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldAnd16 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 16-bit Address, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 32-bit PCI configuration value to the boot script. - - This internal worker function saves a 32-bit PCI configuration value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return Value. - -**/ -UINT32 -InternalSavePciWrite32ValueToBootScript ( - IN UINTN Address, - IN UINT32 Value - ) -{ - InternalSavePciWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value); - - return Value; -} - -/** - Reads a 32-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciRead32 ( - IN UINTN Address - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciRead32 (Address)); -} - -/** - Writes a 32-bit PCI configuration register and saves the value in the S3 - script to be replayed on S3 resume. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciWrite32 (Address, Value)); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciOr32 (Address, OrData)); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciAnd32 (Address, AndData)); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciAndThenOr32 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldRead32 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldWrite32 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port and saves the value - in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldOr32 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldAnd32 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 32-bit Address, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSavePciWrite32ValueToBootScript (Address, PciBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer - and saves the value in the S3 script to be replayed on S3 resume. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -S3PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfgWrite ( - S3BootScriptWidthUint8, - PCILIB_TO_COMMON_ADDRESS (StartAddress), - PciReadBuffer (StartAddress, Size, Buffer), - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return Size; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space and saves the value in the S3 script to be replayed on S3 - resume. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return Size - -**/ -UINTN -EFIAPI -S3PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfgWrite ( - S3BootScriptWidthUint8, - PCILIB_TO_COMMON_ADDRESS (StartAddress), - PciWriteBuffer (StartAddress, Size, Buffer), - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); - - return Size; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.inf deleted file mode 100644 index 50b4fca..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Instance of S3 PCI Segment Library based on PCI Segment and S3 BootScript Library. -# -# S3 PCI Segment Services that perform PCI Configuration cycles and -# also enable the PCI operation to be replayed during an S3 resume. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3PciSegmentLib - MODULE_UNI_FILE = BaseS3PciSegmentLib.uni - FILE_GUID = 17E2C90E-AD1F-443A-8C94-6E50C0E98607 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3PciSegmentLib - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - S3PciSegmentLib.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PciSegmentLib - S3BootScriptLib - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.uni deleted file mode 100644 index 2991c4b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of S3 PCI Segment Library based on PCI Segment and S3 BootScript Library. -// -// S3 PCI Segment Services that perform PCI Configuration cycles and -// also enable the PCI operation to be replayed during an S3 resume. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 PCI Segment Library based on PCI Segment and S3 BootScript Library." - -#string STR_MODULE_DESCRIPTION #language en-US "S3 PCI Segment Services that perform PCI Configuration cycles and also enable the PCI operation to be replayed during an S3 resume." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c deleted file mode 100644 index 9a8d015..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3PciSegmentLib/S3PciSegmentLib.c +++ /dev/null @@ -1,1249 +0,0 @@ -/** @file - The multiple segments PCI configuration Library Services that carry out - PCI configuration and enable the PCI operations to be replayed during an - S3 resume. This library class maps directly on top of the PciSegmentLib class. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include - -/** - Macro that converts address in PciSegmentLib format to the new address that can be pass - to the S3 Boot Script Library functions. The Segment is dropped. - - @param Address Address in PciSegmentLib format. - - @retval New address that can be pass to the S3 Boot Script Library functions. -**/ -#define PCI_SEGMENT_LIB_ADDRESS_TO_S3_BOOT_SCRIPT_PCI_ADDRESS(Address) \ - ((((UINT32)(Address) >> 20) & 0xff) << 24) | \ - ((((UINT32)(Address) >> 15) & 0x1f) << 16) | \ - ((((UINT32)(Address) >> 12) & 0x07) << 8) | \ - LShiftU64 ((Address) & 0xfff, 32) // Always put Register in high four bytes. - -/** - Saves a PCI configuration value to the boot script. - - This internal worker function saves a PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Width The width of PCI configuration. - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Buffer The buffer containing value. - -**/ -VOID -InternalSavePciSegmentWriteValueToBootScript ( - IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINT64 Address, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfg2Write ( - Width, - RShiftU64 ((Address), 32) & 0xffff, - PCI_SEGMENT_LIB_ADDRESS_TO_S3_BOOT_SCRIPT_PCI_ADDRESS (Address), - 1, - Buffer - ); - ASSERT_RETURN_ERROR (Status); -} - -/** - Saves an 8-bit PCI configuration value to the boot script. - - This internal worker function saves an 8-bit PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT8 -InternalSavePciSegmentWrite8ValueToBootScript ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint8, Address, &Value); - - return Value; -} - -/** - Reads an 8-bit PCI configuration register, and saves the value in the S3 script to - be replayed on S3 resume. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 8-bit PCI configuration register specified by Address. - -**/ -UINT8 -EFIAPI -S3PciSegmentRead8 ( - IN UINT64 Address - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentRead8 (Address)); -} - -/** - Writes an 8-bit PCI configuration register, and saves the value in the S3 script to - be replayed on S3 resume. - - Writes the 8-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentWrite8 ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentWrite8 (Address, Value)); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value, and saves - the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentOr8 ( - IN UINT64 Address, - IN UINT8 OrData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentOr8 (Address, OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentAnd8 ( - IN UINT64 Address, - IN UINT8 AndData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentAnd8 (Address, AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, - followed a bitwise OR with another 8-bit value, and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentAndThenOr8 ( - IN UINT64 Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentAndThenOr8 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentBitFieldRead8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldRead8 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register, and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentBitFieldWrite8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldWrite8 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 8-bit port, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentBitFieldOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldOr8 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 8-bit register, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentBitFieldAnd8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAnd8 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, writes the result back to the bit field in the 8-bit port, - and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -S3PciSegmentBitFieldAndThenOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Saves a 16-bit PCI configuration value to the boot script. - - This internal worker function saves a 16-bit PCI configuration value in - the S3 script to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT16 -InternalSavePciSegmentWrite16ValueToBootScript ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint16, Address, &Value); - - return Value; -} - -/** - Reads a 16-bit PCI configuration register, and saves the value in the S3 script - to be replayed on S3 resume. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 16-bit PCI configuration register specified by Address. - -**/ -UINT16 -EFIAPI -S3PciSegmentRead16 ( - IN UINT64 Address - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentRead16 (Address)); -} - -/** - Writes a 16-bit PCI configuration register, and saves the value in the S3 script to - be replayed on S3 resume. - - Writes the 16-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -S3PciSegmentWrite16 ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentWrite16 (Address, Value)); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with a 16-bit - value, and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentOr16 ( - IN UINT64 Address, - IN UINT16 OrData - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentOr16 (Address, OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentAnd16 ( - IN UINT64 Address, - IN UINT16 AndData - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAnd16 (Address, AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, - followed a bitwise OR with another 16-bit value, and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentAndThenOr16 ( - IN UINT64 Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAndThenOr16 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentBitFieldRead16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldRead16 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register, and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentBitFieldWrite16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldWrite16 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 16-bit port, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentBitFieldOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldOr16 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 16-bit register, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentBitFieldAnd16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldAnd16 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, writes the result back to the bit field in the 16-bit port, - and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -S3PciSegmentBitFieldAndThenOr16 ( - 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. - - This internal worker function saves a 32-bit PCI configuration value in the S3 script - to be replayed on S3 resume. - - If the saving process fails, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value saved to boot script. - - @return Value. - -**/ -UINT32 -InternalSavePciSegmentWrite32ValueToBootScript ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - InternalSavePciSegmentWriteValueToBootScript (S3BootScriptWidthUint32, Address, &Value); - - return Value; -} - -/** - Reads a 32-bit PCI configuration register, and saves the value in the S3 script - to be replayed on S3 resume. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 32-bit PCI configuration register specified by Address. - -**/ -UINT32 -EFIAPI -S3PciSegmentRead32 ( - IN UINT64 Address - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentRead32 (Address)); -} - -/** - Writes a 32-bit PCI configuration register, and saves the value in the S3 script to - be replayed on S3 resume. - - Writes the 32-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT32 -EFIAPI -S3PciSegmentWrite32 ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentWrite32 (Address, Value)); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit - value, and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentOr32 ( - IN UINT64 Address, - IN UINT32 OrData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentOr32 (Address, OrData)); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentAnd32 ( - IN UINT64 Address, - IN UINT32 AndData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentAnd32 (Address, AndData)); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, - followed a bitwise OR with another 32-bit value, and saves the value in the S3 script to - be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentAndThenOr32 ( - IN UINT64 Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentAndThenOr32 (Address, AndData, OrData)); -} - -/** - Reads a bit field of a PCI configuration register, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentBitFieldRead32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldRead32 (Address, StartBit, EndBit)); -} - -/** - Writes a bit field to a PCI configuration register, and saves the value in - the S3 script to be replayed on S3 resume. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentBitFieldWrite32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldWrite32 (Address, StartBit, EndBit, Value)); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 32-bit port, and saves the value in the - S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentBitFieldOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldOr32 (Address, StartBit, EndBit, OrData)); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register, and - saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentBitFieldAnd32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAnd32 (Address, StartBit, EndBit, AndData)); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, writes the result back to the bit field in the 32-bit port, - and saves the value in the S3 script to be replayed on S3 resume. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -S3PciSegmentBitFieldAndThenOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData)); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer, - and saves the value in the S3 script to be replayed on S3 resume. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -S3PciSegmentReadBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfg2Write ( - S3BootScriptWidthUint8, - RShiftU64 (StartAddress, 32) & 0xffff, - PCI_SEGMENT_LIB_ADDRESS_TO_S3_BOOT_SCRIPT_PCI_ADDRESS (StartAddress), - PciSegmentReadBuffer (StartAddress, Size, Buffer), - Buffer - ); - ASSERT_RETURN_ERROR (Status); - return Size; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space, and saves the value in the S3 script to be replayed on S3 - resume. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return The parameter of Size. - -**/ -UINTN -EFIAPI -S3PciSegmentWriteBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSavePciCfg2Write ( - S3BootScriptWidthUint8, - RShiftU64 (StartAddress, 32) & 0xffff, - PCI_SEGMENT_LIB_ADDRESS_TO_S3_BOOT_SCRIPT_PCI_ADDRESS (StartAddress), - PciSegmentWriteBuffer (StartAddress, Size, Buffer), - Buffer - ); - ASSERT_RETURN_ERROR (Status); - return Size; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf deleted file mode 100644 index b42aecc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -## @file -# Instance of S3 Smbus Library based on SmBus and S3 BootScript Library. -# -# S3 Smbus Library Services that do SMBus transactions and also enable the -# operatation to be replayed during an S3 resume. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3SmbusLib - MODULE_UNI_FILE = BaseS3SmbusLib.uni - FILE_GUID = 01190654-FED0-40d3-BA7F-2925539E5830 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3SmbusLib - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - S3SmbusLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - SmbusLib - S3BootScriptLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.uni deleted file mode 100644 index e8fa60f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of S3 Smbus Library based on SmBus and S3 BootScript Library. -// -// S3 Smbus Library Services that do SMBus transactions and also enable the -// operatation to be replayed during an S3 resume. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 SMBus Library based on SMBus and S3 BootScript Library" - -#string STR_MODULE_DESCRIPTION #language en-US "S3 SMBus Library Services that do SMBus transactions and also enable the operation to be replayed during an S3 resume." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c deleted file mode 100644 index e10b2a8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3SmbusLib/S3SmbusLib.c +++ /dev/null @@ -1,502 +0,0 @@ -/** @file - Smbus Library Services that do SMBus transactions and also enable the operatation - to be replayed during an S3 resume. This library class maps directly on top - of the SmbusLib class. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The - full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -/** - Saves an SMBus operation to S3 script to be replayed on S3 resume. - - This function provides a standard way to save SMBus operation to S3 boot Script. - The data can either be of the Length byte, word, or a block of data. - If it falis to save S3 boot script, then ASSERT (). - - @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to - execute the SMBus transactions. - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Length Signifies the number of bytes that this operation will do. The maximum number of - bytes can be revision specific and operation specific. - @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations - require this argument. The length of this buffer is identified by Length. - -**/ -VOID -InternalSaveSmBusExecToBootScript ( - IN EFI_SMBUS_OPERATION SmbusOperation, - IN UINTN SmBusAddress, - IN UINTN Length, - IN OUT VOID *Buffer - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSaveSmbusExecute ( - SmBusAddress, - SmbusOperation, - &Length, - Buffer - ); - ASSERT (Status == RETURN_SUCCESS); -} - -/** - Executes an SMBUS quick read command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - -**/ -VOID -EFIAPI -S3SmBusQuickRead ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - SmBusQuickRead (SmBusAddress, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusQuickRead, SmBusAddress, 0, NULL); -} - -/** - Executes an SMBUS quick write command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - -**/ -VOID -EFIAPI -S3SmBusQuickWrite ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - SmBusQuickWrite (SmBusAddress, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusQuickWrite, SmBusAddress, 0, NULL); -} - -/** - Executes an SMBUS receive byte command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - The byte received from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The byte received from the SMBUS. - -**/ -UINT8 -EFIAPI -S3SmBusReceiveByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - Byte = SmBusReceiveByte (SmBusAddress, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte); - - return Byte; -} - -/** - Executes an SMBUS send byte command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress. - The byte specified by Value is sent. - Only the SMBUS slave address field of SmBusAddress is required. Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to send. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -S3SmBusSendByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - Byte = SmBusSendByte (SmBusAddress, Value, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusSendByte, SmBusAddress, 1, &Byte); - - return Byte; -} - -/** - Executes an SMBUS read data byte command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 8-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The byte read from the SMBUS. - -**/ -UINT8 -EFIAPI -S3SmBusReadDataByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - Byte = SmBusReadDataByte (SmBusAddress, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusReadByte, SmBusAddress, 1, &Byte); - - return Byte; -} - -/** - Executes an SMBUS write data byte command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. - The 8-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -S3SmBusWriteDataByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - Byte = SmBusWriteDataByte (SmBusAddress, Value, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusWriteByte, SmBusAddress, 1, &Byte); - - return Byte; -} - -/** - Executes an SMBUS read data word command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The byte read from the SMBUS. - -**/ -UINT16 -EFIAPI -S3SmBusReadDataWord ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - Word = SmBusReadDataWord (SmBusAddress, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusReadWord, SmBusAddress, 2, &Word); - - return Word; -} - -/** - Executes an SMBUS write data word command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -S3SmBusWriteDataWord ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - Word = SmBusWriteDataWord (SmBusAddress, Value, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusWriteWord, SmBusAddress, 2, &Word); - - return Word; -} - -/** - Executes an SMBUS process call command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value returned by the process call command is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The 16-bit value returned by the process call command. - -**/ -UINT16 -EFIAPI -S3SmBusProcessCall ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - Word = SmBusProcessCall (SmBusAddress, Value, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusProcessCall, SmBusAddress, 2, &Value); - - return Word; -} - -/** - Executes an SMBUS read block command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Bytes are read from the SMBUS and stored in Buffer. - The number of bytes read is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is not zero, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer Pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The number of bytes read. - -**/ -UINTN -EFIAPI -S3SmBusReadBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - Length = SmBusReadBlock (SmBusAddress, Buffer, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusReadBlock, SmBusAddress, Length, Buffer); - - return Length; -} - -/** - Executes an SMBUS write block command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from Buffer. - The number of bytes written is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer Pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -S3SmBusWriteBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - Length = SmBusWriteBlock (SmBusAddress, Buffer, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusWriteBlock, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), Buffer); - - return Length; -} - -/** - Executes an SMBUS block process call command and saves the value in the S3 script to be replayed - on S3 resume. - - Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If WriteBuffer is NULL, then ASSERT(). - If ReadBuffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS. - @param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -S3SmBusBlockProcessCall ( - IN UINTN SmBusAddress, - IN VOID *WriteBuffer, - OUT VOID *ReadBuffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - Length = SmBusBlockProcessCall (SmBusAddress, WriteBuffer, ReadBuffer, Status); - - InternalSaveSmBusExecToBootScript (EfiSmbusBWBRProcessCall, SmBusAddress, SMBUS_LIB_LENGTH (SmBusAddress), ReadBuffer); - - return Length; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf deleted file mode 100644 index a1f7cc9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Instance of S3 Stall Library based on Timer and S3 BootScript Library. -# -# Stall Services that do stall and also enable the Stall operatation -# to be replayed during an S3 resume. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are -# licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseS3StallLib - MODULE_UNI_FILE = BaseS3StallLib.uni - FILE_GUID = 498C6AC3-CC29-4821-BE6F-7C6F4ECF2C14 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = S3StallLib - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - S3StallLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - TimerLib - S3BootScriptLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni deleted file mode 100644 index fcff510..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of S3 Stall Library based on Timer and S3 BootScript Library. -// -// Stall Services that do stall and also enable the Stall operatation -// to be replayed during an S3 resume. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are -// licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 Stall Library based on Timer and S3 BootScript Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Stall Services that do stall and also enable the Stall operation to be replayed during an S3 resume." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c deleted file mode 100644 index ad39260..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c +++ /dev/null @@ -1,52 +0,0 @@ -/** @file - Stall Services that do stall and also enable the Stall operatation - to be replayed during an S3 resume. This library class maps directly on top - of the Timer class. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The - full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - - -/** - 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. - - Stalls the CPU for the number of microseconds specified by MicroSeconds. - - @param MicroSeconds The minimum number of microseconds to delay. - - @return MicroSeconds - -**/ -UINTN -EFIAPI -S3Stall ( - IN UINTN MicroSeconds - ) -{ - RETURN_STATUS Status; - - Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds)); - ASSERT (Status == RETURN_SUCCESS); - - return MicroSeconds; -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf deleted file mode 100644 index e2b543d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf +++ /dev/null @@ -1,62 +0,0 @@ -## @file -# Safe Integer Library -# -# This library provides helper functions to prevent integer overflow during -# type conversion, addition, subtraction, and multiplication. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# Copyright (c) 2017, Microsoft Corporation -# -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseSafeIntLib - FILE_GUID = 4EA91BFA-3482-4930-B136-70679C6CE489 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SafeIntLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SafeIntLib.c - -[Sources.Ia32, Sources.ARM] - SafeIntLib32.c - -[Sources.X64, Sources.AARCH64] - SafeIntLib64.c - -[Sources.EBC] - SafeIntLibEbc.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c deleted file mode 100644 index 72f464f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib.c +++ /dev/null @@ -1,4165 +0,0 @@ -/** @file - This library provides helper functions to prevent integer overflow during - type conversion, addition, subtraction, and multiplication. - - Copyright (c) 2017, Microsoft Corporation - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**/ - -#include -#include -#include - - -// -// Magnitude of MIN_INT64 as expressed by a UINT64 number. -// -#define MIN_INT64_MAGNITUDE (((UINT64)(- (MIN_INT64 + 1))) + 1) - -// -// Conversion functions -// -// There are three reasons for having conversion functions: -// -// 1. We are converting from a signed type to an unsigned type of the same -// size, or vice-versa. -// -// 2. We are converting to a smaller type, and we could therefore possibly -// overflow. -// -// 3. We are converting to a bigger type, and we are signed and the type we are -// converting to is unsigned. -// - -/** - INT8 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToUint8 ( - IN INT8 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT8 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToChar8 ( - IN INT8 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT8 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToUint16 ( - IN INT8 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT8 -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToUint32 ( - IN INT8 Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT8 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToUintn ( - IN INT8 Operand, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINTN)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT8 -> UINT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8ToUint64 ( - IN INT8 Operand, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT8 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint8ToInt8 ( - IN UINT8 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT8 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint8ToChar8 ( - IN UINT8 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToInt8 ( - IN INT16 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToChar8 ( - IN INT16 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_INT8)) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToUint8 ( - IN INT16 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT8)) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToUint16 ( - IN INT16 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToUint32 ( - IN INT16 Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToUintn ( - IN INT16 Operand, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINTN)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT16 -> UINT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16ToUint64 ( - IN INT16 Operand, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16ToInt8 ( - IN UINT16 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16ToChar8 ( - IN UINT16 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16ToUint8 ( - IN UINT16 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT8) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16ToInt16 ( - IN UINT16 Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT16) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToInt8 ( - IN INT32 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToChar8 ( - IN INT32 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_INT8)) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUint8 ( - IN INT32 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT8)) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToInt16 ( - IN INT32 Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUint16 ( - IN INT32 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT16)) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUint32 ( - IN INT32 Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT32 -> UINT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUint64 ( - IN INT32 Operand, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToInt8 ( - IN UINT32 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToChar8 ( - IN UINT32 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToUint8 ( - IN UINT32 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT8) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToInt16 ( - IN UINT32 Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT16) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToUint16 ( - IN UINT32 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT16) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToInt32 ( - IN UINT32 Operand, - OUT INT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT32) { - *Result = (INT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToInt8 ( - IN INTN Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToChar8 ( - IN INTN Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_INT8)) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint8 ( - IN INTN Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT8)) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToInt16 ( - IN INTN Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint16 ( - IN INTN Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT16)) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUintn ( - IN INTN Operand, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINTN)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INTN -> UINT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint64 ( - IN INTN Operand, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt8 ( - IN UINTN Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToChar8 ( - IN UINTN Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToUint8 ( - IN UINTN Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT8) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt16 ( - IN UINTN Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT16) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToUint16 ( - IN UINTN Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT16) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt32 ( - IN UINTN Operand, - OUT INT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT32) { - *Result = (INT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToIntn ( - IN UINTN Operand, - OUT INTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INTN) { - *Result = (INTN)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToInt8 ( - IN INT64 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT8) && (Operand <= MAX_INT8)) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToChar8 ( - IN INT64 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_INT8)) { - *Result = (CHAR8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUint8 ( - IN INT64 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT8)) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToInt16 ( - IN INT64 Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT16) && (Operand <= MAX_INT16)) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUint16 ( - IN INT64 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT16)) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToInt32 ( - IN INT64 Operand, - OUT INT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= MIN_INT32) && (Operand <= MAX_INT32)) { - *Result = (INT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUint32 ( - IN INT64 Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Operand >= 0) && (Operand <= MAX_UINT32)) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - INT64 -> UINT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUint64 ( - IN INT64 Operand, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> INT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToInt8 ( - IN UINT64 Operand, - OUT INT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> CHAR8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToChar8 ( - IN UINT64 Operand, - OUT CHAR8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT8) { - *Result = (INT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = CHAR8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> UINT8 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUint8 ( - IN UINT64 Operand, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT8) { - *Result = (UINT8)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> INT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToInt16 ( - IN UINT64 Operand, - OUT INT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT16) { - *Result = (INT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> UINT16 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUint16 ( - IN UINT64 Operand, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT16) { - *Result = (UINT16)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToInt32 ( - IN UINT64 Operand, - OUT INT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT32) { - *Result = (INT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUint32 ( - IN UINT64 Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_UINT32) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToIntn ( - IN UINT64 Operand, - OUT INTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INTN) { - *Result = (INTN)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 -> INT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToInt64 ( - IN UINT64 Operand, - OUT INT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand <= MAX_INT64) { - *Result = (INT64)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = INT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -// -// Addition functions -// - -/** - UINT8 addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint8Add ( - IN UINT8 Augend, - IN UINT8 Addend, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (((UINT8)(Augend + Addend)) >= Augend) { - *Result = (UINT8)(Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16Add ( - IN UINT16 Augend, - IN UINT16 Addend, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (((UINT16)(Augend + Addend)) >= Augend) { - *Result = (UINT16)(Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32Add ( - IN UINT32 Augend, - IN UINT32 Addend, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Augend + Addend) >= Augend) { - *Result = (Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64Add ( - IN UINT64 Augend, - IN UINT64 Addend, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Augend + Addend) >= Augend) { - *Result = (Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -// -// Subtraction functions -// - -/** - UINT8 subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint8Sub ( - IN UINT8 Minuend, - IN UINT8 Subtrahend, - OUT UINT8 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Minuend >= Subtrahend) { - *Result = (UINT8)(Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT8_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT16 subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16Sub ( - IN UINT16 Minuend, - IN UINT16 Subtrahend, - OUT UINT16 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Minuend >= Subtrahend) { - *Result = (UINT16)(Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT16_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT32 subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32Sub ( - IN UINT32 Minuend, - IN UINT32 Subtrahend, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Minuend >= Subtrahend) { - *Result = (Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINT64 subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64Sub ( - IN UINT64 Minuend, - IN UINT64 Subtrahend, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Minuend >= Subtrahend) { - *Result = (Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -// -// Multiplication functions -// - -/** - UINT8 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint8Mult ( - IN UINT8 Multiplicand, - IN UINT8 Multiplier, - OUT UINT8 *Result - ) -{ - UINT32 IntermediateResult; - - IntermediateResult = ((UINT32)Multiplicand) *((UINT32)Multiplier); - - return SafeUint32ToUint8 (IntermediateResult, Result); -} - -/** - UINT16 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint16Mult ( - IN UINT16 Multiplicand, - IN UINT16 Multiplier, - OUT UINT16 *Result - ) -{ - UINT32 IntermediateResult; - - IntermediateResult = ((UINT32)Multiplicand) *((UINT32)Multiplier); - - return SafeUint32ToUint16 (IntermediateResult, Result); -} - -/** - UINT32 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32Mult ( - IN UINT32 Multiplicand, - IN UINT32 Multiplier, - OUT UINT32 *Result - ) -{ - UINT64 IntermediateResult; - - IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier); - - return SafeUint64ToUint32 (IntermediateResult, Result); -} - -/** - UINT64 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64Mult ( - IN UINT64 Multiplicand, - IN UINT64 Multiplier, - OUT UINT64 *Result - ) -{ - RETURN_STATUS Status; - UINT32 DwordA; - UINT32 DwordB; - UINT32 DwordC; - UINT32 DwordD; - UINT64 ProductAD; - UINT64 ProductBC; - UINT64 ProductBD; - UINT64 UnsignedResult; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - ProductAD = 0; - ProductBC = 0; - ProductBD = 0; - UnsignedResult = 0; - Status = RETURN_BUFFER_TOO_SMALL; - - // - // 64x64 into 128 is like 32.32 x 32.32. - // - // a.b * c.d = a*(c.d) + .b*(c.d) = a*c + a*.d + .b*c + .b*.d - // back in non-decimal notation where A=a*2^32 and C=c*2^32: - // A*C + A*d + b*C + b*d - // So there are four components to add together. - // result = (a*c*2^64) + (a*d*2^32) + (b*c*2^32) + (b*d) - // - // a * c must be 0 or there would be bits in the high 64-bits - // a * d must be less than 2^32 or there would be bits in the high 64-bits - // b * c must be less than 2^32 or there would be bits in the high 64-bits - // then there must be no overflow of the resulting values summed up. - // - DwordA = (UINT32)RShiftU64 (Multiplicand, 32); - DwordC = (UINT32)RShiftU64 (Multiplier, 32); - - // - // common case -- if high dwords are both zero, no chance for overflow - // - if ((DwordA == 0) && (DwordC == 0)) { - DwordB = (UINT32)Multiplicand; - DwordD = (UINT32)Multiplier; - - *Result = (((UINT64)DwordB) *(UINT64)DwordD); - 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)) { - DwordD = (UINT32)Multiplier; - - // - // a * d must be less than 2^32 or there would be bits set in the high 64-bits - // - ProductAD = (((UINT64)DwordA) *(UINT64)DwordD); - if ((ProductAD & 0xffffffff00000000) == 0) { - DwordB = (UINT32)Multiplicand; - - // - // b * c must be less than 2^32 or there would be bits set in the high 64-bits - // - ProductBC = (((UINT64)DwordB) *(UINT64)DwordC); - if ((ProductBC & 0xffffffff00000000) == 0) { - // - // now sum them all up checking for overflow. - // shifting is safe because we already checked for overflow above - // - if (!RETURN_ERROR (SafeUint64Add (LShiftU64 (ProductBC, 32), LShiftU64 (ProductAD, 32), &UnsignedResult))) { - // - // b * d - // - ProductBD = (((UINT64)DwordB) *(UINT64)DwordD); - - if (!RETURN_ERROR (SafeUint64Add (UnsignedResult, ProductBD, &UnsignedResult))) { - *Result = UnsignedResult; - Status = RETURN_SUCCESS; - } - } - } - } - } - } - - if (RETURN_ERROR (Status)) { - *Result = UINT64_ERROR; - } - return Status; -} - -// -// Signed operations -// -// Strongly consider using unsigned numbers. -// -// Signed numbers are often used where unsigned numbers should be used. -// For example file sizes and array indices should always be unsigned. -// Subtracting a larger positive signed number from a smaller positive -// signed number with SafeInt32Sub will succeed, producing a negative number, -// that then must not be used as an array index (but can occasionally be -// used as a pointer index.) Similarly for adding a larger magnitude -// negative number to a smaller magnitude positive number. -// -// This library does not protect you from such errors. It tells you if your -// integer operations overflowed, not if you are doing the right thing -// with your non-overflowed integers. -// -// Likewise you can overflow a buffer with a non-overflowed unsigned index. -// - -// -// Signed addition functions -// - -/** - INT8 Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8Add ( - IN INT8 Augend, - IN INT8 Addend, - OUT INT8 *Result - ) -{ - return SafeInt32ToInt8 (((INT32)Augend) + ((INT32)Addend), Result); -} - -/** - CHAR8 Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeChar8Add ( - IN CHAR8 Augend, - IN CHAR8 Addend, - OUT CHAR8 *Result - ) -{ - INT32 Augend32; - INT32 Addend32; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - Augend32 = (INT32)Augend; - Addend32 = (INT32)Addend; - if (Augend32 < 0 || Augend32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - if (Addend32 < 0 || Addend32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - - return SafeInt32ToChar8 (Augend32 + Addend32, Result); -} - -/** - INT16 Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16Add ( - IN INT16 Augend, - IN INT16 Addend, - OUT INT16 *Result - ) -{ - return SafeInt32ToInt16 (((INT32)Augend) + ((INT32)Addend), Result); -} - -/** - INT32 Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32Add ( - IN INT32 Augend, - IN INT32 Addend, - OUT INT32 *Result - ) -{ - return SafeInt64ToInt32 (((INT64)Augend) + ((INT64)Addend), Result); -} - -/** - INT64 Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64Add ( - IN INT64 Augend, - IN INT64 Addend, - OUT INT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - // - // * An Addend of zero can never cause underflow or overflow. - // - // * A positive Addend can only cause overflow. The overflow condition is - // - // (Augend + Addend) > MAX_INT64 - // - // Subtracting Addend from both sides yields - // - // Augend > (MAX_INT64 - Addend) - // - // This condition can be coded directly in C because the RHS will neither - // underflow nor overflow. That is due to the starting condition: - // - // 0 < Addend <= MAX_INT64 - // - // Multiplying all three sides by (-1) yields - // - // 0 > (-Addend) >= (-MAX_INT64) - // - // Adding MAX_INT64 to all three sides yields - // - // MAX_INT64 > (MAX_INT64 - Addend) >= 0 - // - // * A negative Addend can only cause underflow. The underflow condition is - // - // (Augend + Addend) < MIN_INT64 - // - // Subtracting Addend from both sides yields - // - // Augend < (MIN_INT64 - Addend) - // - // This condition can be coded directly in C because the RHS will neither - // underflow nor overflow. That is due to the starting condition: - // - // MIN_INT64 <= Addend < 0 - // - // Multiplying all three sides by (-1) yields - // - // (-MIN_INT64) >= (-Addend) > 0 - // - // Adding MIN_INT64 to all three sides yields - // - // 0 >= (MIN_INT64 - Addend) > MIN_INT64 - // - if (((Addend > 0) && (Augend > (MAX_INT64 - Addend))) || - ((Addend < 0) && (Augend < (MIN_INT64 - Addend)))) { - *Result = INT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } else { - *Result = Augend + Addend; - Status = RETURN_SUCCESS; - } - - return Status; -} - -// -// Signed subtraction functions -// - -/** - INT8 Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8Sub ( - IN INT8 Minuend, - IN INT8 Subtrahend, - OUT INT8 *Result - ) -{ - return SafeInt32ToInt8 (((INT32)Minuend) - ((INT32)Subtrahend), Result); -} - -/** - CHAR8 Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeChar8Sub ( - IN CHAR8 Minuend, - IN CHAR8 Subtrahend, - OUT CHAR8 *Result - ) -{ - INT32 Minuend32; - INT32 Subtrahend32; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - Minuend32 = (INT32)Minuend; - Subtrahend32 = (INT32)Subtrahend; - if (Minuend32 < 0 || Minuend32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - if (Subtrahend32 < 0 || Subtrahend32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - - return SafeInt32ToChar8 (Minuend32 - Subtrahend32, Result); -} - -/** - INT16 Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16Sub ( - IN INT16 Minuend, - IN INT16 Subtrahend, - OUT INT16 *Result - ) -{ - return SafeInt32ToInt16 (((INT32)Minuend) - ((INT32)Subtrahend), Result); -} - -/** - INT32 Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32Sub ( - IN INT32 Minuend, - IN INT32 Subtrahend, - OUT INT32 *Result - ) -{ - return SafeInt64ToInt32 (((INT64)Minuend) - ((INT64)Subtrahend), Result); -} - -/** - INT64 Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64Sub ( - IN INT64 Minuend, - IN INT64 Subtrahend, - OUT INT64 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - // - // * A Subtrahend of zero can never cause underflow or overflow. - // - // * A positive Subtrahend can only cause underflow. The underflow condition - // is: - // - // (Minuend - Subtrahend) < MIN_INT64 - // - // Adding Subtrahend to both sides yields - // - // Minuend < (MIN_INT64 + Subtrahend) - // - // This condition can be coded directly in C because the RHS will neither - // underflow nor overflow. That is due to the starting condition: - // - // 0 < Subtrahend <= MAX_INT64 - // - // Adding MIN_INT64 to all three sides yields - // - // MIN_INT64 < (MIN_INT64 + Subtrahend) <= (MIN_INT64 + MAX_INT64) = -1 - // - // * A negative Subtrahend can only cause overflow. The overflow condition is - // - // (Minuend - Subtrahend) > MAX_INT64 - // - // Adding Subtrahend to both sides yields - // - // Minuend > (MAX_INT64 + Subtrahend) - // - // This condition can be coded directly in C because the RHS will neither - // underflow nor overflow. That is due to the starting condition: - // - // MIN_INT64 <= Subtrahend < 0 - // - // Adding MAX_INT64 to all three sides yields - // - // -1 = (MAX_INT64 + MIN_INT64) <= (MAX_INT64 + Subtrahend) < MAX_INT64 - // - if (((Subtrahend > 0) && (Minuend < (MIN_INT64 + Subtrahend))) || - ((Subtrahend < 0) && (Minuend > (MAX_INT64 + Subtrahend)))) { - *Result = INT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } else { - *Result = Minuend - Subtrahend; - Status = RETURN_SUCCESS; - } - - return Status; -} - -// -// Signed multiplication functions -// - -/** - INT8 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt8Mult ( - IN INT8 Multiplicand, - IN INT8 Multiplier, - OUT INT8 *Result - ) -{ - return SafeInt32ToInt8 (((INT32)Multiplier) *((INT32)Multiplicand), Result); -} - -/** - CHAR8 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeChar8Mult ( - IN CHAR8 Multiplicand, - IN CHAR8 Multiplier, - OUT CHAR8 *Result - ) -{ - INT32 Multiplicand32; - INT32 Multiplier32; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - Multiplicand32 = (INT32)Multiplicand; - Multiplier32 = (INT32)Multiplier; - if (Multiplicand32 < 0 || Multiplicand32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - if (Multiplier32 < 0 || Multiplier32 > MAX_INT8) { - *Result = CHAR8_ERROR; - return RETURN_BUFFER_TOO_SMALL; - } - - return SafeInt32ToChar8 (Multiplicand32 * Multiplier32, Result); -} - -/** - INT16 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt16Mult ( - IN INT16 Multiplicand, - IN INT16 Multiplier, - OUT INT16 *Result - ) -{ - return SafeInt32ToInt16 (((INT32)Multiplicand) *((INT32)Multiplier), Result); -} - -/** - INT32 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32Mult ( - IN INT32 Multiplicand, - IN INT32 Multiplier, - OUT INT32 *Result - ) -{ - return SafeInt64ToInt32 (MultS64x64 (Multiplicand, Multiplier), Result); -} - -/** - INT64 multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64Mult ( - IN INT64 Multiplicand, - IN INT64 Multiplier, - OUT INT64 *Result - ) -{ - RETURN_STATUS Status; - UINT64 UnsignedMultiplicand; - UINT64 UnsignedMultiplier; - UINT64 UnsignedResult; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - // - // Split into sign and magnitude, do unsigned operation, apply sign. - // - if (Multiplicand < 0) { - // - // Avoid negating the most negative number. - // - UnsignedMultiplicand = ((UINT64)(- (Multiplicand + 1))) + 1; - } else { - UnsignedMultiplicand = (UINT64)Multiplicand; - } - - if (Multiplier < 0) { - // - // Avoid negating the most negative number. - // - UnsignedMultiplier = ((UINT64)(- (Multiplier + 1))) + 1; - } else { - UnsignedMultiplier = (UINT64)Multiplier; - } - - Status = SafeUint64Mult (UnsignedMultiplicand, UnsignedMultiplier, &UnsignedResult); - if (!RETURN_ERROR (Status)) { - if ((Multiplicand < 0) != (Multiplier < 0)) { - if (UnsignedResult > MIN_INT64_MAGNITUDE) { - *Result = INT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } else if (UnsignedResult == MIN_INT64_MAGNITUDE) { - *Result = MIN_INT64; - } else { - *Result = - ((INT64)UnsignedResult); - } - } else { - if (UnsignedResult > MAX_INT64) { - *Result = INT64_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } else { - *Result = (INT64)UnsignedResult; - } - } - } else { - *Result = INT64_ERROR; - } - return Status; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c deleted file mode 100644 index d34c735..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib32.c +++ /dev/null @@ -1,555 +0,0 @@ -/** @file - This library provides helper functions to prevent integer overflow during - type conversion, addition, subtraction, and multiplication. - - Copyright (c) 2017, Microsoft Corporation - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**/ - -#include -#include -#include - -/** - INT32 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUintn ( - IN INT32 Operand, - OUT UINTN *Result - ) -{ - return SafeInt32ToUint32 (Operand, (UINT32 *)Result); -} - -/** - UINT32 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToIntn ( - IN UINT32 Operand, - OUT INTN *Result - ) -{ - return SafeUint32ToInt32 (Operand, (INT32 *)Result); -} - -/** - INTN -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToInt32 ( - IN INTN Operand, - OUT INT32 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = (INT32)Operand; - return RETURN_SUCCESS; -} - -/** - INTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint32 ( - IN INTN Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Operand >= 0) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToUint32 ( - IN UINTN Operand, - OUT UINT32 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = (UINT32)Operand; - return RETURN_SUCCESS; -} - -/** - UINTN -> INT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt64 ( - IN UINTN Operand, - OUT INT64 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = (INT64)Operand; - return RETURN_SUCCESS; -} - -/** - INT64 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToIntn ( - IN INT64 Operand, - OUT INTN *Result - ) -{ - return SafeInt64ToInt32 (Operand, (INT32 *)Result); -} - -/** - INT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUintn ( - IN INT64 Operand, - OUT UINTN *Result - ) -{ - return SafeInt64ToUint32 (Operand, (UINT32 *)Result); -} - -/** - UINT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUintn ( - IN UINT64 Operand, - OUT UINTN *Result - ) -{ - return SafeUint64ToUint32 ((UINT64) Operand, (UINT32 *)Result); -} - -/** - UINTN addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnAdd ( - IN UINTN Augend, - IN UINTN Addend, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if ((Augend + Addend) >= Augend) { - *Result = (Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnSub ( - IN UINTN Minuend, - IN UINTN Subtrahend, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (Minuend >= Subtrahend) { - *Result = (Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; -} - -/** - UINTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnMult ( - IN UINTN Multiplicand, - IN UINTN Multiplier, - OUT UINTN *Result - ) -{ - UINT64 IntermediateResult; - - IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier); - - return SafeUint64ToUintn (IntermediateResult, Result); -} - -/** - INTN Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnAdd ( - IN INTN Augend, - IN INTN Addend, - OUT INTN *Result - ) -{ - return SafeInt64ToIntn (((INT64)Augend) + ((INT64)Addend), Result); -} - -/** - INTN Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnSub ( - IN INTN Minuend, - IN INTN Subtrahend, - OUT INTN *Result - ) -{ - return SafeInt64ToIntn (((INT64)Minuend) - ((INT64)Subtrahend), Result); -} - -/** - INTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnMult ( - IN INTN Multiplicand, - IN INTN Multiplier, - OUT INTN *Result - ) -{ - return SafeInt64ToIntn (MultS64x64 (Multiplicand, Multiplier), Result); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c deleted file mode 100644 index e8d3016..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLib64.c +++ /dev/null @@ -1,508 +0,0 @@ -/** @file - This library provides helper functions to prevent integer overflow during - type conversion, addition, subtraction, and multiplication. - - Copyright (c) 2017, Microsoft Corporation - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**/ - -#include -#include - -/** - INT32 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUintn ( - IN INT32 Operand, - OUT UINTN *Result - ) -{ - return SafeInt32ToUint64 (Operand, (UINT64 *) Result); -} - -/** - UINT32 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToIntn ( - IN UINT32 Operand, - OUT INTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = Operand; - return RETURN_SUCCESS; -} - -/** - INTN -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToInt32 ( - IN INTN Operand, - OUT INT32 *Result - ) -{ - return SafeInt64ToInt32 ((INT64) Operand, Result); -} - -/** - INTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint32 ( - IN INTN Operand, - OUT UINT32 *Result - ) -{ - return SafeInt64ToUint32 ((INT64)Operand, Result); -} - -/** - UINTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToUint32 ( - IN UINTN Operand, - OUT UINT32 *Result - ) -{ - return SafeUint64ToUint32 ((UINT64)Operand, Result); -} - -/** - UINTN -> INT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt64 ( - IN UINTN Operand, - OUT INT64 *Result - ) -{ - return SafeUint64ToInt64 ((UINT64)Operand, Result); -} - -/** - INT64 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToIntn ( - IN INT64 Operand, - OUT INTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = (INTN)Operand; - return RETURN_SUCCESS; -} - -/** - INT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUintn ( - IN INT64 Operand, - OUT UINTN *Result - ) -{ - return SafeInt64ToUint64 (Operand, (UINT64 *)Result); -} - -/** - UINT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUintn ( - IN UINT64 Operand, - OUT UINTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - *Result = Operand; - return RETURN_SUCCESS; -} - -/** - UINTN addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnAdd ( - IN UINTN Augend, - IN UINTN Addend, - OUT UINTN *Result - ) -{ - return SafeUint64Add ((UINT64)Augend, (UINT64)Addend, (UINT64 *)Result); -} - -/** - UINTN subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnSub ( - IN UINTN Minuend, - IN UINTN Subtrahend, - OUT UINTN *Result - ) -{ - return SafeUint64Sub ((UINT64)Minuend, (UINT64)Subtrahend, (UINT64 *)Result); -} - -/** - UINTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnMult ( - IN UINTN Multiplicand, - IN UINTN Multiplier, - OUT UINTN *Result - ) -{ - return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result); -} - -/** - INTN Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnAdd ( - IN INTN Augend, - IN INTN Addend, - OUT INTN *Result - ) -{ - return SafeInt64Add ((INT64)Augend, (INT64)Addend, (INT64 *)Result); -} - -/** - INTN Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnSub ( - IN INTN Minuend, - IN INTN Subtrahend, - OUT INTN *Result - ) -{ - return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result); -} - -/** - INTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnMult ( - IN INTN Multiplicand, - IN INTN Multiplier, - OUT INTN *Result - ) -{ - return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c deleted file mode 100644 index d715cdc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSafeIntLib/SafeIntLibEbc.c +++ /dev/null @@ -1,614 +0,0 @@ -/** @file - This library provides helper functions to prevent integer overflow during - type conversion, addition, subtraction, and multiplication. - - Copyright (c) 2017, Microsoft Corporation - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**/ - -#include -#include - -/** - INT32 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt32ToUintn ( - IN INT32 Operand, - OUT UINTN *Result - ) -{ - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt32ToUint32 (Operand, (UINT32 *)Result); - } - return SafeInt32ToUint64 (Operand, (UINT64 *) Result); -} - -/** - UINT32 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint32ToIntn ( - IN UINT32 Operand, - OUT INTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeUint32ToInt32 (Operand, (INT32 *)Result); - } - *Result = Operand; - return RETURN_SUCCESS; -} - -/** - INTN -> INT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToInt32 ( - IN INTN Operand, - OUT INT32 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - *Result = (INT32)Operand; - return RETURN_SUCCESS; - } - return SafeInt64ToInt32 ((INT64) Operand, Result); -} - -/** - INTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnToUint32 ( - IN INTN Operand, - OUT UINT32 *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - if (Operand >= 0) { - *Result = (UINT32)Operand; - Status = RETURN_SUCCESS; - } else { - *Result = UINT32_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; - } - return SafeInt64ToUint32 ((INT64)Operand, Result); -} - -/** - UINTN -> UINT32 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToUint32 ( - IN UINTN Operand, - OUT UINT32 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - *Result = (UINT32)Operand; - return RETURN_SUCCESS; - } - return SafeUint64ToUint32 ((UINT64)Operand, Result); -} - -/** - UINTN -> INT64 conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnToInt64 ( - IN UINTN Operand, - OUT INT64 *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - *Result = (INT64)Operand; - return RETURN_SUCCESS; - } - return SafeUint64ToInt64 ((UINT64)Operand, Result); -} - -/** - INT64 -> INTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToIntn ( - IN INT64 Operand, - OUT INTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt64ToInt32 (Operand, (INT32 *)Result); - } - *Result = (INTN)Operand; - return RETURN_SUCCESS; -} - -/** - INT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeInt64ToUintn ( - IN INT64 Operand, - OUT UINTN *Result - ) -{ - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt64ToUint32 (Operand, (UINT32 *)Result); - } - return SafeInt64ToUint64 (Operand, (UINT64 *)Result); -} - -/** - UINT64 -> UINTN conversion - - Converts the value specified by Operand to a value specified by Result type - and stores the converted value into the caller allocated output buffer - specified by Result. The caller must pass in a Result buffer that is at - least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the conversion results in an overflow or an underflow condition, then - Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Operand Operand to be converted to new type - @param[out] Result Pointer to the result of conversion - - @retval RETURN_SUCCESS Successful conversion - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUint64ToUintn ( - IN UINT64 Operand, - OUT UINTN *Result - ) -{ - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeUint64ToUint32 ((UINT64) Operand, (UINT32 *)Result); - } - *Result = Operand; - return RETURN_SUCCESS; -} - -/** - UINTN addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnAdd ( - IN UINTN Augend, - IN UINTN Addend, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - if ((UINT32)(Augend + Addend) >= Augend) { - *Result = (Augend + Addend); - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; - } - return SafeUint64Add ((UINT64)Augend, (UINT64)Addend, (UINT64 *)Result); -} - -/** - UINTN subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnSub ( - IN UINTN Minuend, - IN UINTN Subtrahend, - OUT UINTN *Result - ) -{ - RETURN_STATUS Status; - - if (Result == NULL) { - return RETURN_INVALID_PARAMETER; - } - - if (sizeof (UINTN) == sizeof (UINT32)) { - if (Minuend >= Subtrahend) { - *Result = (Minuend - Subtrahend); - Status = RETURN_SUCCESS; - } else { - *Result = UINTN_ERROR; - Status = RETURN_BUFFER_TOO_SMALL; - } - - return Status; - } - return SafeUint64Sub ((UINT64)Minuend, (UINT64)Subtrahend, (UINT64 *)Result); -} - -/** - UINTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeUintnMult ( - IN UINTN Multiplicand, - IN UINTN Multiplier, - OUT UINTN *Result - ) -{ - UINT64 IntermediateResult; - - if (sizeof (UINTN) == sizeof (UINT32)) { - IntermediateResult = ((UINT64) Multiplicand) *((UINT64) Multiplier); - - return SafeUint64ToUintn (IntermediateResult, Result); - } - return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result); -} - -/** - INTN Addition - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Augend A number to which addend will be added - @param[in] Addend A number to be added to another - @param[out] Result Pointer to the result of addition - - @retval RETURN_SUCCESS Successful addition - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnAdd ( - IN INTN Augend, - IN INTN Addend, - OUT INTN *Result - ) -{ - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt64ToIntn (((INT64)Augend) + ((INT64)Addend), Result); - } - return SafeInt64Add ((INT64)Augend, (INT64)Addend, (INT64 *)Result); -} - -/** - INTN Subtraction - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Minuend A number from which another is to be subtracted. - @param[in] Subtrahend A number to be subtracted from another - @param[out] Result Pointer to the result of subtraction - - @retval RETURN_SUCCESS Successful subtraction - @retval RETURN_BUFFER_TOO_SMALL Underflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnSub ( - IN INTN Minuend, - IN INTN Subtrahend, - OUT INTN *Result - ) -{ - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt64ToIntn (((INT64)Minuend) - ((INT64)Subtrahend), Result); - } - return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result); -} - -/** - INTN multiplication - - Performs the requested operation using the input parameters into a value - specified by Result type and stores the converted value into the caller - allocated output buffer specified by Result. The caller must pass in a - Result buffer that is at least as large as the Result type. - - If Result is NULL, RETURN_INVALID_PARAMETER is returned. - - If the requested operation results in an overflow or an underflow condition, - then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. - - @param[in] Multiplicand A number that is to be multiplied by another - @param[in] Multiplier A number by which the multiplicand is to be multiplied - @param[out] Result Pointer to the result of multiplication - - @retval RETURN_SUCCESS Successful multiplication - @retval RETURN_BUFFER_TOO_SMALL Overflow - @retval RETURN_INVALID_PARAMETER Result is NULL -**/ -RETURN_STATUS -EFIAPI -SafeIntnMult ( - IN INTN Multiplicand, - IN INTN Multiplier, - OUT INTN *Result - ) -{ - if (sizeof (UINTN) == sizeof (UINT32)) { - return SafeInt64ToIntn (((INT64)Multiplicand) *((INT64)Multiplier), Result); - } - return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c deleted file mode 100644 index ed173e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c +++ /dev/null @@ -1,197 +0,0 @@ -/** @file - Null Serial Port library instance with empty functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include -#include - -/** - Initialize the serial device hardware. - - If no initialization is required, then return RETURN_SUCCESS. - If the serial device was successfully initialized, then return RETURN_SUCCESS. - If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. - - @retval RETURN_SUCCESS The serial device was initialized. - @retval RETURN_DEVICE_ERROR The serial device could not be initialized. - -**/ -RETURN_STATUS -EFIAPI -SerialPortInitialize ( - VOID - ) -{ - return RETURN_SUCCESS; -} - -/** - Write data from buffer to serial device. - - Writes NumberOfBytes data bytes from Buffer to the serial device. - The number of bytes actually written to the serial device is returned. - If the return value is less than NumberOfBytes, then the write operation failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer The pointer to the data buffer to be written. - @param NumberOfBytes The number of bytes to written to the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes written to the serial device. - If this value is less than NumberOfBytes, then the write operation failed. - -**/ -UINTN -EFIAPI -SerialPortWrite ( - IN UINT8 *Buffer, - IN UINTN NumberOfBytes -) -{ - return 0; -} - - -/** - Read data from serial device and save the datas in buffer. - - Reads NumberOfBytes data bytes from a serial device into the buffer - specified by Buffer. The number of bytes actually read is returned. - If the return value is less than NumberOfBytes, then the rest operation failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer The pointer to the data buffer to store the data read from the serial device. - @param NumberOfBytes The number of bytes which will be read. - - @retval 0 Read data failed; No data is to be read. - @retval >0 The actual number of bytes read from serial device. - -**/ -UINTN -EFIAPI -SerialPortRead ( - OUT UINT8 *Buffer, - IN UINTN NumberOfBytes -) -{ - return 0; -} - -/** - Polls a serial device to see if there is any data waiting to be read. - - Polls a serial device to see if there is any data waiting to be read. - If there is data waiting to be read from the serial device, then TRUE is returned. - If there is no data waiting to be read from the serial device, then FALSE is returned. - - @retval TRUE Data is waiting to be read from the serial device. - @retval FALSE There is no data waiting to be read from the serial device. - -**/ -BOOLEAN -EFIAPI -SerialPortPoll ( - VOID - ) -{ - return FALSE; -} - -/** - Sets the control bits on a serial device. - - @param Control Sets the bits of Control that are settable. - - @retval RETURN_SUCCESS The new control bits were set on the serial device. - @retval RETURN_UNSUPPORTED The serial device does not support this operation. - @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly. - -**/ -RETURN_STATUS -EFIAPI -SerialPortSetControl ( - IN UINT32 Control - ) -{ - return RETURN_UNSUPPORTED; -} - -/** - Retrieve the status of the control bits on a serial device. - - @param Control A pointer to return the current control signals from the serial device. - - @retval RETURN_SUCCESS The control bits were read from the serial device. - @retval RETURN_UNSUPPORTED The serial device does not support this operation. - @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly. - -**/ -RETURN_STATUS -EFIAPI -SerialPortGetControl ( - OUT UINT32 *Control - ) -{ - return RETURN_UNSUPPORTED; -} - -/** - Sets the baud rate, receive FIFO depth, transmit/receice time out, parity, - data bits, and stop bits on a serial device. - - @param BaudRate The requested baud rate. A BaudRate value of 0 will use the - device's default interface speed. - On output, the value actually set. - @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the - serial interface. A ReceiveFifoDepth value of 0 will use - the device's default FIFO depth. - On output, the value actually set. - @param Timeout The requested time out for a single character in microseconds. - This timeout applies to both the transmit and receive side of the - interface. A Timeout value of 0 will use the device's default time - out value. - On output, the value actually set. - @param Parity The type of parity to use on this serial device. A Parity value of - DefaultParity will use the device's default parity value. - On output, the value actually set. - @param DataBits The number of data bits to use on the serial device. A DataBits - vaule of 0 will use the device's default data bit setting. - On output, the value actually set. - @param StopBits The number of stop bits to use on this serial device. A StopBits - value of DefaultStopBits will use the device's default number of - stop bits. - On output, the value actually set. - - @retval RETURN_SUCCESS The new attributes were set on the serial device. - @retval RETURN_UNSUPPORTED The serial device does not support this operation. - @retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value. - @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly. - -**/ -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 - ) -{ - return RETURN_UNSUPPORTED; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf deleted file mode 100644 index 79dda12..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +++ /dev/null @@ -1,36 +0,0 @@ -## @file -# Null instance of Serial Port Library with empty functions. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseSerialPortLibNull - MODULE_UNI_FILE = BaseSerialPortLibNull.uni - FILE_GUID = E4541241-8897-411a-91F8-7D7E45837146 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SerialPortLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseSerialPortLibNull.c - - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.uni deleted file mode 100644 index 5af091f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Null instance of Serial Port Library with empty functions. -// -// Null instance of Serial Port Library with empty functions. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Null instance of Serial Port Library with empty functions" - -#string STR_MODULE_DESCRIPTION #language en-US "Null instance of Serial Port Library with empty functions." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c deleted file mode 100644 index ffd61b6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c +++ /dev/null @@ -1,544 +0,0 @@ -/** @file -Null implementation of SmBusLib class library. - -Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Executes an SMBUS quick read command. - - Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_UNSUPPORTED The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickRead ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } -} - -/** - Executes an SMBUS quick write command. - - Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_UNSUPPORTED The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickWrite ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } -} - -/** - Executes an SMBUS receive byte command. - - Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - The byte received from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The byte received from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReceiveByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS send byte command. - - Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress. - The byte specified by Value is sent. - Only the SMBUS slave address field of SmBusAddress is required. Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to send. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusSendByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS read data byte command. - - Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 8-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReadDataByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS write data byte command. - - Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. - The 8-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusWriteDataByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS read data word command. - - Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT16 -EFIAPI -SmBusReadDataWord ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS write data word command. - - Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -SmBusWriteDataWord ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS process call command. - - Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value returned by the process call command is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The 16-bit value returned by the process call command. - -**/ -UINT16 -EFIAPI -SmBusProcessCall ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS read block command. - - Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Bytes are read from the SMBUS and stored in Buffer. - The number of bytes read is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is not zero, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer Pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The number of bytes read. - -**/ -UINTN -EFIAPI -SmBusReadBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS write block command. - - Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from Buffer. - The number of bytes written is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer Pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusWriteBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} - -/** - Executes an SMBUS block process call command. - - Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If WriteBuffer is NULL, then ASSERT(). - If ReadBuffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress Address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS. - @param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusBlockProcessCall ( - IN UINTN SmBusAddress, - IN VOID *WriteBuffer, - OUT VOID *ReadBuffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (WriteBuffer != NULL); - ASSERT (ReadBuffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - if (Status != NULL) { - *Status = RETURN_UNSUPPORTED; - } - return 0; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf deleted file mode 100644 index 0abd266..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf +++ /dev/null @@ -1,35 +0,0 @@ -## @file -# Null implementation of the SMBUS Library. -# -# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseSmbusLibNull - MODULE_UNI_FILE = BaseSmbusLibNull.uni - FILE_GUID = E2ECA273-A1C0-407E-9A5C-F10C55142196 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmbusLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseSmbusLibNull.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.uni deleted file mode 100644 index 00e6d6b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Null implementation of the SMBUS Library. -// -// Null implementation of the SMBUS Library. -// -// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Null implementation of the SMBUS Library." - -#string STR_MODULE_DESCRIPTION #language en-US "Null implementation of the SMBUS Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c deleted file mode 100644 index ad3f268..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - Base Stack Check library for GCC/clang. - - Use -fstack-protector-all compiler flag to make the compiler insert the - __stack_chk_guard "canary" value into the stack and check the value prior - to exiting the function. If the "canary" is overwritten __stack_chk_fail() - is called. This is GCC specific code. - - Copyright (c) 2012, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -/// "canary" value that is inserted by the compiler into the stack frame. -VOID *__stack_chk_guard = (VOID*)0x0AFF; - -// If ASLR was enabled we could use -//void (*__stack_chk_guard)(void) = __stack_chk_fail; - -/** - Error path for compiler generated stack "canary" value check code. If the - stack canary has been overwritten this function gets called on exit of the - function. -**/ -VOID -__stack_chk_fail ( - VOID - ) -{ - UINT8 DebugPropertyMask; - - 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 - // BaseDebugLibNull is in use. - // - DebugPropertyMask = PcdGet8 (PcdDebugPropertyMask); - if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf deleted file mode 100644 index 4a6466c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Stack Check Library -# -# Stack Check Library -# -# Copyright (c) 2014, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseStackCheckLib - MODULE_UNI_FILE = BaseStackCheckLib.uni - FILE_GUID = 5f6579f7-b648-4fdb-9f19-4c17e27e8eff - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL - - -# -# VALID_ARCHITECTURES = ARM AARCH64 -# - -[Sources] - BaseStackCheckGcc.c | GCC - BaseStackCheckGcc.c | RVCT - BaseStackCheckNull.c | MSFT - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - -[FixedPcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni deleted file mode 100644 index 1c50362..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Stack Check Library -// -// Stack Check Library -// -// Copyright (c) 2014, ARM Ltd. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Stack Check Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Stack Check Library" - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c deleted file mode 100644 index 9f7a3b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c +++ /dev/null @@ -1,15 +0,0 @@ -/** @file - This file is purely empty as a work around for BaseStackCheck to pass MSVC build. - - Copyright (c) 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -extern int __BaseStackCheckNull; diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.S deleted file mode 100644 index 2edd526..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.S +++ /dev/null @@ -1,205 +0,0 @@ -// Implementation of synchronization functions for ARM architecture (AArch64) -// -// Copyright (c) 2012-2015, ARM Limited. All rights reserved. -// Copyright (c) 2015, Linaro Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -.text -.align 3 - -GCC_ASM_EXPORT(InternalSyncCompareExchange16) -GCC_ASM_EXPORT(InternalSyncCompareExchange32) -GCC_ASM_EXPORT(InternalSyncCompareExchange64) -GCC_ASM_EXPORT(InternalSyncIncrement) -GCC_ASM_EXPORT(InternalSyncDecrement) - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT16 -//EFIAPI -//InternalSyncCompareExchange16 ( -// IN volatile UINT16 *Value, -// IN UINT16 CompareValue, -// IN UINT16 ExchangeValue -// ) -ASM_PFX(InternalSyncCompareExchange16): - uxth w1, w1 - uxth w2, w2 - dmb sy - -InternalSyncCompareExchange16Again: - ldxrh w3, [x0] - cmp w3, w1 - bne InternalSyncCompareExchange16Fail - -InternalSyncCompareExchange16Exchange: - stxrh w4, w2, [x0] - cbnz w4, InternalSyncCompareExchange16Again - -InternalSyncCompareExchange16Fail: - dmb sy - mov w0, w3 - ret - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT32 -//EFIAPI -//InternalSyncCompareExchange32 ( -// IN volatile UINT32 *Value, -// IN UINT32 CompareValue, -// IN UINT32 ExchangeValue -// ) -ASM_PFX(InternalSyncCompareExchange32): - dmb sy - -InternalSyncCompareExchange32Again: - ldxr w3, [x0] - cmp w3, w1 - bne InternalSyncCompareExchange32Fail - -InternalSyncCompareExchange32Exchange: - stxr w4, w2, [x0] - cbnz w4, InternalSyncCompareExchange32Again - -InternalSyncCompareExchange32Fail: - dmb sy - mov w0, w3 - ret - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT64 -//EFIAPI -//InternalSyncCompareExchange64 ( -// IN volatile UINT64 *Value, -// IN UINT64 CompareValue, -// IN UINT64 ExchangeValue -// ) -ASM_PFX(InternalSyncCompareExchange64): - dmb sy - -InternalSyncCompareExchange64Again: - ldxr x3, [x0] - cmp x3, x1 - bne InternalSyncCompareExchange64Fail - -InternalSyncCompareExchange64Exchange: - stxr w4, x2, [x0] - cbnz w4, InternalSyncCompareExchange64Again - -InternalSyncCompareExchange64Fail: - dmb sy - mov x0, x3 - ret - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncIncrement ( -// IN volatile UINT32 *Value -// ) -ASM_PFX(InternalSyncIncrement): - dmb sy -TryInternalSyncIncrement: - ldxr w1, [x0] - add w1, w1, #1 - stxr w2, w1, [x0] - cbnz w2, TryInternalSyncIncrement - mov w0, w1 - dmb sy - ret - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncDecrement ( -// IN volatile UINT32 *Value -// ) -ASM_PFX(InternalSyncDecrement): - dmb sy -TryInternalSyncDecrement: - ldxr w1, [x0] - sub w1, w1, #1 - stxr w2, w1, [x0] - cbnz w2, TryInternalSyncDecrement - mov w0, w1 - dmb sy - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.asm deleted file mode 100644 index 52f49a5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/AArch64/Synchronization.asm +++ /dev/null @@ -1,205 +0,0 @@ -; Implementation of synchronization functions for ARM architecture (AArch64) -; -; Copyright (c) 2012-2015, ARM Limited. All rights reserved. -; Copyright (c) 2015, Linaro Limited. All rights reserved. -; -; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; - - EXPORT InternalSyncCompareExchange16 - EXPORT InternalSyncCompareExchange32 - EXPORT InternalSyncCompareExchange64 - EXPORT InternalSyncIncrement - EXPORT InternalSyncDecrement - AREA BaseSynchronizationLib_LowLevel, CODE, READONLY - -;/** -; Performs an atomic compare exchange operation on a 16-bit unsigned integer. -; -; Performs an atomic compare exchange operation on the 16-bit unsigned integer -; specified by Value. If Value is equal to CompareValue, then Value is set to -; ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, -; then Value is returned. The compare exchange operation must be performed using -; MP safe mechanisms. -; -; @param Value A pointer to the 16-bit value for the compare exchange -; operation. -; @param CompareValue 16-bit value used in compare operation. -; @param ExchangeValue 16-bit value used in exchange operation. -; -; @return The original *Value before exchange. -; -;**/ -;UINT16 -;EFIAPI -;InternalSyncCompareExchange16 ( -; IN volatile UINT16 *Value, -; IN UINT16 CompareValue, -; IN UINT16 ExchangeValue -; ) -InternalSyncCompareExchange16 - uxth w1, w1 - uxth w2, w2 - dmb sy - -InternalSyncCompareExchange16Again - ldxrh w3, [x0] - cmp w3, w1 - bne InternalSyncCompareExchange16Fail - -InternalSyncCompareExchange16Exchange - stxrh w4, w2, [x0] - cbnz w4, InternalSyncCompareExchange16Again - -InternalSyncCompareExchange16Fail - dmb sy - mov w0, w3 - ret - -;/** -; Performs an atomic compare exchange operation on a 32-bit unsigned integer. -; -; Performs an atomic compare exchange operation on the 32-bit unsigned integer -; specified by Value. If Value is equal to CompareValue, then Value is set to -; ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, -; then Value is returned. The compare exchange operation must be performed using -; MP safe mechanisms. -; -; @param Value A pointer to the 32-bit value for the compare exchange -; operation. -; @param CompareValue 32-bit value used in compare operation. -; @param ExchangeValue 32-bit value used in exchange operation. -; -; @return The original *Value before exchange. -; -;**/ -;UINT32 -;EFIAPI -;InternalSyncCompareExchange32 ( -; IN volatile UINT32 *Value, -; IN UINT32 CompareValue, -; IN UINT32 ExchangeValue -; ) -InternalSyncCompareExchange32 - dmb sy - -InternalSyncCompareExchange32Again - ldxr w3, [x0] - cmp w3, w1 - bne InternalSyncCompareExchange32Fail - -InternalSyncCompareExchange32Exchange - stxr w4, w2, [x0] - cbnz w4, InternalSyncCompareExchange32Again - -InternalSyncCompareExchange32Fail - dmb sy - mov w0, w3 - ret - -;/** -; Performs an atomic compare exchange operation on a 64-bit unsigned integer. -; -; Performs an atomic compare exchange operation on the 64-bit unsigned integer specified -; by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and -; CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. -; The compare exchange operation must be performed using MP safe mechanisms. -; -; @param Value A pointer to the 64-bit value for the compare exchange -; operation. -; @param CompareValue 64-bit value used in compare operation. -; @param ExchangeValue 64-bit value used in exchange operation. -; -; @return The original *Value before exchange. -; -;**/ -;UINT64 -;EFIAPI -;InternalSyncCompareExchange64 ( -; IN volatile UINT64 *Value, -; IN UINT64 CompareValue, -; IN UINT64 ExchangeValue -; ) -InternalSyncCompareExchange64 - dmb sy - -InternalSyncCompareExchange64Again - ldxr x3, [x0] - cmp x3, x1 - bne InternalSyncCompareExchange64Fail - -InternalSyncCompareExchange64Exchange - stxr w4, x2, [x0] - cbnz w4, InternalSyncCompareExchange64Again - -InternalSyncCompareExchange64Fail - dmb sy - mov x0, x3 - ret - -;/** -; Performs an atomic increment of an 32-bit unsigned integer. -; -; Performs an atomic increment of the 32-bit unsigned integer specified by -; Value and returns the incremented value. The increment operation must be -; performed using MP safe mechanisms. The state of the return value is not -; guaranteed to be MP safe. -; -; @param Value A pointer to the 32-bit value to increment. -; -; @return The incremented value. -; -;**/ -;UINT32 -;EFIAPI -;InternalSyncIncrement ( -; IN volatile UINT32 *Value -; ) -InternalSyncIncrement - dmb sy -TryInternalSyncIncrement - ldxr w1, [x0] - add w1, w1, #1 - stxr w2, w1, [x0] - cbnz w2, TryInternalSyncIncrement - mov w0, w1 - dmb sy - ret - -;/** -; Performs an atomic decrement of an 32-bit unsigned integer. -; -; Performs an atomic decrement of the 32-bit unsigned integer specified by -; Value and returns the decrement value. The decrement operation must be -; performed using MP safe mechanisms. The state of the return value is not -; guaranteed to be MP safe. -; -; @param Value A pointer to the 32-bit value to decrement. -; -; @return The decrement value. -; -;**/ -;UINT32 -;EFIAPI -;InternalSyncDecrement ( -; IN volatile UINT32 *Value -; ) -InternalSyncDecrement - dmb sy -TryInternalSyncDecrement - ldxr w1, [x0] - sub w1, w1, #1 - stxr w2, w1, [x0] - cbnz w2, TryInternalSyncDecrement - mov w0, w1 - dmb sy - ret - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.S b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.S deleted file mode 100644 index b63feba..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.S +++ /dev/null @@ -1,213 +0,0 @@ -// Implementation of synchronization functions for ARM architecture -// -// Copyright (c) 2012-2015, ARM Limited. All rights reserved. -// Copyright (c) 2015, Linaro Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -.text -.align 3 - -GCC_ASM_EXPORT(InternalSyncCompareExchange16) -GCC_ASM_EXPORT(InternalSyncCompareExchange32) -GCC_ASM_EXPORT(InternalSyncCompareExchange64) -GCC_ASM_EXPORT(InternalSyncIncrement) -GCC_ASM_EXPORT(InternalSyncDecrement) - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT16 -//EFIAPI -//InternalSyncCompareExchange16 ( -// IN volatile UINT16 *Value, -// IN UINT16 CompareValue, -// IN UINT16 ExchangeValue -// ) -ASM_PFX(InternalSyncCompareExchange16): - dmb - -InternalSyncCompareExchange16Again: - ldrexh r3, [r0] - cmp r3, r1 - bne InternalSyncCompareExchange16Fail - -InternalSyncCompareExchange16Exchange: - strexh ip, r2, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange16Again - -InternalSyncCompareExchange16Fail: - dmb - mov r0, r3 - bx lr - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT32 -//EFIAPI -//InternalSyncCompareExchange32 ( -// IN volatile UINT32 *Value, -// IN UINT32 CompareValue, -// IN UINT32 ExchangeValue -// ) -ASM_PFX(InternalSyncCompareExchange32): - dmb - -InternalSyncCompareExchange32Again: - ldrex r3, [r0] - cmp r3, r1 - bne InternalSyncCompareExchange32Fail - -InternalSyncCompareExchange32Exchange: - strex ip, r2, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange32Again - -InternalSyncCompareExchange32Fail: - dmb - mov r0, r3 - bx lr - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT64 -//EFIAPI -//InternalSyncCompareExchange64 ( -// IN volatile UINT64 *Value, // r0 -// IN UINT64 CompareValue, // r2-r3 -// IN UINT64 ExchangeValue // stack -// ) -ASM_PFX(InternalSyncCompareExchange64): - push { r4-r7 } - ldrd r4, r5, [sp, #16] - dmb - -InternalSyncCompareExchange64Again: - ldrexd r6, r7, [r0] - cmp r6, r2 - cmpeq r7, r3 - bne InternalSyncCompareExchange64Fail - -InternalSyncCompareExchange64Exchange: - strexd ip, r4, r5, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange64Again - -InternalSyncCompareExchange64Fail: - dmb - mov r0, r6 - mov r1, r7 - pop { r4-r7 } - bx lr - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncIncrement ( -// IN volatile UINT32 *Value -// ) -ASM_PFX(InternalSyncIncrement): - dmb -TryInternalSyncIncrement: - ldrex r1, [r0] - add r1, r1, #1 - strex r2, r1, [r0] - cmp r2, #0 - bne TryInternalSyncIncrement - dmb - mov r0, r1 - bx lr - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncDecrement ( -// IN volatile UINT32 *Value -// ) -ASM_PFX(InternalSyncDecrement): - dmb -TryInternalSyncDecrement: - ldrex r1, [r0] - sub r1, r1, #1 - strex r2, r1, [r0] - cmp r2, #0 - bne TryInternalSyncDecrement - dmb - mov r0, r1 - bx lr diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.asm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.asm deleted file mode 100644 index fac8794..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Arm/Synchronization.asm +++ /dev/null @@ -1,214 +0,0 @@ -// Implementation of synchronization functions for ARM architecture -// -// Copyright (c) 2012-2015, ARM Limited. All rights reserved. -// Copyright (c) 2015, Linaro Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - - EXPORT InternalSyncCompareExchange16 - EXPORT InternalSyncCompareExchange32 - EXPORT InternalSyncCompareExchange64 - EXPORT InternalSyncIncrement - EXPORT InternalSyncDecrement - - AREA ArmSynchronization, CODE, READONLY - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT16 -//EFIAPI -//InternalSyncCompareExchange16 ( -// IN volatile UINT16 *Value, -// IN UINT16 CompareValue, -// IN UINT16 ExchangeValue -// ) -InternalSyncCompareExchange16 - dmb - -InternalSyncCompareExchange16Again - ldrexh r3, [r0] - cmp r3, r1 - bne InternalSyncCompareExchange16Fail - -InternalSyncCompareExchange16Exchange - strexh ip, r2, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange16Again - -InternalSyncCompareExchange16Fail - dmb - mov r0, r3 - bx lr - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT32 -//EFIAPI -//InternalSyncCompareExchange32 ( -// IN volatile UINT32 *Value, -// IN UINT32 CompareValue, -// IN UINT32 ExchangeValue -// ) -InternalSyncCompareExchange32 - dmb - -InternalSyncCompareExchange32Again - ldrex r3, [r0] - cmp r3, r1 - bne InternalSyncCompareExchange32Fail - -InternalSyncCompareExchange32Exchange - strex ip, r2, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange32Again - -InternalSyncCompareExchange32Fail - dmb - mov r0, r3 - bx lr - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -//UINT64 -//EFIAPI -//InternalSyncCompareExchange64 ( -// IN volatile UINT64 *Value, // r0 -// IN UINT64 CompareValue, // r2-r3 -// IN UINT64 ExchangeValue // stack -// ) -InternalSyncCompareExchange64 - push { r4-r7 } - ldrd r4, r5, [sp, #16] - dmb - -InternalSyncCompareExchange64Again - ldrexd r6, r7, [r0] - cmp r6, r2 - cmpeq r7, r3 - bne InternalSyncCompareExchange64Fail - -InternalSyncCompareExchange64Exchange - strexd ip, r4, r5, [r0] - cmp ip, #0 - bne InternalSyncCompareExchange64Again - -InternalSyncCompareExchange64Fail - dmb - mov r0, r6 - mov r1, r7 - pop { r4-r7 } - bx lr - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncIncrement ( -// IN volatile UINT32 *Value -// ) -InternalSyncIncrement - dmb -TryInternalSyncIncrement - ldrex r1, [r0] - add r1, r1, #1 - strex r2, r1, [r0] - cmp r2, #0 - bne TryInternalSyncIncrement - dmb - mov r0, r1 - bx lr - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -//UINT32 -//EFIAPI -//InternalSyncDecrement ( -// IN volatile UINT32 *Value -// ) -InternalSyncDecrement - dmb -TryInternalSyncDecrement - ldrex r1, [r0] - sub r1, r1, #1 - strex r2, r1, [r0] - cmp r2, #0 - bne TryInternalSyncDecrement - dmb - mov r0, r1 - bx lr - - END diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf deleted file mode 100644 index 76fe20a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf +++ /dev/null @@ -1,97 +0,0 @@ -## @file -# Base Synchronization Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseSynchronizationLib - MODULE_UNI_FILE = BaseSynchronizationLib.uni - FILE_GUID = FC9990DF-C5FF-44cf-8799-CBB45B577F87 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SynchronizationLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# -[Sources] - BaseSynchronizationLibInternals.h - -[Sources.IA32] - Ia32/InternalGetSpinLockProperties.c | MSFT - Ia32/InterlockedCompareExchange64.c | MSFT - Ia32/InterlockedCompareExchange32.c | MSFT - Ia32/InterlockedCompareExchange16.c | MSFT - InterlockedIncrementMsc.c | MSFT - InterlockedDecrementMsc.c | MSFT - SynchronizationMsc.c | MSFT - - Ia32/InterlockedCompareExchange64.nasm| INTEL - Ia32/InterlockedCompareExchange32.nasm| INTEL - Ia32/InterlockedCompareExchange16.nasm| INTEL - Ia32/InterlockedDecrement.nasm| INTEL - Ia32/InterlockedIncrement.nasm| INTEL - Synchronization.c | INTEL - - Ia32/InternalGetSpinLockProperties.c | GCC - Ia32/GccInline.c | GCC - SynchronizationGcc.c | GCC - -[Sources.X64] - Ia32/InternalGetSpinLockProperties.c | MSFT - X64/InterlockedCompareExchange64.c | MSFT - X64/InterlockedCompareExchange32.c | MSFT - X64/InterlockedCompareExchange16.c | MSFT - InterlockedIncrementMsc.c | MSFT - InterlockedDecrementMsc.c | MSFT - SynchronizationMsc.c | MSFT - - X64/InterlockedCompareExchange64.nasm| INTEL - X64/InterlockedCompareExchange32.nasm| INTEL - X64/InterlockedCompareExchange16.nasm| INTEL - X64/InterlockedDecrement.nasm | INTEL - X64/InterlockedIncrement.nasm | INTEL - Synchronization.c | INTEL - - Ia32/InternalGetSpinLockProperties.c | GCC - X64/GccInline.c | GCC - SynchronizationGcc.c | GCC - -[Sources.EBC] - Synchronization.c - Ebc/Synchronization.c - -[Sources.ARM] - Synchronization.c - Arm/Synchronization.asm | RVCT - Arm/Synchronization.S | GCC - -[Sources.AARCH64] - Synchronization.c - AArch64/Synchronization.S | GCC - AArch64/Synchronization.asm | MSFT - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PcdLib - TimerLib - DebugLib - BaseMemoryLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout ## SOMETIMES_CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.uni deleted file mode 100644 index e12e05f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Base Synchronization Library implementation. -// -// Base Synchronization Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Base Synchronization Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Synchronization Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h deleted file mode 100644 index 46cc5c0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h +++ /dev/null @@ -1,151 +0,0 @@ -/** @file - Declaration of internal functions in BaseSynchronizationLib. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __BASE_SYNCHRONIZATION_LIB_INTERNALS__ -#define __BASE_SYNCHRONIZATION_LIB_INTERNALS__ - -#include -#include -#include -#include -#include -#include - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InternalSyncIncrement ( - IN volatile UINT32 *Value - ); - - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -UINT32 -EFIAPI -InternalSyncDecrement ( - IN volatile UINT32 *Value - ); - - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue A 16-bit value used in compare operation. - @param ExchangeValue A 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ); - - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue A 32-bit value used in compare operation. - @param ExchangeValue A 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ); - - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue A 64-bit value used in compare operation. - @param ExchangeValue A 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ); - -/** - Internal function to retrieve the architecture specific spin lock alignment - requirements for optimal spin lock performance. - - @return The architecture specific spin lock alignment. - -**/ -UINTN -InternalGetSpinLockProperties ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c deleted file mode 100644 index bf30338..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c +++ /dev/null @@ -1,147 +0,0 @@ -/** @file - Implementation of synchronization functions on EBC. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Performs an atomic compare exchange operation on a 16-bit - unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit - unsigned integer specified by Value. If Value is equal to - CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to - CompareValue, then Value is returned. The compare exchange - operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the - compare exchange operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - return *Value != CompareValue ? *Value : - ((*Value = ExchangeValue), CompareValue); -} - -/** - Performs an atomic compare exchange operation on a 32-bit - unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit - unsigned integer specified by Value. If Value is equal to - CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to - CompareValue, then Value is returned. The compare exchange - operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the - compare exchange operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - return *Value != CompareValue ? *Value : - ((*Value = ExchangeValue), CompareValue); -} - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - return *Value != CompareValue ? *Value : - ((*Value = ExchangeValue), CompareValue); -} - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InternalSyncIncrement ( - IN volatile UINT32 *Value - ) -{ - return ++*Value; -} - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -UINT32 -EFIAPI -InternalSyncDecrement ( - IN volatile UINT32 *Value - ) -{ - return --*Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c deleted file mode 100644 index 0a9a124..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c +++ /dev/null @@ -1,207 +0,0 @@ -/** @file - GCC inline implementation of BaseSynchronizationLib processor specific functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InternalSyncIncrement ( - IN volatile UINT32 *Value - ) -{ - UINT32 Result; - - __asm__ __volatile__ ( - "movl $1, %%eax \n\t" - "lock \n\t" - "xadd %%eax, %1 \n\t" - "inc %%eax \n\t" - : "=&a" (Result), // %0 - "+m" (*Value) // %1 - : // no inputs that aren't also outputs - : "memory", - "cc" - ); - - return Result; -} - - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decremented value. The decrement operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decremented value. - -**/ -UINT32 -EFIAPI -InternalSyncDecrement ( - IN volatile UINT32 *Value - ) -{ - UINT32 Result; - - __asm__ __volatile__ ( - "movl $-1, %%eax \n\t" - "lock \n\t" - "xadd %%eax, %1 \n\t" - "dec %%eax \n\t" - : "=&a" (Result), // %0 - "+m" (*Value) // %1 - : // no inputs that aren't also outputs - : "memory", - "cc" - ); - - return Result; -} - - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN OUT volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchgw %2, %1 \n\t" - : "+a" (CompareValue), // %0 - "+m" (*Value) // %1 - : "q" (ExchangeValue) // %2 - : "memory", - "cc" - ); - - return CompareValue; -} - - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN OUT volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchgl %2, %1 \n\t" - : "+a" (CompareValue), // %0 - "+m" (*Value) // %1 - : "q" (ExchangeValue) // %2 - : "memory", - "cc" - ); - - return CompareValue; -} - - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN OUT volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchg8b (%1) \n\t" - : "+A" (CompareValue) // %0 - : "S" (Value), // %1 - "b" ((UINT32) ExchangeValue), // %2 - "c" ((UINT32) (ExchangeValue >> 32)) // %3 - : "memory", - "cc" - ); - - return CompareValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c deleted file mode 100644 index 81a890a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - InterlockedCompareExchange16 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- Copyright (c) 2015, Linaro Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - _asm { - mov ecx, Value - mov ax, CompareValue - mov dx, ExchangeValue - lock cmpxchg [ecx], dx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm deleted file mode 100644 index 5beeede..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm +++ /dev/null @@ -1,43 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; Copyright (c) 2015, Linaro Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange16.Asm -; -; Abstract: -; -; InterlockedCompareExchange16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; InternalSyncCompareExchange16 ( -; IN volatile UINT16 *Value, -; IN UINT16 CompareValue, -; IN UINT16 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange16) -ASM_PFX(InternalSyncCompareExchange16): - mov ecx, [esp + 4] - mov ax, [esp + 8] - mov dx, [esp + 12] - lock cmpxchg [ecx], dx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c deleted file mode 100644 index 3dd737b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - InterlockedCompareExchange32 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - _asm { - mov ecx, Value - mov eax, CompareValue - mov edx, ExchangeValue - lock cmpxchg [ecx], edx - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm deleted file mode 100644 index 62cbb11..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange32.Asm -; -; Abstract: -; -; InterlockedCompareExchange32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncCompareExchange32 ( -; IN volatile UINT32 *Value, -; IN UINT32 CompareValue, -; IN UINT32 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange32) -ASM_PFX(InternalSyncCompareExchange32): - mov ecx, [esp + 4] - mov eax, [esp + 8] - mov edx, [esp + 12] - lock cmpxchg [ecx], edx - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c deleted file mode 100644 index 68c5274..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - InterlockedCompareExchange64 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue A 64-bit value used in a compare operation. - @param ExchangeValue A 64-bit value used in an exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - _asm { - mov esi, Value - mov eax, dword ptr [CompareValue + 0] - mov edx, dword ptr [CompareValue + 4] - mov ebx, dword ptr [ExchangeValue + 0] - mov ecx, dword ptr [ExchangeValue + 4] - lock cmpxchg8b qword ptr [esi] - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm deleted file mode 100644 index c55d55c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm +++ /dev/null @@ -1,48 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange64.Asm -; -; Abstract: -; -; InterlockedCompareExchange64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalSyncCompareExchange64 ( -; IN volatile UINT64 *Value, -; IN UINT64 CompareValue, -; IN UINT64 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange64) -ASM_PFX(InternalSyncCompareExchange64): - push esi - push ebx - mov esi, [esp + 12] - mov eax, [esp + 16] - mov edx, [esp + 20] - mov ebx, [esp + 24] - mov ecx, [esp + 28] - lock cmpxchg8b [esi] - pop ebx - pop esi - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm deleted file mode 100644 index 397c0bc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedDecrement.Asm -; -; Abstract: -; -; InterlockedDecrement function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncDecrement ( -; IN volatile UINT32 *Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncDecrement) -ASM_PFX(InternalSyncDecrement): - mov ecx, [esp + 4] - mov eax, 0FFFFFFFFh - lock xadd dword [ecx], eax - dec eax - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm deleted file mode 100644 index 3925e85..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedIncrement.Asm -; -; Abstract: -; -; InterlockedIncrement function -; -; Notes: -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncIncrement ( -; IN volatile UINT32 *Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncIncrement) -ASM_PFX(InternalSyncIncrement): - mov ecx, [esp + 4] - mov eax, 1 - lock xadd dword [ecx], eax - inc eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c deleted file mode 100644 index 0fefda7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - Internal function to get spin lock alignment. - - Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseSynchronizationLibInternals.h" - -/** - Internal function to retrieve the architecture specific spin lock alignment - requirements for optimal spin lock performance. - - @return The architecture specific spin lock alignment. - -**/ -UINTN -InternalGetSpinLockProperties ( - VOID - ) -{ - UINT32 RegEax; - UINT32 RegEbx; - UINTN FamilyId; - UINTN ModelId; - UINTN CacheLineSize; - - // - // Retrieve CPUID Version Information - // - AsmCpuid (0x01, &RegEax, &RegEbx, NULL, NULL); - // - // EBX: Bits 15 - 08: CLFLUSH line size (Value * 8 = cache line size) - // - CacheLineSize = ((RegEbx >> 8) & 0xff) * 8; - // - // Retrieve CPU Family and Model - // - FamilyId = (RegEax >> 8) & 0xf; - ModelId = (RegEax >> 4) & 0xf; - if (FamilyId == 0x0f) { - // - // In processors based on Intel NetBurst microarchitecture, use two cache lines - // - ModelId = ModelId | ((RegEax >> 12) & 0xf0); - if (ModelId <= 0x04 || ModelId == 0x06) { - CacheLineSize *= 2; - } - } - - if (CacheLineSize < 32) { - CacheLineSize = 32; - } - - return CacheLineSize; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c deleted file mode 100644 index b11588e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedDecrementMsc.c +++ /dev/null @@ -1,46 +0,0 @@ -/** @file - InterlockedDecrement function - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -long _InterlockedDecrement( - long * lpAddend -); - -#pragma intrinsic(_InterlockedDecrement) - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decrement value. The decrement operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decrement value. - -**/ -UINT32 -EFIAPI -InternalSyncDecrement ( - IN volatile UINT32 *Value - ) -{ - return _InterlockedDecrement ((long *)(Value)); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c deleted file mode 100644 index 206729a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c +++ /dev/null @@ -1,46 +0,0 @@ -/** @file - InterLockedIncrement function - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -long _InterlockedIncrement( - long * lpAddend -); - -#pragma intrinsic(_InterlockedIncrement) - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. The state of the return value is not - guaranteed to be MP safe. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InternalSyncIncrement ( - IN volatile UINT32 *Value - ) -{ - return _InterlockedIncrement ((long *)(Value)); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Synchronization.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Synchronization.c deleted file mode 100644 index 0ad0ec7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/Synchronization.c +++ /dev/null @@ -1,416 +0,0 @@ -/** @file - Implementation of synchronization functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseSynchronizationLibInternals.h" - -#define SPIN_LOCK_RELEASED ((UINTN) 1) -#define SPIN_LOCK_ACQUIRED ((UINTN) 2) - -/** - Retrieves the architecture specific spin lock alignment requirements for - optimal spin lock performance. - - This function retrieves the spin lock alignment requirements for optimal - performance on a given CPU architecture. The spin lock alignment is byte alignment. - It must be a power of two and is returned by this function. If there are no alignment - requirements, then 1 must be returned. The spin lock synchronization - functions must function correctly if the spin lock size and alignment values - returned by this function are not used at all. These values are hints to the - consumers of the spin lock synchronization functions to obtain optimal spin - lock performance. - - @return The architecture specific spin lock alignment. - -**/ -UINTN -EFIAPI -GetSpinLockProperties ( - VOID - ) -{ - return 32; -} - -/** - Initializes a spin lock to the released state and returns the spin lock. - - This function initializes the spin lock specified by SpinLock to the released - state, and returns SpinLock. Optimal performance can be achieved by calling - GetSpinLockProperties() to determine the size and alignment requirements for - SpinLock. - - If SpinLock is NULL, then ASSERT(). - - @param SpinLock A pointer to the spin lock to initialize to the released - state. - - @return SpinLock is in release state. - -**/ -SPIN_LOCK * -EFIAPI -InitializeSpinLock ( - OUT SPIN_LOCK *SpinLock - ) -{ - ASSERT (SpinLock != NULL); - *SpinLock = SPIN_LOCK_RELEASED; - return SpinLock; -} - -/** - Waits until a spin lock can be placed in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns SpinLock. Otherwise, this function waits - indefinitely for the spin lock to be released, and then places it in the - acquired state and returns SpinLock. All state transitions of SpinLock must - be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - If PcdSpinLockTimeout is not zero, and SpinLock is can not be acquired in - PcdSpinLockTimeout microseconds, then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @return SpinLock acquired the lock. - -**/ -SPIN_LOCK * -EFIAPI -AcquireSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - UINT64 Current; - UINT64 Previous; - UINT64 Total; - UINT64 Start; - UINT64 End; - UINT64 Timeout; - INT64 Cycle; - INT64 Delta; - - if (PcdGet32 (PcdSpinLockTimeout) == 0) { - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - } - } else if (!AcquireSpinLockOrFail (SpinLock)) { - // - // Get the current timer value - // - Current = GetPerformanceCounter(); - - // - // Initialize local variables - // - Start = 0; - End = 0; - Total = 0; - - // - // Retrieve the performance counter properties and compute the number of performance - // counter ticks required to reach the timeout - // - Timeout = DivU64x32 ( - MultU64x32 ( - GetPerformanceCounterProperties (&Start, &End), - PcdGet32 (PcdSpinLockTimeout) - ), - 1000000 - ); - Cycle = End - Start; - if (Cycle < 0) { - Cycle = -Cycle; - } - Cycle++; - - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - Previous = Current; - Current = GetPerformanceCounter(); - Delta = (INT64) (Current - Previous); - if (Start > End) { - Delta = -Delta; - } - if (Delta < 0) { - Delta += Cycle; - } - Total += Delta; - ASSERT (Total < Timeout); - } - } - return SpinLock; -} - -/** - Attempts to place a spin lock in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns TRUE. Otherwise, FALSE is returned. All state - transitions of SpinLock must be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @retval TRUE SpinLock was placed in the acquired state. - @retval FALSE SpinLock could not be acquired. - -**/ -BOOLEAN -EFIAPI -AcquireSpinLockOrFail ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - 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 - ); -} - -/** - Releases a spin lock. - - This function places the spin lock specified by SpinLock in the release state - and returns SpinLock. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to release. - - @return SpinLock released lock. - -**/ -SPIN_LOCK * -EFIAPI -ReleaseSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue); - - *SpinLock = SPIN_LOCK_RELEASED; - return SpinLock; -} - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InterlockedIncrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncIncrement (Value); -} - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decremented value. The decrement operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to decrement. - - @return The decremented value. - -**/ -UINT32 -EFIAPI -InterlockedDecrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncDecrement (Value); -} - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InterlockedCompareExchange16 ( - IN OUT volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InterlockedCompareExchange32 ( - IN OUT volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange32 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InterlockedCompareExchange64 ( - IN OUT volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange64 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a pointer value. - - Performs an atomic compare exchange operation on the pointer value specified - by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to - CompareValue, then Value is returned. The compare exchange operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the pointer value for the compare exchange - operation. - @param CompareValue Pointer value used in compare operation. - @param ExchangeValue Pointer value used in exchange operation. - - @return The original *Value before exchange. -**/ -VOID * -EFIAPI -InterlockedCompareExchangePointer ( - IN OUT VOID * volatile *Value, - IN VOID *CompareValue, - IN VOID *ExchangeValue - ) -{ - UINT8 SizeOfValue; - - SizeOfValue = sizeof (*Value); - - switch (SizeOfValue) { - case sizeof (UINT32): - 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 - ); - default: - ASSERT (FALSE); - return NULL; - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c deleted file mode 100644 index d0d8296..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c +++ /dev/null @@ -1,432 +0,0 @@ -/** @file - Implementation of synchronization functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseSynchronizationLibInternals.h" - -// -// GCC inline assembly for Read Write Barrier -// -#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0) - -#define SPIN_LOCK_RELEASED ((UINTN) 1) -#define SPIN_LOCK_ACQUIRED ((UINTN) 2) - -/** - Retrieves the architecture specific spin lock alignment requirements for - optimal spin lock performance. - - This function retrieves the spin lock alignment requirements for optimal - performance on a given CPU architecture. The spin lock alignment is byte alignment. - It must be a power of two and is returned by this function. If there are no alignment - requirements, then 1 must be returned. The spin lock synchronization - functions must function correctly if the spin lock size and alignment values - returned by this function are not used at all. These values are hints to the - consumers of the spin lock synchronization functions to obtain optimal spin - lock performance. - - @return The architecture specific spin lock alignment. - -**/ -UINTN -EFIAPI -GetSpinLockProperties ( - VOID - ) -{ - return InternalGetSpinLockProperties (); -} - -/** - Initializes a spin lock to the released state and returns the spin lock. - - This function initializes the spin lock specified by SpinLock to the released - state, and returns SpinLock. Optimal performance can be achieved by calling - GetSpinLockProperties() to determine the size and alignment requirements for - SpinLock. - - If SpinLock is NULL, then ASSERT(). - - @param SpinLock A pointer to the spin lock to initialize to the released - state. - - @return SpinLock is in release state. - -**/ -SPIN_LOCK * -EFIAPI -InitializeSpinLock ( - OUT SPIN_LOCK *SpinLock - ) -{ - ASSERT (SpinLock != NULL); - - _ReadWriteBarrier(); - *SpinLock = SPIN_LOCK_RELEASED; - _ReadWriteBarrier(); - - return SpinLock; -} - -/** - Waits until a spin lock can be placed in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns SpinLock. Otherwise, this function waits - indefinitely for the spin lock to be released, and then places it in the - acquired state and returns SpinLock. All state transitions of SpinLock must - be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - If PcdSpinLockTimeout is not zero, and SpinLock is can not be acquired in - PcdSpinLockTimeout microseconds, then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @return SpinLock acquired the lock. - -**/ -SPIN_LOCK * -EFIAPI -AcquireSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - UINT64 Current; - UINT64 Previous; - UINT64 Total; - UINT64 Start; - UINT64 End; - UINT64 Timeout; - INT64 Cycle; - INT64 Delta; - - if (PcdGet32 (PcdSpinLockTimeout) == 0) { - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - } - } else if (!AcquireSpinLockOrFail (SpinLock)) { - // - // Get the current timer value - // - Current = GetPerformanceCounter(); - - // - // Initialize local variables - // - Start = 0; - End = 0; - Total = 0; - - // - // Retrieve the performance counter properties and compute the number of performance - // counter ticks required to reach the timeout - // - Timeout = DivU64x32 ( - MultU64x32 ( - GetPerformanceCounterProperties (&Start, &End), - PcdGet32 (PcdSpinLockTimeout) - ), - 1000000 - ); - Cycle = End - Start; - if (Cycle < 0) { - Cycle = -Cycle; - } - Cycle++; - - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - Previous = Current; - Current = GetPerformanceCounter(); - Delta = (INT64) (Current - Previous); - if (Start > End) { - Delta = -Delta; - } - if (Delta < 0) { - Delta += Cycle; - } - Total += Delta; - ASSERT (Total < Timeout); - } - } - return SpinLock; -} - -/** - Attempts to place a spin lock in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns TRUE. Otherwise, FALSE is returned. All state - transitions of SpinLock must be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @retval TRUE SpinLock was placed in the acquired state. - @retval FALSE SpinLock could not be acquired. - -**/ -BOOLEAN -EFIAPI -AcquireSpinLockOrFail ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - VOID *Result; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); - - _ReadWriteBarrier (); - Result = InterlockedCompareExchangePointer ( - (VOID**)SpinLock, - (VOID*)SPIN_LOCK_RELEASED, - (VOID*)SPIN_LOCK_ACQUIRED - ); - - _ReadWriteBarrier (); - return (BOOLEAN) (Result == (VOID*) SPIN_LOCK_RELEASED); -} - -/** - Releases a spin lock. - - This function places the spin lock specified by SpinLock in the release state - and returns SpinLock. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to release. - - @return SpinLock released the lock. - -**/ -SPIN_LOCK * -EFIAPI -ReleaseSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); - - _ReadWriteBarrier (); - *SpinLock = SPIN_LOCK_RELEASED; - _ReadWriteBarrier (); - - return SpinLock; -} - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InterlockedIncrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncIncrement (Value); -} - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decremented value. The decrement operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to decrement. - - @return The decremented value. - -**/ -UINT32 -EFIAPI -InterlockedDecrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncDecrement (Value); -} - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue A 16-bit value used in compare operation. - @param ExchangeValue A 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InterlockedCompareExchange16 ( - IN OUT volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue A 32-bit value used in compare operation. - @param ExchangeValue A 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InterlockedCompareExchange32 ( - IN OUT volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange32 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue A 64-bit value used in a compare operation. - @param ExchangeValue A 64-bit value used in an exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InterlockedCompareExchange64 ( - IN OUT volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange64 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a pointer value. - - Performs an atomic compare exchange operation on the pointer value specified - by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to - CompareValue, then Value is returned. The compare exchange operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the pointer value for the compare exchange - operation. - @param CompareValue A pointer value used in a compare operation. - @param ExchangeValue A pointer value used in an exchange operation. - - @return The original *Value before exchange. -**/ -VOID * -EFIAPI -InterlockedCompareExchangePointer ( - IN OUT VOID * volatile *Value, - IN VOID *CompareValue, - IN VOID *ExchangeValue - ) -{ - UINT8 SizeOfValue; - - SizeOfValue = sizeof (*Value); - - switch (SizeOfValue) { - case sizeof (UINT32): - 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 - ); - default: - ASSERT (FALSE); - return NULL; - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c deleted file mode 100644 index 5591d24..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c +++ /dev/null @@ -1,434 +0,0 @@ -/** @file - Implementation of synchronization functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "BaseSynchronizationLibInternals.h" - -/** - Microsoft Visual Studio 7.1 Function Prototypes for read write barrier Intrinsics. -**/ - -void _ReadWriteBarrier (void); -#pragma intrinsic(_ReadWriteBarrier) - - -#define SPIN_LOCK_RELEASED ((UINTN) 1) -#define SPIN_LOCK_ACQUIRED ((UINTN) 2) - -/** - Retrieves the architecture specific spin lock alignment requirements for - optimal spin lock performance. - - This function retrieves the spin lock alignment requirements for optimal - performance on a given CPU architecture. The spin lock alignment is byte alignment. - It must be a power of two and is returned by this function. If there are no alignment - requirements, then 1 must be returned. The spin lock synchronization - functions must function correctly if the spin lock size and alignment values - returned by this function are not used at all. These values are hints to the - consumers of the spin lock synchronization functions to obtain optimal spin - lock performance. - - @return The architecture specific spin lock alignment. - -**/ -UINTN -EFIAPI -GetSpinLockProperties ( - VOID - ) -{ - return InternalGetSpinLockProperties (); -} - -/** - Initializes a spin lock to the released state and returns the spin lock. - - This function initializes the spin lock specified by SpinLock to the released - state, and returns SpinLock. Optimal performance can be achieved by calling - GetSpinLockProperties() to determine the size and alignment requirements for - SpinLock. - - If SpinLock is NULL, then ASSERT(). - - @param SpinLock A pointer to the spin lock to initialize to the released - state. - - @return SpinLock is in release state. - -**/ -SPIN_LOCK * -EFIAPI -InitializeSpinLock ( - OUT SPIN_LOCK *SpinLock - ) -{ - ASSERT (SpinLock != NULL); - - _ReadWriteBarrier(); - *SpinLock = SPIN_LOCK_RELEASED; - _ReadWriteBarrier(); - - return SpinLock; -} - -/** - Waits until a spin lock can be placed in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns SpinLock. Otherwise, this function waits - indefinitely for the spin lock to be released, and then places it in the - acquired state and returns SpinLock. All state transitions of SpinLock must - be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - If PcdSpinLockTimeout is not zero, and SpinLock is can not be acquired in - PcdSpinLockTimeout microseconds, then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @return SpinLock acquired the lock. - -**/ -SPIN_LOCK * -EFIAPI -AcquireSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - UINT64 Current; - UINT64 Previous; - UINT64 Total; - UINT64 Start; - UINT64 End; - UINT64 Timeout; - INT64 Cycle; - INT64 Delta; - - if (PcdGet32 (PcdSpinLockTimeout) == 0) { - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - } - } else if (!AcquireSpinLockOrFail (SpinLock)) { - // - // Get the current timer value - // - Current = GetPerformanceCounter(); - - // - // Initialize local variables - // - Start = 0; - End = 0; - Total = 0; - - // - // Retrieve the performance counter properties and compute the number of performance - // counter ticks required to reach the timeout - // - Timeout = DivU64x32 ( - MultU64x32 ( - GetPerformanceCounterProperties (&Start, &End), - PcdGet32 (PcdSpinLockTimeout) - ), - 1000000 - ); - Cycle = End - Start; - if (Cycle < 0) { - Cycle = -Cycle; - } - Cycle++; - - while (!AcquireSpinLockOrFail (SpinLock)) { - CpuPause (); - Previous = Current; - Current = GetPerformanceCounter(); - Delta = (INT64) (Current - Previous); - if (Start > End) { - Delta = -Delta; - } - if (Delta < 0) { - Delta += Cycle; - } - Total += Delta; - ASSERT (Total < Timeout); - } - } - return SpinLock; -} - -/** - Attempts to place a spin lock in the acquired state. - - This function checks the state of the spin lock specified by SpinLock. If - SpinLock is in the released state, then this function places SpinLock in the - acquired state and returns TRUE. Otherwise, FALSE is returned. All state - transitions of SpinLock must be performed using MP safe mechanisms. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to place in the acquired state. - - @retval TRUE SpinLock was placed in the acquired state. - @retval FALSE SpinLock could not be acquired. - -**/ -BOOLEAN -EFIAPI -AcquireSpinLockOrFail ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - VOID *Result; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); - - _ReadWriteBarrier (); - Result = InterlockedCompareExchangePointer ( - (VOID**)SpinLock, - (VOID*)SPIN_LOCK_RELEASED, - (VOID*)SPIN_LOCK_ACQUIRED - ); - - _ReadWriteBarrier (); - return (BOOLEAN) (Result == (VOID*) SPIN_LOCK_RELEASED); -} - -/** - Releases a spin lock. - - This function places the spin lock specified by SpinLock in the release state - and returns SpinLock. - - If SpinLock is NULL, then ASSERT(). - If SpinLock was not initialized with InitializeSpinLock(), then ASSERT(). - - @param SpinLock A pointer to the spin lock to release. - - @return SpinLock released the lock. - -**/ -SPIN_LOCK * -EFIAPI -ReleaseSpinLock ( - IN OUT SPIN_LOCK *SpinLock - ) -{ - SPIN_LOCK LockValue; - - ASSERT (SpinLock != NULL); - - LockValue = *SpinLock; - ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED); - - _ReadWriteBarrier (); - *SpinLock = SPIN_LOCK_RELEASED; - _ReadWriteBarrier (); - - return SpinLock; -} - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InterlockedIncrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncIncrement (Value); -} - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decremented value. The decrement operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value to decrement. - - @return The decremented value. - -**/ -UINT32 -EFIAPI -InterlockedDecrement ( - IN volatile UINT32 *Value - ) -{ - ASSERT (Value != NULL); - return InternalSyncDecrement (Value); -} - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue A 16-bit value used in a compare operation. - @param ExchangeValue A 16-bit value used in an exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InterlockedCompareExchange16 ( - IN OUT volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue A 32-bit value used in a compare operation. - @param ExchangeValue A 32-bit value used in an exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InterlockedCompareExchange32 ( - IN OUT volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange32 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue A 64-bit value used in a compare operation. - @param ExchangeValue A 64-bit value used in an exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InterlockedCompareExchange64 ( - IN OUT volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - ASSERT (Value != NULL); - return InternalSyncCompareExchange64 (Value, CompareValue, ExchangeValue); -} - -/** - Performs an atomic compare exchange operation on a pointer value. - - Performs an atomic compare exchange operation on the pointer value specified - by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to - CompareValue, then Value is returned. The compare exchange operation must be - performed using MP safe mechanisms. - - If Value is NULL, then ASSERT(). - - @param Value A pointer to the pointer value for the compare exchange - operation. - @param CompareValue A pointer value used in a compare operation. - @param ExchangeValue A pointer value used in an exchange operation. - - @return The original *Value before exchange. -**/ -VOID * -EFIAPI -InterlockedCompareExchangePointer ( - IN OUT VOID * volatile *Value, - IN VOID *CompareValue, - IN VOID *ExchangeValue - ) -{ - UINT8 SizeOfValue; - - SizeOfValue = (UINT8) sizeof (*Value); - - switch (SizeOfValue) { - case sizeof (UINT32): - 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 - ); - default: - ASSERT (FALSE); - return NULL; - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c deleted file mode 100644 index e137305..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c +++ /dev/null @@ -1,206 +0,0 @@ -/** @file - GCC inline implementation of BaseSynchronizationLib processor specific functions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -/** - Performs an atomic increment of an 32-bit unsigned integer. - - Performs an atomic increment of the 32-bit unsigned integer specified by - Value and returns the incremented value. The increment operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to increment. - - @return The incremented value. - -**/ -UINT32 -EFIAPI -InternalSyncIncrement ( - IN volatile UINT32 *Value - ) -{ - UINT32 Result; - - __asm__ __volatile__ ( - "movl $1, %%eax \n\t" - "lock \n\t" - "xadd %%eax, %1 \n\t" - "inc %%eax \n\t" - : "=&a" (Result), // %0 - "+m" (*Value) // %1 - : // no inputs that aren't also outputs - : "memory", - "cc" - ); - - return Result; -} - - -/** - Performs an atomic decrement of an 32-bit unsigned integer. - - Performs an atomic decrement of the 32-bit unsigned integer specified by - Value and returns the decremented value. The decrement operation must be - performed using MP safe mechanisms. - - @param Value A pointer to the 32-bit value to decrement. - - @return The decremented value. - -**/ -UINT32 -EFIAPI -InternalSyncDecrement ( - IN volatile UINT32 *Value - ) -{ - UINT32 Result; - - __asm__ __volatile__ ( - "movl $-1, %%eax \n\t" - "lock \n\t" - "xadd %%eax, %1 \n\t" - "dec %%eax \n\t" - : "=&a" (Result), // %0 - "+m" (*Value) // %1 - : // no inputs that aren't also outputs - : "memory", - "cc" - ); - - return Result; -} - - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN OUT volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchgw %2, %1 \n\t" - : "+a" (CompareValue), // %0 - "+m" (*Value) // %1 - : "r" (ExchangeValue) // %2 - : "memory", - "cc" - ); - - return CompareValue; -} - - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN OUT volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchgl %2, %1 \n\t" - : "+a" (CompareValue), // %0 - "+m" (*Value) // %1 - : "r" (ExchangeValue) // %2 - : "memory", - "cc" - ); - - return CompareValue; -} - - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN OUT volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - __asm__ __volatile__ ( - "lock \n\t" - "cmpxchgq %2, %1 \n\t" - : "+a" (CompareValue), // %0 - "+m" (*Value) // %1 - : "r" (ExchangeValue) // %2 - : "memory", - "cc" - ); - - return CompareValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c deleted file mode 100644 index d51d6e3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - InterlockedCompareExchange16 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- Copyright (c) 2015, Linaro Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -__int16 _InterlockedCompareExchange16( - __int16 volatile * Destination, - __int16 Exchange, - __int16 Comperand -); - -#pragma intrinsic(_InterlockedCompareExchange16) - -/** - Performs an atomic compare exchange operation on a 16-bit unsigned integer. - - Performs an atomic compare exchange operation on the 16-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 16-bit value for the compare exchange - operation. - @param CompareValue 16-bit value used in compare operation. - @param ExchangeValue 16-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT16 -EFIAPI -InternalSyncCompareExchange16 ( - IN volatile UINT16 *Value, - IN UINT16 CompareValue, - IN UINT16 ExchangeValue - ) -{ - return _InterlockedCompareExchange16 (Value, ExchangeValue, CompareValue); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm deleted file mode 100644 index b9ef3d4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm +++ /dev/null @@ -1,42 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; Copyright (c) 2015, Linaro Ltd. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange16.Asm -; -; Abstract: -; -; InterlockedCompareExchange16 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT16 -; EFIAPI -; InternalSyncCompareExchange16 ( -; IN volatile UINT16 *Value, -; IN UINT16 CompareValue, -; IN UINT16 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange16) -ASM_PFX(InternalSyncCompareExchange16): - mov ax, dx - lock cmpxchg [rcx], r8w - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c deleted file mode 100644 index b275d67..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - InterlockedCompareExchange32 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -long _InterlockedCompareExchange( - long volatile * Destination, - long Exchange, - long Comperand -); - -#pragma intrinsic(_InterlockedCompareExchange) - -/** - Performs an atomic compare exchange operation on a 32-bit unsigned integer. - - Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to - ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using - MP safe mechanisms. - - @param Value A pointer to the 32-bit value for the compare exchange - operation. - @param CompareValue 32-bit value used in compare operation. - @param ExchangeValue 32-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT32 -EFIAPI -InternalSyncCompareExchange32 ( - IN volatile UINT32 *Value, - IN UINT32 CompareValue, - IN UINT32 ExchangeValue - ) -{ - return _InterlockedCompareExchange (Value, ExchangeValue, CompareValue); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm deleted file mode 100644 index e199ef9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange32.Asm -; -; Abstract: -; -; InterlockedCompareExchange32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncCompareExchange32 ( -; IN volatile UINT32 *Value, -; IN UINT32 CompareValue, -; IN UINT32 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange32) -ASM_PFX(InternalSyncCompareExchange32): - mov eax, edx - lock cmpxchg [rcx], r8d - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c deleted file mode 100644 index c7b6daa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - InterlockedCompareExchange64 function - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -/** - Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics. -**/ - -__int64 _InterlockedCompareExchange64( - __int64 volatile * Destination, - __int64 Exchange, - __int64 Comperand -); - -#pragma intrinsic(_InterlockedCompareExchange64) - -/** - Performs an atomic compare exchange operation on a 64-bit unsigned integer. - - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. - The compare exchange operation must be performed using MP safe mechanisms. - - @param Value A pointer to the 64-bit value for the compare exchange - operation. - @param CompareValue 64-bit value used in compare operation. - @param ExchangeValue 64-bit value used in exchange operation. - - @return The original *Value before exchange. - -**/ -UINT64 -EFIAPI -InternalSyncCompareExchange64 ( - IN volatile UINT64 *Value, - IN UINT64 CompareValue, - IN UINT64 ExchangeValue - ) -{ - return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm deleted file mode 100644 index e78de53..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedCompareExchange64.Asm -; -; Abstract: -; -; InterlockedCompareExchange64 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT64 -; EFIAPI -; InternalSyncCompareExchange64 ( -; IN volatile UINT64 *Value, -; IN UINT64 CompareValue, -; IN UINT64 ExchangeValue -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncCompareExchange64) -ASM_PFX(InternalSyncCompareExchange64): - mov rax, rdx - lock cmpxchg [rcx], r8 - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm deleted file mode 100644 index bd24b96..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedDecrement.Asm -; -; Abstract: -; -; InterlockedDecrement function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncDecrement ( -; IN volatile UINT32 *Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncDecrement) -ASM_PFX(InternalSyncDecrement): - mov eax, 0FFFFFFFFh - lock xadd dword [rcx], eax - dec eax - ret diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm b/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm deleted file mode 100644 index b37fedf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php. -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; InterlockedIncrement.Asm -; -; Abstract: -; -; InterlockedIncrement function -; -; Notes: -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; InternalSyncIncrement ( -; IN volatile UINT32 *Value -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(InternalSyncIncrement) -ASM_PFX(InternalSyncIncrement): - mov eax, 1 - lock xadd dword [rcx], eax - inc eax - ret - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf deleted file mode 100644 index 106c1d7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# NULL instance of Timer Library as a template. -# -# A non-functional instance of the Timer Library that can be used as a template -# for the implementation of a functional timer library instance. This library instance can -# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer -# services as well as EBC modules that require timer services. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseTimerLibNullTemplate - MODULE_UNI_FILE = BaseTimerLibNullTemplate.uni - FILE_GUID = f4731d79-537e-4505-bd52-c03f9b1f6b89 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = TimerLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - TimerLibNull.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.uni deleted file mode 100644 index eaffc8e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// NULL instance of Timer Library as a template. -// -// A non-functional instance of the Timer Library that can be used as a template -// for the implementation of a functional timer library instance. This library instance can -// also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer -// services as well as EBC modules that require timer services. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "NULL instance of Timer Library as a template" - -#string STR_MODULE_DESCRIPTION #language en-US "A non-functional instance of the Timer Library that can be used as a template for the implementation of a functional timer library instance. This library instance can also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer services, as well as EBC modules that require timer services." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c deleted file mode 100644 index 93766b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c +++ /dev/null @@ -1,134 +0,0 @@ -/** @file - A non-functional instance of the Timer Library. - - Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Stalls the CPU for at least the given number of microseconds. - - Stalls the CPU for the number of microseconds specified by MicroSeconds. - - @param MicroSeconds The minimum number of microseconds to delay. - - @return The value of MicroSeconds inputted. - -**/ -UINTN -EFIAPI -MicroSecondDelay ( - IN UINTN MicroSeconds - ) -{ - ASSERT (FALSE); - return MicroSeconds; -} - -/** - Stalls the CPU for at least the given number of nanoseconds. - - Stalls the CPU for the number of nanoseconds specified by NanoSeconds. - - @param NanoSeconds The minimum number of nanoseconds to delay. - - @return The value of NanoSeconds inputted. - -**/ -UINTN -EFIAPI -NanoSecondDelay ( - IN UINTN NanoSeconds - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Retrieves the current value of a 64-bit free running performance counter. - - The counter can either count up by 1 or count down by 1. If the physical - performance counter counts by a larger increment, then the counter values - must be translated. The properties of the counter can be retrieved from - GetPerformanceCounterProperties(). - - @return The current value of the free running performance counter. - -**/ -UINT64 -EFIAPI -GetPerformanceCounter ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -/** - Retrieves the 64-bit frequency in Hz and the range of performance counter - values. - - If StartValue is not NULL, then the value that the performance counter starts - with immediately after is it rolls over is returned in StartValue. If - EndValue is not NULL, then the value that the performance counter end with - immediately before it rolls over is returned in EndValue. The 64-bit - frequency of the performance counter in Hz is always returned. If StartValue - is less than EndValue, then the performance counter counts up. If StartValue - is greater than EndValue, then the performance counter counts down. For - example, a 64-bit free running counter that counts up would have a StartValue - of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter - that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0. - - @param StartValue The value the performance counter starts with when it - rolls over. - @param EndValue The value that the performance counter ends with before - it rolls over. - - @return The frequency in Hz. - -**/ -UINT64 -EFIAPI -GetPerformanceCounterProperties ( - OUT UINT64 *StartValue, OPTIONAL - OUT UINT64 *EndValue OPTIONAL - ) -{ - ASSERT (FALSE); - - return (UINT64)(-1); -} - -/** - Converts elapsed ticks of performance counter to time in nanoseconds. - - This function converts the elapsed ticks of running performance counter to - time value in unit of nanoseconds. - - @param Ticks The number of elapsed ticks of running performance counter. - - @return The elapsed time in nanoseconds. - -**/ -UINT64 -EFIAPI -GetTimeInNanoSecond ( - IN UINT64 Ticks - ) -{ - ASSERT (FALSE); - return 0; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c deleted file mode 100644 index 2ea481c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c +++ /dev/null @@ -1,822 +0,0 @@ -/** @file - UEFI Decompress Library implementation refer to UEFI specification. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include -#include -#include -#include -#include - -#include "BaseUefiDecompressLibInternals.h" - -/** - Read NumOfBit of bits from source into mBitBuf. - - Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source. - - @param Sd The global scratch data. - @param NumOfBits The number of bits to shift and read. - -**/ -VOID -FillBuf ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfBits - ) -{ - // - // Left shift NumOfBits of bits in advance - // - 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); - - if (Sd->mCompSize > 0) { - // - // Get 1 byte into SubBitBuf - // - Sd->mCompSize--; - 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; - - } - } - - // - // Calculate additional bit count read to update mBitCount - // - Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits); - - // - // Copy NumOfBits of bits from mSubBitBuf into mBitBuf - // - Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount; -} - -/** - Get NumOfBits of bits out from mBitBuf. - - Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent - NumOfBits of bits from source. Returns NumOfBits of bits that are - popped out. - - @param Sd The global scratch data. - @param NumOfBits The number of bits to pop and read. - - @return The bits that are popped out. - -**/ -UINT32 -GetBits ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfBits - ) -{ - UINT32 OutBits; - - // - // Pop NumOfBits of Bits from Left - // - OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits)); - - // - // Fill up mBitBuf from source - // - FillBuf (Sd, NumOfBits); - - return OutBits; -} - -/** - Creates Huffman Code mapping table according to code length array. - - Creates Huffman Code mapping table for Extra Set, Char&Len Set - and Position Set according to code length array. - If TableBits > 16, then ASSERT (). - - @param Sd The global scratch data. - @param NumOfChar The number of symbols in the symbol set. - @param BitLen Code length array. - @param TableBits The width of the mapping table. - @param Table The table to be created. - - @retval 0 OK. - @retval BAD_TABLE The table is corrupted. - -**/ -UINT16 -MakeTable ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfChar, - IN UINT8 *BitLen, - IN UINT16 TableBits, - OUT UINT16 *Table - ) -{ - UINT16 Count[17]; - UINT16 Weight[17]; - UINT16 Start[18]; - UINT16 *Pointer; - UINT16 Index3; - UINT16 Index; - UINT16 Len; - UINT16 Char; - UINT16 JuBits; - UINT16 Avail; - UINT16 NextCode; - UINT16 Mask; - UINT16 WordOfStart; - UINT16 WordOfCount; - UINT16 MaxTableLength; - - // - // The maximum mapping table width supported by this internal - // working function is 16. - // - ASSERT (TableBits <= 16); - - for (Index = 0; Index <= 16; Index++) { - Count[Index] = 0; - } - - for (Index = 0; Index < NumOfChar; Index++) { - if (BitLen[Index] > 16) { - return (UINT16) BAD_TABLE; - } - Count[BitLen[Index]]++; - } - - Start[0] = 0; - Start[1] = 0; - - for (Index = 1; Index <= 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; - } - - JuBits = (UINT16) (16 - TableBits); - - Weight[0] = 0; - for (Index = 1; Index <= TableBits; Index++) { - Start[Index] >>= JuBits; - Weight[Index] = (UINT16) (1U << (TableBits - Index)); - } - - while (Index <= 16) { - Weight[Index] = (UINT16) (1U << (16 - Index)); - Index++; - } - - Index = (UINT16) (Start[TableBits + 1] >> JuBits); - - if (Index != 0) { - 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); - - for (Char = 0; Char < NumOfChar; Char++) { - - Len = BitLen[Char]; - if (Len == 0 || Len >= 17) { - continue; - } - - NextCode = (UINT16) (Start[Len] + Weight[Len]); - - if (Len <= TableBits) { - - for (Index = Start[Len]; Index < NextCode; Index++) { - if (Index >= MaxTableLength) { - return (UINT16) BAD_TABLE; - } - Table[Index] = Char; - } - - } else { - - Index3 = Start[Len]; - Pointer = &Table[Index3 >> JuBits]; - Index = (UINT16) (Len - TableBits); - - while (Index != 0) { - if (*Pointer == 0 && Avail < (2 * NC - 1)) { - Sd->mRight[Avail] = Sd->mLeft[Avail] = 0; - *Pointer = Avail++; - } - - if (*Pointer < (2 * NC - 1)) { - if ((Index3 & Mask) != 0) { - Pointer = &Sd->mRight[*Pointer]; - } else { - Pointer = &Sd->mLeft[*Pointer]; - } - } - - Index3 <<= 1; - Index--; - } - - *Pointer = Char; - - } - - Start[Len] = NextCode; - } - // - // Succeeds - // - return 0; -} - -/** - Decodes a position value. - - Get a position value according to Position Huffman Table. - - @param Sd The global scratch data. - - @return The position value decoded. - -**/ -UINT32 -DecodeP ( - IN SCRATCH_DATA *Sd - ) -{ - UINT16 Val; - UINT32 Mask; - UINT32 Pos; - - Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; - - if (Val >= MAXNP) { - Mask = 1U << (BITBUFSIZ - 1 - 8); - - do { - - if ((Sd->mBitBuf & Mask) != 0) { - Val = Sd->mRight[Val]; - } else { - Val = Sd->mLeft[Val]; - } - - Mask >>= 1; - } while (Val >= MAXNP); - } - // - // Advance what we have read - // - FillBuf (Sd, Sd->mPTLen[Val]); - - Pos = Val; - if (Val > 1) { - Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1))); - } - - return Pos; -} - -/** - Reads code lengths for the Extra Set or the Position Set. - - Read in the Extra Set or Position Set Length Array, then - generate the Huffman code mapping for them. - - @param Sd The global scratch data. - @param nn The number of symbols. - @param nbit The number of bits needed to represent nn. - @param Special The special symbol that needs to be taken care of. - - @retval 0 OK. - @retval BAD_TABLE Table is corrupted. - -**/ -UINT16 -ReadPTLen ( - IN SCRATCH_DATA *Sd, - IN UINT16 nn, - IN UINT16 nbit, - IN UINT16 Special - ) -{ - UINT16 Number; - UINT16 CharC; - UINT16 Index; - UINT32 Mask; - - ASSERT (nn <= NPT); - // - // Read Extra Set Code Length Array size - // - Number = (UINT16) GetBits (Sd, nbit); - - if (Number == 0) { - // - // This represents only Huffman code used - // - CharC = (UINT16) GetBits (Sd, nbit); - - SetMem16 (&Sd->mPTTable[0] , sizeof (Sd->mPTTable), CharC); - - SetMem (Sd->mPTLen, nn, 0); - - return 0; - } - - Index = 0; - - while (Index < Number && Index < NPT) { - - CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3)); - - // - // If a code length is less than 7, then it is encoded as a 3-bit - // value. Or it is encoded as a series of "1"s followed by a - // terminating "0". The number of "1"s = Code length - 4. - // - if (CharC == 7) { - Mask = 1U << (BITBUFSIZ - 1 - 3); - while (Mask & Sd->mBitBuf) { - Mask >>= 1; - CharC += 1; - } - } - - FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3)); - - Sd->mPTLen[Index++] = (UINT8) CharC; - - // - // For Code&Len Set, - // After the third length of the code length concatenation, - // a 2-bit value is used to indicated the number of consecutive - // zero lengths after the third length. - // - if (Index == Special) { - CharC = (UINT16) GetBits (Sd, 2); - while ((INT16) (--CharC) >= 0 && Index < NPT) { - Sd->mPTLen[Index++] = 0; - } - } - } - - while (Index < nn && Index < NPT) { - Sd->mPTLen[Index++] = 0; - } - - return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable); -} - -/** - Reads code lengths for Char&Len Set. - - Read in and decode the Char&Len Set Code Length Array, then - generate the Huffman Code mapping table for the Char&Len Set. - - @param Sd The global scratch data. - -**/ -VOID -ReadCLen ( - SCRATCH_DATA *Sd - ) -{ - UINT16 Number; - UINT16 CharC; - UINT16 Index; - UINT32 Mask; - - Number = (UINT16) GetBits (Sd, CBIT); - - if (Number == 0) { - // - // This represents only Huffman code used - // - CharC = (UINT16) GetBits (Sd, CBIT); - - SetMem (Sd->mCLen, NC, 0); - SetMem16 (&Sd->mCTable[0], sizeof (Sd->mCTable), CharC); - - return ; - } - - Index = 0; - while (Index < Number && Index < NC) { - CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; - if (CharC >= NT) { - Mask = 1U << (BITBUFSIZ - 1 - 8); - - do { - - if (Mask & Sd->mBitBuf) { - CharC = Sd->mRight[CharC]; - } else { - CharC = Sd->mLeft[CharC]; - } - - 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); - } else if (CharC == 2) { - CharC = (UINT16) (GetBits (Sd, CBIT) + 20); - } - - while ((INT16) (--CharC) >= 0 && Index < NC) { - Sd->mCLen[Index++] = 0; - } - - } else { - - Sd->mCLen[Index++] = (UINT8) (CharC - 2); - - } - } - - SetMem (Sd->mCLen + Index, NC - Index, 0); - - MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable); - - return ; -} - -/** - Decode a character/length value. - - Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates - Huffman code mapping table for Extra Set, Code&Len Set and - Position Set. - - @param Sd The global scratch data. - - @return The value decoded. - -**/ -UINT16 -DecodeC ( - SCRATCH_DATA *Sd - ) -{ - UINT16 Index2; - UINT32 Mask; - - if (Sd->mBlockSize == 0) { - // - // Starting a new block - // Read BlockSize from block header - // - Sd->mBlockSize = (UINT16) GetBits (Sd, 16); - - // - // Read in the Extra Set Code Length Array, - // Generate the Huffman code mapping table for Extra Set. - // - Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3); - if (Sd->mBadTableFlag != 0) { - return 0; - } - - // - // Read in and decode the Char&Len Set Code Length Array, - // Generate the Huffman code mapping table for Char&Len Set. - // - ReadCLen (Sd); - - // - // 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)); - if (Sd->mBadTableFlag != 0) { - return 0; - } - } - - // - // Get one code according to Code&Set Huffman Table - // - Sd->mBlockSize--; - Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)]; - - if (Index2 >= NC) { - Mask = 1U << (BITBUFSIZ - 1 - 12); - - do { - if ((Sd->mBitBuf & Mask) != 0) { - Index2 = Sd->mRight[Index2]; - } else { - Index2 = Sd->mLeft[Index2]; - } - - Mask >>= 1; - } while (Index2 >= NC); - } - // - // Advance what we have read - // - FillBuf (Sd, Sd->mCLen[Index2]); - - return Index2; -} - -/** - Decode the source data and put the resulting data into the destination buffer. - - @param Sd The global scratch data. - -**/ -VOID -Decode ( - SCRATCH_DATA *Sd - ) -{ - UINT16 BytesRemain; - UINT32 DataIdx; - UINT16 CharC; - - BytesRemain = (UINT16) (-1); - - DataIdx = 0; - - for (;;) { - // - // Get one code from mBitBuf - // - CharC = DecodeC (Sd); - if (Sd->mBadTableFlag != 0) { - goto Done; - } - - if (CharC < 256) { - // - // Process an Original character - // - if (Sd->mOutBuf >= Sd->mOrigSize) { - goto Done; - } else { - // - // Write orignal character into mDstBase - // - Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC; - } - - } else { - // - // Process a Pointer - // - CharC = (UINT16) (CharC - (BIT8 - THRESHOLD)); - - // - // Get string length - // - BytesRemain = CharC; - - // - // Locate string position - // - DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1; - - // - // Write BytesRemain of bytes into mDstBase - // - BytesRemain--; - - while ((INT16) (BytesRemain) >= 0) { - if (Sd->mOutBuf >= Sd->mOrigSize) { - goto Done; - } - if (DataIdx >= Sd->mOrigSize) { - Sd->mBadTableFlag = (UINT16) BAD_TABLE; - goto Done; - } - Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++]; - - BytesRemain--; - } - // - // Once mOutBuf is fully filled, directly return - // - if (Sd->mOutBuf >= Sd->mOrigSize) { - goto Done; - } - } - } - -Done: - return ; -} - -/** - Given a compressed source buffer, this function retrieves the size of - the uncompressed buffer and the size of the scratch buffer required - to decompress the compressed source buffer. - - Retrieves the size of the uncompressed buffer and the temporary scratch buffer - required to decompress the buffer specified by Source and SourceSize. - If the size of the uncompressed buffer or the size of the scratch buffer cannot - be determined from the compressed data specified by Source and SourceData, - then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed - buffer is returned in DestinationSize, the size of the scratch buffer is returned - in ScratchSize, and RETURN_SUCCESS is returned. - This function does not have scratch buffer available to perform a thorough - checking of the validity of the source data. It just retrieves the "Original Size" - field from the beginning bytes of the source data and output it as DestinationSize. - And ScratchSize is specific to the decompression implementation. - - If Source is NULL, then ASSERT(). - If DestinationSize is NULL, then ASSERT(). - If ScratchSize is NULL, then ASSERT(). - - @param Source The source buffer containing the compressed data. - @param SourceSize The size, in bytes, of the source buffer. - @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer - that will be generated when the compressed buffer specified - by Source and SourceSize is decompressed. - @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that - is required to decompress the compressed buffer specified - by Source and SourceSize. - - @retval RETURN_SUCCESS The size of the uncompressed data was returned - in DestinationSize, and the size of the scratch - buffer was returned in ScratchSize. - @retval RETURN_INVALID_PARAMETER - The size of the uncompressed data or the size of - the scratch buffer cannot be determined from - the compressed data specified by Source - and SourceSize. -**/ -RETURN_STATUS -EFIAPI -UefiDecompressGetInfo ( - IN CONST VOID *Source, - IN UINT32 SourceSize, - OUT UINT32 *DestinationSize, - OUT UINT32 *ScratchSize - ) -{ - UINT32 CompressedSize; - - ASSERT (Source != NULL); - ASSERT (DestinationSize != NULL); - ASSERT (ScratchSize != NULL); - - if (SourceSize < 8) { - return RETURN_INVALID_PARAMETER; - } - - CompressedSize = ReadUnaligned32 ((UINT32 *)Source); - if (SourceSize < (CompressedSize + 8) || (CompressedSize + 8) < 8) { - return RETURN_INVALID_PARAMETER; - } - - *ScratchSize = sizeof (SCRATCH_DATA); - *DestinationSize = ReadUnaligned32 ((UINT32 *)Source + 1); - - return RETURN_SUCCESS; -} - -/** - Decompresses a compressed source buffer. - - Extracts decompressed data to its original form. - This function is designed so that the decompression algorithm can be implemented - without using any memory services. As a result, this function is not allowed to - call any memory allocation services in its implementation. It is the caller's - responsibility to allocate and free the Destination and Scratch buffers. - If the compressed source data specified by Source is successfully decompressed - into Destination, then RETURN_SUCCESS is returned. If the compressed source data - specified by Source is not in a valid compressed data format, - then RETURN_INVALID_PARAMETER is returned. - - If Source is NULL, then ASSERT(). - If Destination is NULL, then ASSERT(). - If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT(). - - @param Source The source buffer containing the compressed data. - @param Destination The destination buffer to store the decompressed data. - @param Scratch A temporary scratch buffer that is used to perform the decompression. - This is an optional parameter that may be NULL if the - required scratch buffer size is 0. - - @retval RETURN_SUCCESS Decompression completed successfully, and - the uncompressed buffer is returned in Destination. - @retval RETURN_INVALID_PARAMETER - The source buffer specified by Source is corrupted - (not in a valid compressed format). -**/ -RETURN_STATUS -EFIAPI -UefiDecompress ( - IN CONST VOID *Source, - IN OUT VOID *Destination, - IN OUT VOID *Scratch OPTIONAL - ) -{ - UINT32 CompSize; - UINT32 OrigSize; - SCRATCH_DATA *Sd; - CONST UINT8 *Src; - UINT8 *Dst; - - ASSERT (Source != NULL); - ASSERT (Destination != NULL); - ASSERT (Scratch != NULL); - - Src = Source; - Dst = Destination; - - 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); - - // - // If compressed file size is 0, return - // - if (OrigSize == 0) { - return RETURN_SUCCESS; - } - - Src = Src + 8; - SetMem (Sd, sizeof (SCRATCH_DATA), 0); - - // - // The length of the field 'Position Set Code Length Array Size' in Block Header. - // For UEFI 2.0 de/compression algorithm(Version 1), mPBit = 4 - // - Sd->mPBit = 4; - Sd->mSrcBase = (UINT8 *)Src; - Sd->mDstBase = Dst; - // - // CompSize and OrigSize are calculated in bytes - // - Sd->mCompSize = CompSize; - Sd->mOrigSize = OrigSize; - - // - // Fill the first BITBUFSIZ bits - // - FillBuf (Sd, BITBUFSIZ); - - // - // Decompress it - // - Decode (Sd); - - if (Sd->mBadTableFlag != 0) { - // - // Something wrong with the source - // - return RETURN_INVALID_PARAMETER; - } - - return RETURN_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf deleted file mode 100644 index 7c1e7cc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# UEFI Decompress Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseUefiDecompressLib - MODULE_UNI_FILE = BaseUefiDecompressLib.uni - FILE_GUID = 9ae5147d-b240-467f-a484-b024fdc42ee0 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiDecompressLib - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BaseUefiDecompressLibInternals.h - BaseUefiDecompressLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - DebugLib - BaseMemoryLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.uni deleted file mode 100644 index 3d7db17..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// UEFI Decompress Library implementation. -// -// UEFI Decompress Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "UEFI Decompress Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "UEFI Decompress Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h deleted file mode 100644 index 91d7ad9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h +++ /dev/null @@ -1,211 +0,0 @@ -/** @file - Internal data structure defintions for Base UEFI Decompress Library. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__ -#define __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__ - -// -// Decompression algorithm begins here -// -#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) -#if NT > MAXNP -#define NPT NT -#else -#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]; - - /// - /// The length of the field 'Position Set Code Length Array Size' in Block Header. - /// For UEFI 2.0 de/compression algorithm, mPBit = 4. - /// - UINT8 mPBit; -} SCRATCH_DATA; - -/** - Read NumOfBit of bits from source into mBitBuf. - - Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source. - - @param Sd The global scratch data. - @param NumOfBits The number of bits to shift and read. - -**/ -VOID -FillBuf ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfBits - ); - -/** - Get NumOfBits of bits out from mBitBuf. - - Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent - NumOfBits of bits from source. Returns NumOfBits of bits that are - popped out. - - @param Sd The global scratch data. - @param NumOfBits The number of bits to pop and read. - - @return The bits that are popped out. - -**/ -UINT32 -GetBits ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfBits - ); - -/** - Creates Huffman Code mapping table according to code length array. - - Creates Huffman Code mapping table for Extra Set, Char&Len Set - and Position Set according to code length array. - If TableBits > 16, then ASSERT (). - - @param Sd The global scratch data. - @param NumOfChar The number of symbols in the symbol set. - @param BitLen Code length array. - @param TableBits The width of the mapping table. - @param Table The table to be created. - - @retval 0 OK. - @retval BAD_TABLE The table is corrupted. - -**/ -UINT16 -MakeTable ( - IN SCRATCH_DATA *Sd, - IN UINT16 NumOfChar, - IN UINT8 *BitLen, - IN UINT16 TableBits, - OUT UINT16 *Table - ); - -/** - Decodes a position value. - - Get a position value according to Position Huffman Table. - - @param Sd The global scratch data. - - @return The position value decoded. - -**/ -UINT32 -DecodeP ( - IN SCRATCH_DATA *Sd - ); - -/** - Reads code lengths for the Extra Set or the Position Set. - - Read in the Extra Set or Position Set Length Array, then - generate the Huffman code mapping for them. - - @param Sd The global scratch data. - @param nn The number of symbols. - @param nbit The number of bits needed to represent nn. - @param Special The special symbol that needs to be taken care of. - - @retval 0 OK. - @retval BAD_TABLE Table is corrupted. - -**/ -UINT16 -ReadPTLen ( - IN SCRATCH_DATA *Sd, - IN UINT16 nn, - IN UINT16 nbit, - IN UINT16 Special - ); - -/** - Reads code lengths for Char&Len Set. - - Read in and decode the Char&Len Set Code Length Array, then - generate the Huffman Code mapping table for the Char&Len Set. - - @param Sd The global scratch data. - -**/ -VOID -ReadCLen ( - SCRATCH_DATA *Sd - ); - -/** - Decode a character/length value. - - Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates - Huffman code mapping table for Extra Set, Code&Len Set and - Position Set. - - @param Sd The global scratch data. - - @return The value decoded. - -**/ -UINT16 -DecodeC ( - SCRATCH_DATA *Sd - ); - -/** - Decode the source data and put the resulting data into the destination buffer. - - @param Sd The global scratch data. - -**/ -VOID -Decode ( - SCRATCH_DATA *Sd - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c deleted file mode 100644 index dc6d96c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c +++ /dev/null @@ -1,79 +0,0 @@ -/** @file - Entry point to the DXE Core. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - - -#include -#include -#include - -// -// Cache copy of HobList pointer. -// -VOID *gHobList = NULL; - -/** - The entry point of PE/COFF Image for the DXE Core. - - This function is the entry point for the DXE Core. This function is required to call - ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return. - The DXE Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI - System Table and the image handle for the DXE Core itself have been established. - If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. - - @param HobStart The pointer to the beginning of the HOB List passed in from the PEI Phase. - -**/ -VOID -EFIAPI -_ModuleEntryPoint ( - IN VOID *HobStart - ) -{ - // - // Cache a pointer to the HobList - // - gHobList = HobStart; - - // - // Call the DXE Core entry point - // - ProcessModuleEntryPointList (HobStart); - - // - // Should never return - // - ASSERT(FALSE); - CpuDeadLoop (); -} - - -/** - Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). - - This function is required to call _ModuleEntryPoint() passing in HobStart. - - @param HobStart The pointer to the beginning of the HOB List passed in from the PEI Phase. - -**/ -VOID -EFIAPI -EfiMain ( - IN VOID *HobStart - ) -{ - _ModuleEntryPoint (HobStart); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf deleted file mode 100644 index 49677c0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# Module entry point library for DXE core. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeCoreEntryPoint - MODULE_UNI_FILE = DxeCoreEntryPoint.uni - FILE_GUID = d258d6af-2fc0-4019-9c1f-1101c3dd19b5 - MODULE_TYPE = DXE_CORE - VERSION_STRING = 1.0 - LIBRARY_CLASS = DxeCoreEntryPoint|DXE_CORE - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - DxeCoreEntryPoint.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.uni deleted file mode 100644 index 3af375f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Module entry point library for DXE core. -// -// Module entry point library for DXE core. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for DXE core" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for DXE core." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf deleted file mode 100644 index b39992f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf +++ /dev/null @@ -1,44 +0,0 @@ -## @file -# Instance of HOB Library for DXE Core. -# -# HOB Library implementation for the DXE Core. Does not have a constructor. -# Uses gHobList defined in the DXE Core Entry Point Library. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeCoreHobLib - MODULE_UNI_FILE = DxeCoreHobLib.uni - FILE_GUID = 882ee1a3-35b2-412c-b8a2-7a8d34a7c390 - MODULE_TYPE = DXE_CORE - VERSION_STRING = 1.0 - LIBRARY_CLASS = HobLib|DXE_CORE - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - HobLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - DebugLib - DxeCoreEntryPoint - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.uni deleted file mode 100644 index 5d90208..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of HOB Library for DXE Core. -// -// HOB Library implementation for the DXE Core. Does not have a constructor. -// Uses gHobList defined in the DXE Core Entry Point Library. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of HOB Library for DXE Core" - -#string STR_MODULE_DESCRIPTION #language en-US "HOB Library implementation for the DXE Core. Does not have a constructor. Uses gHobList defined in the DXE Core Entry Point Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/HobLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/HobLib.c deleted file mode 100644 index 4b6f895..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeCoreHobLib/HobLib.c +++ /dev/null @@ -1,603 +0,0 @@ -/** @file - HOB Library implementation for DxeCore driver. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer - to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through - the EFI System Table by looking up theHOB list GUID in the System Configuration Table. - Since the System Configuration Table does not exist that the time the DXE Core is - launched, the DXE Core uses a global variable from the DXE Core Entry Point Library - to manage the pointer to the HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - ASSERT (gHobList != NULL); - return gHobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - 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; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - -/** - Builds a HOB for a loaded PE32 module. - - This function builds a HOB for a loaded PE32 module. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If ModuleName is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param ModuleName The GUID File Name of the module. - @param MemoryAllocationModule The 64 bit physical address of the module. - @param ModuleLength The length of the module in bytes. - @param EntryPoint The 64 bit physical address of the module entry point. - -**/ -VOID -EFIAPI -BuildModuleHob ( - IN CONST EFI_GUID *ModuleName, - IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, - IN UINT64 ModuleLength, - IN EFI_PHYSICAL_ADDRESS EntryPoint - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB that describes a chunk of system memory with Owner GUID. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - @param OwnerGUID GUID for the owner of this resource. - -**/ -VOID -EFIAPI -BuildResourceDescriptorWithOwnerHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes, - IN EFI_GUID *OwnerGUID - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB that describes a chunk of system memory. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - -**/ -VOID -EFIAPI -BuildResourceDescriptorHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a customized HOB tagged with a GUID for identification and returns - the start address of GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification - and returns the start address of GUID HOB data so that caller can fill the customized data. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase. - For DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidHob ( - IN CONST EFI_GUID *Guid, - IN UINTN DataLength - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); - return NULL; -} - -/** - Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB - data field, and returns the start address of the GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification and copies the input - data to the HOB data field and returns the start address of the GUID HOB data. It can only be - invoked during PEI phase; for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase. - For DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If Data is NULL and DataLength > 0, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param Data The data to be copied into the data field of the GUID HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidDataHob ( - IN CONST EFI_GUID *Guid, - IN VOID *Data, - IN UINTN DataLength - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); - return NULL; -} - -/** - Builds a Firmware Volume HOB. - - This function builds a Firmware Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - -**/ -VOID -EFIAPI -BuildFvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a EFI_HOB_TYPE_FV2 HOB. - - This function builds a EFI_HOB_TYPE_FV2 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param FvName The name of the Firmware Volume. - @param FileName The name of the file. - -**/ -VOID -EFIAPI -BuildFv2Hob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN CONST EFI_GUID *FvName, - IN CONST EFI_GUID *FileName - ) -{ - ASSERT (FALSE); -} - -/** - Builds a EFI_HOB_TYPE_FV3 HOB. - - This function builds a EFI_HOB_TYPE_FV3 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param AuthenticationStatus The authentication status. - @param ExtractedFv TRUE if the FV was extracted as a file within - another firmware volume. FALSE otherwise. - @param FvName The name of the Firmware Volume. - Valid only if IsExtractedFv is TRUE. - @param FileName The name of the file. - Valid only if IsExtractedFv is TRUE. - -**/ -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 - ) -{ - ASSERT (FALSE); -} - -/** - Builds a Capsule Volume HOB. - - This function builds a Capsule Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If the platform does not support Capsule Volume HOBs, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The base address of the Capsule Volume. - @param Length The size of the Capsule Volume in bytes. - -**/ -VOID -EFIAPI -BuildCvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the CPU. - - This function builds a HOB for the CPU. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param SizeOfMemorySpace The maximum physical memory addressability of the processor. - @param SizeOfIoSpace The maximum physical I/O addressability of the processor. - -**/ -VOID -EFIAPI -BuildCpuHob ( - IN UINT8 SizeOfMemorySpace, - IN UINT8 SizeOfIoSpace - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the BSP store. - - This function builds a HOB for BSP store. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the BSP. - @param Length The length of the BSP store in bytes. - @param MemoryType Type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildBspStoreHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the memory allocation. - - This function builds a HOB for the memory allocation. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the memory. - @param Length The length of the memory allocation in bytes. - @param MemoryType Type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildMemoryAllocationHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c deleted file mode 100644 index 7ecc93b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c +++ /dev/null @@ -1,455 +0,0 @@ -/** @file - Provide generic extract guided section functions for Dxe phase. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include - -#define EXTRACT_HANDLER_TABLE_SIZE 0x10 - -UINT32 mNumberOfExtractHandler = 0; -UINT32 mMaxNumberOfExtractHandler = 0; - -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. - - @retval RETURN_SUCCESS Reallocated more global memory space to store guid and function tables. - @retval RETURN_OUT_OF_RESOURCES Not enough memory to allocate. -**/ -RETURN_STATUS -EFIAPI -ReallocateExtractHandlerTable ( - VOID - ) -{ - // - // Reallocate memory for GuidTable - // - mExtractHandlerGuidTable = ReallocatePool ( - mMaxNumberOfExtractHandler * sizeof (GUID), - (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (GUID), - mExtractHandlerGuidTable - ); - - if (mExtractHandlerGuidTable == NULL) { - goto Done; - } - - // - // 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 - ); - - if (mExtractDecodeHandlerTable == NULL) { - goto Done; - } - - // - // 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 - ); - - if (mExtractGetInfoHandlerTable == NULL) { - goto Done; - } - - // - // Increase max handler number - // - mMaxNumberOfExtractHandler = mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE; - return RETURN_SUCCESS; - -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. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval RETURN_SUCCESS Allocated the global memory space to store guid and function tables. - @retval RETURN_OUT_OF_RESOURCES Not enough memory to allocate. -**/ -RETURN_STATUS -EFIAPI -DxeExtractGuidedSectionLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return ReallocateExtractHandlerTable (); -} - -/** - Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers(). - - Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs. - The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated - and caller must treat this array of GUIDs as read-only data. - If ExtractHandlerGuidTable is NULL, then ASSERT(). - - @param[out] ExtractHandlerGuidTable A pointer to the array of GUIDs that have been registered through - ExtractGuidedSectionRegisterHandlers(). - - @return The number of the supported extract guided Handler. - -**/ -UINTN -EFIAPI -ExtractGuidedSectionGetGuidList ( - OUT GUID **ExtractHandlerGuidTable - ) -{ - ASSERT (ExtractHandlerGuidTable != NULL); - - *ExtractHandlerGuidTable = mExtractHandlerGuidTable; - return mNumberOfExtractHandler; -} - -/** - Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER - for a specific GUID section type. - - Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid. - If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED. - If there are not enough resources available to register the handlers then RETURN_OUT_OF_RESOURCES is returned. - - If SectionGuid is NULL, then ASSERT(). - If GetInfoHandler is NULL, then ASSERT(). - If DecodeHandler is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the the handlers - of the GUIDed section type being registered. - @param[in] GetInfoHandler The pointer to a function that examines a GUIDed section and returns the - size of the decoded buffer and the size of an optional scratch buffer - required to actually decode the data in a GUIDed section. - @param[in] DecodeHandler The pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. - - @retval RETURN_SUCCESS The handlers were registered. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to register the handlers. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionRegisterHandlers ( - IN CONST GUID *SectionGuid, - IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, - IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler - ) -{ - UINT32 Index; - VOID *GuidData; - - // - // Check input parameter. - // - ASSERT (SectionGuid != NULL); - ASSERT (GetInfoHandler != NULL); - ASSERT (DecodeHandler != NULL); - - // - // Search the match registered GetInfo handler for the input guided section. - // - 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; - return RETURN_SUCCESS; - } - } - - // - // Check the global table is enough to contain new Handler. - // - if (mNumberOfExtractHandler >= mMaxNumberOfExtractHandler) { - if (ReallocateExtractHandlerTable () != RETURN_SUCCESS) { - return RETURN_OUT_OF_RESOURCES; - } - } - - // - // Register new Handler and guid value. - // - 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); - if (GuidData != NULL) { - gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData); - } - - return RETURN_SUCCESS; -} - -/** - Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to retrieve and return the size of the decoded buffer and the size of an - optional scratch buffer required to actually decode the data in a GUIDed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of - type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBufferSize is NULL, then ASSERT(). - If ScratchBufferSize is NULL, then ASSERT(). - If SectionAttribute is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required if the buffer - specified by InputSection were decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space if the buffer specified by - InputSection were decoded. - @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes field of - EFI_GUID_DEFINED_SECTION in the PI Specification. - - @retval RETURN_SUCCESS Successfully obtained the required information. - @retval RETURN_UNSUPPORTED The GUID from the section specified by InputSection does not match any of - the GUIDs registered with ExtractGuidedSectionRegisterHandlers(). - @retval Others The return status from the handler associated with the GUID retrieved from - the section specified by InputSection. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetInfo ( - IN CONST VOID *InputSection, - OUT UINT32 *OutputBufferSize, - OUT UINT32 *ScratchBufferSize, - OUT UINT16 *SectionAttribute - ) -{ - UINT32 Index; - EFI_GUID *SectionDefinitionGuid; - - ASSERT (InputSection != NULL); - ASSERT (OutputBufferSize != NULL); - ASSERT (ScratchBufferSize != NULL); - ASSERT (SectionAttribute != NULL); - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid); - } - - // - // Search the match registered GetInfo handler for the input guided section. - // - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to decode the data in a GUIDed section and return the result in a caller - allocated output buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this - decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the data in InputSection, - then OutputBuffer is set to point at the data in InputSection. Otherwise, the decoded data will be placed in caller - allocated buffer specified by OutputBuffer. This function is responsible for computing the EFI_AUTH_STATUS_PLATFORM_OVERRIDE - bit of in AuthenticationStatus. The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBuffer is NULL, then ASSERT(). - If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. - @param[in] ScratchBuffer A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation. - @param[out] AuthenticationStatus - A pointer to the authentication status of the decoded output buffer. See the definition - of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI - Specification. - - @retval RETURN_SUCCESS The buffer specified by InputSection was decoded. - @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionDecode ( - IN CONST VOID *InputSection, - OUT VOID **OutputBuffer, - IN VOID *ScratchBuffer, OPTIONAL - OUT UINT32 *AuthenticationStatus - ) -{ - UINT32 Index; - EFI_GUID *SectionDefinitionGuid; - - // - // Check the input parameters - // - ASSERT (InputSection != NULL); - ASSERT (OutputBuffer != NULL); - ASSERT (AuthenticationStatus != NULL); - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid); - } - - // - // Search the match registered extract handler for the input guided section. - // - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and - EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type. - - Retrieves the handlers associated with SectionGuid and returns them in - GetInfoHandler and DecodeHandler. - - If the GUID value specified by SectionGuid has not been registered, then - return RETURN_NOT_FOUND. - - If SectionGuid is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed - section type being retrieved. - @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns - the size of the decoded buffer and the size of an optional scratch - buffer required to actually decode the data in a GUIDed section. - This is an optional parameter that may be NULL. If it is NULL, then - the previously registered handler is not returned. - @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. This is an optional parameter that may be NULL. - If it is NULL, then the previously registered handler is not returned. - - @retval RETURN_SUCCESS The handlers were retrieved. - @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetHandlers ( - IN CONST GUID *SectionGuid, - OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL - OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL - ) -{ - UINT32 Index; - - // - // Check input parameter. - // - ASSERT (SectionGuid != NULL); - - // - // Search the match registered GetInfo handler for the input guided section. - // - 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/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf deleted file mode 100644 index 15fba0a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -## @file -# Instance of ExtractGuidedSection Library for DXE phase. -# -# This library provides generic extract guided section functions for DXE module. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeExtractGuidedSectionLib - MODULE_UNI_FILE = DxeExtractGuidedSectionLib.uni - FILE_GUID = f773469b-e265-4b0c-b0a6-2f971fbfe72b - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = ExtractGuidedSectionLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - CONSTRUCTOR = DxeExtractGuidedSectionLibConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DxeExtractGuidedSectionLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - MemoryAllocationLib - BaseMemoryLib - DebugLib - UefiBootServicesTableLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.uni deleted file mode 100644 index c37815a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of ExtractGuidedSection Library for DXE phase. -// -// This library provides generic extract guided section functions for DXE module. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of ExtractGuidedSection Library for DXE phase" - -#string STR_MODULE_DESCRIPTION #language en-US "This library provides generic extract guided section functions for a DXE module." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.inf deleted file mode 100644 index a3654a7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Instance of HOB Library using HOB list from EFI Configuration Table. -# -# HOB Library implementation that retrieves the HOB List -# from the System Configuration Table in the EFI System Table. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeHobLib - MODULE_UNI_FILE = DxeHobLib.uni - FILE_GUID = f12b59c9-76d0-4661-ad7c-f04d1bef0558 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = HobLib|DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = HobLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - HobLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - DebugLib - UefiLib - -[Guids] - gEfiHobListGuid ## CONSUMES ## SystemTable - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.uni deleted file mode 100644 index a7592fb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/DxeHobLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of HOB Library using HOB list from EFI Configuration Table. -// -// HOB Library implementation that retrieves the HOB List -// from the System Configuration Table in the EFI System Table. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of HOB Library using HOB list from EFI Configuration Table" - -#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library implementation that retrieves the HOB List from the System Configuration Table in the EFI System Table." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/HobLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/HobLib.c deleted file mode 100644 index 7a7c952..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHobLib/HobLib.c +++ /dev/null @@ -1,637 +0,0 @@ -/** @file - HOB Library implemenation for Dxe Phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include - -#include -#include -#include -#include - -VOID *mHobList = NULL; - -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer - to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through - the EFI System Table by looking up theHOB list GUID in the System Configuration Table. - Since the System Configuration Table does not exist that the time the DXE Core is - launched, the DXE Core uses a global variable from the DXE Core Entry Point Library - to manage the pointer to the HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - This function also caches the pointer to the HOB list retrieved. - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - EFI_STATUS Status; - - if (mHobList == NULL) { - Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &mHobList); - ASSERT_EFI_ERROR (Status); - ASSERT (mHobList != NULL); - } - return mHobList; -} - -/** - The constructor function caches the pointer to HOB list by calling GetHobList() - and will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor successfully gets HobList. - -**/ -EFI_STATUS -EFIAPI -HobLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - GetHobList (); - - return EFI_SUCCESS; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If there does not exist such HOB from the starting HOB pointer, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - 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; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If there does not exist such HOB from the starting HOB pointer, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - -/** - Builds a HOB for a loaded PE32 module. - - This function builds a HOB for a loaded PE32 module. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If ModuleName is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param ModuleName The GUID File Name of the module. - @param MemoryAllocationModule The 64 bit physical address of the module. - @param ModuleLength The length of the module in bytes. - @param EntryPoint The 64 bit physical address of the module entry point. - -**/ -VOID -EFIAPI -BuildModuleHob ( - IN CONST EFI_GUID *ModuleName, - IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, - IN UINT64 ModuleLength, - IN EFI_PHYSICAL_ADDRESS EntryPoint - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB that describes a chunk of system memory with Owner GUID. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - @param OwnerGUID GUID for the owner of this resource. - -**/ -VOID -EFIAPI -BuildResourceDescriptorWithOwnerHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes, - IN EFI_GUID *OwnerGUID - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB that describes a chunk of system memory. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - -**/ -VOID -EFIAPI -BuildResourceDescriptorHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a customized HOB tagged with a GUID for identification and returns - the start address of GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification - and returns the start address of GUID HOB data so that caller can fill the customized data. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidHob ( - IN CONST EFI_GUID *Guid, - IN UINTN DataLength - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); - return NULL; -} - -/** - Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB - data field, and returns the start address of the GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification and copies the input - data to the HOB data field and returns the start address of the GUID HOB data. It can only be - invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If Data is NULL and DataLength > 0, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param Data The data to be copied into the data field of the GUID HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidDataHob ( - IN CONST EFI_GUID *Guid, - IN VOID *Data, - IN UINTN DataLength - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); - return NULL; -} - -/** - Builds a Firmware Volume HOB. - - This function builds a Firmware Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - -**/ -VOID -EFIAPI -BuildFvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a EFI_HOB_TYPE_FV2 HOB. - - This function builds a EFI_HOB_TYPE_FV2 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param FvName The name of the Firmware Volume. - @param FileName The name of the file. - -**/ -VOID -EFIAPI -BuildFv2Hob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN CONST EFI_GUID *FvName, - IN CONST EFI_GUID *FileName - ) -{ - ASSERT (FALSE); -} - -/** - Builds a EFI_HOB_TYPE_FV3 HOB. - - This function builds a EFI_HOB_TYPE_FV3 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param AuthenticationStatus The authentication status. - @param ExtractedFv TRUE if the FV was extracted as a file within - another firmware volume. FALSE otherwise. - @param FvName The name of the Firmware Volume. - Valid only if IsExtractedFv is TRUE. - @param FileName The name of the file. - Valid only if IsExtractedFv is TRUE. - -**/ -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 - ) -{ - ASSERT (FALSE); -} - -/** - Builds a Capsule Volume HOB. - - This function builds a Capsule Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If the platform does not support Capsule Volume HOBs, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The base address of the Capsule Volume. - @param Length The size of the Capsule Volume in bytes. - -**/ -VOID -EFIAPI -BuildCvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the CPU. - - This function builds a HOB for the CPU. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param SizeOfMemorySpace The maximum physical memory addressability of the processor. - @param SizeOfIoSpace The maximum physical I/O addressability of the processor. - -**/ -VOID -EFIAPI -BuildCpuHob ( - IN UINT8 SizeOfMemorySpace, - IN UINT8 SizeOfIoSpace - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the BSP store. - - This function builds a HOB for BSP store. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the BSP. - @param Length The length of the BSP store in bytes. - @param MemoryType Type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildBspStoreHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the memory allocation. - - This function builds a HOB for the memory allocation. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the memory. - @param Length The length of the memory allocation in bytes. - @param MemoryType Type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildMemoryAllocationHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.inf deleted file mode 100644 index 0f76fd7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# DXE instance of Hsti Library. -# -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeHstiLib - MODULE_UNI_FILE = DxeHstiLib.uni - FILE_GUID = 7DE1C620-F587-4116-A36D-40F3467B9A0C - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = HstiLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - -[Sources] - HstiAip.c - HstiDxe.c - HstiDxe.h - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - MemoryAllocationLib - DebugLib - UefiBootServicesTableLib - -[Guids] -## SOMETIMES_PRODUCES ## GUID -## SOMETIMES_CONSUMES ## GUID - gAdapterInfoPlatformSecurityGuid - -[Protocols] -## SOMETIMES_PRODUCES -## SOMETIMES_CONSUMES - gEfiAdapterInformationProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.uni deleted file mode 100644 index 6a09ddd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/DxeHstiLib.uni +++ /dev/null @@ -1,19 +0,0 @@ -// /** @file -// DXE instance of Hsti Library. -// -// Copyright (c) 2015, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "DXE instance of Hsti Library." - -#string STR_MODULE_DESCRIPTION #language en-US "The HSTI Library implementation that create, get, or update HSTI table in DXE phase." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiAip.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiAip.c deleted file mode 100644 index 0c2b444..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiAip.c +++ /dev/null @@ -1,175 +0,0 @@ -/** @file - - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HstiDxe.h" - -/** - Returns the current state information for the adapter. - - This function returns information of type InformationType from the adapter. - If an adapter does not support the requested informational type, then - EFI_UNSUPPORTED is returned. - - @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance. - @param[in] InformationType A pointer to an EFI_GUID that defines the contents of InformationBlock. - @param[out] InformationBlock The service returns a pointer to the buffer with the InformationBlock - structure which contains details about the data specific to InformationType. - @param[out] InformationBlockSize The driver returns the size of the InformationBlock in bytes. - - @retval EFI_SUCCESS The InformationType information was retrieved. - @retval EFI_UNSUPPORTED The InformationType is not known. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. - @retval EFI_INVALID_PARAMETER This is NULL. - @retval EFI_INVALID_PARAMETER InformationBlock is NULL. - @retval EFI_INVALID_PARAMETER InformationBlockSize is NULL. - -**/ -EFI_STATUS -EFIAPI -HstiAipGetInfo ( - IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, - IN EFI_GUID *InformationType, - OUT VOID **InformationBlock, - OUT UINTN *InformationBlockSize - ) -{ - HSTI_AIP_PRIVATE_DATA *HstiAip; - - 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); - - *InformationBlock = AllocateCopyPool (HstiAip->HstiSize, HstiAip->Hsti); - if (*InformationBlock == NULL) { - return EFI_OUT_OF_RESOURCES; - } - *InformationBlockSize = HstiAip->HstiSize; - return EFI_SUCCESS; -} - -/** - Sets state information for an adapter. - - This function sends information of type InformationType for an adapter. - If an adapter does not support the requested information type, then EFI_UNSUPPORTED - is returned. - - @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance. - @param[in] InformationType A pointer to an EFI_GUID that defines the contents of InformationBlock. - @param[in] InformationBlock A pointer to the InformationBlock structure which contains details - about the data specific to InformationType. - @param[in] InformationBlockSize The size of the InformationBlock in bytes. - - @retval EFI_SUCCESS The information was received and interpreted successfully. - @retval EFI_UNSUPPORTED The InformationType is not known. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_INVALID_PARAMETER This is NULL. - @retval EFI_INVALID_PARAMETER InformationBlock is NULL. - @retval EFI_WRITE_PROTECTED The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO(). - -**/ -EFI_STATUS -EFIAPI -HstiAipSetInfo ( - IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN VOID *InformationBlock, - IN UINTN InformationBlockSize - ) -{ - HSTI_AIP_PRIVATE_DATA *HstiAip; - VOID *NewHsti; - - if ((This == NULL) || (InformationBlock == NULL)) { - return EFI_INVALID_PARAMETER; - } - if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) { - return EFI_UNSUPPORTED; - } - - if (!InternalHstiIsValidTable (InformationBlock, InformationBlockSize)) { - return EFI_VOLUME_CORRUPTED; - } - - 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->HstiMaxSize = InformationBlockSize; - } - - CopyMem (HstiAip->Hsti, InformationBlock, InformationBlockSize); - HstiAip->HstiSize = InformationBlockSize; - return EFI_SUCCESS; -} - -/** - Get a list of supported information types for this instance of the protocol. - - This function returns a list of InformationType GUIDs that are supported on an - adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned - in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in - InfoTypesBufferCount. - - @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance. - @param[out] InfoTypesBuffer A pointer to the array of InformationType GUIDs that are supported - by This. - @param[out] InfoTypesBufferCount A pointer to the number of GUIDs present in InfoTypesBuffer. - - @retval EFI_SUCCESS The list of information type GUIDs that are supported on this adapter was - returned in InfoTypesBuffer. The number of information type GUIDs was - returned in InfoTypesBufferCount. - @retval EFI_INVALID_PARAMETER This is NULL. - @retval EFI_INVALID_PARAMETER InfoTypesBuffer is NULL. - @retval EFI_INVALID_PARAMETER InfoTypesBufferCount is NULL. - @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results. - -**/ -EFI_STATUS -EFIAPI -HstiAipGetSupportedTypes ( - IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, - OUT EFI_GUID **InfoTypesBuffer, - OUT UINTN *InfoTypesBufferCount - ) -{ - if ((This == NULL) || (InfoTypesBuffer == NULL) || (InfoTypesBufferCount == NULL)) { - return EFI_INVALID_PARAMETER; - } - - *InfoTypesBuffer = AllocateCopyPool (sizeof(gAdapterInfoPlatformSecurityGuid), &gAdapterInfoPlatformSecurityGuid); - if (*InfoTypesBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - *InfoTypesBufferCount = 1; - - return EFI_SUCCESS; -} - -EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol = { - HstiAipGetInfo, - HstiAipSetInfo, - HstiAipGetSupportedTypes, -}; diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.c deleted file mode 100644 index 424c488..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.c +++ /dev/null @@ -1,612 +0,0 @@ -/** @file - - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HstiDxe.h" - -/** - Find HSTI table in AIP protocol, and return the data. - This API will return the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param HstiData HSTI data. This buffer is allocated by callee, and it - is the responsibility of the caller to free it after - using it. - @param HstiSize HSTI size - - @return Aip The AIP protocol having this HSTI. - @return NULL There is not HSTI table with the Role and ImplementationID published in system. -**/ -VOID * -InternalHstiFindAip ( - IN UINT32 Role, - IN CHAR16 *ImplementationID OPTIONAL, - OUT VOID **HstiData OPTIONAL, - OUT UINTN *HstiSize OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_ADAPTER_INFORMATION_PROTOCOL *Aip; - UINTN NoHandles; - EFI_HANDLE *Handles; - UINTN Index; - EFI_GUID *InfoTypesBuffer; - UINTN InfoTypesBufferCount; - UINTN InfoTypesIndex; - EFI_ADAPTER_INFORMATION_PROTOCOL *AipCandidate; - VOID *InformationBlock; - UINTN InformationBlockSize; - ADAPTER_INFO_PLATFORM_SECURITY *Hsti; - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiAdapterInformationProtocolGuid, - NULL, - &NoHandles, - &Handles - ); - if (EFI_ERROR (Status)) { - return NULL; - } - - Hsti = NULL; - Aip = NULL; - InformationBlock = NULL; - InformationBlockSize = 0; - for (Index = 0; Index < NoHandles; Index++) { - Status = gBS->HandleProtocol ( - Handles[Index], - &gEfiAdapterInformationProtocolGuid, - (VOID **)&Aip - ); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Check AIP - // - Status = Aip->GetSupportedTypes ( - Aip, - &InfoTypesBuffer, - &InfoTypesBufferCount - ); - if (EFI_ERROR (Status)) { - continue; - } - - AipCandidate = NULL; - for (InfoTypesIndex = 0; InfoTypesIndex < InfoTypesBufferCount; InfoTypesIndex++) { - if (CompareGuid (&InfoTypesBuffer[InfoTypesIndex], &gAdapterInfoPlatformSecurityGuid)) { - AipCandidate = Aip; - break; - } - } - FreePool (InfoTypesBuffer); - - if (AipCandidate == NULL) { - continue; - } - - // - // Check HSTI Role - // - Aip = AipCandidate; - Status = Aip->GetInformation ( - Aip, - &gAdapterInfoPlatformSecurityGuid, - &InformationBlock, - &InformationBlockSize - ); - if (EFI_ERROR (Status)) { - continue; - } - - Hsti = InformationBlock; - if ((Hsti->Role == Role) && - ((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0))) { - break; - } else { - Hsti = NULL; - FreePool (InformationBlock); - continue; - } - } - FreePool (Handles); - - if (Hsti == NULL) { - return NULL; - } - - if (HstiData != NULL) { - *HstiData = InformationBlock; - } - if (HstiSize != NULL) { - *HstiSize = InformationBlockSize; - } - return Aip; -} - -/** - Return if input HSTI data follows HSTI specification. - - @param HstiData HSTI data - @param HstiSize HSTI size - - @retval TRUE HSTI data follows HSTI specification. - @retval FALSE HSTI data does not follow HSTI specification. -**/ -BOOLEAN -InternalHstiIsValidTable ( - IN VOID *HstiData, - IN UINTN HstiSize - ) -{ - ADAPTER_INFO_PLATFORM_SECURITY *Hsti; - UINTN Index; - CHAR16 *ErrorString; - CHAR16 ErrorChar; - UINTN ErrorStringSize; - UINTN ErrorStringLength; - - Hsti = HstiData; - - // - // basic check for header - // - if (HstiData == NULL) { - DEBUG ((EFI_D_ERROR, "HstiData == NULL\n")); - return FALSE; - } - if (HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) { - DEBUG ((EFI_D_ERROR, "HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)\n")); - return FALSE; - } - if (((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) { - DEBUG ((EFI_D_ERROR, "((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < SecurityFeaturesSize\n")); - return FALSE; - } - - // - // Check Version - // - if (Hsti->Version != PLATFORM_SECURITY_VERSION_VNEXTCS) { - DEBUG ((EFI_D_ERROR, "Version != PLATFORM_SECURITY_VERSION_VNEXTCS\n")); - return FALSE; - } - - // - // Check Role - // - if ((Hsti->Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) || - (Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM)) { - DEBUG ((EFI_D_ERROR, "Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE ||\n")); - DEBUG ((EFI_D_ERROR, "Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM\n")); - return FALSE; - } - - // - // Check ImplementationID - // - 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])) { - DEBUG ((EFI_D_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); - - // - // basic check for ErrorString - // - if (ErrorStringSize == 0) { - DEBUG ((EFI_D_ERROR, "ErrorStringSize == 0\n")); - return FALSE; - } - if ((ErrorStringSize & BIT0) != 0) { - DEBUG ((EFI_D_ERROR, "(ErrorStringSize & BIT0) != 0\n")); - return FALSE; - } - - // - // ErrorString might not be CHAR16 aligned. - // - CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar)); - for (ErrorStringLength = 0; (ErrorChar != 0) && (ErrorStringLength < (ErrorStringSize/2)); ErrorStringLength++) { - ErrorString++; - CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar)); - } - - // - // check the length of ErrorString - // - if (ErrorChar != 0) { - DEBUG ((EFI_D_ERROR, "ErrorString has no NUL CHAR\n")); - return FALSE; - } - if (ErrorStringLength == (ErrorStringSize/2)) { - DEBUG ((EFI_D_ERROR, "ErrorString Length incorrect\n")); - return FALSE; - } - - return TRUE; -} - -/** - Publish HSTI table in AIP protocol. - - One system should have only one PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE. - - If the Role is NOT PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE, - SecurityFeaturesRequired field will be ignored. - - @param Hsti HSTI data - @param HstiSize HSTI size - - @retval EFI_SUCCESS The HSTI data is published in AIP protocol. - @retval EFI_ALREADY_STARTED There is already HSTI table with Role and ImplementationID published in system. - @retval EFI_VOLUME_CORRUPTED The input HSTI data does not follow HSTI specification. - @retval EFI_OUT_OF_RESOURCES There is not enough system resource to publish HSTI data in AIP protocol. -**/ -EFI_STATUS -EFIAPI -HstiLibSetTable ( - 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; - - if (!InternalHstiIsValidTable (Hsti, HstiSize)) { - return EFI_VOLUME_CORRUPTED; - } - - Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role; - ImplementationID = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->ImplementationID; - Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL); - if (Aip != NULL) { - return EFI_ALREADY_STARTED; - } - - 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; - ZeroMem (SecurityFeaturesRequired, SecurityFeaturesSize); - } - - HstiAip->Signature = HSTI_AIP_PRIVATE_SIGNATURE; - CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof(EFI_ADAPTER_INFORMATION_PROTOCOL)); - HstiAip->HstiSize = HstiSize; - HstiAip->HstiMaxSize = HstiSize; - - Handle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiAdapterInformationProtocolGuid, - &HstiAip->Aip, - NULL - ); - if (EFI_ERROR (Status)) { - FreePool (HstiAip->Hsti); - FreePool (HstiAip); - } - - return Status; -} - -/** - Search HSTI table in AIP protocol, and return the data. - This API will return the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param Hsti HSTI data. This buffer is allocated by callee, and it - is the responsibility of the caller to free it after - using it. - @param HstiSize HSTI size - - @retval EFI_SUCCESS The HSTI data in AIP protocol is returned. - @retval EFI_NOT_FOUND There is not HSTI table with the Role and ImplementationID published in system. -**/ -EFI_STATUS -EFIAPI -HstiLibGetTable ( - IN UINT32 Role, - IN CHAR16 *ImplementationID OPTIONAL, - OUT VOID **Hsti, - OUT UINTN *HstiSize - ) -{ - EFI_ADAPTER_INFORMATION_PROTOCOL *Aip; - - Aip = InternalHstiFindAip (Role, ImplementationID, Hsti, HstiSize); - if (Aip == NULL) { - return EFI_NOT_FOUND; - } - return EFI_SUCCESS; -} - -/** - Record FeaturesVerified in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ByteIndex Byte index of FeaturesVerified of HSTI data. - @param BitMask Bit mask of FeaturesVerified of HSTI data. - @param Set TRUE means to set the FeaturesVerified bit. - FALSE means to clear the FeaturesVerified bit. - - @retval EFI_SUCCESS The FeaturesVerified of HSTI data updated in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_UNSUPPORTED The ByteIndex is invalid. -**/ -EFI_STATUS -InternalHstiRecordFeaturesVerified ( - 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; - - Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize); - if (Aip == NULL) { - return EFI_NOT_STARTED; - } - - if (ByteIndex >= Hsti->SecurityFeaturesSize) { - return EFI_UNSUPPORTED; - } - - SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2); - - if (Set) { - SecurityFeaturesVerified[ByteIndex] = (UINT8)(SecurityFeaturesVerified[ByteIndex] | (Bit)); - } else { - SecurityFeaturesVerified[ByteIndex] = (UINT8)(SecurityFeaturesVerified[ByteIndex] & (~Bit)); - } - - Status = Aip->SetInformation ( - Aip, - &gAdapterInfoPlatformSecurityGuid, - Hsti, - HstiSize - ); - FreePool (Hsti); - return Status; -} - -/** - Set FeaturesVerified in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ByteIndex Byte index of FeaturesVerified of HSTI data. - @param BitMask Bit mask of FeaturesVerified of HSTI data. - - @retval EFI_SUCCESS The FeaturesVerified of HSTI data updated in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_UNSUPPORTED The ByteIndex is invalid. -**/ -EFI_STATUS -EFIAPI -HstiLibSetFeaturesVerified ( - IN UINT32 Role, - IN CHAR16 *ImplementationID, OPTIONAL - IN UINT32 ByteIndex, - IN UINT8 BitMask - ) -{ - return InternalHstiRecordFeaturesVerified ( - Role, - ImplementationID, - ByteIndex, - BitMask, - TRUE - ); -} - -/** - Clear FeaturesVerified in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ByteIndex Byte index of FeaturesVerified of HSTI data. - @param BitMask Bit mask of FeaturesVerified of HSTI data. - - @retval EFI_SUCCESS The FeaturesVerified of HSTI data updated in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_UNSUPPORTED The ByteIndex is invalid. -**/ -EFI_STATUS -EFIAPI -HstiLibClearFeaturesVerified ( - IN UINT32 Role, - IN CHAR16 *ImplementationID, OPTIONAL - IN UINT32 ByteIndex, - IN UINT8 BitMask - ) -{ - return InternalHstiRecordFeaturesVerified ( - Role, - ImplementationID, - ByteIndex, - BitMask, - FALSE - ); -} - -/** - Record ErrorString in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ErrorString ErrorString of HSTI data. - @param Append TRUE means to append the ErrorString to HSTI table. - FALSE means to set the ErrorString in HSTI table. - - @retval EFI_SUCCESS The ErrorString of HSTI data is published in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString. -**/ -EFI_STATUS -InternalHstiRecordErrorString ( - 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; - - Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize); - if (Aip == NULL) { - return EFI_NOT_STARTED; - } - - if (Append) { - Offset = HstiSize - sizeof(CHAR16); - } else { - Offset = sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3; - } - StringSize = StrSize (ErrorString); - - NewHstiSize = Offset + StringSize; - NewHsti = AllocatePool (NewHstiSize); - if (NewHsti == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (NewHsti, Hsti, Offset); - CopyMem ((UINT8 *)NewHsti + Offset, ErrorString, StringSize); - - Status = Aip->SetInformation ( - Aip, - &gAdapterInfoPlatformSecurityGuid, - NewHsti, - NewHstiSize - ); - FreePool (Hsti); - FreePool (NewHsti); - return Status; -} - -/** - Append ErrorString in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ErrorString ErrorString of HSTI data. - - @retval EFI_SUCCESS The ErrorString of HSTI data is updated in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString. -**/ -EFI_STATUS -EFIAPI -HstiLibAppendErrorString ( - IN UINT32 Role, - IN CHAR16 *ImplementationID, OPTIONAL - IN CHAR16 *ErrorString - ) -{ - return InternalHstiRecordErrorString ( - Role, - ImplementationID, - ErrorString, - TRUE - ); -} - -/** - Set a new ErrorString in published HSTI table. - This API will update the HSTI table with indicated Role and ImplementationID, - NULL ImplementationID means to find the first HSTI table with indicated Role. - - @param Role Role of HSTI data. - @param ImplementationID ImplementationID of HSTI data. - NULL means find the first one match Role. - @param ErrorString ErrorString of HSTI data. - - @retval EFI_SUCCESS The ErrorString of HSTI data is updated in AIP protocol. - @retval EFI_NOT_STARTED There is not HSTI table with the Role and ImplementationID published in system. - @retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString. -**/ -EFI_STATUS -EFIAPI -HstiLibSetErrorString ( - IN UINT32 Role, - IN CHAR16 *ImplementationID, OPTIONAL - IN CHAR16 *ErrorString - ) -{ - return InternalHstiRecordErrorString ( - Role, - ImplementationID, - ErrorString, - FALSE - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.h b/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.h deleted file mode 100644 index 517f348..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeHstiLib/HstiDxe.h +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _HSTI_DXE_H_ -#define _HSTI_DXE_H_ - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#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; -} HSTI_AIP_PRIVATE_DATA; - -#define HSTI_AIP_PRIVATE_DATA_FROM_THIS(a) \ - CR (a, \ - HSTI_AIP_PRIVATE_DATA, \ - Aip, \ - HSTI_AIP_PRIVATE_SIGNATURE \ - ) - -#define HSTI_DEFAULT_ERROR_STRING_LEN 255 - -extern EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol; - -/** - Return if input HSTI data follows HSTI specification. - - @param HstiData HSTI data - @param HstiSize HSTI size - - @retval TRUE HSTI data follows HSTI specification. - @retval FALSE HSTI data does not follow HSTI specification. -**/ -BOOLEAN -InternalHstiIsValidTable ( - IN VOID *HstiData, - IN UINTN HstiSize - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h deleted file mode 100644 index e903c89..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h +++ /dev/null @@ -1,172 +0,0 @@ -/** @file - Internal include file of DXE CPU IO2 Library. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _DXE_CPUIO2_LIB_INTERNAL_H_ -#define _DXE_CPUIO2_LIB_INTERNAL_H_ - -#include - -#include - -#include -#include -#include -#include - - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI CPU I/O space. - -**/ -UINT64 -EFIAPI -IoReadWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width - ); - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return The parameter of Data. - -**/ -UINT64 -EFIAPI -IoWriteWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Data - ); - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The port is read Count times, and the read data is stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifoWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ); - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width specified by Width. - The port is written Count times, and the write data is retrieved from the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to write I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoWriteFifoWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ); - -/** - Reads memory-mapped registers in the EFI system memory space. - - Reads the MMIO registers specified by Address with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioReadWorker ( - IN UINTN Address, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width - ); - -/** - Writes memory-mapped registers in the EFI system memory space. - - Writes the MMIO registers specified by Address with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioWriteWorker ( - IN UINTN Address, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Data - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf deleted file mode 100644 index 79f65af..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file -# I/O Library instance based on EFI_CPU_IO2_PROTOCOL. -# -# I/O Library implementation that uses the CPU I/O2 Protocol for I/O and MMIO operations. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeIoLibCpuIo2 - MODULE_UNI_FILE = DxeIoLibCpuIo2.uni - FILE_GUID = 33D33BF3-349E-4768-9459-836A9F7558FB - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib|DXE_DRIVER - CONSTRUCTOR = IoLibConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - IoLibMmioBuffer.c - DxeCpuIo2LibInternal.h - IoHighLevel.c - IoLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - UefiBootServicesTableLib - -[Protocols] - gEfiCpuIo2ProtocolGuid ## CONSUMES - -[Depex] - gEfiCpuIo2ProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni deleted file mode 100644 index 6d68716..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// I/O Library instance based on EFI_CPU_IO2_PROTOCOL. -// -// I/O Library implementation that uses the CPU I/O2 Protocol for I/O and MMIO operations. -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials are licensed and made available -// under the terms and conditions of the BSD License which accompanies this -// distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "I/O Library instance based on EFI_CPU_IO2_PROTOCOL" - -#string STR_MODULE_DESCRIPTION #language en-US "I/O Library implementation that uses the CPU I/O2 Protocol for I/O and MMIO operations." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c deleted file mode 100644 index 8d88a35..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c +++ /dev/null @@ -1,2307 +0,0 @@ -/** @file - High-level Io/Mmio functions. - - All assertions for bit field operations are handled bit field functions in the - Base Library. - - Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "DxeCpuIo2LibInternal.h" - -/** - Reads an 8-bit I/O port, performs a bitwise OR, and writes the - result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoOr8 ( - IN UINTN Port, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back - to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAnd8 ( - IN UINTN Port, - IN UINT8 AndData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAndThenOr8 ( - IN UINTN Port, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in an 8-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoBitFieldRead8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldWrite8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return IoWrite8 ( - Port, - BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAnd8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return IoWrite8 ( - Port, - BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 8-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAndThenOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit I/O port, performs a bitwise OR, and writes the - result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoOr16 ( - IN UINTN Port, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back - to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAnd16 ( - IN UINTN Port, - IN UINT16 AndData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAndThenOr16 ( - IN UINTN Port, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 16-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoBitFieldRead16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldWrite16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return IoWrite16 ( - Port, - BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAnd16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return IoWrite16 ( - Port, - BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 16-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAndThenOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit I/O port, performs a bitwise OR, and writes the - result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoOr32 ( - IN UINTN Port, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) | OrData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back - to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAnd32 ( - IN UINTN Port, - IN UINT32 AndData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) & AndData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAndThenOr32 ( - IN UINTN Port, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 32-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoBitFieldRead32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldWrite32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return IoWrite32 ( - Port, - BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAnd32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return IoWrite32 ( - Port, - BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 32-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAndThenOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit I/O port, performs a bitwise OR, and writes the - result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoOr64 ( - IN UINTN Port, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) | OrData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back - to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAnd64 ( - IN UINTN Port, - IN UINT64 AndData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) & AndData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAndThenOr64 ( - IN UINTN Port, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 64-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoBitFieldRead64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldWrite64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return IoWrite64 ( - Port, - BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAnd64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return IoWrite64 ( - Port, - BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAndThenOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise OR, and writes the - result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result - back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 8-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in an 8-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 8-bit register is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioWrite8 ( - Address, - BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 8-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise OR, and writes the - result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result - back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 16-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 16-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 16-bit register is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioWrite16 ( - Address, - BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 16-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise OR, and writes the - result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) | OrData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result - back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) & AndData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 32-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 32-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 32-bit register is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioWrite32 ( - Address, - BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 32-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise OR, and writes the - result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioOr64 ( - IN UINTN Address, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) | OrData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result - back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAnd64 ( - IN UINTN Address, - IN UINT64 AndData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) & AndData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 64-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAndThenOr64 ( - IN UINTN Address, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 64-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioBitFieldRead64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 64-bit register is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldWrite64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return MmioWrite64 ( - Address, - BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAnd64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 64-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAndThenOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData) - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c deleted file mode 100644 index c437ef9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c +++ /dev/null @@ -1,869 +0,0 @@ -/** @file - I/O Library instance based on EFI_CPU_IO2_PROTOCOL. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "DxeCpuIo2LibInternal.h" - -// -// Globle varible to cache pointer to CpuIo2 protocol. -// -EFI_CPU_IO2_PROTOCOL *mCpuIo = NULL; - -/** - The constructor function caches the pointer to CpuIo2 protocol. - - The constructor function locates CpuIo2 protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -IoLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **) &mCpuIo); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI CPU I/O space. - -**/ -UINT64 -EFIAPI -IoReadWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width - ) -{ - EFI_STATUS Status; - UINT64 Data; - - Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return The parameter of Data. - -**/ -UINT64 -EFIAPI -IoWriteWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Data - ) -{ - EFI_STATUS Status; - - Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The port is read Count times, and the read data is stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifoWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - - Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer); - ASSERT_EFI_ERROR (Status); -} - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width specified by Width. - The port is written Count times, and the write data is retrieved from the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to write I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoWriteFifoWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - - Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer); - ASSERT_EFI_ERROR (Status); -} - -/** - Reads memory-mapped registers in the EFI system memory space. - - Reads the MMIO registers specified by Address with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioReadWorker ( - IN UINTN Address, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width - ) -{ - EFI_STATUS Status; - UINT64 Data; - - Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Writes memory-mapped registers in the EFI system memory space. - - Writes the MMIO registers specified by Address with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioWriteWorker ( - IN UINTN Address, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Data - ) -{ - EFI_STATUS Status; - - Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - return (UINT8)IoReadWorker (Port, EfiCpuIoWidthUint8); -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - return (UINT8)IoWriteWorker (Port, EfiCpuIoWidthUint8, Value); -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - return (UINT16)IoReadWorker (Port, EfiCpuIoWidthUint16); -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - return (UINT16)IoWriteWorker (Port, EfiCpuIoWidthUint16, Value); -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - return (UINT32)IoReadWorker (Port, EfiCpuIoWidthUint32); -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - return (UINT32)IoWriteWorker (Port, EfiCpuIoWidthUint32, Value); -} - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - return IoReadWorker (Port, EfiCpuIoWidthUint64); -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - return IoWriteWorker (Port, EfiCpuIoWidthUint64, Value); -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); -} - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - return (UINT8)MmioReadWorker (Address, EfiCpuIoWidthUint8); -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return (UINT8)MmioWriteWorker (Address, EfiCpuIoWidthUint8, Value); -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - return (UINT16)MmioReadWorker (Address, EfiCpuIoWidthUint16); -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - return (UINT16)MmioWriteWorker (Address, EfiCpuIoWidthUint16, Value); -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - return (UINT32)MmioReadWorker (Address, EfiCpuIoWidthUint32); -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - return (UINT32)MmioWriteWorker (Address, EfiCpuIoWidthUint32, Value); -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & 7) == 0); - return (UINT64)MmioReadWorker (Address, EfiCpuIoWidthUint64); -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & 7) == 0); - return (UINT64)MmioWriteWorker (Address, EfiCpuIoWidthUint64, Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c deleted file mode 100644 index c25cb9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeIoLibCpuIo2/IoLibMmioBuffer.c +++ /dev/null @@ -1,413 +0,0 @@ -/** @file - I/O Library MMIO Buffer Functions. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "DxeCpuIo2LibInternal.h" - -/** - Copy data from MMIO region to system memory by using 8-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 8-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioReadBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = Buffer; - - while (Length-- > 0) { - *(Buffer++) = MmioRead8 (StartAddress++); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 16-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 16-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer. - -**/ -UINT16 * -EFIAPI -MmioReadBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead16 (StartAddress); - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 32-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 32-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer. - -**/ -UINT32 * -EFIAPI -MmioReadBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead32 (StartAddress); - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 64-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 64-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer. - -**/ -UINT64 * -EFIAPI -MmioReadBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead64 (StartAddress); - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 8-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 8-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer. - -**/ -UINT8 * -EFIAPI -MmioWriteBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT8 *Buffer - ) -{ - VOID* ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = (UINT8 *) Buffer; - - while (Length-- > 0) { - MmioWrite8 (StartAddress++, *(Buffer++)); - } - - return ReturnBuffer; - -} - -/** - Copy data from system memory to MMIO region by using 16-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 16-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer. - -**/ -UINT16 * -EFIAPI -MmioWriteBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = (UINT16 *) Buffer; - - while (Length > 0) { - MmioWrite16 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 32-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 32-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer. - -**/ -UINT32 * -EFIAPI -MmioWriteBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = (UINT32 *) Buffer; - - while (Length > 0) { - MmioWrite32 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from system memory to MMIO region by using 64-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 64-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer. - -**/ -UINT64 * -EFIAPI -MmioWriteBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = (UINT64 *) Buffer; - - while (Length > 0) { - MmioWrite64 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c deleted file mode 100644 index c7eefac..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c +++ /dev/null @@ -1,1626 +0,0 @@ -/** @file -Implementation of PcdLib class library for DXE phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -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. - - @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL. -**/ -EFI_PCD_PROTOCOL * -EFIAPI -GetPiPcdProtocol ( - VOID - ) -{ - EFI_STATUS Status; - - if (mPiPcd == NULL) { - // - // 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); - ASSERT_EFI_ERROR (Status); - ASSERT (mPiPcd != NULL); - } - return mPiPcd; -} - -/** - Retrieves the PCD protocol from the handle database. - - @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL. -**/ -PCD_PROTOCOL * -EFIAPI -GetPcdProtocol ( - VOID - ) -{ - EFI_STATUS Status; - - if (mPcd == NULL) { - // - // PCD protocol need to be installed before the module access Dynamic type PCD. - // But dynamic type PCD is not required in PI 1.2 specification. - // - Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd); - ASSERT_EFI_ERROR (Status); - ASSERT (mPcd != NULL); - } - return mPcd; -} - -/** - Retrieves the PI PCD info protocol from the handle database. - - @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3. -**/ -EFI_GET_PCD_INFO_PROTOCOL * -GetPiPcdInfoProtocolPointer ( - VOID - ) -{ - EFI_STATUS Status; - - if (mPiPcdInfo == NULL) { - Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo); - ASSERT_EFI_ERROR (Status); - ASSERT (mPiPcdInfo != NULL); - } - return mPiPcdInfo; -} - -/** - Retrieves the PCD info protocol from the handle database. - - @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL. -**/ -GET_PCD_INFO_PROTOCOL * -GetPcdInfoProtocolPointer ( - VOID - ) -{ - EFI_STATUS Status; - - if (mPcdInfo == NULL) { - Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo); - ASSERT_EFI_ERROR (Status); - ASSERT (mPcdInfo != NULL); - } - return mPcdInfo; -} - -/** - This function provides a means by which SKU support can be established in the PCD infrastructure. - - Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. - - @param SkuId The SKU value that will be used when the PCD service retrieves and sets values - associated with a PCD token. - - @return Return the SKU ID that just be set. - -**/ -UINTN -EFIAPI -LibPcdSetSku ( - IN UINTN SkuId - ) -{ - GetPcdProtocol()->SetSku (SkuId); - - return SkuId; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 8-bit value for the token specified by TokenNumber. - -**/ -UINT8 -EFIAPI -LibPcdGet8 ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->Get8 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 16-bit value for the token specified by TokenNumber. - -**/ -UINT16 -EFIAPI -LibPcdGet16 ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->Get16 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 32-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 32-bit value for the token specified by TokenNumber. - -**/ -UINT32 -EFIAPI -LibPcdGet32 ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->Get32 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 64-bit value for the token specified by TokenNumber. - -**/ -UINT64 -EFIAPI -LibPcdGet64 ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->Get64 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the pointer to the buffer of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the pointer to the token specified by TokenNumber. - -**/ -VOID * -EFIAPI -LibPcdGetPtr ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->GetPtr (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the Boolean value of the token specified by TokenNumber. - -**/ -BOOLEAN -EFIAPI -LibPcdGetBool ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->GetBool (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve the size of a given PCD token. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the size of the token specified by TokenNumber. - -**/ -UINTN -EFIAPI -LibPcdGetSize ( - IN UINTN TokenNumber - ) -{ - return GetPcdProtocol()->GetSize (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT8. - -**/ -UINT8 -EFIAPI -LibPcdGetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Get8 (Guid, TokenNumber); -} - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT16. - -**/ -UINT16 -EFIAPI -LibPcdGetEx16 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Get16 (Guid, TokenNumber); -} - - -/** - Returns the 32-bit value for the token specified by TokenNumber and Guid. - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT32. - -**/ -UINT32 -EFIAPI -LibPcdGetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Get32 (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT64. - -**/ -UINT64 -EFIAPI -LibPcdGetEx64 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Get64 (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the pointer to the buffer of token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the VOID* pointer. - -**/ -VOID * -EFIAPI -LibPcdGetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->GetPtr (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the BOOLEAN. - -**/ -BOOLEAN -EFIAPI -LibPcdGetExBool ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->GetBool (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve the size of a given PCD token. - - Returns the size of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the size. - -**/ -UINTN -EFIAPI -LibPcdGetExSize ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->GetSize (Guid, TokenNumber); -} - - - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSet8 ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - GetPcdProtocol()->Set8 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSet16 ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - GetPcdProtocol()->Set16 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSet32 ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - GetPcdProtocol()->Set32 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSet64 ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - GetPcdProtocol()->Set64 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value - specified by Buffer and SizeOfBuffer. Buffer is returned. - If SizeOfBuffer is greater than the maximum size support by TokenNumber, - then set SizeOfBuffer to the maximum size supported by TokenNumber and - return NULL to indicate that the set operation was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and NULL must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pointer for the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetPtr ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - EFI_STATUS Status; - UINTN InputSizeOfBuffer; - - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - InputSizeOfBuffer = *SizeOfBuffer; - Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); - if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { - return NULL; - } - - return (VOID *)Buffer; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetBool ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - GetPcdProtocol()->SetBool (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (Guid != NULL); - - GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSetEx16 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (Guid != NULL); - - GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (Guid != NULL); - - GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSetEx64 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (Guid != NULL); - - GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size - supported by TokenNumber and return NULL to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - UINTN InputSizeOfBuffer; - - ASSERT (Guid != NULL); - - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - InputSizeOfBuffer = *SizeOfBuffer; - Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); - if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { - return NULL; - } - - return Buffer; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The Boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetExBool ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (Guid != NULL); - - GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value); - - return Value; -} -#endif - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet8S ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - return GetPcdProtocol()->Set8 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet16S ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - return GetPcdProtocol()->Set16 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet32S ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - return GetPcdProtocol()->Set32 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet64S ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - return GetPcdProtocol()->Set64 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetPtrS ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - return GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetBoolS ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - return GetPcdProtocol()->SetBool (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx8S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx16S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx32S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx64S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid Pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExPtrS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - ASSERT (Guid != NULL); - - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - return GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExBoolS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (Guid != NULL); - - return GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value); -} - -/** - Set up a notification function that is called when a specified token is set. - - When the token specified by TokenNumber and Guid is set, - then notification function specified by NotificationFunction is called. - If Guid is NULL, then the default token space is used. - If NotificationFunction is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates which - namespace to set a value from. If NULL, then the default - token space is used. - @param[in] TokenNumber The PCD token number to monitor. - @param[in] NotificationFunction The function to call when the token - specified by Guid and TokenNumber is set. - -**/ -VOID -EFIAPI -LibPcdCallbackOnSet ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - EFI_STATUS Status; - - ASSERT (NotificationFunction != NULL); - - Status = GetPiPcdProtocol()->CallbackOnSet (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK) NotificationFunction); - ASSERT_EFI_ERROR (Status); - - return; -} - - - -/** - Disable a notification function that was established with LibPcdCallbackonSet(). - - Disable a notification function that was previously established with LibPcdCallbackOnSet(). - If NotificationFunction is NULL, then ASSERT(). - If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, - and NotificationFunction, then ASSERT(). - - @param[in] Guid Specify the GUID token space. - @param[in] TokenNumber Specify the token number. - @param[in] NotificationFunction The callback function to be unregistered. - -**/ -VOID -EFIAPI -LibPcdCancelCallback ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - EFI_STATUS Status; - - ASSERT (NotificationFunction != NULL); - - Status = GetPiPcdProtocol()->CancelCallback (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK) NotificationFunction); - ASSERT_EFI_ERROR (Status); - - return; -} - - - -/** - Retrieves the next token in a token space. - - Retrieves the next PCD token number from the token space specified by Guid. - If Guid is NULL, then the default token space is used. If TokenNumber is 0, - then the first token number is returned. Otherwise, the token number that - follows TokenNumber in the token space is returned. If TokenNumber is the last - token number in the token space, then 0 is returned. - - If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates which namespace - to set a value from. If NULL, then the default token space is used. - @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD - token number. - - @return The next valid token number. - -**/ -UINTN -EFIAPI -LibPcdGetNextToken ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber - ) -{ - EFI_STATUS Status; - - Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber); - ASSERT (!EFI_ERROR (Status) || TokenNumber == 0); - - return TokenNumber; -} - - - -/** - Used to retrieve the list of available PCD token space GUIDs. - - Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces - in the platform. - If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned. - If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned. - - @param TokenSpaceGuid The pointer to the a PCD token space GUID. - - @return The next valid token namespace. - -**/ -GUID * -EFIAPI -LibPcdGetNextTokenSpace ( - IN CONST GUID *TokenSpaceGuid - ) -{ - GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid); - - return (GUID *)TokenSpaceGuid; -} - - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtr ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return (VOID *) Buffer; -} - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrS ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return RETURN_SUCCESS; -} - - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtrAndSize ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return (VOID *) Buffer; -} - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrAndSizeS ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return RETURN_SUCCESS; -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the default token space specified, then ASSERT(). - - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfo ( - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - EFI_STATUS Status; - - Status = GetPcdInfoProtocolPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo); - ASSERT_EFI_ERROR (Status); -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfoEx ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - EFI_STATUS Status; - - Status = GetPiPcdInfoProtocolPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo); - ASSERT_EFI_ERROR (Status); -} - -/** - Retrieve the currently set SKU Id. - - @return The currently set SKU Id. If the platform has not set at a SKU Id, then the - default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU - Id is returned. -**/ -UINTN -EFIAPI -LibPcdGetSku ( - VOID - ) -{ - return GetPiPcdInfoProtocolPointer()->GetSku (); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf deleted file mode 100644 index 5135325..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf +++ /dev/null @@ -1,68 +0,0 @@ -## @file -# Instance of PCD Library using PCD Protocol. -# -# There are two PCD protocols as follows: -# 1) PCD_PROTOCOL -# It is EDKII implementation which support Dynamic/DynamicEx Pcds. -# 2) EFI_PCD_PROTOCOL -# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx -# type Pcd. -# -# For dynamicEx type PCD, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL. -# -# This library instance uses the PCD_PROTOCOL to handle dynamic PCD request and use -# EFI_PCD_PROTOCOL to handle dynamicEx type PCD. -# -# Note: A driver of type DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER can only use this DxePcdLib -# in their initialization without any issues to access Dynamic and DynamicEx PCD. They can't -# access Dynamic and DynamicEx PCD in the implementation of runtime services and SMI handlers. -# Because EFI_PCD_PROTOCOL is DXE protocol that is not aviable in OS runtime phase. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxePcdLib - MODULE_UNI_FILE = DxePcdLib.uni - FILE_GUID = af97eb89-4cc6-45f8-a514-ca025b346480 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PcdLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DxePcdLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - UefiBootServicesTableLib - DebugLib - - -[Protocols] - gPcdProtocolGuid ## SOMETIMES_CONSUMES - gEfiPcdProtocolGuid ## CONSUMES - gGetPcdInfoProtocolGuid ## SOMETIMES_CONSUMES - gEfiGetPcdInfoProtocolGuid ## SOMETIMES_CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiPcdProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.uni deleted file mode 100644 index 33bf628..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.uni +++ /dev/null @@ -1,31 +0,0 @@ -// /** @file -// Instance of PCD Library using PCD Protocol. -// -// There are two PCD protocols as follows: -// 1) PCD_PROTOCOL -// It is EDKII implementation which support Dynamic/DynamicEx Pcds. -// 2) EFI_PCD_PROTOCOL -// It is defined by PI specification 1.2, Vol 3 which only support dynamicEx -// type Pcd. -// -// For dynamicEx type PCD, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL. -// -// This library instance uses the PCD_PROTOCOL to handle dynamic PCD request and use -// EFI_PCD_PROTOCOL to handle dynamicEx type PCD. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCD Library using PCD Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "There are two PCD protocols: 1) PCD_PROTOCOL It is an EDKII implementation that supporst Dynamic/DynamicEx PCDs. 2) EFI_PCD_PROTOCOL It is defined by PI Specification 1.2, Vol 3, which only support dynamicEx type PCD. For dynamicEx type PCDs, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL. This library instance uses the PCD_PROTOCOL to handle dynamic PCD requests and uses EFI_PCD_PROTOCOL to handle DynamicEx type PCDs." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c deleted file mode 100644 index 154bf20..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c +++ /dev/null @@ -1,346 +0,0 @@ -/** @file - DXE runtime Debug library instance based on Serial Port library. - It takes care not to call into SerialPortLib after ExitBootServices() has - been called, to prevent touching hardware that is no longer owned by the - firmware. - - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
- Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -STATIC EFI_EVENT mEfiExitBootServicesEvent; -STATIC BOOLEAN mEfiAtRuntime = FALSE; - -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 - -/** - Set AtRuntime flag as TRUE after ExitBootServices. - - @param[in] Event The Event that is being processed. - @param[in] Context The Event Context. - -**/ -STATIC -VOID -EFIAPI -ExitBootServicesEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - mEfiAtRuntime = TRUE; -} - -/** - The constructor function to initialize the Serial Port library and - register a callback for the ExitBootServices event. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The operation completed successfully. - @retval other Either the serial port failed to initialize or the - ExitBootServices event callback registration failed. -**/ -EFI_STATUS -EFIAPI -DxeRuntimeDebugLibSerialPortConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = SerialPortInitialize (); - if (EFI_ERROR (Status)) { - return Status; - } - - return SystemTable->BootServices->CreateEventEx (EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, ExitBootServicesEvent, NULL, - &gEfiEventExitBootServicesGuid, - &mEfiExitBootServicesEvent); -} - -/** - If a runtime driver exits with an error, it must call this routine - to free the allocated resource before the exiting. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The Runtime Driver Lib shutdown successfully. - @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized. -**/ -EFI_STATUS -EFIAPI -DxeRuntimeDebugLibSerialPortDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return SystemTable->BootServices->CloseEvent (mEfiExitBootServicesEvent); -} - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format Format string for the debug message to print. - @param ... Variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - if (mEfiAtRuntime) { - return; - } - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Check driver debug mask value and global mask - // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) { - return; - } - - // - // Convert the DEBUG() message to an ASCII String - // - VA_START (Marker, Format); - AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker); - VA_END (Marker); - - // - // Send the print string to a Serial Port - // - SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated the assert condition. - @param LineNumber The line number in the source file that generated the assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Generate the ASSERT() message in Ascii format - // - AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT [%a] %a(%d): %a\n", - gEfiCallerBaseName, FileName, LineNumber, Description); - - if (!mEfiAtRuntime) { - // - // Send the print string to the Console Output device - // - SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); - } - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf deleted file mode 100644 index f1bb2bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file -# DXE runtime Debug library instance based on Serial Port library. -# It takes care not to call into SerialPortLib after ExitBootServices() has -# been called, to prevent touching hardware that is no longer owned by the -# firmware. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x0001001A - BASE_NAME = DxeRuntimeDebugLibSerialPort - MODULE_UNI_FILE = DxeRuntimeDebugLibSerialPort.uni - FILE_GUID = 9D914E2F-7CCB-41DB-8E74-9AFF8F3BBFBF - MODULE_TYPE = DXE_RUNTIME_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib|DXE_RUNTIME_DRIVER - CONSTRUCTOR = DxeRuntimeDebugLibSerialPortConstructor - DESTRUCTOR = DxeRuntimeDebugLibSerialPortDestructor - -# -# VALID_ARCHITECTURES = AARCH64 ARM IA32 X64 EBC -# - -[Sources] - DebugLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugPrintErrorLevelLib - PcdLib - PrintLib - SerialPortLib - -[Guids] - gEfiEventExitBootServicesGuid ## CONSUMES ## Event - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.uni deleted file mode 100644 index bf3dad5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// DXE runtime Debug library instance based on Serial Port library. -// It takes care not to call into SerialPortLib after ExitBootServices() has -// been called, to prevent touching hardware that is no longer owned by the -// firmware. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "DXE runtime Debug library instance based on Serial Port library" - -#string STR_MODULE_DESCRIPTION #language en-US "It takes care not to call into SerialPortLib after ExitBootServices() has been called." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf deleted file mode 100644 index 6c48180..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf +++ /dev/null @@ -1,58 +0,0 @@ -## @file -# Instance of PCI Express Library using the 256 MB PCI Express MMIO window that -# is safe for runtime use. -# -# PCI Express Library that uses the 256 MB PCI Express MMIO window to perform -# PCI Configuration cycles. Layers on top of an I/O Library instance. A table of -# PCI devices that are registered for for runtime access is maintained so the -# proper virtual address is used to perform the PCI Express Configuration cycle. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeRuntimePciExpressLib - MODULE_UNI_FILE = DxeRuntimePciExpressLib.uni - FILE_GUID = 54DCBCE5-92AD-41f5-AAAF-1170F16DA6A8 - MODULE_TYPE = DXE_RUNTIME_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciExpressLib|DXE_RUNTIME_DRIVER - CONSTRUCTOR = DxeRuntimePciExpressLibConstructor - DESTRUCTOR = DxeRuntimePciExpressLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciExpressLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - IoLib - DebugLib - PcdLib - MemoryAllocationLib - UefiBootServicesTableLib - DxeServicesTableLib - UefiRuntimeLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES - -[Guids] - gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.uni deleted file mode 100644 index d9e72f1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.uni +++ /dev/null @@ -1,26 +0,0 @@ -// /** @file -// Instance of PCI Express Library using the 256 MB PCI Express MMIO window that -// -// is safe for runtime use. -// -// PCI Express Library that uses the 256 MB PCI Express MMIO window to perform -// PCI Configuration cycles. Layers on top of an I/O Library instance. A table of -// PCI devices that are registered for for runtime access is maintained so the -// proper virtual address is used to perform the PCI Express Configuration cycle. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCI Express Support Library" - -#string STR_MODULE_DESCRIPTION #language en-US "The PCI Express Library uses a 256 MB PCI Express MMIO window to perform PCI Configuration cycles. This library layers on top of an I/O Library instance. A table of PCI devices that are registered for runtime access is maintained so that the proper virtual address is used to perform the PCI Express Configuration cycle." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c deleted file mode 100644 index f9096bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c +++ /dev/null @@ -1,1660 +0,0 @@ -/** @file - Functions in this library instance make use of MMIO functions in IoLib to - access memory mapped PCI configuration space. - - All assertions for I/O operations are handled in MMIO functions in the IoLib - Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/// -/// Define table for mapping PCI Express MMIO physical addresses to virtual addresses at OS runtime -/// -typedef struct { - UINTN PhysicalAddress; - UINTN VirtualAddress; -} PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE; - -/// -/// Set Virtual Address Map Event -/// -EFI_EVENT mDxeRuntimePciExpressLibVirtualNotifyEvent = NULL; - -/// -/// Module global that contains the base physical address of the PCI Express MMIO range. -/// -UINTN mDxeRuntimePciExpressLibPciExpressBaseAddress = 0; - -/// -/// The number of PCI devices that have been registered for runtime access. -/// -UINTN mDxeRuntimePciExpressLibNumberOfRuntimeRanges = 0; - -/// -/// The table of PCI devices that have been registered for runtime access. -/// -PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE *mDxeRuntimePciExpressLibRegistrationTable = NULL; - -/// -/// The table index of the most recent virtual address lookup. -/// -UINTN mDxeRuntimePciExpressLibLastRuntimeRange = 0; - - -/** - Convert the physical PCI Express MMIO addresses for all registered PCI devices - to virtual addresses. - - @param[in] Event The event that is being processed. - @param[in] Context The Event Context. -**/ -VOID -EFIAPI -DxeRuntimePciExpressLibVirtualNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINTN Index; - - // - // If there have been no runtime registrations, then just return - // - if (mDxeRuntimePciExpressLibRegistrationTable == NULL) { - return; - } - - // - // Convert physical addresses associated with the set of registered PCI devices to - // virtual addresses. - // - for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) { - EfiConvertPointer (0, (VOID **) &(mDxeRuntimePciExpressLibRegistrationTable[Index].VirtualAddress)); - } - - // - // Convert table pointer that is allocated from EfiRuntimeServicesData to a virtual address. - // - EfiConvertPointer (0, (VOID **) &mDxeRuntimePciExpressLibRegistrationTable); -} - -/** - The constructor function caches the PCI Express Base Address and creates a - Set Virtual Address Map event to convert physical address to virtual addresses. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor completed successfully. - @retval Other value The constructor did not complete successfully. - -**/ -EFI_STATUS -EFIAPI -DxeRuntimePciExpressLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Cache the physical address of the PCI Express MMIO range into a module global variable - // - mDxeRuntimePciExpressLibPciExpressBaseAddress = (UINTN) PcdGet64 (PcdPciExpressBaseAddress); - - // - // Register SetVirtualAddressMap () notify function - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - DxeRuntimePciExpressLibVirtualNotify, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mDxeRuntimePciExpressLibVirtualNotifyEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - The destructor function frees any allocated buffers and closes the Set Virtual - Address Map event. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The destructor completed successfully. - @retval Other value The destructor did not complete successfully. - -**/ -EFI_STATUS -EFIAPI -DxeRuntimePciExpressLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // If one or more PCI devices have been registered for runtime access, then - // free the registration table. - // - if (mDxeRuntimePciExpressLibRegistrationTable != NULL) { - FreePool (mDxeRuntimePciExpressLibRegistrationTable); - } - - // - // Close the Set Virtual Address Map event - // - Status = gBS->CloseEvent (mDxeRuntimePciExpressLibVirtualNotifyEvent); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Gets the base address of PCI Express. - - This internal functions retrieves PCI Express Base Address via a PCD entry - PcdPciExpressBaseAddress. - - @param Address The address that encodes the PCI Bus, Device, Function and Register. - @return The base address of PCI Express. - -**/ -UINTN -GetPciExpressAddress ( - IN UINTN Address - ) -{ - UINTN Index; - - // - // Make sure Address is valid - // - ASSERT (((Address) & ~0xfffffff) == 0); - - // - // Convert Address to a physical address in the MMIO PCI Express range - // - Address += mDxeRuntimePciExpressLibPciExpressBaseAddress; - - // - // If SetVirtualAddressMap() has not been called, then just return the physical address - // - if (!EfiGoneVirtual ()) { - return Address; - } - - // - // See if there is a physical address match at the exact same index as the last address match - // - if (mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibLastRuntimeRange].PhysicalAddress == (Address & (~0x00000fff))) { - // - // Convert the physical address to a virtual address and return the virtual address - // - return (Address & 0x00000fff) + mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibLastRuntimeRange].VirtualAddress; - } - - // - // Search the entire table for a physical address match - // - for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) { - if (mDxeRuntimePciExpressLibRegistrationTable[Index].PhysicalAddress == (Address & (~0x00000fff))) { - // - // Cache the matching index value - // - mDxeRuntimePciExpressLibLastRuntimeRange = Index; - // - // Convert the physical address to a virtual address and return the virtual address - // - return (Address & 0x00000fff) + mDxeRuntimePciExpressLibRegistrationTable[Index].VirtualAddress; - } - } - - // - // No match was found. This is a critical error at OS runtime, so ASSERT() and force a breakpoint. - // - ASSERT (FALSE); - CpuBreakpoint(); - - // - // Return the physical address - // - return Address; -} - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration - registers associated with that PCI device may be accessed after SetVirtualAddressMap() - is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciExpressRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - EFI_STATUS Status; - EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; - UINTN Index; - VOID *NewTable; - - // - // Return an error if this function is called after ExitBootServices(). - // - if (EfiAtRuntime ()) { - return RETURN_UNSUPPORTED; - } - - // - // Make sure Address is valid - // - ASSERT (((Address) & ~0xfffffff) == 0); - - // - // Convert Address to a physical address in the MMIO PCI Express range - // at the beginning of the PCI Configuration header for the specified - // PCI Bus/Dev/Func - // - Address = GetPciExpressAddress (Address & 0x0ffff000); - - // - // See if Address has already been registerd for runtime access - // - for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) { - if (mDxeRuntimePciExpressLibRegistrationTable[Index].PhysicalAddress == Address) { - return RETURN_SUCCESS; - } - } - - // - // Get the GCD Memory Descriptor for the PCI Express Bus/Dev/Func specified by Address - // - Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor); - if (EFI_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - // - // Mark the 4KB region for the PCI Express Bus/Dev/Func as EFI_RUNTIME_MEMORY so the OS - // will allocate a virtual address range for the 4KB PCI Configuration Header. - // - Status = gDS->SetMemorySpaceAttributes (Address, 0x1000, Descriptor.Attributes | EFI_MEMORY_RUNTIME); - if (EFI_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - // - // Grow the size of the registration table - // - NewTable = ReallocateRuntimePool ( - (mDxeRuntimePciExpressLibNumberOfRuntimeRanges + 0) * sizeof (PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE), - (mDxeRuntimePciExpressLibNumberOfRuntimeRanges + 1) * sizeof (PCI_EXPRESS_RUNTIME_REGISTRATION_TABLE), - mDxeRuntimePciExpressLibRegistrationTable - ); - if (NewTable == NULL) { - return RETURN_OUT_OF_RESOURCES; - } - mDxeRuntimePciExpressLibRegistrationTable = NewTable; - mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibNumberOfRuntimeRanges].PhysicalAddress = Address; - mDxeRuntimePciExpressLibRegistrationTable[mDxeRuntimePciExpressLibNumberOfRuntimeRanges].VirtualAddress = Address; - mDxeRuntimePciExpressLibNumberOfRuntimeRanges++; - - return RETURN_SUCCESS; -} - - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressRead8 ( - IN UINTN Address - ) -{ - return MmioRead8 (GetPciExpressAddress (Address)); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return MmioWrite8 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioOr8 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioAnd8 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioAndThenOr8 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioBitFieldWrite8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioBitFieldOr8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioBitFieldAnd8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioBitFieldAndThenOr8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressRead16 ( - IN UINTN Address - ) -{ - return MmioRead16 (GetPciExpressAddress (Address)); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return MmioWrite16 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioOr16 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioAnd16 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioAndThenOr16 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioBitFieldWrite16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioBitFieldOr16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioBitFieldAnd16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioBitFieldAndThenOr16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressRead32 ( - IN UINTN Address - ) -{ - return MmioRead32 (GetPciExpressAddress (Address)); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return MmioWrite32 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioOr32 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioAnd32 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioAndThenOr32 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioBitFieldWrite32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioBitFieldOr32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioBitFieldAnd32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioBitFieldAndThenOr32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size read data from StartAddress. - -**/ -UINTN -EFIAPI -PciExpressReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - // - // Make sure Address is valid - // - ASSERT (((StartAddress) & ~0xfffffff) == 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - 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; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciExpressWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - // - // Make sure Address is valid - // - ASSERT (((StartAddress) & ~0xfffffff) == 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - 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/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/Allocate.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/Allocate.c deleted file mode 100644 index fe40549..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/Allocate.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - DxeServicesLib memory allocation routines - - Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - Allocates one or more 4KB pages of a given type from a memory region that is - accessible to PEI. - - Allocates the number of 4KB pages of type 'MemoryType' and returns a - pointer to the allocated buffer. The buffer returned is aligned on a 4KB - boundary. If Pages is 0, then NULL is returned. If there is not enough - memory remaining to satisfy the request, then NULL is returned. - - @param[in] MemoryType The memory type to allocate - @param[in] Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePeiAccessiblePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - - if (Pages == 0) { - return NULL; - } - - Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - return (VOID *)(UINTN)Memory; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.c deleted file mode 100644 index 3024b8f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.c +++ /dev/null @@ -1,1098 +0,0 @@ -/** @file - MDE DXE Services Library provides functions that simplify the development of DXE Drivers. - These functions help access data from sections of FFS files or from file path. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - Identify the device handle from which the Image is loaded from. As this device handle is passed to - GetSectionFromFv as the identifier for a Firmware Volume, an EFI_FIRMWARE_VOLUME2_PROTOCOL - protocol instance should be located succesfully by calling gBS->HandleProtocol (). - - This function locates the EFI_LOADED_IMAGE_PROTOCOL instance installed - on ImageHandle. It then returns EFI_LOADED_IMAGE_PROTOCOL.DeviceHandle. - - If ImageHandle is NULL, then ASSERT (); - If failed to locate a EFI_LOADED_IMAGE_PROTOCOL on ImageHandle, then ASSERT (); - - @param ImageHandle The firmware allocated handle for UEFI image. - - @retval EFI_HANDLE The device handle from which the Image is loaded from. - -**/ -EFI_HANDLE -InternalImageHandleToFvHandle ( - EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - - ASSERT (ImageHandle != NULL); - - Status = gBS->HandleProtocol ( - (EFI_HANDLE *) ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImage - ); - - ASSERT_EFI_ERROR (Status); - - // - // The LoadedImage->DeviceHandle may be NULL. - // For example for DxeCore, there is LoadedImage protocol installed for it, but the - // LoadedImage->DeviceHandle could not be initialized before the FV2 (contain DxeCore) - // protocol is installed. - // - return LoadedImage->DeviceHandle; - -} - -/** - Allocate and fill a buffer from a Firmware Section identified by a Firmware File GUID name, a Firmware - Section type and instance number from the specified Firmware Volume. - - This functions first locate the EFI_FIRMWARE_VOLUME2_PROTOCOL protocol instance on FvHandle in order to - carry out the Firmware Volume read operation. The function then reads the Firmware Section found sepcifed - by NameGuid, SectionType and SectionInstance. - - The details of this search order is defined in description of EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection () - found in PI Specification. - - If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section - is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND - is returned. - - The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated - by this function. This function can be only called at TPL_NOTIFY and below. - - If NameGuid is NULL, then ASSERT(); - If Buffer is NULL, then ASSERT(); - If Size is NULL, then ASSERT(). - - @param FvHandle The device handle that contains a instance of - EFI_FIRMWARE_VOLUME2_PROTOCOL instance. - @param NameGuid The GUID name of a Firmware File. - @param SectionType The Firmware Section type. - @param SectionInstance The instance number of Firmware Section to - read from starting from 0. - @param Buffer On output, Buffer contains the the data read - from the section in the Firmware File found. - @param Size On output, the size of Buffer. - - @retval EFI_SUCCESS The image is found and data and size is returned. - @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType - can't be found. - @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the - output data buffer or complete the operations. - @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the - Firmware Volume. - @retval EFI_ACCESS_DENIED The firmware volume containing the searched - Firmware File is configured to disallow reads. - -**/ -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 - ) -{ - EFI_STATUS Status; - EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; - UINT32 AuthenticationStatus; - - ASSERT (NameGuid != NULL); - ASSERT (Buffer != NULL); - ASSERT (Size != NULL); - - if (FvHandle == NULL) { - // - // Return EFI_NOT_FOUND directly for NULL FvHandle. - // - return EFI_NOT_FOUND; - } - - Status = gBS->HandleProtocol ( - FvHandle, - &gEfiFirmwareVolume2ProtocolGuid, - (VOID **) &Fv - ); - if (EFI_ERROR (Status)) { - return EFI_NOT_FOUND; - } - - // - // Read desired section content in NameGuid file - // - *Buffer = NULL; - *Size = 0; - Status = Fv->ReadSection ( - Fv, - NameGuid, - SectionType, - SectionInstance, - Buffer, - Size, - &AuthenticationStatus - ); - - if (EFI_ERROR (Status) && (SectionType == EFI_SECTION_TE)) { - // - // Try reading PE32 section, if the required section is TE type - // - *Buffer = NULL; - *Size = 0; - Status = Fv->ReadSection ( - Fv, - NameGuid, - EFI_SECTION_PE32, - SectionInstance, - Buffer, - Size, - &AuthenticationStatus - ); - } - - return Status; -} - -/** - Searches all the available firmware volumes and returns the first matching FFS section. - - This function searches all the firmware volumes for FFS files with FV file type specified by FileType - The order that the firmware volumes is searched is not deterministic. For each available FV a search - is made for FFS file of type FileType. If the FV contains more than one FFS file with the same FileType, - the FileInstance instance will be the matched FFS file. For each FFS file found a search - is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances - of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. - Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. - It is the caller's responsibility to use FreePool() to free the allocated buffer. - See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections - are retrieved from an FFS file based on SectionType and SectionInstance. - - If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, - the search will be retried with a section type of EFI_SECTION_PE32. - This function must be called with a TPL <= TPL_NOTIFY. - - If Buffer is NULL, then ASSERT(). - If Size is NULL, then ASSERT(). - - @param FileType Indicates the FV file type to search for within all - available FVs. - @param FileInstance Indicates which file instance within all available - FVs specified by FileType. - FileInstance starts from zero. - @param SectionType Indicates the FFS section type to search for - within the FFS file - specified by FileType with FileInstance. - @param SectionInstance Indicates which section instance within the FFS file - specified by FileType with FileInstance to retrieve. - SectionInstance starts from zero. - @param Buffer On output, a pointer to a callee allocated buffer - containing the FFS file section that was found. - Is it the caller's responsibility to free this - buffer using FreePool(). - @param Size On output, a pointer to the size, in bytes, of Buffer. - - @retval EFI_SUCCESS The specified FFS section was returned. - @retval EFI_NOT_FOUND The specified FFS section could not be found. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve - the matching FFS section. - @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a - device error. - @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because - the firmware volume that - contains the matching FFS section does not allow reads. -**/ -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 - ) -{ - 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); - - // - // Locate all available FVs. - // - HandleBuffer = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiFirmwareVolume2ProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Go through FVs one by one to find the required section data. - // - for (IndexFv = 0; IndexFv < HandleCount; IndexFv++) { - Status = gBS->HandleProtocol ( - HandleBuffer[IndexFv], - &gEfiFirmwareVolume2ProtocolGuid, - (VOID **)&Fv - ); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Use Firmware Volume 2 Protocol to search for a file of type FileType in all FVs. - // - IndexFile = FileInstance + 1; - Key = 0; - do { - Status = Fv->GetNextFile (Fv, &Key, &FileType, &NameGuid, &Attributes, Size); - if (EFI_ERROR (Status)) { - break; - } - IndexFile --; - } while (IndexFile > 0); - - // - // Fv File with the required FV file type is found. - // Search the section file in the found FV file. - // - if (IndexFile == 0) { - Status = InternalGetSectionFromFv ( - HandleBuffer[IndexFv], - &NameGuid, - SectionType, - SectionInstance, - Buffer, - Size - ); - - if (!EFI_ERROR (Status)) { - goto Done; - } - } - } - - // - // The required FFS section file is not found. - // - if (IndexFv == HandleCount) { - Status = EFI_NOT_FOUND; - } - -Done: - if (HandleBuffer != NULL) { - FreePool(HandleBuffer); - } - - return Status; -} - -/** - Searches all the availables firmware volumes and returns the first matching FFS section. - - This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid. - The order that the firmware volumes is searched is not deterministic. For each FFS file found a search - is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances - of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. - Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. - It is the caller's responsibility to use FreePool() to free the allocated buffer. - See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections - are retrieved from an FFS file based on SectionType and SectionInstance. - - If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, - the search will be retried with a section type of EFI_SECTION_PE32. - This function must be called with a TPL <= TPL_NOTIFY. - - If NameGuid is NULL, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If Size is NULL, then ASSERT(). - - - @param NameGuid A pointer to to the FFS filename GUID to search for - within any of the firmware volumes in the platform. - @param SectionType Indicates the FFS section type to search for within - the FFS file specified by NameGuid. - @param SectionInstance Indicates which section instance within the FFS file - specified by NameGuid to retrieve. - @param Buffer On output, a pointer to a callee allocated buffer - containing the FFS file section that was found. - Is it the caller's responsibility to free this buffer - using FreePool(). - @param Size On output, a pointer to the size, in bytes, of Buffer. - - @retval EFI_SUCCESS The specified FFS section was returned. - @retval EFI_NOT_FOUND The specified FFS section could not be found. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to - retrieve the matching FFS section. - @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a - device error. - @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the - firmware volume that - contains the matching FFS section does not allow reads. -**/ -EFI_STATUS -EFIAPI -GetSectionFromAnyFv ( - 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; - - // - // Search the FV that contain the caller's FFS first. - // FV builder can choose to build FFS into the this FV - // so that this implementation of GetSectionFromAnyFv - // will locate the FFS faster. - // - FvHandle = InternalImageHandleToFvHandle (gImageHandle); - 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 - ); - if (EFI_ERROR (Status)) { - goto Done; - } - - for (Index = 0; Index < HandleCount; Index++) { - // - // Skip the FV that contain the caller's FFS - // - if (HandleBuffer[Index] != FvHandle) { - Status = InternalGetSectionFromFv ( - HandleBuffer[Index], - NameGuid, - SectionType, - SectionInstance, - Buffer, - Size - ); - - if (!EFI_ERROR (Status)) { - goto Done; - } - } - - } - - if (Index == HandleCount) { - Status = EFI_NOT_FOUND; - } - -Done: - - if (HandleBuffer != NULL) { - FreePool(HandleBuffer); - } - return Status; - -} - -/** - Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section. - - This function searches the firmware volume that the currently executing module was loaded - from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found a search - is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance - instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. - Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. - It is the caller's responsibility to use FreePool() to free the allocated buffer. - See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from - an FFS file based on SectionType and SectionInstance. - - If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned. - If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, - the search will be retried with a section type of EFI_SECTION_PE32. - - This function must be called with a TPL <= TPL_NOTIFY. - If NameGuid is NULL, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If Size is NULL, then ASSERT(). - - @param NameGuid A pointer to to the FFS filename GUID to search for - within the firmware volumes that the currently - executing module was loaded from. - @param SectionType Indicates the FFS section type to search for within - the FFS file specified by NameGuid. - @param SectionInstance Indicates which section instance within the FFS file - specified by NameGuid to retrieve. - @param Buffer On output, a pointer to a callee allocated buffer - containing the FFS file section that was found. - Is it the caller's responsibility to free this buffer - using FreePool(). - @param Size On output, a pointer to the size, in bytes, of Buffer. - - - @retval EFI_SUCCESS The specified FFS section was returned. - @retval EFI_NOT_FOUND The specified FFS section could not be found. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve - the matching FFS section. - @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a - device error. - @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the - firmware volume that contains the matching FFS - section does not allow reads. -**/ -EFI_STATUS -EFIAPI -GetSectionFromFv ( - IN CONST EFI_GUID *NameGuid, - IN EFI_SECTION_TYPE SectionType, - IN UINTN SectionInstance, - OUT VOID **Buffer, - OUT UINTN *Size - ) -{ - return InternalGetSectionFromFv ( - InternalImageHandleToFvHandle(gImageHandle), - NameGuid, - SectionType, - SectionInstance, - Buffer, - Size - ); -} - - -/** - Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section. - - This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType. - If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType, - then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(), - and the size of the allocated buffer is returned in Size. It is the caller's responsibility - to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for - details on how sections are retrieved from an FFS file based on SectionType and SectionInstance. - - If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned. - If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, - the search will be retried with a section type of EFI_SECTION_PE32. - This function must be called with a TPL <= TPL_NOTIFY. - - If Buffer is NULL, then ASSERT(). - If Size is NULL, then ASSERT(). - - - @param SectionType Indicates the FFS section type to search for within - the FFS file that the currently executing module - was loaded from. - @param SectionInstance Indicates which section instance to retrieve within - the FFS file that the currently executing module - was loaded from. - @param Buffer On output, a pointer to a callee allocated buffer - containing the FFS file section that was found. - Is it the caller's responsibility to free this buffer - using FreePool(). - @param Size On output, a pointer to the size, in bytes, of Buffer. - - @retval EFI_SUCCESS The specified FFS section was returned. - @retval EFI_NOT_FOUND The specified FFS section could not be found. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve - the matching FFS section. - @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a - device error. - @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the - firmware volume that contains the matching FFS - section does not allow reads. - -**/ -EFI_STATUS -EFIAPI -GetSectionFromFfs ( - IN EFI_SECTION_TYPE SectionType, - IN UINTN SectionInstance, - OUT VOID **Buffer, - OUT UINTN *Size - ) -{ - return InternalGetSectionFromFv( - InternalImageHandleToFvHandle(gImageHandle), - &gEfiCallerIdGuid, - SectionType, - SectionInstance, - Buffer, - Size - ); -} - - -/** - Get the image file buffer data and buffer size by its device path. - - Access the file either from a firmware volume, from a file system interface, - or from the load file interface. - - Allocate memory to store the found image. The caller is responsible to free memory. - - If FilePath is NULL, then NULL is returned. - If FileSize is NULL, then NULL is returned. - If AuthenticationStatus is NULL, then NULL is returned. - - @param[in] BootPolicy Policy for Open Image File.If TRUE, indicates - that the request originates from the boot - manager, and that the boot manager is - attempting to load FilePath as a boot - selection. If FALSE, then FilePath must - match an exact file to be loaded. - @param[in] FilePath The pointer to the device path of the file - that is absracted to the file buffer. - @param[out] FileSize The pointer to the size of the abstracted - file buffer. - @param[out] AuthenticationStatus Pointer to the authentication status. - - @retval NULL FilePath is NULL, or FileSize is NULL, or AuthenticationStatus is NULL, or the file can't be found. - @retval other The abstracted file buffer. The caller is responsible to free memory. -**/ -VOID * -EFIAPI -GetFileBufferByFilePath ( - 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; - - // - // Check input File device path. - // - if (FilePath == NULL || FileSize == NULL || AuthenticationStatus == NULL) { - return NULL; - } - - // - // Init local variable - // - TempDevicePathNode = NULL; - FvNameGuid = NULL; - FileInfo = NULL; - FileHandle = NULL; - ImageBuffer = NULL; - ImageBufferSize = 0; - *AuthenticationStatus = 0; - - // - // Copy File Device Path - // - OrigDevicePathNode = DuplicateDevicePath (FilePath); - if (OrigDevicePathNode == NULL) { - return NULL; - } - - // - // Check whether this device path support FV2 protocol. - // Is so, this device path may contain a Image. - // - DevicePathNode = OrigDevicePathNode; - 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); - if (FvNameGuid == NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - // - // Read image from the firmware file - // - 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 - ); - if (EFI_ERROR (Status)) { - // - // Try a raw file, since a PE32 SECTION does not exist - // - if (ImageBuffer != NULL) { - FreePool (ImageBuffer); - *AuthenticationStatus = 0; - } - ImageBuffer = NULL; - Status = FwVol->ReadFile ( - FwVol, - FvNameGuid, - (VOID **)&ImageBuffer, - &ImageBufferSize, - &Type, - &Attrib, - AuthenticationStatus - ); - } - } - } - if (!EFI_ERROR (Status)) { - goto Finish; - } - } - - // - // Attempt to access the file via a file system interface - // - DevicePathNode = OrigDevicePathNode; - Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathNode, &Handle); - if (!EFI_ERROR (Status)) { - Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID**)&Volume); - if (!EFI_ERROR (Status)) { - // - // Open the Volume to get the File System handle - // - Status = Volume->OpenVolume (Volume, &FileHandle); - if (!EFI_ERROR (Status)) { - // - // Duplicate the device path to avoid the access to unaligned device path node. - // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH - // nodes, It assures the fields in device path nodes are 2 byte aligned. - // - TempDevicePathNode = DuplicateDevicePath (DevicePathNode); - if (TempDevicePathNode == NULL) { - FileHandle->Close (FileHandle); - // - // Setting Status to an EFI_ERROR value will cause the rest of - // the file system support below to be skipped. - // - 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 seperate. The goal is to inch - // our way down each device path node and close the previous node - // - DevicePathNode = TempDevicePathNode; - while (!EFI_ERROR (Status) && !IsDevicePathEnd (DevicePathNode)) { - if (DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH || - DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP) { - Status = EFI_UNSUPPORTED; - break; - } - - LastHandle = FileHandle; - FileHandle = NULL; - - Status = LastHandle->Open ( - LastHandle, - &FileHandle, - ((FILEPATH_DEVICE_PATH *) DevicePathNode)->PathName, - EFI_FILE_MODE_READ, - 0 - ); - - // - // Close the previous node - // - LastHandle->Close (LastHandle); - - DevicePathNode = NextDevicePathNode (DevicePathNode); - } - - if (!EFI_ERROR (Status)) { - // - // 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; - FileInfoSize = 0; - Status = FileHandle->GetInfo ( - FileHandle, - &gEfiFileInfoGuid, - &FileInfoSize, - FileInfo - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - FileInfo = AllocatePool (FileInfoSize); - if (FileInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = FileHandle->GetInfo ( - FileHandle, - &gEfiFileInfoGuid, - &FileInfoSize, - FileInfo - ); - } - } - - if (!EFI_ERROR (Status) && (FileInfo != NULL)) { - if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == 0) { - // - // Allocate space for the file - // - ImageBuffer = AllocatePool ((UINTN)FileInfo->FileSize); - if (ImageBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - // - // Read the file into the buffer we allocated - // - ImageBufferSize = (UINTN)FileInfo->FileSize; - Status = FileHandle->Read (FileHandle, &ImageBufferSize, ImageBuffer); - } - } - } - } - // - // 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; - } - } - - // - // Attempt to access the file via LoadFile2 interface - // - if (!BootPolicy) { - DevicePathNode = OrigDevicePathNode; - Status = gBS->LocateDevicePath (&gEfiLoadFile2ProtocolGuid, &DevicePathNode, &Handle); - if (!EFI_ERROR (Status)) { - 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 - ); - 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 - ); - } - } - } - if (!EFI_ERROR (Status)) { - goto Finish; - } - } - } - - // - // Attempt to access the file via LoadFile interface - // - DevicePathNode = OrigDevicePathNode; - Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &DevicePathNode, &Handle); - if (!EFI_ERROR (Status)) { - 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 - ); - if (Status == EFI_BUFFER_TOO_SMALL) { - ImageBuffer = AllocatePool (ImageBufferSize); - if (ImageBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = LoadFile->LoadFile ( - LoadFile, - DevicePathNode, - BootPolicy, - &ImageBufferSize, - ImageBuffer - ); - } - } - } - } - -Finish: - - if (EFI_ERROR (Status)) { - if (ImageBuffer != NULL) { - FreePool (ImageBuffer); - ImageBuffer = NULL; - } - *FileSize = 0; - } else { - *FileSize = ImageBufferSize; - } - - FreePool (OrigDevicePathNode); - - return ImageBuffer; -} - -/** - Searches all the available firmware volumes and returns the file device path of first matching - FFS section. - - This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid. - The order that the firmware volumes is searched is not deterministic. For each FFS file found a search - is made for FFS sections of type SectionType. - - If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, - the search will be retried with a section type of EFI_SECTION_PE32. - This function must be called with a TPL <= TPL_NOTIFY. - - If NameGuid is NULL, then ASSERT(). - - @param NameGuid A pointer to to the FFS filename GUID to search for - within any of the firmware volumes in the platform. - @param SectionType Indicates the FFS section type to search for within - the FFS file specified by NameGuid. - @param SectionInstance Indicates which section instance within the FFS file - specified by NameGuid to retrieve. - @param FvFileDevicePath Device path for the target FFS - file. - - @retval EFI_SUCCESS The specified file device path of FFS section was returned. - @retval EFI_NOT_FOUND The specified file device path of FFS section could not be found. - @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a - device error. - @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the - firmware volume that contains the matching FFS section does not - allow reads. - @retval EFI_INVALID_PARAMETER FvFileDevicePath is NULL. - -**/ -EFI_STATUS -EFIAPI -GetFileDevicePathFromAnyFv ( - IN CONST EFI_GUID *NameGuid, - IN EFI_SECTION_TYPE SectionType, - IN UINTN SectionInstance, - 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; - - if (FvFileDevicePath == NULL) { - return EFI_INVALID_PARAMETER; - } - - HandleBuffer = NULL; - FvDevicePath = NULL; - TempFvFileDevicePath = NULL; - Buffer = NULL; - Size = 0; - - // - // Search the FV that contain the caller's FFS first. - // FV builder can choose to build FFS into the this FV - // so that this implementation of GetSectionFromAnyFv - // will locate the FFS faster. - // - FvHandle = InternalImageHandleToFvHandle (gImageHandle); - Status = InternalGetSectionFromFv ( - FvHandle, - NameGuid, - SectionType, - SectionInstance, - &Buffer, - &Size - ); - if (!EFI_ERROR (Status)) { - goto Done; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiFirmwareVolume2ProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - goto Done; - } - - for (Index = 0; Index < HandleCount; Index++) { - // - // Skip the FV that contain the caller's FFS - // - if (HandleBuffer[Index] != FvHandle) { - Status = InternalGetSectionFromFv ( - HandleBuffer[Index], - NameGuid, - SectionType, - SectionInstance, - &Buffer, - &Size - ); - - if (!EFI_ERROR (Status)) { - // - // Update FvHandle to the current handle. - // - FvHandle = HandleBuffer[Index]; - goto Done; - } - } - } - - if (Index == HandleCount) { - Status = EFI_NOT_FOUND; - } - -Done: - if (Status == EFI_SUCCESS) { - // - // Build a device path to the file in the FV to pass into gBS->LoadImage - // - Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath); - if (EFI_ERROR (Status)) { - *FvFileDevicePath = NULL; - } else { - TempFvFileDevicePath = AllocateZeroPool (sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + END_DEVICE_PATH_LENGTH); - if (TempFvFileDevicePath == NULL) { - *FvFileDevicePath = NULL; - return EFI_OUT_OF_RESOURCES; - } - EfiInitializeFwVolDevicepathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH*)TempFvFileDevicePath, NameGuid); - SetDevicePathEndNode (NextDevicePathNode (TempFvFileDevicePath)); - *FvFileDevicePath = AppendDevicePath ( - FvDevicePath, - (EFI_DEVICE_PATH_PROTOCOL *)TempFvFileDevicePath - ); - FreePool (TempFvFileDevicePath); - } - } - - if (Buffer != NULL) { - FreePool (Buffer); - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf deleted file mode 100644 index c641d08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf +++ /dev/null @@ -1,65 +0,0 @@ -## @file -# DXE Services Library instance provides functions that simplify the development of DXE Drivers. -# -# DXE Services Library provides access data from sections of FFS files based on FV protocol. -# It also provides access file based on file path from a firmware volume, -# from a file system interface, or from the load file interface. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeServicesLib - MODULE_UNI_FILE = DxeServicesLib.uni - FILE_GUID = EE680C58-FFC0-4a5d-858F-66FF9C84BC9F - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DxeServicesLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 -# - -[Sources] - DxeServicesLib.c - -[Sources.IA32, Sources.EBC, Sources.ARM, Sources.AARCH64] - Allocate.c - -[Sources.X64] - X64/Allocate.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - MemoryAllocationLib - DebugLib - DevicePathLib - UefiLib - UefiBootServicesTableLib - -[LibraryClasses.X64] - HobLib - -[Guids] - gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## UNDEFINED - -[Protocols] - gEfiFirmwareVolume2ProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadFileProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadFile2ProtocolGuid ## SOMETIMES_CONSUMES - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.uni deleted file mode 100644 index 57f3176..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/DxeServicesLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// DXE Services Library instance provides functions that simplify the development of DXE Drivers. -// -// DXE Services Library provides access data from sections of FFS files based on FV protocol. -// It also provides access file based on file path from a firmware volume, -// from a file system interface, or from the load file interface. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Provides functions that simplify the development of DXE Drivers" - -#string STR_MODULE_DESCRIPTION #language en-US "A DXE Services Library provides access data from sections of FFS files based on FV protocol. It also provides access file based on file path from a firmware volume, from a file system interface, or from the load file interface." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/X64/Allocate.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/X64/Allocate.c deleted file mode 100644 index 913a8a1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesLib/X64/Allocate.c +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - DxeServicesLib memory allocation routines - - Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -/** - Allocates one or more 4KB pages of a given type from a memory region that is - accessible to PEI. - - Allocates the number of 4KB pages of type 'MemoryType' and returns a - pointer to the allocated buffer. The buffer returned is aligned on a 4KB - boundary. If Pages is 0, then NULL is returned. If there is not enough - memory remaining to satisfy the request, then NULL is returned. - - @param[in] MemoryType The memory type to allocate - @param[in] Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePeiAccessiblePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - EFI_ALLOCATE_TYPE AllocType; - EFI_PHYSICAL_ADDRESS Memory; - EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; - - if (Pages == 0) { - return NULL; - } - - AllocType = AllocateAnyPages; - // - // A X64 build of DXE may be combined with a 32-bit build of PEI, and so we - // need to check the memory limit set by PEI, and allocate below 4 GB if the - // limit is set to 4 GB or lower. - // - PhitHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList (); - if (PhitHob->EfiFreeMemoryTop <= MAX_UINT32) { - AllocType = AllocateMaxAddress; - Memory = MAX_UINT32; - } - - Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - return (VOID *)(UINTN)Memory; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c deleted file mode 100644 index 16b7689..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c +++ /dev/null @@ -1,68 +0,0 @@ -/** @file - This library implement library class DxeServiceTableLib. - It produce EFI_DXE_SERVICE pointer in global variable gDS in library's constructure. - - A DXE driver can use gDS pointer to access services in EFI_DXE_SERVICE, if this - DXE driver declare that use DxeServicesTableLib library class and link to this - library instance. - - Please attention this library instance can not be used util EFI_SYSTEM_TABLE was - initialized. - - This library contains contruct function to retrieve EFI_DXE_SERIVCE, this construct - function will be invoked in DXE driver's autogen file. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include - -// -// Cache copy of the DXE Services Table -// -EFI_DXE_SERVICES *gDS = NULL; - -/** - The constructor function caches the pointer of DXE Services Table. - - The constructor function caches the pointer of DXE Services Table. - It will ASSERT() if that operation fails. - It will ASSERT() if the pointer of DXE Services Table is NULL. - It will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -DxeServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Cache copy of the DXE Services Table - // - Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS); - ASSERT_EFI_ERROR (Status); - ASSERT (gDS != NULL); - - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf deleted file mode 100644 index bbb8d00..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf +++ /dev/null @@ -1,49 +0,0 @@ -## @file -# Instance of DXE Services Table Library using EFI Configuration Table. -# -# DXE Services Table Library that retrieves a pointer to the DXE Services -# Table from the Configuration Table in the EFI System Table. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeServicesTableLib - MODULE_UNI_FILE = DxeServicesTableLib.uni - FILE_GUID = baa1baa3-0a8d-402c-8042-985115fae953 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DxeServicesTableLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - - CONSTRUCTOR = DxeServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DxeServicesTableLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - UefiLib - DebugLib - - -[Guids] - gEfiDxeServicesTableGuid ## CONSUMES ## SystemTable - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.uni deleted file mode 100644 index e437230..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of DXE Services Table Library using EFI Configuration Table. -// -// DXE Services Table Library that retrieves a pointer to the DXE Services -// Table from the Configuration Table in the EFI System Table. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Uses EFI Configuration Table" - -#string STR_MODULE_DESCRIPTION #language en-US "DXE Services Table Library retrieves a pointer to the DXE Services Table from the Configuration Table in the EFI System Table." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c deleted file mode 100644 index cf87294..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.c +++ /dev/null @@ -1,104 +0,0 @@ -/** @file -Implementation of SmBusLib class library for DXE phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - - -#include "InternalSmbusLib.h" - - -// -// Globle varible to cache pointer to Smbus protocol. -// -EFI_SMBUS_HC_PROTOCOL *mSmbus = NULL; - -/** - The constructor function caches the pointer to Smbus protocol. - - The constructor function locates Smbus protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmbusLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID**) &mSmbus); - ASSERT_EFI_ERROR (Status); - ASSERT (mSmbus != NULL); - - return Status; -} - -/** - Executes an SMBus operation to an SMBus controller. - - This function provides a standard way to execute Smbus script - as defined in the SmBus Specification. The data can either be of - the Length byte, word, or a block of data. - - @param SmbusOperation Signifies which particular SMBus hardware protocol instance - that it will use to execute the SMBus transactions. - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Length Signifies the number of bytes that this operation will do. - The maximum number of bytes can be revision specific - and operation specific. - @param Buffer Contains the value of data to execute to the SMBus slave - device. Not all operations require this argument. The - length of this buffer is identified by Length. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The actual number of bytes that are executed for this operation. - -**/ -UINTN -InternalSmBusExec ( - IN EFI_SMBUS_OPERATION SmbusOperation, - IN UINTN SmBusAddress, - IN UINTN Length, - IN OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - RETURN_STATUS ReturnStatus; - EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress; - - SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress); - - ReturnStatus = mSmbus->Execute ( - mSmbus, - SmbusDeviceAddress, - SMBUS_LIB_COMMAND (SmBusAddress), - SmbusOperation, - SMBUS_LIB_PEC (SmBusAddress), - &Length, - Buffer - ); - if (Status != NULL) { - *Status = ReturnStatus; - } - - return Length; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf deleted file mode 100644 index 0eb8408..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf +++ /dev/null @@ -1,51 +0,0 @@ -## @file -# SMBUS Library that layers on top of the SMBUS Protocol. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeSmbusLib - MODULE_UNI_FILE = DxeSmbusLib.uni - FILE_GUID = 4F369FB1-31A7-423c-960E-B3EFD337894F - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmbusLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - CONSTRUCTOR = SmbusLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - SmbusLib.c - DxeSmbusLib.c - InternalSmbusLib.h - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - UefiBootServicesTableLib - DebugLib - - -[Protocols] - gEfiSmbusHcProtocolGuid ## CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiSmbusHcProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.uni deleted file mode 100644 index 30adce8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// SMBUS Library that layers on top of the SMBUS Protocol. -// -// SMBUS Library that layers on top of the SMBUS Protocol. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SMBUS Library that layers on top of the SMBUS Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "SMBUS Library that layers on top of the SMBUS Protocol." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h b/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h deleted file mode 100644 index 82bb301..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h +++ /dev/null @@ -1,85 +0,0 @@ -/** @file -Internal header file for Smbus library. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#ifndef __INTERNAL_SMBUS_LIB_H_ -#define __INTERNAL_SMBUS_LIB_H_ - - -#include - -#include - -#include -#include -#include -#include - -#include - -// -// Declaration for internal functions -// -/** - Executes an SMBus operation to an SMBus controller. - - This function provides a standard way to execute Smbus script - as defined in the SmBus Specification. The data can either be of - the Length byte, word, or a block of data. - - @param SmbusOperation Signifies which particular SMBus hardware protocol instance - that it will use toexecute the SMBus transactions. - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Length Signifies the number of bytes that this operation will - do. The maximum number of bytes can be revision specific - and operation specific. - @param Buffer Contains the value of data to execute to the SMBus slave - device. Not all operations require this argument. The - length of this buffer is identified by Length. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The actual number of bytes that are executed for this operation. - -**/ -UINTN -InternalSmBusExec ( - IN EFI_SMBUS_OPERATION SmbusOperation, - IN UINTN SmBusAddress, - IN UINTN Length, - IN OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ); - -/** - The constructor function caches the pointer to Smbus protocol. - - The constructor function locates Smbus protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmbusLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/SmbusLib.c b/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/SmbusLib.c deleted file mode 100644 index bdce7bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/DxeSmbusLib/SmbusLib.c +++ /dev/null @@ -1,592 +0,0 @@ -/** @file -Implementation of SmBusLib class library for DXE phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#include "InternalSmbusLib.h" - -/** - Executes an SMBUS quick read command. - - Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not - completed because a failure reflected in the Host Status - Register bit. Device errors are a result of a transaction - collision, illegal command field, unclaimed cycle (host - initiated), or bus errors (collisions). - RETURN_UNSUPPORTED: The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickRead ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusQuickRead, SmBusAddress, 0, NULL, Status); -} - -/** - Executes an SMBUS quick write command. - - Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_UNSUPPORTED: The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickWrite ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusQuickWrite, SmBusAddress, 0, NULL, Status); -} - -/** - Executes an SMBUS receive byte command. - - Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - The byte received from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle(host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte received from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReceiveByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte, Status); - - return Byte; -} - -/** - Executes an SMBUS send byte command. - - Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress. - The byte specified by Value is sent. - Only the SMBUS slave address field of SmBusAddress is required. Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to send. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle(host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusSendByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Byte = Value; - InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status); - - return Value; -} - -/** - Executes an SMBUS read data byte command. - - Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 8-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failurereflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReadDataByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status); - - return Byte; -} - -/** - Executes an SMBUS write data byte command. - - Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. - The 8-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusWriteDataByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Byte = Value; - InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status); - - return Value; -} - -/** - Executes an SMBUS read data word command. - - Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is - incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT16 -EFIAPI -SmBusReadDataWord ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status); - - return Word; -} - -/** - Executes an SMBUS write data word command. - - Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the SMBUS - command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. - (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -SmBusWriteDataWord ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Word = Value; - InternalSmBusExec (EfiSmbusWriteWord, SmBusAddress, 2, &Word, Status); - - return Value; -} - -/** - Executes an SMBUS process call command. - - Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value returned by the process call command is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is - incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The 16-bit value returned by the process call command. - -**/ -UINT16 -EFIAPI -SmBusProcessCall ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status); - - return Value; -} - -/** - Executes an SMBUS read block command. - - Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Bytes are read from the SMBUS and stored in Buffer. - The number of bytes read is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is not zero, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer The pointer to the buffer to store the bytes read from - the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the SMBUS - command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is - incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes read. - -**/ -UINTN -EFIAPI -SmBusReadBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - return InternalSmBusExec (EfiSmbusReadBlock, SmBusAddress, 0x20, Buffer, Status); -} - -/** - Executes an SMBUS write block command. - - Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from Buffer. - The number of bytes written is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - MBUS Command, SMBUS Data Length, and PEC. - @param Buffer The pointer to the buffer to store the bytes read from - the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is - incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusWriteBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Length = SMBUS_LIB_LENGTH (SmBusAddress); - return InternalSmBusExec (EfiSmbusWriteBlock, SmBusAddress, Length, Buffer, Status); -} - -/** - Executes an SMBUS block process call command. - - Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If WriteBuffer is NULL, then ASSERT(). - If ReadBuffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param WriteBuffer The pointer to the buffer of bytes to write to the SMBUS. - @param ReadBuffer The pointer to the buffer of bytes to read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is - incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusBlockProcessCall ( - IN UINTN SmBusAddress, - IN VOID *WriteBuffer, - OUT VOID *ReadBuffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - ASSERT (WriteBuffer != NULL); - ASSERT (ReadBuffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Length = SMBUS_LIB_LENGTH (SmBusAddress); - // - // Assuming that ReadBuffer is large enough to save another memory copy. - // - ReadBuffer = CopyMem (ReadBuffer, WriteBuffer, Length); - return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, ReadBuffer, Status); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c deleted file mode 100644 index 3ddd05f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - MM Services Table Library. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -EFI_MM_SYSTEM_TABLE *gMmst = NULL; - -/** - The constructor function caches the pointer of the MM Services Table. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -MmServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_MM_BASE_PROTOCOL *InternalMmBase; - - InternalMmBase = NULL; - // - // Retrieve MM Base Protocol, Do not use gBS from UefiBootServicesTableLib on purpose - // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the - // MM driver explicity declares that dependency. - // - Status = SystemTable->BootServices->LocateProtocol ( - &gEfiMmBaseProtocolGuid, - NULL, - (VOID **)&InternalMmBase - ); - ASSERT_EFI_ERROR (Status); - ASSERT (InternalMmBase != NULL); - - // - // We are in MM, retrieve the pointer to MM System Table - // - InternalMmBase->GetMmstLocation (InternalMmBase, &gMmst); - ASSERT (gMmst != NULL); - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf deleted file mode 100644 index 33001ae..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# MM Services Table Library. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x0001001B - BASE_NAME = MmServicesTableLib - MODULE_UNI_FILE = MmServicesTableLib.uni - FILE_GUID = 9508ECFD-66D1-4B4C-9415-F25F0FFF9E93 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MmServicesTableLib|DXE_SMM_DRIVER - PI_SPECIFICATION_VERSION = 0x00010032 - CONSTRUCTOR = MmServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - MmServicesTableLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - -[Protocols] - gEfiMmBaseProtocolGuid ## CONSUMES - -[Depex] - gEfiMmBaseProtocolGuid diff --git a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni deleted file mode 100644 index a02c96f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// -// MM Services Table Library. -// -// It implements MmServicesTableLib based on gEfiMmBaseProtocolGuid, which -// is simply gEfiSmmBase2ProtocolGuid under the hood. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "MM Services Table Library" - -#string STR_MODULE_DESCRIPTION #language en-US "MM Services Table Library." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c deleted file mode 100644 index 4a4f014..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - Instance of Base PCI Segment Library that support multi-segment PCI configuration access. - - PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to - support multi-segment PCI configuration access through enhanced configuration access mechanism. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "PciSegmentLibCommon.h" - -/** - Return the virtual address for the physical address. - - @param Address The physical address. - - @retval The virtual address. -**/ -UINTN -PciSegmentLibVirtualAddress ( - IN UINTN Address - ) -{ - return Address; -} - -/** - Register a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - If any reserved bits in Address are set, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciSegmentRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - // - // Use PciSegmentLibGetEcamAddress() to validate the Address. - // - DEBUG_CODE ( - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count); - ); - return RETURN_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf deleted file mode 100644 index a852257..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf +++ /dev/null @@ -1,46 +0,0 @@ -## @file -# Instance of Base PCI Segment Library that support multi-segment PCI configuration access. -# -# PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to -# support multi-segment PCI configuration access through enhanced configuration access mechanism. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BasePciSegmentLibSegmentInfo - MODULE_UNI_FILE = BasePciSegmentLibSegmentInfo.uni - FILE_GUID = 3427D883-E093-4CC9-BE85-6BD4058E96E2 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciSegmentLibCommon.h - PciSegmentLibCommon.c - BasePciSegmentLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - IoLib - DebugLib - PciSegmentInfoLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.uni b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.uni deleted file mode 100644 index 49793c8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Base PCI Segment Library that support multi-segment PCI configuration access. - -// PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to -// support multi-segment PCI configuration access through enhanced configuration access mechanism. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base PCI Segment Library that support multi-segment PCI configuration access." - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to support multi-segment PCI configuration access through enhanced configuration access mechanism." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c deleted file mode 100644 index 862dfbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c +++ /dev/null @@ -1,321 +0,0 @@ -/** @file - Instance of Runtime PCI Segment Library that support multi-segment PCI configuration access. - - PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to - support multi-segment PCI configuration access through enhanced configuration access mechanism. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "PciSegmentLibCommon.h" -#include -#include -#include -#include -#include -#include -#include - -/// -/// Define table for mapping PCI Segment MMIO physical addresses to virtual addresses at OS runtime -/// -typedef struct { - UINTN PhysicalAddress; - UINTN VirtualAddress; -} PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE; - -/// -/// Set Virtual Address Map Event -/// -EFI_EVENT mDxeRuntimePciSegmentLibVirtualNotifyEvent = NULL; - -/// -/// The number of PCI devices that have been registered for runtime access. -/// -UINTN mDxeRuntimePciSegmentLibNumberOfRuntimeRanges = 0; - -/// -/// The table of PCI devices that have been registered for runtime access. -/// -PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE *mDxeRuntimePciSegmentLibRegistrationTable = NULL; - -/// -/// The table index of the most recent virtual address lookup. -/// -UINTN mDxeRuntimePciSegmentLibLastRuntimeRange = 0; - -/** - Convert the physical PCI Express MMIO addresses for all registered PCI devices - to virtual addresses. - - @param[in] Event The event that is being processed. - @param[in] Context The Event Context. -**/ -VOID -EFIAPI -DxeRuntimePciSegmentLibVirtualNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINTN Index; - EFI_STATUS Status; - - // - // If there have been no runtime registrations, then just return - // - if (mDxeRuntimePciSegmentLibRegistrationTable == NULL) { - return; - } - - // - // Convert physical addresses associated with the set of registered PCI devices to - // virtual addresses. - // - for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) { - 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); - ASSERT_EFI_ERROR (Status); -} - -/** - The constructor function caches the PCI Express Base Address and creates a - Set Virtual Address Map event to convert physical address to virtual addresses. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor completed successfully. - @retval Other value The constructor did not complete successfully. - -**/ -EFI_STATUS -EFIAPI -DxeRuntimePciSegmentLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Register SetVirtualAddressMap () notify function - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - DxeRuntimePciSegmentLibVirtualNotify, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mDxeRuntimePciSegmentLibVirtualNotifyEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - The destructor function frees any allocated buffers and closes the Set Virtual - Address Map event. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The destructor completed successfully. - @retval Other value The destructor did not complete successfully. - -**/ -EFI_STATUS -EFIAPI -DxeRuntimePciSegmentLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // If one or more PCI devices have been registered for runtime access, then - // free the registration table. - // - if (mDxeRuntimePciSegmentLibRegistrationTable != NULL) { - FreePool (mDxeRuntimePciSegmentLibRegistrationTable); - } - - // - // Close the Set Virtual Address Map event - // - Status = gBS->CloseEvent (mDxeRuntimePciSegmentLibVirtualNotifyEvent); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Register a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - If any reserved bits in Address are set, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciSegmentRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - RETURN_STATUS Status; - EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; - UINTN Index; - VOID *NewTable; - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - UINT64 EcamAddress; - - // - // 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; - SegmentInfo = GetPciSegmentInfo (&Count); - EcamAddress = PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count); - - // - // Return an error if this function is called after ExitBootServices(). - // - if (EfiAtRuntime ()) { - return RETURN_UNSUPPORTED; - } - if (sizeof (UINTN) == sizeof (UINT32)) { - ASSERT (EcamAddress < BASE_4GB); - } - Address = (UINTN)EcamAddress; - - // - // See if Address has already been registerd for runtime access - // - for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) { - if (mDxeRuntimePciSegmentLibRegistrationTable[Index].PhysicalAddress == Address) { - return RETURN_SUCCESS; - } - } - - // - // Get the GCD Memory Descriptor for the ECAM Address - // - Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor); - if (EFI_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - // - // Mark the 4KB region for the PCI Express Bus/Dev/Func as EFI_RUNTIME_MEMORY so the OS - // will allocate a virtual address range for the 4KB PCI Configuration Header. - // - Status = gDS->SetMemorySpaceAttributes (Address, EFI_PAGE_SIZE, Descriptor.Attributes | EFI_MEMORY_RUNTIME); - if (EFI_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - // - // Grow the size of the registration table - // - NewTable = ReallocateRuntimePool ( - (mDxeRuntimePciSegmentLibNumberOfRuntimeRanges + 0) * sizeof (PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE), - (mDxeRuntimePciSegmentLibNumberOfRuntimeRanges + 1) * sizeof (PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE), - mDxeRuntimePciSegmentLibRegistrationTable - ); - if (NewTable == NULL) { - return RETURN_OUT_OF_RESOURCES; - } - mDxeRuntimePciSegmentLibRegistrationTable = NewTable; - mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].PhysicalAddress = Address; - mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].VirtualAddress = Address; - mDxeRuntimePciSegmentLibNumberOfRuntimeRanges++; - - return RETURN_SUCCESS; -} - -/** - Return the linear address for the physical address. - - @param Address The physical address. - - @retval The linear address. -**/ -UINTN -PciSegmentLibVirtualAddress ( - IN UINTN Address - ) -{ - UINTN Index; - // - // If SetVirtualAddressMap() has not been called, then just return the physical address - // - if (!EfiGoneVirtual ()) { - return Address; - } - - // - // See if there is a physical address match at the exact same index as the last address match - // - if (mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibLastRuntimeRange].PhysicalAddress == (Address & (~(UINTN)EFI_PAGE_MASK))) { - // - // Convert the physical address to a virtual address and return the virtual address - // - return (Address & EFI_PAGE_MASK) + mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibLastRuntimeRange].VirtualAddress; - } - - // - // Search the entire table for a physical address match - // - for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) { - if (mDxeRuntimePciSegmentLibRegistrationTable[Index].PhysicalAddress == (Address & (~(UINTN)EFI_PAGE_MASK))) { - // - // Cache the matching index value - // - mDxeRuntimePciSegmentLibLastRuntimeRange = Index; - // - // Convert the physical address to a virtual address and return the virtual address - // - return (Address & EFI_PAGE_MASK) + mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress; - } - } - - // - // No match was found. This is a critical error at OS runtime, so ASSERT() and force a breakpoint. - // - ASSERT (FALSE); - CpuBreakpoint (); - - // - // Return the physical address - // - return Address; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf deleted file mode 100644 index d7019f5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file -# Instance of Runtime PCI Segment Library that support multi-segment PCI configuration access. -# -# PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to -# support multi-segment PCI configuration access through enhanced configuration access mechanism. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeRuntimePciSegmentLibSegmentInfo - MODULE_UNI_FILE = DxeRuntimePciSegmentLibSegmentInfo.uni - FILE_GUID = F73EB3DE-F4E3-47CB-9F18-97796AE06314 - MODULE_TYPE = DXE_RUNTIME_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentLib|DXE_RUNTIME_DRIVER - CONSTRUCTOR = DxeRuntimePciSegmentLibConstructor - DESTRUCTOR = DxeRuntimePciSegmentLibDestructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciSegmentLibCommon.h - PciSegmentLibCommon.c - DxeRuntimePciSegmentLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - IoLib - DebugLib - PciSegmentInfoLib - UefiRuntimeLib - MemoryAllocationLib - DxeServicesTableLib - UefiBootServicesTableLib - -[Guids] - gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.uni b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.uni deleted file mode 100644 index b8cfcfa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Runtime PCI Segment Library that support multi-segment PCI configuration access. - -// PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to -// support multi-segment PCI configuration access through enhanced configuration access mechanism. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Runtime PCI Segment Library that support multi-segment PCI configuration access." - -#string STR_MODULE_DESCRIPTION #language en-US "PCI Segment Library that consumes segment information provided by PciSegmentInfoLib to support multi-segment PCI configuration access through enhanced configuration access mechanism." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c deleted file mode 100644 index 02d84d0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c +++ /dev/null @@ -1,1375 +0,0 @@ -/** @file - Provide common routines used by BasePciSegmentLibSegmentInfo and - DxeRuntimePciSegmentLibSegmentInfo libraries. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#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; -} PCI_SEGMENT_LIB_ADDRESS_STRUCTURE; - -/** - Internal function that converts PciSegmentLib format address that encodes the PCI Bus, Device, - Function and Register to ECAM (Enhanced Configuration Access Mechanism) address. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param SegmentInfo An array of PCI_SEGMENT_INFO holding the segment information. - @param Count Number of segments. - - @retval ECAM address. -**/ -UINTN -PciSegmentLibGetEcamAddress ( - 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); - - if (sizeof (UINTN) == sizeof (UINT32)) { - ASSERT (Address < BASE_4GB); - } - - return PciSegmentLibVirtualAddress ((UINTN)Address); -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 8-bit PCI configuration register specified by Address. - -**/ -UINT8 -EFIAPI -PciSegmentRead8 ( - IN UINT64 Address - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count)); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentWrite8 ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentOr8 ( - IN UINT64 Address, - IN UINT8 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAnd8 ( - IN UINT64 Address, - IN UINT8 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, - followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAndThenOr8 ( - IN UINT64 Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldRead8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldWrite8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAnd8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAndThenOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 16-bit PCI configuration register specified by Address. - -**/ -UINT16 -EFIAPI -PciSegmentRead16 ( - IN UINT64 Address - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count)); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -PciSegmentWrite16 ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentOr16 ( - IN UINT64 Address, - IN UINT16 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAnd16 ( - IN UINT64 Address, - IN UINT16 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, - followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAndThenOr16 ( - IN UINT64 Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldRead16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldWrite16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAnd16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAndThenOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 32-bit PCI configuration register specified by Address. - -**/ -UINT32 -EFIAPI -PciSegmentRead32 ( - IN UINT64 Address - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count)); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT32 -EFIAPI -PciSegmentWrite32 ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentOr32 ( - IN UINT64 Address, - IN UINT32 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAnd32 ( - IN UINT64 Address, - IN UINT32 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, - followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAndThenOr32 ( - IN UINT64 Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldRead32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldWrite32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - - Reads the 32-bit PCI configuration register specified by Address, performs a bitwise - AND between the read result and the value specified by AndData, and writes the result - to the 32-bit PCI configuration register specified by Address. The value written to - the PCI configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in AndData are stripped. - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAnd32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAndThenOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - SegmentInfo = GetPciSegmentInfo (&Count); - return MmioBitFieldAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciSegmentReadBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - UINTN Address; - - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - SegmentInfo = GetPciSegmentInfo (&Count); - Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((Address & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = MmioRead8 (Address); - Address += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, MmioRead32 (Address)); - Address += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, MmioRead16 (Address)); - Address += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Read the last remaining byte if exist - // - *(volatile UINT8 *)Buffer = MmioRead8 (Address); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return The parameter of Size. - -**/ -UINTN -EFIAPI -PciSegmentWriteBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - UINTN Count; - PCI_SEGMENT_INFO *SegmentInfo; - UINTN Address; - - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - SegmentInfo = GetPciSegmentInfo (&Count); - Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((Address & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - MmioWrite8 (Address, *(UINT8*)Buffer); - Address += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - MmioWrite32 (Address, ReadUnaligned32 (Buffer)); - Address += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - MmioWrite16 (Address, ReadUnaligned16 (Buffer)); - Address += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - MmioWrite8 (Address, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h b/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h deleted file mode 100644 index 936d499..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h +++ /dev/null @@ -1,57 +0,0 @@ -/** @file - Provide common routines used by BasePciSegmentLibSegmentInfo and - DxeRuntimePciSegmentLibSegmentInfo libraries. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _PCI_SEGMENT_LIB_COMMON_H_ -#define _PCI_SEGMENT_LIB_COMMON_H_ - -#include -#include -#include -#include -#include -#include -#include - -/** - Return the linear address for the physical address. - - @param Address The physical address. - - @retval The linear address. -**/ -UINTN -PciSegmentLibVirtualAddress ( - IN UINTN Address - ); - -/** - Internal function that converts PciSegmentLib format address that encodes the PCI Bus, Device, - Function and Register to ECAM (Enhanced Configuration Access Mechanism) address. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param SegmentInfo An array of PCI_SEGMENT_INFO holding the segment information. - @param Count Number of segments. - - @retval ECAM address. -**/ -UINTN -PciSegmentLibGetEcamAddress ( - IN UINT64 Address, - IN CONST PCI_SEGMENT_INFO *SegmentInfo, - IN UINTN Count - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c deleted file mode 100644 index d790638..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - Entry point to a the PEI Core. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -// -// The Library classes this module produced -// -#include -#include -#include - -/** - The entry point of PE/COFF Image for the PEI Core. - - This function is the entry point for the PEI Foundation, which allows the SEC phase - to pass information about the stack, temporary RAM and the Boot Firmware Volume. - In addition, it also allows the SEC phase to pass services and data forward for use - during the PEI phase in the form of one or more PPIs. - There is no limit to the number of additional PPIs that can be passed from SEC into - the PEI Foundation. As part of its initialization phase, the PEI Foundation will add - these SEC-hosted PPIs to its PPI database such that both the PEI Foundation and any - modules can leverage the associated service calls and/or code in these early PPIs. - This function is required to call ProcessModuleEntryPointList() with the Context - parameter set to NULL. ProcessModuleEntryPoint() is never expected to return. - The PEI Core is responsible for calling ProcessLibraryConstructorList() as soon as - the PEI Services Table and the file handle for the PEI Core itself have been established. - If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. - - @param SecCoreData Points to a data structure containing information about the - PEI core's operating environment, such as the size and - location of temporary RAM, the stack location and the BFV - location. - - @param PpiList Points to a list of one or more PPI descriptors to be - installed initially by the PEI core. An empty PPI list - consists of a single descriptor with the end-tag - EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. - As part of its initialization phase, the PEI Foundation will - add these SEC-hosted PPIs to its PPI database, such that both - the PEI Foundation and any modules can leverage the associated - service calls and/or code in these early PPIs. - -**/ -VOID -EFIAPI -_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); - CpuDeadLoop (); -} - - -/** - Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). - - This function is required to call _ModuleEntryPoint() passing in SecCoreData and PpiList. - - @param SecCoreData Points to a data structure containing information about the PEI core's - operating environment, such as the size and location of temporary RAM, - the stack location and the BFV location. - - @param PpiList Points to a list of one or more PPI descriptors to be installed - initially by the PEI core. An empty PPI list consists of - a single descriptor with the end-tag - EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. - As part of its initialization phase, the PEI Foundation will - add these SEC-hosted PPIs to its PPI database, such that both - the PEI Foundationand any modules can leverage the associated - service calls and/or code in these early PPIs. - -**/ -VOID -EFIAPI -EfiMain ( - IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList - ) -{ - _ModuleEntryPoint (SecCoreData, PpiList); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf deleted file mode 100644 index 5fccbef..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# Module entry point library for PEI core. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiCoreEntryPoint - MODULE_UNI_FILE = PeiCoreEntryPoint.uni - FILE_GUID = b3b0654a-969d-4096-86cb-27e262a02083 - MODULE_TYPE = PEI_CORE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeiCoreEntryPoint|PEI_CORE - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiCoreEntryPoint.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.uni deleted file mode 100644 index e5ae4b7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Module entry point library for PEI core. -// -// Module entry point library for PEI core. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for PEI core" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for PEI core." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf deleted file mode 100644 index a4c9f61..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Instance of Post Code Library based on Report Status Code Library. -# -# Post Code Library that layers on top of a Report Status Code Library instance. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiDxePostCodeLibReportStatusCode - MODULE_UNI_FILE = PeiDxePostCodeLibReportStatusCode.uni - FILE_GUID = e062c52d-78dc-4cc5-b246-b13497a8123c - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PostCodeLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER PEIM PEI_CORE UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PostCode.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - ReportStatusCodeLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni deleted file mode 100644 index 67b761a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Post Code Library based on Report Status Code Library. -// -// Post Code Library that layers on top of a Report Status Code Library instance. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Post Code Library based on Report Status Code Library" - -#string STR_MODULE_DESCRIPTION #language en-US "The Post Code Library that layers on top of a Report Status Code Library instance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c deleted file mode 100644 index 549ef9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c +++ /dev/null @@ -1,159 +0,0 @@ -/** @file - Post code library instace bases on report status code library - PostCode Library for PEIMs and DXE drivers that send PostCode to ReportStatusCode - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -/** - Converts POST code value to status code value. - - This macro converts the post code to status code value. Bits 0..4 of PostCode - are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits - 24..26 of status code value. - - @param PostCode POST code value. - - @return The converted status code value. - -**/ -#define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \ - ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19))) - -/** - Sends an 32-bit value to a POST card. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - Some implementations of this library function may perform I/O operations - directly to a POST card device. Other implementations may send Value to - ReportStatusCode(), and the status code reporting mechanism will eventually - display the 32-bit value on the status reporting device. - - PostCode() must actively prevent recursion. If PostCode() is called while - processing another any other Post Code Library function, then - PostCode() must return Value immediately. - - @param Value The 32-bit value to write to the POST card. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCode ( - IN UINT32 Value - ) -{ - REPORT_STATUS_CODE (EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value)); - return Value; -} - - -/** - Sends an 32-bit value to a POST and associated ASCII string. - - Sends the 32-bit value specified by Value to a POST card, and returns Value. - If Description is not NULL, then the ASCII string specified by Description is - also passed to the handler that displays the POST card value. Some - implementations of this library function may perform I/O operations directly - to a POST card device. Other implementations may send Value to ReportStatusCode(), - and the status code reporting mechanism will eventually display the 32-bit - value on the status reporting device. - - PostCodeWithDescription()must actively prevent recursion. If - PostCodeWithDescription() is called while processing another any other Post - Code Library function, then PostCodeWithDescription() must return Value - immediately. - - @param Value The 32-bit value to write to the POST card. - @param Description The pointer to an ASCII string that is a description of the - POST code value. This is an optional parameter that may - be NULL. - - @return The 32-bit value to write to the POST card. - -**/ -UINT32 -EFIAPI -PostCodeWithDescription ( - IN UINT32 Value, - IN CONST CHAR8 *Description OPTIONAL - ) -{ - if (Description == NULL) { - REPORT_STATUS_CODE ( - EFI_PROGRESS_CODE, - POST_CODE_TO_STATUS_CODE_VALUE (Value) - ); - } else { - REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( - EFI_PROGRESS_CODE, - POST_CODE_TO_STATUS_CODE_VALUE (Value), - Description, - AsciiStrSize (Description) - ); - } - - return Value; -} - - -/** - Returns TRUE if POST Codes are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if POST code descriptions are enabled. - - This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED - bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned. - - @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is set. - @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of - PcdPostCodeProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -PostCodeDescriptionEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c deleted file mode 100644 index 70dd998..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c +++ /dev/null @@ -1,519 +0,0 @@ -/** @file - Provide generic extract guided section functions for PEI phase. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include - -#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; -} PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO; - -/** - Build guid hob for the global memory to store the registered guid and Handler list. - If GuidHob exists, HandlerInfo will be directly got from Guid hob data. - - @param[in, out] InfoPointer The pointer to pei handler information structure. - - @retval RETURN_SUCCESS Build Guid hob for the global memory space to store guid and function tables. - @retval RETURN_OUT_OF_RESOURCES No enough memory to allocated. -**/ -RETURN_STATUS -PeiGetExtractGuidedSectionHandlerInfo ( - IN OUT PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer - ) -{ - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - EFI_PEI_HOB_POINTERS Hob; - - // - // First try to get handler information from guid hob specified by CallerId. - // - 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); - 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) - ); - } - // - // Return HandlerInfo pointer. - // - *InfoPointer = HandlerInfo; - return EFI_SUCCESS; - } - } - Hob.Raw = GET_NEXT_HOB (Hob); - Hob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, Hob.Raw); - } - - // - // 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)) - ); - if (HandlerInfo == NULL) { - // - // No enough resource to build guid hob. - // - *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) - ); - // - // return the created HandlerInfo. - // - *InfoPointer = HandlerInfo; - return EFI_SUCCESS; -} - -/** - Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers(). - - Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs. - The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated - and caller must treat this array of GUIDs as read-only data. - If ExtractHandlerGuidTable is NULL, then ASSERT(). - - @param[out] ExtractHandlerGuidTable A pointer to the array of GUIDs that have been registered through - ExtractGuidedSectionRegisterHandlers(). - - @return the number of the supported extract guided Handler. - -**/ -UINTN -EFIAPI -ExtractGuidedSectionGetGuidList ( - OUT GUID **ExtractHandlerGuidTable - ) -{ - EFI_STATUS Status; - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - ASSERT (ExtractHandlerGuidTable != NULL); - - // - // Get all registered handler information - // - Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (EFI_ERROR (Status)) { - *ExtractHandlerGuidTable = NULL; - return 0; - } - - // - // Get GuidTable and Table Number - // - ASSERT (HandlerInfo != NULL); - *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable; - return HandlerInfo->NumberOfExtractHandler; -} - -/** - Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER - for a specific GUID section type. - - Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid. - If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED. - If there are not enough resources available to register the handlers then RETURN_OUT_OF_RESOURCES is returned. - - If SectionGuid is NULL, then ASSERT(). - If GetInfoHandler is NULL, then ASSERT(). - If DecodeHandler is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the the handlers - of the GUIDed section type being registered. - @param[in] GetInfoHandler The pointer to a function that examines a GUIDed section and returns the - size of the decoded buffer and the size of an optional scratch buffer - required to actually decode the data in a GUIDed section. - @param[in] DecodeHandler The pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. - - @retval RETURN_SUCCESS The handlers were registered. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to register the handlers. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionRegisterHandlers ( - IN CONST GUID *SectionGuid, - IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, - IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler - ) -{ - EFI_STATUS Status; - UINT32 Index; - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - // - // Check input parameter - // - ASSERT (SectionGuid != NULL); - ASSERT (GetInfoHandler != NULL); - ASSERT (DecodeHandler != NULL); - - - - // - // Get the registered handler information - // - Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Search the match registered GetInfo handler for the input guided section. - // - ASSERT (HandlerInfo != NULL); - 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; - return RETURN_SUCCESS; - } - } - - // - // Check the global table is enough to contain new Handler. - // - if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) { - return RETURN_OUT_OF_RESOURCES; - } - - // - // Register new Handler and guid value. - // - CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid); - 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, - sizeof (GUID) - ); - - return RETURN_SUCCESS; -} - -/** - Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to retrieve and return the size of the decoded buffer and the size of an - optional scratch buffer required to actually decode the data in a GUIDed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of - type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBufferSize is NULL, then ASSERT(). - If ScratchBufferSize is NULL, then ASSERT(). - If SectionAttribute is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required if the buffer - specified by InputSection were decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space if the buffer specified by - InputSection were decoded. - @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes field of - EFI_GUID_DEFINED_SECTION in the PI Specification. - - @retval RETURN_SUCCESS Get the required information successfully. - @retval RETURN_UNSUPPORTED The GUID from the section specified by InputSection does not match any of - the GUIDs registered with ExtractGuidedSectionRegisterHandlers(). - @retval Others The return status from the handler associated with the GUID retrieved from - the section specified by InputSection. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetInfo ( - IN CONST VOID *InputSection, - OUT UINT32 *OutputBufferSize, - OUT UINT32 *ScratchBufferSize, - OUT UINT16 *SectionAttribute - ) -{ - UINT32 Index; - EFI_STATUS Status; - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - EFI_GUID *SectionDefinitionGuid; - - // - // Check input parameter - // - ASSERT (InputSection != NULL); - ASSERT (OutputBufferSize != NULL); - ASSERT (ScratchBufferSize != NULL); - ASSERT (SectionAttribute != NULL); - - // - // Get all registered handler information. - // - Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (EFI_ERROR (Status)) { - return Status; - } - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - 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 ++) { - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type - EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers(). - The selected handler is used to decode the data in a GUIDed section and return the result in a caller - allocated output buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(), - then RETURN_UNSUPPORTED is returned. - If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler - of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers() - is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this - decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the data in InputSection, - then OutputBuffer is set to point at the data in InputSection. Otherwise, the decoded data will be placed in caller - allocated buffer specified by OutputBuffer. This function is responsible for computing the EFI_AUTH_STATUS_PLATFORM_OVERRIDE - bit of in AuthenticationStatus. The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned. - - If InputSection is NULL, then ASSERT(). - If OutputBuffer is NULL, then ASSERT(). - If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file. - @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. - @param[in] ScratchBuffer A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation. - @param[out] AuthenticationStatus - A pointer to the authentication status of the decoded output buffer. See the definition - of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI - Specification. - - @retval RETURN_SUCCESS The buffer specified by InputSection was decoded. - @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionDecode ( - IN CONST VOID *InputSection, - OUT VOID **OutputBuffer, - IN VOID *ScratchBuffer, OPTIONAL - OUT UINT32 *AuthenticationStatus - ) -{ - UINT32 Index; - EFI_STATUS Status; - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - EFI_GUID *SectionDefinitionGuid; - - // - // Check input parameter - // - ASSERT (InputSection != NULL); - ASSERT (OutputBuffer != NULL); - ASSERT (AuthenticationStatus != NULL); - - // - // Get all registered handler information. - // - Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (EFI_ERROR (Status)) { - return Status; - } - - if (IS_SECTION2 (InputSection)) { - SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); - } else { - 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 ++) { - 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 - ); - } - } - - // - // Not found, the input guided section is not supported. - // - return RETURN_UNSUPPORTED; -} - -/** - Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and - EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type. - - Retrieves the handlers associated with SectionGuid and returns them in - GetInfoHandler and DecodeHandler. - - If the GUID value specified by SectionGuid has not been registered, then - return RETURN_NOT_FOUND. - - If SectionGuid is NULL, then ASSERT(). - - @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed - section type being retrieved. - @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns - the size of the decoded buffer and the size of an optional scratch - buffer required to actually decode the data in a GUIDed section. - This is an optional parameter that may be NULL. If it is NULL, then - the previously registered handler is not returned. - @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller - allocated output buffer. This is an optional parameter that may be NULL. - If it is NULL, then the previously registered handler is not returned. - - @retval RETURN_SUCCESS The handlers were retrieved. - @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID. - -**/ -RETURN_STATUS -EFIAPI -ExtractGuidedSectionGetHandlers ( - IN CONST GUID *SectionGuid, - OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL - OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL - ) -{ - EFI_STATUS Status; - UINT32 Index; - PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; - - // - // Check input parameter - // - ASSERT (SectionGuid != NULL); - - // - // Get the registered handler information - // - Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Search the match registered GetInfo handler for the input guided section. - // - ASSERT (HandlerInfo != NULL); - 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/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf deleted file mode 100644 index d2cc94a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Instance of ExtractGuidedSection Library for PEI phase. -# -# This library provides generic extract guided section functions for PEIM and PEI_CORE module. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiExtractGuidedSectionLib - MODULE_UNI_FILE = PeiExtractGuidedSectionLib.uni - FILE_GUID = 41ddf016-2a11-415f-8880-00d938e9541a - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = ExtractGuidedSectionLib|PEIM PEI_CORE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiExtractGuidedSectionLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - DebugLib - HobLib - PcdLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.uni deleted file mode 100644 index 6842496..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of ExtractGuidedSection Library for PEI phase. -// -// This library provides generic extract guided section functions for PEIM and PEI_CORE module. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Extract Guided Section Library" - -#string STR_MODULE_DESCRIPTION #language en-US "This library provides generic extract guided section functions for PEIM and PEI_CORE modules." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/HobLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/HobLib.c deleted file mode 100644 index c37cded..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/HobLib.c +++ /dev/null @@ -1,858 +0,0 @@ -/** @file - Provide Hob Library functions for Pei phase. - -Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include - -#include -#include -#include -#include - -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer - to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through - the EFI System Table by looking up theHOB list GUID in the System Configuration Table. - Since the System Configuration Table does not exist that the time the DXE Core is - launched, the DXE Core uses a global variable from the DXE Core Entry Point Library - to manage the pointer to the HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - EFI_STATUS Status; - VOID *HobList; - - Status = PeiServicesGetHobList (&HobList); - ASSERT_EFI_ERROR (Status); - ASSERT (HobList != NULL); - - return HobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If there does not exist such HOB from the starting HOB pointer, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - 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; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If there does not exist such HOB from the starting HOB pointer, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID. - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_STATUS Status; - EFI_BOOT_MODE BootMode; - - Status = PeiServicesGetBootMode (&BootMode); - ASSERT_EFI_ERROR (Status); - - return BootMode; -} - -/** - Adds a new HOB to the HOB List. - - This internal function enables PEIMs to create various types of HOBs. - - @param Type Type of the new HOB. - @param Length Length of the new HOB to allocate. - - @retval NULL The HOB could not be allocated. - @retval others The address of new HOB. - -**/ -VOID * -EFIAPI -InternalPeiCreateHob ( - IN UINT16 Type, - IN UINT16 Length - ) -{ - 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. - // - ASSERT (Hob != NULL); - return Hob; -} - -/** - Builds a HOB for a loaded PE32 module. - - This function builds a HOB for a loaded PE32 module. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If ModuleName is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param ModuleName The GUID File Name of the module. - @param MemoryAllocationModule The 64 bit physical address of the module. - @param ModuleLength The length of the module in bytes. - @param EntryPoint The 64 bit physical address of the module entry point. - -**/ -VOID -EFIAPI -BuildModuleHob ( - 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)); - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE)); - if (Hob == NULL) { - return; - } - - CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid); - Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule; - Hob->MemoryAllocationHeader.MemoryLength = ModuleLength; - Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode; - - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved)); - - CopyGuid (&Hob->ModuleName, ModuleName); - Hob->EntryPoint = EntryPoint; -} - -/** - Builds a HOB that describes a chunk of system memory with Owner GUID. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - @param OwnerGUID GUID for the owner of this resource. - -**/ -VOID -EFIAPI -BuildResourceDescriptorWithOwnerHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes, - IN EFI_GUID *OwnerGUID - ) -{ - EFI_HOB_RESOURCE_DESCRIPTOR *Hob; - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR)); - if (Hob == NULL) { - return; - } - - Hob->ResourceType = ResourceType; - Hob->ResourceAttribute = ResourceAttribute; - Hob->PhysicalStart = PhysicalStart; - Hob->ResourceLength = NumberOfBytes; - - CopyGuid (&Hob->Owner, OwnerGUID); -} - -/** - Builds a HOB that describes a chunk of system memory. - - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory described by this HOB. - @param PhysicalStart The 64 bit physical address of memory described by this HOB. - @param NumberOfBytes The length of the memory described by this HOB in bytes. - -**/ -VOID -EFIAPI -BuildResourceDescriptorHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes - ) -{ - EFI_HOB_RESOURCE_DESCRIPTOR *Hob; - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR)); - if (Hob == NULL) { - return; - } - - Hob->ResourceType = ResourceType; - Hob->ResourceAttribute = ResourceAttribute; - Hob->PhysicalStart = PhysicalStart; - Hob->ResourceLength = NumberOfBytes; - ZeroMem (&(Hob->Owner), sizeof (EFI_GUID)); -} - -/** - Builds a customized HOB tagged with a GUID for identification and returns - the start address of GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification - and returns the start address of GUID HOB data so that caller can fill the customized data. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidHob ( - IN CONST EFI_GUID *Guid, - IN UINTN DataLength - ) -{ - EFI_HOB_GUID_TYPE *Hob; - - // - // Make sure Guid is valid - // - ASSERT (Guid != NULL); - - // - // Make sure that data length is not too long. - // - ASSERT (DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE))); - - 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; -} - -/** - Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB - data field, and returns the start address of the GUID HOB data. - - This function builds a customized HOB tagged with a GUID for identification and copies the input - data to the HOB data field and returns the start address of the GUID HOB data. It can only be - invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If Guid is NULL, then ASSERT(). - If Data is NULL and DataLength > 0, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). - HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8. - - @param Guid The GUID to tag the customized HOB. - @param Data The data to be copied into the data field of the GUID HOB. - @param DataLength The size of the data payload for the GUID HOB. - - @retval NULL The GUID HOB could not be allocated. - @retval others The start address of GUID HOB data. - -**/ -VOID * -EFIAPI -BuildGuidDataHob ( - IN CONST EFI_GUID *Guid, - IN VOID *Data, - IN UINTN DataLength - ) -{ - VOID *HobData; - - ASSERT (Data != NULL || DataLength == 0); - - HobData = BuildGuidHob (Guid, DataLength); - if (HobData == NULL) { - return HobData; - } - - return CopyMem (HobData, Data, DataLength); -} - -/** - Check FV alignment. - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - - @retval TRUE FvImage buffer is at its required alignment. - @retval FALSE FvImage buffer is not at its required alignment. - -**/ -BOOLEAN -InternalCheckFvAlignment ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; - UINT32 FvAlignment; - - FvAlignment = 0; - 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 - // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from - // its initial linked location and maintain its alignment. - // - if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) { - // - // Get FvHeader alignment - // - FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16); - // - // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value. - // - if (FvAlignment < 8) { - FvAlignment = 8; - } - if ((UINTN)BaseAddress % FvAlignment != 0) { - // - // FvImage buffer is not at its required alignment. - // - DEBUG (( - DEBUG_ERROR, - "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n", - BaseAddress, - Length, - FvAlignment - )); - return FALSE; - } - } - - return TRUE; -} - -/** - Builds a Firmware Volume HOB. - - This function builds a Firmware Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - -**/ -VOID -EFIAPI -BuildFvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - EFI_HOB_FIRMWARE_VOLUME *Hob; - - if (!InternalCheckFvAlignment (BaseAddress, Length)) { - ASSERT (FALSE); - return; - } - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME)); - if (Hob == NULL) { - return; - } - - Hob->BaseAddress = BaseAddress; - Hob->Length = Length; -} - -/** - Builds a EFI_HOB_TYPE_FV2 HOB. - - This function builds a EFI_HOB_TYPE_FV2 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param FvName The name of the Firmware Volume. - @param FileName The name of the file. - -**/ -VOID -EFIAPI -BuildFv2Hob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN CONST EFI_GUID *FvName, - IN CONST EFI_GUID *FileName - ) -{ - EFI_HOB_FIRMWARE_VOLUME2 *Hob; - - if (!InternalCheckFvAlignment (BaseAddress, Length)) { - ASSERT (FALSE); - return; - } - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2)); - if (Hob == NULL) { - return; - } - - Hob->BaseAddress = BaseAddress; - Hob->Length = Length; - CopyGuid (&Hob->FvName, FvName); - CopyGuid (&Hob->FileName, FileName); -} - -/** - Builds a EFI_HOB_TYPE_FV3 HOB. - - This function builds a EFI_HOB_TYPE_FV3 HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). - - @param BaseAddress The base address of the Firmware Volume. - @param Length The size of the Firmware Volume in bytes. - @param AuthenticationStatus The authentication status. - @param ExtractedFv TRUE if the FV was extracted as a file within - another firmware volume. FALSE otherwise. - @param FvName The name of the Firmware Volume. - Valid only if IsExtractedFv is TRUE. - @param FileName The name of the file. - Valid only if IsExtractedFv is TRUE. - -**/ -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 - ) -{ - EFI_HOB_FIRMWARE_VOLUME3 *Hob; - - if (!InternalCheckFvAlignment (BaseAddress, Length)) { - ASSERT (FALSE); - return; - } - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3)); - if (Hob == NULL) { - return; - } - - Hob->BaseAddress = BaseAddress; - Hob->Length = Length; - Hob->AuthenticationStatus = AuthenticationStatus; - Hob->ExtractedFv = ExtractedFv; - if (ExtractedFv) { - CopyGuid (&Hob->FvName, FvName); - CopyGuid (&Hob->FileName, FileName); - } -} - -/** - Builds a Capsule Volume HOB. - - This function builds a Capsule Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If the platform does not support Capsule Volume HOBs, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The base address of the Capsule Volume. - @param Length The size of the Capsule Volume in bytes. - -**/ -VOID -EFIAPI -BuildCvHob ( - 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)); - if (Hob == NULL) { - return; - } - - Hob->BaseAddress = BaseAddress; - Hob->Length = Length; -} - -/** - Builds a HOB for the CPU. - - This function builds a HOB for the CPU. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param SizeOfMemorySpace The maximum physical memory addressability of the processor. - @param SizeOfIoSpace The maximum physical I/O addressability of the processor. - -**/ -VOID -EFIAPI -BuildCpuHob ( - IN UINT8 SizeOfMemorySpace, - IN UINT8 SizeOfIoSpace - ) -{ - EFI_HOB_CPU *Hob; - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU)); - if (Hob == NULL) { - return; - } - - Hob->SizeOfMemorySpace = SizeOfMemorySpace; - Hob->SizeOfIoSpace = SizeOfIoSpace; - - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->Reserved, sizeof (Hob->Reserved)); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - 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)); - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK)); - if (Hob == NULL) { - return; - } - - CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid); - Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress; - Hob->AllocDescriptor.MemoryLength = Length; - Hob->AllocDescriptor.MemoryType = EfiBootServicesData; - - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved)); -} - -/** - Builds a HOB for the BSP store. - - This function builds a HOB for BSP store. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the BSP. - @param Length The length of the BSP store in bytes. - @param MemoryType The type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildBspStoreHob ( - 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)); - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE)); - if (Hob == NULL) { - return; - } - - CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid); - Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress; - Hob->AllocDescriptor.MemoryLength = Length; - Hob->AllocDescriptor.MemoryType = MemoryType; - - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved)); -} - -/** - Builds a HOB for the memory allocation. - - This function builds a HOB for the memory allocation. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. - - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the memory. - @param Length The length of the memory allocation in bytes. - @param MemoryType The type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildMemoryAllocationHob ( - 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)); - - Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION)); - if (Hob == NULL) { - return; - } - - ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID)); - Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress; - Hob->AllocDescriptor.MemoryLength = Length; - Hob->AllocDescriptor.MemoryType = MemoryType; - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved)); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.inf deleted file mode 100644 index 0a04ba7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.inf +++ /dev/null @@ -1,56 +0,0 @@ -## @file -# Instance of HOB Library using PEI Services. -# -# HOB Library implementation that uses PEI Services to retrieve the HOB List. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiHobLib - MODULE_UNI_FILE = PeiHobLib.uni - FILE_GUID = 9643128f-ac24-4b3e-b6be-d8849a306153 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = HobLib|PEIM PEI_CORE SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - HobLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - PeiServicesLib - DebugLib - -[Guids] - gEfiHobMemoryAllocStackGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation StackHob - gEfiHobMemoryAllocBspStoreGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation BspStoreHob - gEfiHobMemoryAllocModuleGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation ModuleHob - -# -# [Hob] -# MEMORY_ALLOCATION ## SOMETIMES_PRODUCES -# RESOURCE_DESCRIPTOR ## SOMETIMES_PRODUCES -# FIRMWARE_VOLUME ## SOMETIMES_PRODUCES -# - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.uni deleted file mode 100644 index 38fc17c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiHobLib/PeiHobLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of HOB Library using PEI Services. -// -// HOB Library implementation that uses PEI Services to retrieve the HOB List. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of HOB Library using PEI Services" - -#string STR_MODULE_DESCRIPTION #language en-US "HOB Library implementation that uses PEI Services to retrieve the HOB List." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c deleted file mode 100644 index 707d83a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c +++ /dev/null @@ -1,2356 +0,0 @@ -/** @file - High-level Io/Mmio functions. - - All assertions for bit field operations are handled bit field functions in the - Base Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -/** - Reads an 8-bit I/O port, performs a bitwise OR, and writes the - result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoOr8 ( - IN UINTN Port, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back - to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAnd8 ( - IN UINTN Port, - IN UINT8 AndData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAndThenOr8 ( - IN UINTN Port, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in an 8-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoBitFieldRead8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldWrite8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return IoWrite8 ( - Port, - BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAnd8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return IoWrite8 ( - Port, - BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 8-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAndThenOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit I/O port, performs a bitwise OR, and writes the - result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoOr16 ( - IN UINTN Port, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back - to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAnd16 ( - IN UINTN Port, - IN UINT16 AndData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAndThenOr16 ( - IN UINTN Port, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 16-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoBitFieldRead16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldWrite16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return IoWrite16 ( - Port, - BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAnd16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return IoWrite16 ( - Port, - BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 16-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAndThenOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit I/O port, performs a bitwise OR, and writes the - result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoOr32 ( - IN UINTN Port, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) | OrData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back - to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAnd32 ( - IN UINTN Port, - IN UINT32 AndData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) & AndData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAndThenOr32 ( - IN UINTN Port, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 32-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoBitFieldRead32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldWrite32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return IoWrite32 ( - Port, - BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAnd32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return IoWrite32 ( - Port, - BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 32-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAndThenOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit I/O port, performs a bitwise OR, and writes the - result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoOr64 ( - IN UINTN Port, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) | OrData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back - to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAnd64 ( - IN UINTN Port, - IN UINT64 AndData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) & AndData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAndThenOr64 ( - IN UINTN Port, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 64-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoBitFieldRead64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldWrite64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return IoWrite64 ( - Port, - BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAnd64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return IoWrite64 ( - Port, - BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAndThenOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise OR, and writes the - result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result - back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 8-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in an 8-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 8-bit register is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioWrite8 ( - Address, - BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 8-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise OR, and writes the - result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result - back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 16-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 16-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 16-bit register is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioWrite16 ( - Address, - BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 16-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise OR, and writes the - result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) | OrData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result - back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) & AndData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 32-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 32-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 32-bit register is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioWrite32 ( - Address, - BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 32-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise OR, and writes the - result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioOr64 ( - IN UINTN Address, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) | OrData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result - back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAnd64 ( - IN UINTN Address, - IN UINT64 AndData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) & AndData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - OR, and writes the result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 64-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAndThenOr64 ( - IN UINTN Address, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 64-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioBitFieldRead64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 64-bit register is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldWrite64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return MmioWrite64 ( - Address, - BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAnd64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 64-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAndThenOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData) - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLib.c deleted file mode 100644 index 6b8141e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLib.c +++ /dev/null @@ -1,835 +0,0 @@ -/** @file - I/O Library. The implementations are based on EFI_PEI_SERVICE->CpuIo interface. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The port is read Count times, and the read data is stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifoWorker ( - IN UINTN Port, - IN EFI_PEI_CPU_IO_PPI_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - EFI_STATUS Status; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - - Status = CpuIo->Io.Read (PeiServices, CpuIo, Width, Port, Count, Buffer); - ASSERT_EFI_ERROR (Status); -} - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width specified by Width. - The port is written Count times, and the write data is retrieved from the provided Buffer. - - This function must guarantee that all I/O read and write operations are serialized. - If such operations are not supported, then ASSERT(). - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Count The number of times to write I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoWriteFifoWorker ( - IN UINTN Port, - IN EFI_PEI_CPU_IO_PPI_WIDTH Width, - IN UINTN Count, - IN VOID *Buffer - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - EFI_STATUS Status; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - - Status = CpuIo->Io.Write (PeiServices, CpuIo, Width, Port, Count, Buffer); - ASSERT_EFI_ERROR (Status); -} - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - 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); -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - 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); - return Value; -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port); -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value); - return Value; -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port); -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value); - return Value; -} - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port); -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value); - return Value;; -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer); -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - IoWriteFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer); -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint16, Count, Buffer); -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - IoWriteFifoWorker (Port, EfiPeiCpuIoWidthFifoUint16, Count, Buffer); -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint32, Count, Buffer); -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - IoWriteFifoWorker (Port, EfiPeiCpuIoWidthFifoUint32, Count, Buffer); -} - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - 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); -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - 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); - return Value; -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address); - -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value); - return Value; -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address); - -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - - @return Value. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value); - return Value; -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & (sizeof (UINT64) - 1)) == 0); - return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address); - -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_PEI_CPU_IO_PPI *CpuIo; - - PeiServices = GetPeiServicesTablePointer (); - CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & 7) == 0); - CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value); - return Value; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c deleted file mode 100644 index 5453d13..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c +++ /dev/null @@ -1,418 +0,0 @@ -/** @file - I/O Library MMIO Buffer Functions. - The implementations are based on EFI_PEI_SERVICE->CpuIo interface. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include - -/** - Copy data from MMIO region to system memory by using 8-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 8-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioReadBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = Buffer; - - while (Length-- != 0) { - *(Buffer++) = MmioRead8 (StartAddress++); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 16-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 16-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioReadBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead16 (StartAddress); - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 32-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 32-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioReadBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead32 (StartAddress); - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 64-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 64-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioReadBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length != 0) { - *(Buffer++) = MmioRead64 (StartAddress); - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 8-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 8-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioWriteBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT8 *Buffer - ) -{ - VOID* ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = (UINT8 *) Buffer; - - while (Length-- != 0) { - MmioWrite8 (StartAddress++, *(Buffer++)); - } - - return ReturnBuffer; - -} - -/** - Copy data from system memory to MMIO region by using 16-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 16-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioWriteBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = (UINT16 *) Buffer; - - while (Length != 0) { - MmioWrite16 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 32-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 32-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioWriteBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = (UINT32 *) Buffer; - - while (Length != 0) { - MmioWrite32 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from system memory to MMIO region by using 64-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 64-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size, in bytes, of Buffer. - @param Buffer The pointer to a system memory buffer containing the data to write. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioWriteBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = (UINT64 *) Buffer; - - while (Length != 0) { - MmioWrite64 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf deleted file mode 100644 index 7c1b680..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Instance of I/O Library using CPU I/O PPI. -# -# I/O Library implementation that uses the CPU I/O PPI for I/O -# and MMIO operations. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiIoLibCpuIo - MODULE_UNI_FILE = PeiIoLibCpuIo.uni - FILE_GUID = b2585b69-fb63-4220-844a-8fbea8bf01af - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib|PEIM PEI_CORE SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - IoHighLevel.c - IoLib.c - IoLibMmioBuffer.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PeiServicesTablePointerLib - BaseLib - DebugLib - -[Depex.common.PEIM] - gEfiPeiCpuIoPpiInstalledGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.uni deleted file mode 100644 index 4931d69..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of I/O Library using CPU I/O PPI. -// -// I/O Library implementation that uses the CPU I/O PPI for I/O -// and MMIO operations. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of I/O Library using CPU I/O PPI" - -#string STR_MODULE_DESCRIPTION #language en-US "I/O Library implementation that uses the CPU I/O PPI for I/O and MMIO operations." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c deleted file mode 100644 index 1b512d8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c +++ /dev/null @@ -1,848 +0,0 @@ -/** @file - Support routines for memory allocation routines - based on PeiService for PEI phase drivers. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - - -#include -#include -#include -#include -#include - - -/** - Allocates one or more 4KB pages of a certain memory type. - - Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated - buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. - If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - - if (Pages == 0) { - return NULL; - } - - Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - - return (VOID *) (UINTN) Memory; -} - -/** - Allocates one or more 4KB pages of type EfiBootServicesData. - - Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiBootServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData. - - Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiRuntimeServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType. - - Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiReservedMemoryType, Pages); -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the page allocation - functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer - must have been allocated on a previous call to the page allocation services of the Memory - Allocation Library. If it is not possible to free allocated pages, then this function will - perform no actions. - - If Buffer was not allocated with a page allocation function in the Memory Allocation Library, - then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreePages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages); - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates one or more 4KB pages of a certain memory type at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment - specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned. - If there is not enough memory at the specified alignment remaining to satisfy the request, then - NULL is returned. - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateAlignedPages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - IN UINTN Alignment - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - UINTN AlignedMemory; - UINTN AlignmentMask; - UINTN UnalignedPages; - UINTN RealPages; - - // - // Alignment must be a power of two or zero. - // - ASSERT ((Alignment & (Alignment - 1)) == 0); - - 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); - // - // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow. - // - ASSERT (RealPages > Pages); - - Status = PeiServicesAllocatePages (MemoryType, RealPages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask; - UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory); - if (UnalignedPages > 0) { - // - // Free first unaligned page(s). - // - Status = PeiServicesFreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages); - UnalignedPages = RealPages - Pages - UnalignedPages; - if (UnalignedPages > 0) { - // - // Free last unaligned page(s). - // - Status = PeiServicesFreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - } else { - // - // Do not over-allocate pages in this case. - // - Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - AlignedMemory = (UINTN) Memory; - } - return (VOID *) AlignedMemory; -} - -/** - Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedRuntimePages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedReservedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment); -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the aligned page - allocation functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer - must have been allocated on a previous call to the aligned page allocation services of the Memory - Allocation Library. If it is not possible to free allocated pages, then this function will - perform no actions. - - If Buffer was not allocated with an aligned page allocation function in the Memory Allocation - Library, then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreeAlignedPages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages); - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type and returns a - pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePool ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN AllocationSize - ) -{ - // - // If we need lots of small runtime/reserved memory type from PEI in the future, - // we can consider providing a more complex algorithm that allocates runtime pages and - // provide pool allocations from those pages. - // - return InternalAllocatePages (MemoryType, EFI_SIZE_TO_PAGES (AllocationSize)); -} - -/** - Allocates a buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a - pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePool ( - IN UINTN AllocationSize - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - Status = PeiServicesAllocatePool (AllocationSize, &Buffer); - if (EFI_ERROR (Status)) { - Buffer = NULL; - } - return Buffer; -} - -/** - Allocates a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiReservedMemoryType, AllocationSize); -} - -/** - Allocates and zeros a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer - with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid - buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, - then NULL is returned. - - @param PoolType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateZeroPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = ZeroMem (Memory, AllocationSize); - } - return Memory; -} - -/** - Allocates and zeros a buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateZeroPool ( - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - Memory = AllocatePool (AllocationSize); - if (Memory != NULL) { - Memory = ZeroMem (Memory, AllocationSize); - } - return Memory; -} - -/** - Allocates and zeros a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates and zeros a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize); -} - -/** - Copies a buffer to an allocated buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateCopyPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - VOID *Memory; - - ASSERT (Buffer != NULL); - ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1)); - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = CopyMem (Memory, Buffer, AllocationSize); - } - return Memory; -} - -/** - Copies a buffer to an allocated buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - VOID *Memory; - - ASSERT (Buffer != NULL); - ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1)); - - Memory = AllocatePool (AllocationSize); - if (Memory != NULL) { - Memory = CopyMem (Memory, Buffer, AllocationSize); - } - return Memory; -} - -/** - Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer); -} - -/** - Copies a buffer to an allocated buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer); -} - -/** - Reallocates a buffer of a specified memory type. - - Allocates and zeros the number bytes specified by NewSize from memory of the type - specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalReallocatePool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - VOID *NewBuffer; - - NewBuffer = InternalAllocateZeroPool (PoolType, NewSize); - if (NewBuffer != NULL && OldBuffer != NULL) { - CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); - FreePool (OldBuffer); - } - return NewBuffer; -} - -/** - Reallocates a buffer of type EfiBootServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocatePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiRuntimeServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateRuntimePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiReservedMemoryType. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateReservedPool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer); -} - -/** - Frees a buffer that was previously allocated with one of the pool allocation functions in the - Memory Allocation Library. - - Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the - pool allocation services of the Memory Allocation Library. If it is not possible to free pool - resources, then this function will perform no actions. - - If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, - then ASSERT(). - - @param Buffer The pointer to the buffer to free. - -**/ -VOID -EFIAPI -FreePool ( - IN VOID *Buffer - ) -{ - // - // PEI phase does not support to free pool, so leave it as NOP. - // -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf deleted file mode 100644 index 9939d94..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# Instance of Memory Allocation Library using PEI Services. -# -# Memory Allocation Library that uses PEI Services to allocate memory. -# Free operations are ignored. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiMemoryAllocationLib - MODULE_UNI_FILE = PeiMemoryAllocationLib.uni - FILE_GUID = b694e0dc-cd4e-4b30-885b-9c164ed3e74a - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = MemoryAllocationLib|PEIM PEI_CORE SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - MemoryAllocationLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - BaseMemoryLib - PeiServicesLib - HobLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.uni deleted file mode 100644 index 6f84d69..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Memory Allocation Library using PEI Services. -// -// Memory Allocation Library that uses PEI Services to allocate memory. -// Free operations are ignored. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Memory Allocation Library using PEI Services" - -#string STR_MODULE_DESCRIPTION #language en-US "Memory Allocation Library that uses PEI Services to allocate memory. Free operations are ignored." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c deleted file mode 100644 index a80ea43..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLib.c deleted file mode 100644 index c3429d1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLib.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - Base Memory Library functions implementation bases on PeiServcie. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function wraps the gPS->CopyMem (). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *Destination, - IN CONST VOID *Source, - IN UINTN Length - ) -{ - (*GetPeiServicesTablePointer ())->CopyMem ( - Destination, - (VOID*)Source, - Length - ); - return Destination; -} - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function wraps the gPS->SetMem (). - - @param Buffer Memory to set. - @param Size The number of bytes to set. - @param Value Value of the set operation. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ) -{ - (*GetPeiServicesTablePointer ())->SetMem ( - Buffer, - Size, - Value - ); - return Buffer; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c deleted file mode 100644 index 42e2e7d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c +++ /dev/null @@ -1,289 +0,0 @@ -/** @file - Architecture Independent Base Memory Library Implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT16*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT32*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT64*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - return InternalMemSetMem (Buffer, Length, 0); -} - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer - @param SourceBuffer The second memory buffer - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - 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; - } - return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer; -} - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - CONST UINT8 *Pointer; - - Pointer = (CONST UINT8*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - CONST UINT16 *Pointer; - - Pointer = (CONST UINT16*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - CONST UINT32 *Pointer; - - Pointer = (CONST UINT32*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - CONST UINT64 *Pointer; - - Pointer = (CONST UINT64*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - CONST UINT8 *BufferData; - UINTN Index; - - BufferData = Buffer; - for (Index = 0; Index < Length; Index++) { - if (BufferData[Index] != 0) { - return FALSE; - } - } - return TRUE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibInternals.h deleted file mode 100644 index 71897bb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/MemLibInternals.h +++ /dev/null @@ -1,249 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include - -#include -#include -#include -#include - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function wraps the (*PeiServices)->CopyMem (). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *Destination, - IN CONST VOID *Source, - IN UINTN Length - ); - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function wraps the (*PeiServices)->SetMem (). - - @param Buffer The memory to set. - @param Size The number of bytes to set. - @param Value Value of the set operation. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer - @param SourceBuffer The second memory buffer - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence, or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf deleted file mode 100644 index 42bfdfc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf +++ /dev/null @@ -1,60 +0,0 @@ -## @file -# Instance of Base Memory Library using PEI Services. -# -# Base Memory Library implementation that uses PEI Services -# where possible for size reduction. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiMemoryLib - MODULE_UNI_FILE = PeiMemoryLib.uni - FILE_GUID = 3a9759d2-53bc-4eb2-abcd-c93099419063 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib|PEIM - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGeneric.c - MemLibGuid.c - MemLib.c - MemLibInternals.h - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - DebugLib - PeiServicesTablePointerLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.uni deleted file mode 100644 index f4ac7bb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library using PEI Services. -// -// Base Memory Library implementation that uses PEI Services -// where possible for size reduction. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library using PEI Services" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library implementation that uses PEI Services where possible, for size reduction." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c deleted file mode 100644 index 7001f29..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c deleted file mode 100644 index c51b846..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c deleted file mode 100644 index f412897..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c deleted file mode 100644 index f9ed175..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c deleted file mode 100644 index 998743c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c +++ /dev/null @@ -1,1625 +0,0 @@ -/** @file -Implementation of PcdLib class library for PEI phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - - - - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -/** - Retrieve the PCD_PPI pointer. - - This function is to locate PCD_PPI PPI via PeiService. - If fail to locate PCD_PPI, then ASSERT_EFI_ERROR(). - - @retval PCD_PPI * The pointer to the PCD_PPI. - -**/ -PCD_PPI * -GetPcdPpiPointer ( - VOID - ) -{ - EFI_STATUS Status; - PCD_PPI *PcdPpi; - - Status = PeiServicesLocatePpi (&gPcdPpiGuid, 0, NULL, (VOID **)&PcdPpi); - ASSERT_EFI_ERROR (Status); - - return PcdPpi; -} - -/** - Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3. - - This function is to locate EFI_PEI_PCD_PPI PPI via PeiService. - If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR(). - - @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI. - -**/ -EFI_PEI_PCD_PPI * -GetPiPcdPpiPointer ( - VOID - ) -{ - EFI_STATUS Status; - EFI_PEI_PCD_PPI *PiPcdPpi; - - Status = PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid, 0, NULL, (VOID **)&PiPcdPpi); - ASSERT_EFI_ERROR (Status); - - return PiPcdPpi; -} - -/** - Retrieve the GET_PCD_INFO_PPI pointer. - - This function is to locate GET_PCD_INFO_PPI PPI via PeiService. - If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR(). - - @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI. - -**/ -GET_PCD_INFO_PPI * -GetPcdInfoPpiPointer ( - VOID - ) -{ - EFI_STATUS Status; - GET_PCD_INFO_PPI *PcdInfoPpi; - - Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi); - ASSERT_EFI_ERROR (Status); - - return PcdInfoPpi; -} - -/** - Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3. - - This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService. - If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR(). - - @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI. - -**/ -EFI_GET_PCD_INFO_PPI * -GetPiPcdInfoPpiPointer ( - VOID - ) -{ - EFI_STATUS Status; - EFI_GET_PCD_INFO_PPI *PiPcdInfoPpi; - - Status = PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PiPcdInfoPpi); - ASSERT_EFI_ERROR (Status); - - return PiPcdInfoPpi; -} - -/** - This function provides a means by which SKU support can be established in the PCD infrastructure. - - Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. - - @param SkuId The SKU value that will be used when the PCD service retrieves - and sets values associated with a PCD token. - - @return Return the SKU ID that just be set. - -**/ -UINTN -EFIAPI -LibPcdSetSku ( - IN UINTN SkuId - ) -{ - GetPiPcdPpiPointer()->SetSku (SkuId); - - return SkuId; -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 8-bit value for the token specified by TokenNumber. - -**/ -UINT8 -EFIAPI -LibPcdGet8 ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->Get8 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 16-bit value for the token specified by TokenNumber. - -**/ -UINT16 -EFIAPI -LibPcdGet16 ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->Get16 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 32-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 32-bit value for the token specified by TokenNumber. - -**/ -UINT32 -EFIAPI -LibPcdGet32 ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->Get32 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the 64-bit value for the token specified by TokenNumber. - -**/ -UINT64 -EFIAPI -LibPcdGet64 ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->Get64 (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the pointer to the buffer of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the pointer to the token specified by TokenNumber. - -**/ -VOID * -EFIAPI -LibPcdGetPtr ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->GetPtr (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the Boolean value of the token specified by TokenNumber. - -**/ -BOOLEAN -EFIAPI -LibPcdGetBool ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->GetBool (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve the size of a given PCD token. - - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Returns the size of the token specified by TokenNumber. - -**/ -UINTN -EFIAPI -LibPcdGetSize ( - IN UINTN TokenNumber - ) -{ - return (GetPcdPpiPointer ())->GetSize (TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 8-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT8. - -**/ -UINT8 -EFIAPI -LibPcdGetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Get8 (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 16-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT16. - -**/ -UINT16 -EFIAPI -LibPcdGetEx16 ( - 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(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT32. - -**/ -UINT32 -EFIAPI -LibPcdGetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Get32 (Guid, TokenNumber); -} - - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the 64-bit value for the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the UINT64. - -**/ -UINT64 -EFIAPI -LibPcdGetEx64 ( - 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. - - Returns the pointer to the buffer of token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the VOID* pointer. - -**/ -VOID * -EFIAPI -LibPcdGetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->GetPtr (Guid, TokenNumber); -} - - - -/** - This function provides a means by which to retrieve a value for a given PCD token. - - Returns the Boolean value of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the BOOLEAN. - -**/ -BOOLEAN -EFIAPI -LibPcdGetExBool ( - 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. - - Returns the size of the token specified by TokenNumber and Guid. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. - - @return Return the size. - -**/ -UINTN -EFIAPI -LibPcdGetExSize ( - IN CONST GUID *Guid, - IN UINTN TokenNumber - ) -{ - ASSERT (Guid != NULL); - return (GetPiPcdPpiPointer ())->GetSize (Guid, TokenNumber); -} - - - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSet8 ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - (GetPcdPpiPointer ())->Set8 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSet16 ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - (GetPcdPpiPointer ())->Set16 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSet32 ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - (GetPcdPpiPointer ())->Set32 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSet64 ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - (GetPcdPpiPointer ())->Set64 (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value - specified by Buffer and SizeOfBuffer. Buffer is returned. - If SizeOfBuffer is greater than the maximum size support by TokenNumber, - then set SizeOfBuffer to the maximum size supported by TokenNumber and - return NULL to indicate that the set operation was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and NULL must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pointer for the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetPtr ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - EFI_STATUS Status; - UINTN InputSizeOfBuffer; - - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - InputSizeOfBuffer = *SizeOfBuffer; - Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); - if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { - return NULL; - } - - return (VOID *) Buffer; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber - to the value specified by Value. Value is returned. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetBool ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - (GetPcdPpiPointer ())->SetBool (TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return Return the value that was set. - -**/ -UINT8 -EFIAPI -LibPcdSetEx8 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (Guid != NULL); - - (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return Return the value that was set. - -**/ -UINT16 -EFIAPI -LibPcdSetEx16 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (Guid != NULL); - - (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return Return the value that was set. - -**/ -UINT32 -EFIAPI -LibPcdSetEx32 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (Guid != NULL); - - (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return Return the value that was set. - -**/ -UINT64 -EFIAPI -LibPcdSetEx64 ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (Guid != NULL); - - (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); - - return Value; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size - supported by TokenNumber and return NULL to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return Return the pinter to the buffer been set. - -**/ -VOID * -EFIAPI -LibPcdSetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - UINTN InputSizeOfBuffer; - - ASSERT (SizeOfBuffer != NULL); - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - ASSERT (Guid != NULL); - - InputSizeOfBuffer = *SizeOfBuffer; - Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); - if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { - return NULL; - } - - return Buffer; -} - - - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the Boolean value for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The Boolean value to set. - - @return Return the value that was set. - -**/ -BOOLEAN -EFIAPI -LibPcdSetExBool ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (Guid != NULL); - - (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); - - return Value; -} -#endif - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet8S ( - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - return (GetPcdPpiPointer ())->Set8 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet16S ( - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - return (GetPcdPpiPointer ())->Set16 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet32S ( - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - return (GetPcdPpiPointer ())->Set32 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSet64S ( - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - return (GetPcdPpiPointer ())->Set64 (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the - maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned. - - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetPtrS ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - return (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetBoolS ( - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - return (GetPcdPpiPointer ())->SetBool (TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 8-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx8S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT8 Value - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 16-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx16S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT16 Value - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 32-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx32S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT32 Value - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the 64-bit value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetEx64S ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINT64 Value - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets a buffer for the token specified by TokenNumber to the value specified by - Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size - support by TokenNumber, then set SizeOfBuffer to the maximum size supported by - TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation - was not actually performed. - - If Guid is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[in] Guid Pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExPtrS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN VOID *Buffer - ) -{ - ASSERT (Guid != NULL); - - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - return (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); -} - -/** - This function provides a means by which to set a value for a given PCD token. - - Sets the boolean value for the token specified by TokenNumber - to the value specified by Value. - - If Guid is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPcdSetExBoolS ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN BOOLEAN Value - ) -{ - ASSERT (Guid != NULL); - - return (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); -} - -/** - Set up a notification function that is called when a specified token is set. - - When the token specified by TokenNumber and Guid is set, - then notification function specified by NotificationFunction is called. - If Guid is NULL, then the default token space is used. - If NotificationFunction is NULL, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that - designates which namespace to set a value from. - If NULL, then the default token space is used. - @param[in] TokenNumber The PCD token number to monitor. - @param[in] NotificationFunction The function to call when the token - specified by Guid and TokenNumber is set. - -**/ -VOID -EFIAPI -LibPcdCallbackOnSet ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - EFI_STATUS Status; - - ASSERT (NotificationFunction != NULL); - - 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(). - - Disable a notification function that was previously established with LibPcdCallbackOnSet(). - If NotificationFunction is NULL, then ASSERT(). - If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, - and NotificationFunction, then ASSERT(). - - @param[in] Guid Specify the GUID token space. - @param[in] TokenNumber Specify the token number. - @param[in] NotificationFunction The callback function to be unregistered. - -**/ -VOID -EFIAPI -LibPcdCancelCallback ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber, - IN PCD_CALLBACK NotificationFunction - ) -{ - EFI_STATUS Status; - - ASSERT (NotificationFunction != NULL); - - Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction); - - ASSERT_EFI_ERROR (Status); - - return; -} - - - -/** - Retrieves the next token in a token space. - - Retrieves the next PCD token number from the token space specified by Guid. - If Guid is NULL, then the default token space is used. If TokenNumber is 0, - then the first token number is returned. Otherwise, the token number that - follows TokenNumber in the token space is returned. If TokenNumber is the last - token number in the token space, then 0 is returned. - - If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The pointer to a 128-bit unique value that designates which namespace - to set a value from. If NULL, then the default token space is used. - @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD - token number. - - @return The next valid token number. - -**/ -UINTN -EFIAPI -LibPcdGetNextToken ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber - ) -{ - EFI_STATUS Status; - - Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber); - ASSERT (!EFI_ERROR (Status) || TokenNumber == 0); - - return TokenNumber; -} - - -/** - Used to retrieve the list of available PCD token space GUIDs. - - Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces - in the platform. - If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned. - If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned. - - @param TokenSpaceGuid The pointer to the a PCD token space GUID - - @return The next valid token namespace. - -**/ -GUID * -EFIAPI -LibPcdGetNextTokenSpace ( - IN CONST GUID *TokenSpaceGuid - ) -{ - (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid); - - return (GUID *) TokenSpaceGuid; -} - - - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtr ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return (VOID *) Buffer; -} - -/** - Sets a value of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrS ( - OUT VOID *PatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - - return RETURN_SUCCESS; -} - - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified by Buffer - and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than - MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return - NULL to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and NULL must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return Return the pointer to the buffer been set. - -**/ -VOID * -EFIAPI -LibPatchPcdSetPtrAndSize ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return NULL; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return (VOID *) Buffer; -} - -/** - Sets a value and size of a patchable PCD entry that is type pointer. - - Sets the PCD entry specified by PatchVariable to the value specified - by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, - then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER - to indicate that the set operation was not actually performed. - If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to - MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. - - If PatchVariable is NULL, then ASSERT(). - If SizeOfPatchVariable is NULL, then ASSERT(). - If SizeOfBuffer is NULL, then ASSERT(). - If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). - - @param[out] PatchVariable A pointer to the global variable in a module that is - the target of the set operation. - @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable. - @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. - @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. - @param[in] Buffer A pointer to the buffer to used to set the target variable. - - @return The status of the set operation. - -**/ -RETURN_STATUS -EFIAPI -LibPatchPcdSetPtrAndSizeS ( - OUT VOID *PatchVariable, - OUT UINTN *SizeOfPatchVariable, - IN UINTN MaximumDatumSize, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer - ) -{ - ASSERT (PatchVariable != NULL); - ASSERT (SizeOfPatchVariable != NULL); - ASSERT (SizeOfBuffer != NULL); - - if (*SizeOfBuffer > 0) { - ASSERT (Buffer != NULL); - } - - if ((*SizeOfBuffer > MaximumDatumSize) || - (*SizeOfBuffer == MAX_ADDRESS)) { - *SizeOfBuffer = MaximumDatumSize; - return RETURN_INVALID_PARAMETER; - } - - CopyMem (PatchVariable, Buffer, *SizeOfBuffer); - *SizeOfPatchVariable = *SizeOfBuffer; - - return RETURN_SUCCESS; -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the default token space specified, then ASSERT(). - - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfo ( - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - EFI_STATUS Status; - - Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo); - ASSERT_EFI_ERROR (Status); -} - -/** - Retrieve additional information associated with a PCD token. - - This includes information such as the type of value the TokenNumber is associated with as well as possible - human readable name that is associated with the token. - - If TokenNumber is not in the token space specified by Guid, then ASSERT(). - - @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. - @param[in] TokenNumber The PCD token number. - @param[out] PcdInfo The returned information associated with the requested TokenNumber. - The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. -**/ -VOID -EFIAPI -LibPcdGetInfoEx ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - OUT PCD_INFO *PcdInfo - ) -{ - EFI_STATUS Status; - - Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo); - ASSERT_EFI_ERROR (Status); -} - -/** - Retrieve the currently set SKU Id. - - @return The currently set SKU Id. If the platform has not set at a SKU Id, then the - default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU - Id is returned. -**/ -UINTN -EFIAPI -LibPcdGetSku ( - VOID - ) -{ - return GetPiPcdInfoPpiPointer()->GetSku (); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf deleted file mode 100644 index b5d87ff..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf +++ /dev/null @@ -1,66 +0,0 @@ -## @file -# Instance of PCD Library using PCD PPI. -# -# There are two PCD PPIs as follows: -# 1) PCD_PPI -# It is EDKII implementation which support Dynamic/DynamicEx Pcds. -# 2) EFI_PEI_PCD_PPI -# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx -# type Pcd. -# For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI. -# This library instance uses the PCD_PPI to handle dynamic PCD request and use -# EFI_PEI_PCD_PPI to handle dynamicEx type PCD. -# -# This library instance assume the PCD_PPI and EFI_PEI_PCD_PPI are both installed early. -# -# PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiPcdLib - MODULE_UNI_FILE = PeiPcdLib.uni - FILE_GUID = 9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PcdLib|PEIM PEI_CORE SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiPcdLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - PeiServicesLib - DebugLib - - -[Ppis] - gPcdPpiGuid ## SOMETIMES_CONSUMES - gEfiPeiPcdPpiGuid ## CONSUMES - gGetPcdInfoPpiGuid ## SOMETIMES_CONSUMES - gEfiGetPcdInfoPpiGuid ## SOMETIMES_CONSUMES - -[Depex.common.PEIM] - gEfiPeiPcdPpiGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.uni deleted file mode 100644 index e892581..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.uni +++ /dev/null @@ -1,33 +0,0 @@ -// /** @file -// Instance of PCD Library using PCD PPI. -// -// There are two PCD PPIs as follows: -// 1) PCD_PPI -// It is EDKII implementation which support Dynamic/DynamicEx Pcds. -// 2) EFI_PEI_PCD_PPI -// It is defined by PI specification 1.2, Vol 3 which only support dynamicEx -// type Pcd. -// For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI. -// This library instance uses the PCD_PPI to handle dynamic PCD request and use -// EFI_PEI_PCD_PPI to handle dynamicEx type PCD. -// -// This library instance assume the PCD_PPI and EFI_PEI_PCD_PPI are both installed early. -// -// PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCD Library for PEI" - -#string STR_MODULE_DESCRIPTION #language en-US "There are two PCD PPIs as follows: 1) PCD_PPI: It is EDKII implementation which support Dynamic/DynamicEx Pcds. 2) EFI_PEI_PCD_PPI: It is defined by PI Specification 1.2, Vol 3, which only support dynamicEx type Pcd. For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI. This library instance uses the PCD_PPI to handle dynamic PCD request and use EFI_PEI_PCD_PPI to handle dynamicEx type PCD. This library instance assumes that PCD_PPI and EFI_PEI_PCD_PPI are both installed early. The PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c deleted file mode 100644 index 07a2578..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c +++ /dev/null @@ -1,1422 +0,0 @@ -/** @file - PCI Library using PCI CFG2 PPI. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include - -#include -#include -#include -#include -#include - -/** - Assert the validity of a PCI address. A valid PCI address should contain 1's - only in the low 28 bits. - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A,M) \ - ASSERT (((A) & (~0xfffffff | (M))) == 0) - -/** - Translate PCI Lib address into format of PCI CFG2 PPI. - - @param A The address that encodes the PCI Bus, Device, Function and - Register. - -**/ -#define PCI_TO_PCICFG2_ADDRESS(A) \ - ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) - -/** - Internal worker function to read a PCI configuration register. - - This function wraps EFI_PEI_PCI_CFG2_PPI.Read() service. - It reads and returns the PCI configuration register specified by Address, - the width of data is specified by Width. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to read - - @return The value read from the PCI configuration register. - -**/ -UINT32 -PeiPciLibPciCfg2ReadWorker ( - 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; - - Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **) &PciCfg2Ppi); - ASSERT_EFI_ERROR (Status); - ASSERT (PciCfg2Ppi != NULL); - - PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address); - PciCfg2Ppi->Read ( - GetPeiServicesTablePointer (), - PciCfg2Ppi, - Width, - PciCfg2Address, - &Data - ); - - return Data; -} - -/** - Internal worker function to writes a PCI configuration register. - - This function wraps EFI_PEI_PCI_CFG2_PPI.Write() service. - It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specified by Width. - Data is returned. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to write - @param Data The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -PeiPciLibPciCfg2WriteWorker ( - 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; - - Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **) &PciCfg2Ppi); - ASSERT_EFI_ERROR (Status); - ASSERT (PciCfg2Ppi != NULL); - - PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address); - PciCfg2Ppi->Write ( - GetPeiServicesTablePointer (), - PciCfg2Ppi, - Width, - PciCfg2Address, - &Data - ); - - return Data; -} - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - return RETURN_UNSUPPORTED; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciRead8 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciWrite8 ( - Address, - BitFieldWrite8 (PciRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldOr8 (PciRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciWrite8 ( - Address, - BitFieldAnd8 (PciRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldAndThenOr8 (PciRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciRead16 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciWrite16 ( - Address, - BitFieldWrite16 (PciRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldOr16 (PciRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciWrite16 ( - Address, - BitFieldAnd16 (PciRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldAndThenOr16 (PciRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciRead32 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return PeiPciLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint32); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint32, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciWrite32 ( - Address, - BitFieldWrite32 (PciRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldOr32 (PciRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciWrite32 ( - Address, - BitFieldAnd32 (PciRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldAndThenOr32 (PciRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciRead16 (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 = PciRead8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf deleted file mode 100644 index dc0a12e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf +++ /dev/null @@ -1,56 +0,0 @@ -## @file -# PCI Library that layers on top of the PCI CFG2 PPI. -# -# This library produces the APIs from the PCI Library and implements -# these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more EFI_PEI_PCI CFG2 -# PPIs are typically produced by a chipset specific PEIM. This library only uses -# the first PPI found, so this library instance should only be used platforms -# with a single PCI segment. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiPciLibPciCfg2 - MODULE_UNI_FILE = PeiPciLibPciCfg2.uni - FILE_GUID = FA3AD693-D58A-4619-960B-8EE85C914870 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciLib|PEIM SEC PEI_CORE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PciLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - PeiServicesTablePointerLib - BaseLib - DebugLib - PeiServicesLib - -[Ppis] - gEfiPciCfg2PpiGuid ## CONSUMES - -[Depex.common.PEIM] - gEfiPciCfg2PpiGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.uni deleted file mode 100644 index 3bba2e8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// PCI Library that layers on top of the PCI CFG2 PPI. -// -// This library produces the APIs from the PCI Library and implements -// these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more EFI_PEI_PCI CFG2 -// PPIs are typically produced by a chipset specific PEIM. This library only uses -// the first PPI found, so this library instance should only be used platforms -// with a single PCI segment. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCI Library that layers on top of the PCI CFG2 PPI" - -#string STR_MODULE_DESCRIPTION #language en-US "This library produces the APIs from the PCI Library, and implements these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more EFI_PEI_PCI CFG2 PPIs are typically produced by a chipset-specific PEIM. This library only uses the first PPI found, so this library instance should only be used on platforms with a single PCI segment." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c deleted file mode 100644 index 7c65956..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c +++ /dev/null @@ -1,1414 +0,0 @@ -/** @file - PCI Segment Library implementation using PCI CFG2 PPI. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include - -#include -#include -#include -#include -#include - -/** - Assert the validity of a PCI Segment address. - A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ - ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0) - -/** - Translate PCI Lib address into format of PCI CFG2 PPI. - - @param A The address that encodes the PCI Bus, Device, Function and - Register. - -**/ -#define PCI_TO_PCICFG2_ADDRESS(A) \ - ((((UINT32)(A) << 4) & 0xff000000) | (((UINT32)(A) >> 4) & 0x00000700) | (((UINT32)(A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) - -/** - Gets PCI CFG2 PPI. - - This internal function retrieves PCI CFG2 PPI from PPI database. - - @param Address The address that encodes the PCI Segment, Bus, Device, - Function and Register. - - @return The pointer to PCI CFG2 PPI. - -**/ -EFI_PEI_PCI_CFG2_PPI * -InternalGetPciCfg2Ppi ( - IN UINT64 Address - ) -{ - EFI_STATUS Status; - UINTN Instance; - EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi; - UINT64 SegmentNumber; - - Instance = 0; - PciCfg2Ppi = NULL; - SegmentNumber = BitFieldRead64 (Address, 32, 63); - - // - // Loop through all instances of the PPI and match segment number - // - do { - Status = PeiServicesLocatePpi( - &gEfiPciCfg2PpiGuid, - Instance, - NULL, - (VOID**) &PciCfg2Ppi - ); - ASSERT_EFI_ERROR (Status); - Instance++; - } while (PciCfg2Ppi->Segment != SegmentNumber); - - return PciCfg2Ppi; -} - -/** - Internal worker function to read a PCI configuration register. - - This function wraps EFI_PEI_PCI_CFG2_PPI.Read() service. - It reads and returns the PCI configuration register specified by Address, - the width of data is specified by Width. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to read - - @return The value read from the PCI configuration register. - -**/ -UINT32 -PeiPciSegmentLibPciCfg2ReadWorker ( - IN UINT64 Address, - IN EFI_PEI_PCI_CFG_PPI_WIDTH Width - ) -{ - UINT32 Data; - CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi; - UINT64 PciCfg2Address; - - PciCfg2Ppi = InternalGetPciCfg2Ppi (Address); - PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address); - PciCfg2Ppi->Read ( - GetPeiServicesTablePointer (), - PciCfg2Ppi, - Width, - PciCfg2Address, - &Data - ); - - return Data; -} - -/** - Internal worker function to writes a PCI configuration register. - - This function wraps EFI_PEI_PCI_CFG2_PPI.Write() service. - It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specifed by Width. - Data is returned. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to write - @param Data The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -PeiPciSegmentLibPciCfg2WriteWorker ( - IN UINT64 Address, - IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, - IN UINT32 Data - ) -{ - CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi; - UINT64 PciCfg2Address; - - PciCfg2Ppi = InternalGetPciCfg2Ppi (Address); - PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address); - PciCfg2Ppi->Write ( - GetPeiServicesTablePointer (), - PciCfg2Ppi, - Width, - PciCfg2Address, - &Data - ); - - return Data; -} - -/** - Register a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciSegmentRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - return RETURN_UNSUPPORTED; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 8-bit PCI configuration register specified by Address. - -**/ -UINT8 -EFIAPI -PciSegmentRead8 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return (UINT8) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentWrite8 ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return (UINT8) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentOr8 ( - IN UINT64 Address, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAnd8 ( - IN UINT64 Address, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, - followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAndThenOr8 ( - IN UINT64 Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldRead8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldWrite8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldWrite8 (PciSegmentRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldOr8 (PciSegmentRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAnd8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAnd8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAndThenOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAndThenOr8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 16-bit PCI configuration register specified by Address. - -**/ -UINT16 -EFIAPI -PciSegmentRead16 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return (UINT16) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -PciSegmentWrite16 ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return (UINT16) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentOr16 ( - IN UINT64 Address, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAnd16 ( - IN UINT64 Address, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, - followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAndThenOr16 ( - IN UINT64 Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldRead16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldWrite16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldWrite16 (PciSegmentRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldOr16 (PciSegmentRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAnd16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAnd16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAndThenOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAndThenOr16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 32-bit PCI configuration register specified by Address. - -**/ -UINT32 -EFIAPI -PciSegmentRead32 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint32); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT32 -EFIAPI -PciSegmentWrite32 ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint32, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentOr32 ( - IN UINT64 Address, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAnd32 ( - IN UINT64 Address, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, - followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAndThenOr32 ( - IN UINT64 Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldRead32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldWrite32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldWrite32 (PciSegmentRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldOr32 (PciSegmentRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - - Reads the 32-bit PCI configuration register specified by Address, performs a bitwise - AND between the read result and the value specified by AndData, and writes the result - to the 32-bit PCI configuration register specified by Address. The value written to - the PCI configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in AndData are stripped. - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAnd32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAnd32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAndThenOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAndThenOr32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciSegmentReadBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciSegmentRead16 (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 = PciSegmentRead8 (StartAddress); - } - - return ReturnValue; -} - - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return The parameter of Size. - -**/ -UINTN -EFIAPI -PciSegmentWriteBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf deleted file mode 100644 index 82594a6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file -# PCI Segment Library that layers on top of the PCI CFG2 PPI. -# -# This library produces the APIs from the PCI Segment Library and -# implements these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more -# EFI_PEI_PCI CFG2 PPIs are typically produced by a chipset specific PEIM. -# This library instance should only be used platforms with multiple PCI segments. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiPciSegmentLibPciCfg2 - MODULE_UNI_FILE = PeiPciSegmentLibPciCfg2.uni - FILE_GUID = 254901AD-7DB7-45f8-93C8-93D579398D9F - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentLib|PEIM SEC PEI_CORE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PciSegmentLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PeiServicesTablePointerLib - BaseLib - DebugLib - PeiServicesLib - -[Ppis] - gEfiPciCfg2PpiGuid ## CONSUMES - -[Depex.common.PEIM] - gEfiPciCfg2PpiGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.uni deleted file mode 100644 index 82d1cca..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// PCI Segment Library that layers on top of the PCI CFG2 PPI. -// -// This library produces the APIs from the PCI Segment Library and -// implements these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more -// EFI_PEI_PCI CFG2 PPIs are typically produced by a chipset specific PEIM. -// This library instance should only be used platforms with multiple PCI segments. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCI Segment Library that layers on top of the PCI CFG2 PPI" - -#string STR_MODULE_DESCRIPTION #language en-US "This library produces the APIs from the PCI Segment Library and implements these APIs by calling into the EFI_PEI_PCI CFG2 PPI. One or more EFI_PEI_PCI CFG2 PPIs are typically produced by a chipset-specific PEIM. This library instance should only be used on platforms with multiple PCI segments." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c deleted file mode 100644 index abd0c09..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.c +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - Resource Publication Library that uses PEI Core Services to publish system memory. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -#include - - -#include -#include -#include - - -/** - Declares the presence of permanent system memory in the platform. - - Declares that the system memory buffer specified by MemoryBegin and MemoryLength - as permanent memory that may be used for general purpose use by software. - The amount of memory available to software may be less than MemoryLength - if published memory has alignment restrictions. - If MemoryLength is 0, then ASSERT(). - If MemoryLength is greater than (MAX_ADDRESS - MemoryBegin + 1), then ASSERT(). - - @param MemoryBegin The start address of the memory being declared. - @param MemoryLength The number of bytes of memory being declared. - - @retval RETURN_SUCCESS The memory buffer was published. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources to publish the memory buffer - -**/ -RETURN_STATUS -EFIAPI -PublishSystemMemory ( - IN PHYSICAL_ADDRESS MemoryBegin, - IN UINT64 MemoryLength - ) -{ - EFI_STATUS Status; - - ASSERT (MemoryLength > 0); - ASSERT (MemoryLength <= (MAX_ADDRESS - MemoryBegin + 1)); - - Status = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength); - - return (RETURN_STATUS) Status; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf deleted file mode 100644 index 37495ac..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# Instance of Resource Publication Library using PEI Services. -# -# Resource Publication Library that uses PEI Services to publish system memory. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiResourcePublicationLib - MODULE_UNI_FILE = PeiResourcePublicationLib.uni - FILE_GUID = e8d6390d-e190-4957-9ab6-d47d51b01336 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = ResourcePublicationLib|PEIM SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiResourcePublicationLib.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - PeiServicesLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.uni deleted file mode 100644 index 593f877..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Resource Publication Library using PEI Services. -// -// Resource Publication Library that uses PEI Services to publish system memory. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Resource Publication Library using PEI Services" - -#string STR_MODULE_DESCRIPTION #language en-US "This Resource Publication Library uses PEI Services to publish system memory." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.c deleted file mode 100644 index 251773c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.c +++ /dev/null @@ -1,817 +0,0 @@ -/** @file - Implementation for PEI Services Library. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -/** - This service enables a given PEIM to register an interface into the PEI Foundation. - - @param PpiList A pointer to the list of interfaces that the caller shall install. - - @retval EFI_SUCCESS The interface was successfully installed. - @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL. - @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the - EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field. - @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. - -**/ -EFI_STATUS -EFIAPI -PeiServicesInstallPpi ( - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->InstallPpi (PeiServices, PpiList); -} - -/** - This service enables PEIMs to replace an entry in the PPI database with an alternate entry. - - @param OldPpi The pointer to the old PEI PPI Descriptors. - @param NewPpi The pointer to the new PEI PPI Descriptors. - - @retval EFI_SUCCESS The interface was successfully installed. - @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL. - @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the - EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field. - @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. - @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been - installed. - -**/ -EFI_STATUS -EFIAPI -PeiServicesReInstallPpi ( - IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, - IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi); -} - -/** - This service enables PEIMs to discover a given instance of an interface. - - @param Guid A pointer to the GUID whose corresponding interface needs to be - found. - @param Instance The N-th instance of the interface that is required. - @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR. - @param Ppi A pointer to the instance of the interface. - - @retval EFI_SUCCESS The interface was successfully returned. - @retval EFI_NOT_FOUND The PPI descriptor is not found in the database. - -**/ -EFI_STATUS -EFIAPI -PeiServicesLocatePpi ( - 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; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi); -} - -/** - This service enables PEIMs to register a given service to be invoked when another service is - installed or reinstalled. - - @param NotifyList A pointer to the list of notification interfaces - that the caller shall install. - - @retval EFI_SUCCESS The interface was successfully installed. - @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL. - @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do - not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES - bit set in the Flags field. - @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. - -**/ -EFI_STATUS -EFIAPI -PeiServicesNotifyPpi ( - IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->NotifyPpi (PeiServices, NotifyList); -} - -/** - This service enables PEIMs to ascertain the present value of the boot mode. - - @param BootMode A pointer to contain the value of the boot mode. - - @retval EFI_SUCCESS The boot mode was returned successfully. - @retval EFI_INVALID_PARAMETER BootMode is NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesGetBootMode ( - OUT EFI_BOOT_MODE *BootMode - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->GetBootMode (PeiServices, BootMode); -} - -/** - This service enables PEIMs to update the boot mode variable. - - @param BootMode The value of the boot mode to set. - - @retval EFI_SUCCESS The value was successfully updated - -**/ -EFI_STATUS -EFIAPI -PeiServicesSetBootMode ( - IN EFI_BOOT_MODE BootMode - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->SetBootMode (PeiServices, BootMode); -} - -/** - This service enables a PEIM to ascertain the address of the list of HOBs in memory. - - @param HobList A pointer to the list of HOBs that the PEI Foundation - will initialize. - - @retval EFI_SUCCESS The list was successfully returned. - @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published. - -**/ -EFI_STATUS -EFIAPI -PeiServicesGetHobList ( - OUT VOID **HobList - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->GetHobList (PeiServices, HobList); -} - -/** - This service enables PEIMs to create various types of HOBs. - - @param Type The type of HOB to be installed. - @param Length The length of the HOB to be added. - @param Hob The address of a pointer that will contain the - HOB header. - - @retval EFI_SUCCESS The HOB was successfully created. - @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation. - -**/ -EFI_STATUS -EFIAPI -PeiServicesCreateHob ( - IN UINT16 Type, - IN UINT16 Length, - OUT VOID **Hob - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->CreateHob (PeiServices, Type, Length, Hob); -} - -/** - This service enables PEIMs to discover additional firmware volumes. - - @param Instance This instance of the firmware volume to find. The - value 0 is the Boot Firmware Volume (BFV). - @param VolumeHandle Handle of the firmware volume header of the volume - to return. - - @retval EFI_SUCCESS The volume was found. - @retval EFI_NOT_FOUND The volume was not found. - @retval EFI_INVALID_PARAMETER FwVolHeader is NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsFindNextVolume ( - IN UINTN Instance, - IN OUT EFI_PEI_FV_HANDLE *VolumeHandle - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle); -} - -/** - This service enables PEIMs to discover additional firmware files. - - @param SearchType A filter to find files only of this type. - @param VolumeHandle The pointer to the firmware volume header of the - volume to search. This parameter must point to a - valid FFS volume. - @param FileHandle Handle of the current file from which to begin searching. - - @retval EFI_SUCCESS The file was found. - @retval EFI_NOT_FOUND The file was not found. - @retval EFI_NOT_FOUND The header checksum was not zero. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsFindNextFile ( - IN EFI_FV_FILETYPE SearchType, - IN EFI_PEI_FV_HANDLE VolumeHandle, - IN OUT EFI_PEI_FILE_HANDLE *FileHandle - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, VolumeHandle, FileHandle); -} - -/** - This service enables PEIMs to discover sections of a given type within a valid FFS file. - - @param SectionType The value of the section type to find. - @param FileHandle A pointer to the file header that contains the set - of sections to be searched. - @param SectionData A pointer to the discovered section, if successful. - - @retval EFI_SUCCESS The section was found. - @retval EFI_NOT_FOUND The section was not found. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsFindSectionData ( - IN EFI_SECTION_TYPE SectionType, - IN EFI_PEI_FILE_HANDLE FileHandle, - OUT VOID **SectionData - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData); -} - -/** - This service enables PEIMs to discover sections of a given instance and type within a valid FFS file. - - @param SectionType The value of the section type to find. - @param SectionInstance Section instance to find. - @param FileHandle A pointer to the file header that contains the set - of sections to be searched. - @param SectionData A pointer to the discovered section, if successful. - @param AuthenticationStatus A pointer to the authentication status for this section. - - @retval EFI_SUCCESS The section was found. - @retval EFI_NOT_FOUND The section was not found. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsFindSectionData3 ( - 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; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->FindSectionData3 (PeiServices, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus); -} - -/** - This service enables PEIMs to register the permanent memory configuration - that has been initialized with the PEI Foundation. - - @param MemoryBegin The value of a region of installed memory. - @param MemoryLength The corresponding length of a region of installed memory. - - @retval EFI_SUCCESS The region was successfully installed in a HOB. - @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system. - @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation. - -**/ -EFI_STATUS -EFIAPI -PeiServicesInstallPeiMemory ( - IN EFI_PHYSICAL_ADDRESS MemoryBegin, - IN UINT64 MemoryLength - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength); -} - -/** - This service enables PEIMs to allocate memory. - - @param MemoryType Type of memory to allocate. - @param Pages The number of pages to allocate. - @param Memory Pointer of memory allocated. - - @retval EFI_SUCCESS The memory range was successfully allocated. - @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode, - EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData, - EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS. - @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. - -**/ -EFI_STATUS -EFIAPI -PeiServicesAllocatePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - OUT EFI_PHYSICAL_ADDRESS *Memory - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, Memory); -} - -/** - This service enables PEIMs to free memory. - - @param Memory Memory to be freed. - @param Pages The number of pages to free. - - @retval EFI_SUCCESS The requested pages were freed. - @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid. - @retval EFI_NOT_FOUND The requested memory pages were not allocated with - AllocatePages(). - -**/ -EFI_STATUS -EFIAPI -PeiServicesFreePages ( - IN EFI_PHYSICAL_ADDRESS Memory, - IN UINTN Pages - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->FreePages (PeiServices, Memory, Pages); -} - -/** - This service allocates memory from the Hand-Off Block (HOB) heap. - - @param Size The number of bytes to allocate from the pool. - @param Buffer If the call succeeds, a pointer to a pointer to - the allocate buffer; otherwise, undefined. - - @retval EFI_SUCCESS The allocation was successful - @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size. - -**/ -EFI_STATUS -EFIAPI -PeiServicesAllocatePool ( - IN UINTN Size, - OUT VOID **Buffer - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer); -} - -/** - Resets the entire platform. - - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet. - -**/ -EFI_STATUS -EFIAPI -PeiServicesResetSystem ( - VOID - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices = GetPeiServicesTablePointer (); - return (*PeiServices)->ResetSystem (PeiServices); -} - -/** - This service is a wrapper for the PEI Service RegisterForShadow(), except the - pointer to the PEI Services Table has been removed. See the Platform - Initialization Pre-EFI Initialization Core Interface Specification for details. - - @param FileHandle PEIM's file handle. Must be the currently - executing PEIM. - - @retval EFI_SUCCESS The PEIM was successfully registered for - shadowing. - - @retval EFI_ALREADY_STARTED The PEIM was previously - registered for shadowing. - - @retval EFI_NOT_FOUND The FileHandle does not refer to a - valid file handle. -**/ -EFI_STATUS -EFIAPI -PeiServicesRegisterForShadow ( - IN EFI_PEI_FILE_HANDLE FileHandle - ) -{ - return (*GetPeiServicesTablePointer())->RegisterForShadow (FileHandle); -} - -/** - This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services - Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface - Specification for details. - - @param FileHandle The handle of the file. - - @param FileInfo Upon exit, points to the file's - information. - - @retval EFI_SUCCESS File information returned. - - @retval EFI_INVALID_PARAMETER If FileHandle does not - represent a valid file. - - @retval EFI_INVALID_PARAMETER FileInfo is NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsGetFileInfo ( - IN CONST EFI_PEI_FILE_HANDLE FileHandle, - OUT EFI_FV_FILE_INFO *FileInfo - ) -{ - return (*GetPeiServicesTablePointer())->FfsGetFileInfo (FileHandle, FileInfo); -} - -/** - This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services - Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface - Specification for details. - - @param FileHandle The handle of the file. - @param FileInfo Upon exit, points to the file's - information. - - @retval EFI_SUCCESS File information returned. - @retval EFI_INVALID_PARAMETER If FileHandle does not - represent a valid file. - @retval EFI_INVALID_PARAMETER FileInfo is NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsGetFileInfo2 ( - IN CONST EFI_PEI_FILE_HANDLE FileHandle, - OUT EFI_FV_FILE_INFO2 *FileInfo - ) -{ - return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo); -} - -/** - This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services - Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface - Specification for details. - - @param FileName A pointer to the name of the file to - find within the firmware volume. - - @param VolumeHandle The firmware volume to search FileHandle - Upon exit, points to the found file's - handle or NULL if it could not be found. - @param FileHandle The pointer to found file handle - - @retval EFI_SUCCESS File was found. - - @retval EFI_NOT_FOUND File was not found. - - @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or - FileName was NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsFindFileByName ( - IN CONST EFI_GUID *FileName, - IN CONST EFI_PEI_FV_HANDLE VolumeHandle, - OUT EFI_PEI_FILE_HANDLE *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 - Specification for details. - - @param VolumeHandle Handle of the volume. - - @param VolumeInfo Upon exit, points to the volume's - information. - - @retval EFI_SUCCESS File information returned. - - @retval EFI_INVALID_PARAMETER If FileHandle does not - represent a valid file. - - @retval EFI_INVALID_PARAMETER If FileInfo is NULL. - -**/ -EFI_STATUS -EFIAPI -PeiServicesFfsGetVolumeInfo ( - IN EFI_PEI_FV_HANDLE VolumeHandle, - OUT EFI_FV_INFO *VolumeInfo - ) -{ - return (*GetPeiServicesTablePointer())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo); -} - -/** - Install a EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance so the PEI Core will be notified about a new firmware volume. - - This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI using - the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance. - If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI, then ASSERT(). - If the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI can not be installed, then ASSERT(). - If NULL is specified for FvFormat, but FvInfo does not have the firmware file system 2 format, then ASSERT. - - @param InstallFvInfoPpi Install FvInfo Ppi if it is TRUE. Otherwise, install FvInfo2 Ppi. - @param FvFormat Unique identifier of the format of the memory-mapped - firmware volume. This parameter is optional and - may be NULL. If NULL is specified, the - EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed. - @param FvInfo Points to a buffer which allows the - EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. - The format of this buffer is specific to the FvFormat. - For memory-mapped firmware volumes, this typically - points to the first byte of the firmware volume. - @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped - firmware volumes, this is typically the size of - the firmware volume. - @param ParentFvName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID name of the originating firmware - volume. Otherwise, this parameter must be NULL. - @param ParentFileName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID file name of the originating - firmware file. Otherwise, this parameter must be NULL. - @param AuthenticationStatus Authentication Status, it will be ignored if InstallFvInfoPpi is TRUE. -**/ -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 - ) -{ - 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; - if (InstallFvInfoPpi) { - // - // To install FvInfo Ppi. - // - FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI)); - ASSERT (FvInfoPpi != NULL); - PpiGuid = &gEfiPeiFirmwareVolumeInfoPpiGuid; - } else { - // - // To install FvInfo2 Ppi. - // - FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI)); - ASSERT (FvInfoPpi != NULL); - ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *) FvInfoPpi)->AuthenticationStatus = AuthenticationStatus; - PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid; - } - - if (FvFormat != NULL) { - CopyGuid (&FvInfoPpi->FvFormat, FvFormat); - } else { - CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid); - // - // Since the EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed if NULL is specified for FvFormat, - // check the FileSystemGuid pointed by FvInfo against EFI_FIRMWARE_FILE_SYSTEM2_GUID to make sure - // FvInfo has the firmware file system 2 format. - // If the ASSERT really appears, FvFormat needs to be specified correctly, for example, - // EFI_FIRMWARE_FILE_SYSTEM3_GUID can be used for firmware file system 3 format, or - // ((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)); - } - 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); - FvInfoPpi->ParentFileName = ParentFileNameValue; - } - - FvInfoPpiDescriptor = AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR)); - ASSERT (FvInfoPpiDescriptor != NULL); - - FvInfoPpiDescriptor->Guid = PpiGuid; - FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; - FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi; - Status = PeiServicesInstallPpi (FvInfoPpiDescriptor); - ASSERT_EFI_ERROR (Status); - -} - -/** - Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume. - - This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using - the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance. - If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT(). - If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT(). - If NULL is specified for FvFormat, but FvInfo does not have the firmware file system 2 format, then ASSERT. - - @param FvFormat Unique identifier of the format of the memory-mapped - firmware volume. This parameter is optional and - may be NULL. If NULL is specified, the - EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed. - @param FvInfo Points to a buffer which allows the - EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. - The format of this buffer is specific to the FvFormat. - For memory-mapped firmware volumes, this typically - points to the first byte of the firmware volume. - @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped - firmware volumes, this is typically the size of - the firmware volume. - @param ParentFvName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID name of the originating firmware - volume. Otherwise, this parameter must be NULL. - @param ParentFileName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID file name of the originating - firmware file. Otherwise, this parameter must be NULL. -**/ -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 - ) -{ - InternalPeiServicesInstallFvInfoPpi (TRUE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, 0); -} - -/** - Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume. - - This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using - the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance. - If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT(). - If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT(). - If NULL is specified for FvFormat, but FvInfo does not have the firmware file system 2 format, then ASSERT. - - @param FvFormat Unique identifier of the format of the memory-mapped - firmware volume. This parameter is optional and - may be NULL. If NULL is specified, the - EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed. - @param FvInfo Points to a buffer which allows the - EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. - The format of this buffer is specific to the FvFormat. - For memory-mapped firmware volumes, this typically - points to the first byte of the firmware volume. - @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped - firmware volumes, this is typically the size of - the firmware volume. - @param ParentFvName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID name of the originating firmware - volume. Otherwise, this parameter must be NULL. - @param ParentFileName If the new firmware volume originated from a file - in a different firmware volume, then this parameter - specifies the GUID file name of the originating - firmware file. Otherwise, this parameter must be NULL. - @param AuthenticationStatus Authentication Status -**/ -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 - ) -{ - InternalPeiServicesInstallFvInfoPpi (FALSE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, AuthenticationStatus); -} - -/** - Resets the entire platform. - - @param[in] ResetType The type of reset to perform. - @param[in] ResetStatus The status code for the reset. - @param[in] DataSize The size, in bytes, of ResetData. - @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown - the data buffer starts with a Null-terminated string, optionally - followed by additional binary data. The string is a description - that the caller may use to further indicate the reason for the - system reset. ResetData is only valid if ResetStatus is something - other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific - where a minimum amount of ResetData is always required. - -**/ -VOID -EFIAPI -PeiServicesResetSystem2 ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN VOID *ResetData OPTIONAL - ) -{ - (*GetPeiServicesTablePointer())->ResetSystem2 (ResetType, ResetStatus, DataSize, ResetData); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf deleted file mode 100644 index 6476169..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# PEI Services Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiServicesLib - MODULE_UNI_FILE = PeiServicesLib.uni - FILE_GUID = a804239b-4155-446f-acc8-f0825d74908c - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeiServicesLib|SEC PEIM PEI_CORE - PI_SPECIFICATION_VERSION = 0x0001000A - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiServicesLib.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - PeiServicesTablePointerLib - MemoryAllocationLib - DebugLib - -[Guids] - gEfiFirmwareFileSystem2Guid ## SOMETIMES_PRODUCES ## GUID # FV File System Guid. - -[Ppis] - gEfiPeiFirmwareVolumeInfoPpiGuid ## SOMETIMES_PRODUCES - gEfiPeiFirmwareVolumeInfo2PpiGuid ## SOMETIMES_PRODUCES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.uni deleted file mode 100644 index ce1028e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesLib/PeiServicesLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// PEI Services Library implementation. -// -// PEI Services Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PEI Services Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "PEI Services Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c deleted file mode 100644 index 9a6ce37..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c +++ /dev/null @@ -1,116 +0,0 @@ -/** @file - PEI Services Table Pointer Library. - - This library is used for PEIM which does executed from flash device directly but - executed in memory. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -CONST EFI_PEI_SERVICES **gPeiServices; - -/** - Caches a pointer PEI Services Table. - - Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer - in a CPU specific manner as specified in the CPU binding section of the Platform Initialization - Pre-EFI Initialization Core Interface Specification. - - If PeiServicesTablePointer is NULL, then ASSERT(). - - @param PeiServicesTablePointer The address of PeiServices pointer. -**/ -VOID -EFIAPI -SetPeiServicesTablePointer ( - IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer - ) -{ - ASSERT (PeiServicesTablePointer != NULL); - gPeiServices = PeiServicesTablePointer; -} - -/** - Retrieves the cached value of the PEI Services Table pointer. - - Returns the cached value of the PEI Services Table pointer in a CPU specific manner - as specified in the CPU binding section of the Platform Initialization Pre-EFI - Initialization Core Interface Specification. - - If the cached PEI Services Table pointer is NULL, then ASSERT(). - - @return The pointer to PeiServices. - -**/ -CONST EFI_PEI_SERVICES ** -EFIAPI -GetPeiServicesTablePointer ( - VOID - ) -{ - ASSERT (gPeiServices != NULL); - return gPeiServices; -} - - -/** - The constructor function caches the pointer to PEI services. - - The constructor function caches the pointer to PEI services. - It will always return EFI_SUCCESS. - - @param FileHandle The handle of FFS header the loaded driver. - @param PeiServices The pointer to the PEI services. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -PeiServicesTablePointerLibConstructor ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - gPeiServices = PeiServices; - return EFI_SUCCESS; -} - -/** - Perform CPU specific actions required to migrate the PEI Services Table - pointer from temporary RAM to permanent RAM. - - For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes - immediately preceding the Interrupt Descriptor Table (IDT) in memory. - For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes - immediately preceding the Interrupt Descriptor Table (IDT) in memory. - For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in - a dedicated CPU register. This means that there is no memory storage - associated with storing the PEI Services Table pointer, so no additional - migration actions are required for Itanium or ARM CPUs. - -**/ -VOID -EFIAPI -MigratePeiServicesTablePointer ( - VOID - ) -{ - // - // PEI Services Table pointer is cached in the global variable. No additional - // migration actions are required. - // - return; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf deleted file mode 100644 index cab883c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf +++ /dev/null @@ -1,44 +0,0 @@ -## @file -# Instance of PEI Services Table Pointer Library using global variable for the table pointer. -# -# PEI Services Table Pointer Library implementation that retrieves a pointer to the -# PEI Services Table from a global variable. Not available to modules that execute from -# read-only memory. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiServicesTablePointerLib - MODULE_UNI_FILE = PeiServicesTablePointerLib.uni - FILE_GUID = 1c747f6b-0a58-49ae-8ea3-0327a4fa10e3 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC - - CONSTRUCTOR = PeiServicesTablePointerLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeiServicesTablePointer.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.uni deleted file mode 100644 index 96fd42d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of PEI Services Table Pointer Library using global variable for the table pointer. -// -// PEI Services Table Pointer Library implementation that retrieves a pointer to the -// PEI Services Table from a global variable. Not available to modules that execute from -// read-only memory. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PEI Services Table Pointer Library using global variable for the table pointer" - -#string STR_MODULE_DESCRIPTION #language en-US "The PEI Services Table Pointer Library implementation that retrieves a pointer to the PEI Services Table from a global variable. Not available to modules that execute from read-only memory." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c deleted file mode 100644 index 7392d3c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c +++ /dev/null @@ -1,131 +0,0 @@ -/** @file - PEI Services Table Pointer Library for IA-32 and x64. - - According to PI specification, the peiservice pointer is stored prior at IDT - table in IA32 and x64 architecture. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -/** - Retrieves the cached value of the PEI Services Table pointer. - - Returns the cached value of the PEI Services Table pointer in a CPU specific manner - as specified in the CPU binding section of the Platform Initialization Pre-EFI - Initialization Core Interface Specification. - - If the cached PEI Services Table pointer is NULL, then ASSERT(). - - @return The pointer to PeiServices. - -**/ -CONST EFI_PEI_SERVICES ** -EFIAPI -GetPeiServicesTablePointer ( - VOID - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - IA32_DESCRIPTOR Idtr; - - AsmReadIdtr (&Idtr); - PeiServices = (CONST EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.Base - sizeof (UINTN))); - ASSERT (PeiServices != NULL); - return PeiServices; -} - -/** - Caches a pointer PEI Services Table. - - Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer - in a CPU specific manner as specified in the CPU binding section of the Platform Initialization - Pre-EFI Initialization Core Interface Specification. - The function set the pointer of PEI services immediately preceding the IDT table - according to PI specification. - - If PeiServicesTablePointer is NULL, then ASSERT(). - - @param PeiServicesTablePointer The address of PeiServices pointer. -**/ -VOID -EFIAPI -SetPeiServicesTablePointer ( - IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer - ) -{ - IA32_DESCRIPTOR Idtr; - - ASSERT (PeiServicesTablePointer != NULL); - AsmReadIdtr (&Idtr); - (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer; -} - -/** - Perform CPU specific actions required to migrate the PEI Services Table - pointer from temporary RAM to permanent RAM. - - For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes - immediately preceding the Interrupt Descriptor Table (IDT) in memory. - For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes - immediately preceding the Interrupt Descriptor Table (IDT) in memory. - For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in - a dedicated CPU register. This means that there is no memory storage - associated with storing the PEI Services Table pointer, so no additional - migration actions are required for Itanium or ARM CPUs. - - If The cached PEI Services Table pointer is NULL, then ASSERT(). - If the permanent memory is allocated failed, then ASSERT(). -**/ -VOID -EFIAPI -MigratePeiServicesTablePointer ( - VOID - ) -{ - 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))); - ASSERT (PeiServices != NULL); - // - // Allocate the permanent memory. - // - Status = (*PeiServices)->AllocatePages ( - 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); - AsmWriteIdtr (&Idtr); - - return; -} - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf deleted file mode 100644 index 93dc134..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# Instance of PEI Services Table Pointer Library using IDT for the table pointer. -# -# PEI Services Table Pointer Library implementation that retrieves a pointer to the PEI -# Services Table from the IDT on IA-32 and x64. -# -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiServicesTablePointerLibIdt - MODULE_UNI_FILE = PeiServicesTablePointerLibIdt.uni - FILE_GUID = DED3F743-CE2C-4ba6-92A2-FFCE2A6D72D9 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Packages] - MdePkg/MdePkg.dec - -[Sources] - PeiServicesTablePointer.c - - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.uni deleted file mode 100644 index e290665..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of PEI Services Table Pointer Library using IDT for the table pointer. -// -// PEI Services Table Pointer Library implementation that retrieves a pointer to the PEI -// Services Table from the IDT on IA-32 and x64. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of PEI Services Table Pointer Library using IDT for the table pointer" - -#string STR_MODULE_DESCRIPTION #language en-US "PEI Services Table Pointer Library implementation that retrieves a pointer to the PEI Services Table from the IDT on IA-32 and x64." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h b/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h deleted file mode 100644 index c7504e2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h +++ /dev/null @@ -1,80 +0,0 @@ -/** @file -Internal header file for Smbus library. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#ifndef __INTERNAL_SMBUS_LIB_H_ -#define __INTERNAL_SMBUS_LIB_H_ - - -#include - -#include - -#include -#include -#include -#include - -// -// Declaration for internal functions -// - -/** - Gets Smbus PPIs. - - This internal function retrieves Smbus PPI from PPI database. - - @param VOID - - @return The pointer to Smbus PPI. - -**/ -EFI_PEI_SMBUS2_PPI * -InternalGetSmbusPpi ( - VOID - ); - -/** - Executes an SMBus operation to an SMBus controller. - - This function provides a standard way to execute Smbus script - as defined in the SmBus Specification. The data can either be of - the Length byte, word, or a block of data. - - @param SmbusOperation Signifies which particular SMBus hardware protocol - instance that it will use to execute the SMBus transactions. - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Length Signifies the number of bytes that this operation will - do. The maximum number of bytes can be revision specific - and operation specific. - @param Buffer Contains the value of data to execute to the SMBus slave - device. Not all operations require this argument. The - length of this buffer is identified by Length. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The actual number of bytes that are executed for this operation. - -**/ -UINTN -InternalSmBusExec ( - IN EFI_SMBUS_OPERATION SmbusOperation, - IN UINTN SmBusAddress, - IN UINTN Length, - IN OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c deleted file mode 100644 index 1ce9d04..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c +++ /dev/null @@ -1,95 +0,0 @@ -/** @file -Implementation of SmBusLib class library for PEI phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "InternalSmbusLib.h" - -/** - Gets Smbus PPIs. - - This internal function retrieves Smbus PPI from PPI database. - - @param VOID - - @return The pointer to Smbus PPI. - -**/ -EFI_PEI_SMBUS2_PPI * -InternalGetSmbusPpi ( - VOID - ) -{ - EFI_STATUS Status; - EFI_PEI_SMBUS2_PPI *SmbusPpi; - - Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **) &SmbusPpi); - ASSERT_EFI_ERROR (Status); - ASSERT (SmbusPpi != NULL); - - return SmbusPpi; -} - -/** - Executes an SMBus operation to an SMBus controller. - - This function provides a standard way to execute Smbus script - as defined in the SmBus Specification. The data can either be of - the Length byte, word, or a block of data. - - @param SmbusOperation Signifies which particular SMBus hardware protocol instance - that it will use to execute the SMBus transactions. - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Length Signifies the number of bytes that this operation will - do. The maximum number of bytes can be revision specific - and operation specific. - @param Buffer Contains the value of data to execute to the SMBus slave - device. Not all operations require this argument. The - length of this buffer is identified by Length. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - - @return The actual number of bytes that are executed for this operation. - -**/ -UINTN -InternalSmBusExec ( - 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 (); - SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress); - - ReturnStatus = SmbusPpi->Execute ( - SmbusPpi, - SmbusDeviceAddress, - SMBUS_LIB_COMMAND (SmBusAddress), - SmbusOperation, - SMBUS_LIB_PEC (SmBusAddress), - &Length, - Buffer - ); - if (Status != NULL) { - *Status = ReturnStatus; - } - - return Length; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf deleted file mode 100644 index bf78fe5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf +++ /dev/null @@ -1,50 +0,0 @@ -## @file -# SMBUS library that layers on top of the SMBUS2 PPI. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiSmbusLibSmbus2Ppi - MODULE_UNI_FILE = PeiSmbusLibSmbus2Ppi.uni - FILE_GUID = 2A1E1C92-AABA-4d62-AC40-F3A4C3387356 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmbusLib|PEIM SEC - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - SmbusLib.c - PeiSmbusLib.c - InternalSmbusLib.h - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - PeiServicesLib - DebugLib - -[Ppis] - gEfiPeiSmbus2PpiGuid ## CONSUMES - -[Depex.common.PEIM] - gEfiPeiSmbus2PpiGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.uni deleted file mode 100644 index e783ddc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// SMBUS library that layers on top of the SMBUS2 PPI. -// -// SMBUS library that layers on top of the SMBUS2 PPI. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SMBUS library that layers on top of the SMBUS2 PPI" - -#string STR_MODULE_DESCRIPTION #language en-US "SMBUS library that layers on top of the SMBUS2 PPI." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c b/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c deleted file mode 100644 index e1785bf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c +++ /dev/null @@ -1,584 +0,0 @@ -/** @file -Implementation of SmBusLib class library for PEI phase. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#include "InternalSmbusLib.h" - -/** - Executes an SMBUS quick read command. - - Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_UNSUPPORTED: The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickRead ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusQuickRead, SmBusAddress, 0, NULL, Status); -} - -/** - Executes an SMBUS quick write command. - - Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - If Status is not NULL, then the status of the executed command is returned in Status. - If PEC is set in SmBusAddress, then ASSERT(). - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_UNSUPPORTED:: The SMBus operation is not supported. - -**/ -VOID -EFIAPI -SmBusQuickWrite ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (!SMBUS_LIB_PEC (SmBusAddress)); - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusQuickWrite, SmBusAddress, 0, NULL, Status); -} - -/** - Executes an SMBUS receive byte command. - - Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address field of SmBusAddress is required. - The byte received from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte received from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReceiveByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte, Status); - - return Byte; -} - -/** - Executes an SMBUS send byte command. - - Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress. - The byte specified by Value is sent. - Only the SMBUS slave address field of SmBusAddress is required. Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Command in SmBusAddress is not zero, then ASSERT(). - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to send. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. Device - errors are a result of a transaction collision, illegal - command field, unclaimed cycle (host initiated), or bus - errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusSendByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Byte = Value; - InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status); - - return Value; -} - -/** - Executes an SMBUS read data byte command. - - Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 8-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT8 -EFIAPI -SmBusReadDataByte ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status); - - return Byte; -} - -/** - Executes an SMBUS write data byte command. - - Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. - The 8-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 8-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT8 -EFIAPI -SmBusWriteDataByte ( - IN UINTN SmBusAddress, - IN UINT8 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT8 Byte; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Byte = Value; - InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status); - - return Value; -} - -/** - Executes an SMBUS read data word command. - - Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value read from the SMBUS is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The byte read from the SMBUS. - -**/ -UINT16 -EFIAPI -SmBusReadDataWord ( - IN UINTN SmBusAddress, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status); - - return Word; -} - -/** - Executes an SMBUS write data word command. - - Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Value is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -SmBusWriteDataWord ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINT16 Word; - - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Word = Value; - InternalSmBusExec (EfiSmbusWriteWord, SmBusAddress, 2, &Word, Status); - - return Value; -} - -/** - Executes an SMBUS process call command. - - Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress. - The 16-bit value specified by Value is written. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - The 16-bit value returned by the process call command is returned. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is not zero, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Value The 16-bit value to write. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The 16-bit value returned by the process call command. - -**/ -UINT16 -EFIAPI -SmBusProcessCall ( - IN UINTN SmBusAddress, - IN UINT16 Value, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status); - - return Value; -} - -/** - Executes an SMBUS read block command. - - Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress. - Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. - Bytes are read from the SMBUS and stored in Buffer. - The number of bytes read is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is not zero, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param Buffer The pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_SUCCESS: The SMBUS command was executed. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes read. - -**/ -UINTN -EFIAPI -SmBusReadBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - return InternalSmBusExec (EfiSmbusReadBlock, SmBusAddress, 0x20, Buffer, Status); -} - -/** - Executes an SMBUS write block command. - - Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from Buffer. - The number of bytes written is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If Buffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - MBUS Command, SMBUS Data Length, and PEC. - @param Buffer The pointer to the buffer to store the bytes read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR: The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusWriteBlock ( - IN UINTN SmBusAddress, - OUT VOID *Buffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - ASSERT (Buffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Length = SMBUS_LIB_LENGTH (SmBusAddress); - return InternalSmBusExec (EfiSmbusWriteBlock, SmBusAddress, Length, Buffer, Status); -} - -/** - Executes an SMBUS block process call command. - - Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress. - The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. - Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer. - If Status is not NULL, then the status of the executed command is returned in Status. - It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read. - SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes. - If Length in SmBusAddress is zero or greater than 32, then ASSERT(). - If WriteBuffer is NULL, then ASSERT(). - If ReadBuffer is NULL, then ASSERT(). - If any reserved bits of SmBusAddress are set, then ASSERT(). - - @param SmBusAddress The address that encodes the SMBUS Slave Address, - SMBUS Command, SMBUS Data Length, and PEC. - @param WriteBuffer The pointer to the buffer of bytes to write to the SMBUS. - @param ReadBuffer The pointer to the buffer of bytes to read from the SMBUS. - @param Status Return status for the executed command. - This is an optional parameter and may be NULL. - RETURN_TIMEOUT: A timeout occurred while executing the - SMBUS command. - RETURN_DEVICE_ERROR: The request was not completed because - a failure reflected in the Host Status Register bit. - Device errors are a result of a transaction collision, - illegal command field, unclaimed cycle (host initiated), - or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct. (PEC is incorrect.) - RETURN_UNSUPPORTED: The SMBus operation is not supported. - - @return The number of bytes written. - -**/ -UINTN -EFIAPI -SmBusBlockProcessCall ( - IN UINTN SmBusAddress, - IN VOID *WriteBuffer, - OUT VOID *ReadBuffer, - OUT RETURN_STATUS *Status OPTIONAL - ) -{ - UINTN Length; - - ASSERT (WriteBuffer != NULL); - ASSERT (ReadBuffer != NULL); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1); - ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32); - ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); - - Length = SMBUS_LIB_LENGTH (SmBusAddress); - // - // Assuming that ReadBuffer is large enough to save another memory copy. - // - ReadBuffer = CopyMem (ReadBuffer, WriteBuffer, Length); - return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, ReadBuffer, Status); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c deleted file mode 100644 index 77dcada..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c +++ /dev/null @@ -1,81 +0,0 @@ -/** @file - Entry point to a PEIM. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - - -#include -#include - -/** - The entry point of PE/COFF Image for a PEIM. - - This function is the entry point for a PEIM. This function must call ProcessLibraryConstructorList() - and ProcessModuleEntryPointList(). The return value from ProcessModuleEntryPointList() is returned. - If _gPeimRevision is not zero and PeiServices->Hdr.Revision is less than _gPeimRevison, then ASSERT(). - - @param FileHandle Handle of the file being invoked. - @param PeiServices Describes the list of possible PEI Services. - - @retval EFI_SUCCESS The PEIM executed normally. - @retval !EFI_SUCCESS The PEIM failed to execute normally. -**/ -EFI_STATUS -EFIAPI -_ModuleEntryPoint ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - if (_gPeimRevision != 0) { - // - // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver - // - ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision); - } - - // - // Call constructor for all libraries - // - ProcessLibraryConstructorList (FileHandle, PeiServices); - - // - // Call the driver entry point - // - return ProcessModuleEntryPointList (FileHandle, PeiServices); -} - - -/** - Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). - - This function is required to call _ModuleEntryPoint() passing in FileHandle and PeiServices. - - @param FileHandle Handle of the file being invoked. - @param PeiServices Describes the list of possible PEI Services. - - @retval EFI_SUCCESS The PEIM executed normally. - @retval !EFI_SUCCESS The PEIM failed to execute normally. - -**/ -EFI_STATUS -EFIAPI -EfiMain ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - return _ModuleEntryPoint (FileHandle, PeiServices); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf deleted file mode 100644 index 724c4a8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# Module entry point library for PEIM. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeimEntryPoint - MODULE_UNI_FILE = PeimEntryPoint.uni - FILE_GUID = fa177ff7-1fc7-458d-a358-d9d62ae61cec - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = PeimEntryPoint|PEIM - -# -# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is for build only) -# - -[Sources] - PeimEntryPoint.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.uni deleted file mode 100644 index a1894f5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Module entry point library for PEIM. -// -// Module entry point library for PEIM. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for PEIM" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for PEIM." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf b/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf deleted file mode 100644 index a511000..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf +++ /dev/null @@ -1,59 +0,0 @@ -## @file -# Instance of Timer Library only using CPU resources. -# -# Timer Library that only uses CPU resources to provide calibrated delays -# on IA-32, x64, and IPF. -# Note: A driver of type DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER can use this TimerLib -# in their initialization without any issues. They only have to be careful in -# the implementation of runtime services and SMI handlers. -# Because CPU Local APIC and ITC could be programmed by OS, it cannot be -# used by SMM drivers and runtime drivers, ACPI timer is recommended for SMM -# drivers and runtime drivers. -# -# Note that for IA-32 and x64, this library only supports xAPIC mode. If x2APIC -# support is desired, the SecPeiDxeTimerLibUefiCpu library can be used. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SecPeiDxeTimerLibCpu - MODULE_UNI_FILE = SecPeiDxeTimerLibCpu.uni - FILE_GUID = b5a05743-9b71-489b-a0ed-a0eb3950d23b - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = TimerLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources.Ia32, Sources.X64] - X86TimerLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - -[LibraryClasses.IA32, LibraryClasses.X64] - PcdLib - IoLib - DebugLib - -[Pcd.IA32, Pcd.X64] - gEfiMdePkgTokenSpaceGuid.PcdFSBClock ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.uni b/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.uni deleted file mode 100644 index a758c7f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.uni +++ /dev/null @@ -1,31 +0,0 @@ -// /** @file -// Instance of Timer Library only using CPU resources. -// -// Timer Library that only uses CPU resources to provide calibrated delays -// on IA-32, x64, and IPF. -// Note: A driver of type DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER can use this TimerLib -// in their initialization without any issues. They only have to be careful in -// the implementation of runtime services and SMI handlers. -// Because CPU Local APIC and ITC could be programmed by OS, it cannot be -// used by SMM drivers and runtime drivers, ACPI timer is recommended for SMM -// drivers and runtime drivers. -// -// Note that for IA-32 and x64, this library only supports xAPIC mode. If x2APIC -// support is desired, the SecPeiDxeTimerLibUefiCpu library can be used. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Timer Library only using CPU resources" - -#string STR_MODULE_DESCRIPTION #language en-US "This Timer Library only uses CPU resources to provide calibrated delays on IA-32, x64, and IPF. Note: A driver of types DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER can use this TimerLib in their initialization without any issues. They only have to be careful in the implementation of runtime services and SMI handlers. Because CPU Local APIC and ITC could be programmed by the OS, it cannot be used by SMM drivers and runtime drivers, and ACPI timer is recommended for SMM drivers and runtime drivers. Note that for IA-32 and x64, this library only supports xAPIC mode. If x2APIC support is desired, the SecPeiDxeTimerLibUefiCpu library can be used." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c deleted file mode 100644 index 4b99a70..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c +++ /dev/null @@ -1,375 +0,0 @@ -/** @file - Timer Library functions built upon local APIC on IA32/x64. - - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include - -#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[] = { - 0x02, 0x04, 0x08, 0x10, - 0x02, 0x04, 0x08, 0x10, - 0x20, 0x40, 0x80, 0x01, - 0x20, 0x40, 0x80, 0x01 -}; - -/** - Internal function to retrieve the base address of local APIC. - - This function will ASSERT if: - The local APIC is not globally enabled. - The local APIC is not working under XAPIC mode. - The local APIC is not software enabled. - - @return The base address of local APIC - -**/ -UINTN -EFIAPI -InternalX86GetApicBase ( - VOID - ) -{ - UINTN MsrValue; - UINTN ApicBase; - - MsrValue = (UINTN) AsmReadMsr64 (27); - ApicBase = MsrValue & 0xffffff000ULL; - - // - // Check the APIC Global Enable bit (bit 11) in IA32_APIC_BASE MSR. - // This bit will be 1, if local APIC is globally enabled. - // - ASSERT ((MsrValue & BIT11) != 0); - - // - // Check the APIC Extended Mode bit (bit 10) in IA32_APIC_BASE MSR. - // This bit will be 0, if local APIC is under XAPIC mode. - // - ASSERT ((MsrValue & BIT10) == 0); - - // - // Check the APIC Software Enable/Disable bit (bit 8) in Spurious-Interrupt - // Vector Register. - // This bit will be 1, if local APIC is software enabled. - // - ASSERT ((MmioRead32 (ApicBase + APIC_SVR) & BIT8) != 0); - - return ApicBase; -} - -/** - Internal function to return the frequency of the local APIC timer. - - @param ApicBase The base address of memory mapped registers of local APIC. - - @return The frequency of the timer in Hz. - -**/ -UINT32 -EFIAPI -InternalX86GetTimerFrequency ( - IN UINTN ApicBase - ) -{ - return - PcdGet32(PcdFSBClock) / - mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + APIC_TDCR, 0, 3)]; -} - -/** - Internal function to read the current tick counter of local APIC. - - @param ApicBase The base address of memory mapped registers of local APIC. - - @return The tick counter read. - -**/ -INT32 -EFIAPI -InternalX86GetTimerTick ( - IN UINTN ApicBase - ) -{ - return MmioRead32 (ApicBase + APIC_TMCCT); -} - -/** - Internal function to read the initial timer count of local APIC. - - @param ApicBase The base address of memory mapped registers of local APIC. - - @return The initial timer count read. - -**/ -UINT32 -InternalX86GetInitTimerCount ( - IN UINTN ApicBase - ) -{ - return MmioRead32 (ApicBase + APIC_TMICT); -} - -/** - Stalls the CPU for at least the given number of ticks. - - Stalls the CPU for at least the given number of ticks. It's invoked by - MicroSecondDelay() and NanoSecondDelay(). - - This function will ASSERT if the APIC timer intial count returned from - InternalX86GetInitTimerCount() is zero. - - @param ApicBase The base address of memory mapped registers of local APIC. - @param Delay A period of time to delay in ticks. - -**/ -VOID -EFIAPI -InternalX86Delay ( - IN UINTN ApicBase, - IN UINT32 Delay - ) -{ - INT32 Ticks; - UINT32 Times; - UINT32 InitCount; - UINT32 StartTick; - - // - // In case Delay is too larger, separate it into several small delay slot. - // Devided Delay by half value of Init Count is to avoid Delay close to - // the Init Count, timeout maybe missing if the time consuming between 2 - // GetApicTimerCurrentCount() invoking is larger than the time gap between - // Delay and the Init Count. - // - InitCount = InternalX86GetInitTimerCount (ApicBase); - ASSERT (InitCount != 0); - Times = Delay / (InitCount / 2); - Delay = Delay % (InitCount / 2); - - // - // Get Start Tick and do delay - // - StartTick = InternalX86GetTimerTick (ApicBase); - do { - // - // Wait until time out by Delay value - // - do { - CpuPause (); - // - // Get Ticks from Start to Current. - // - Ticks = StartTick - InternalX86GetTimerTick (ApicBase); - // - // Ticks < 0 means Timer wrap-arounds happens. - // - if (Ticks < 0) { - Ticks += InitCount; - } - } while ((UINT32)Ticks < Delay); - - // - // Update StartTick and Delay for next delay slot - // - StartTick -= (StartTick > Delay) ? Delay : (Delay - InitCount); - Delay = InitCount / 2; - } while (Times-- > 0); -} - -/** - Stalls the CPU for at least the given number of microseconds. - - Stalls the CPU for the number of microseconds specified by MicroSeconds. - - @param MicroSeconds The minimum number of microseconds to delay. - - @return The value of MicroSeconds inputted. - -**/ -UINTN -EFIAPI -MicroSecondDelay ( - IN UINTN MicroSeconds - ) -{ - UINTN ApicBase; - - ApicBase = InternalX86GetApicBase (); - InternalX86Delay ( - ApicBase, - (UINT32)DivU64x32 ( - MultU64x64 ( - InternalX86GetTimerFrequency (ApicBase), - MicroSeconds - ), - 1000000u - ) - ); - return MicroSeconds; -} - -/** - Stalls the CPU for at least the given number of nanoseconds. - - Stalls the CPU for the number of nanoseconds specified by NanoSeconds. - - @param NanoSeconds The minimum number of nanoseconds to delay. - - @return The value of NanoSeconds inputted. - -**/ -UINTN -EFIAPI -NanoSecondDelay ( - IN UINTN NanoSeconds - ) -{ - UINTN ApicBase; - - ApicBase = InternalX86GetApicBase (); - InternalX86Delay ( - ApicBase, - (UINT32)DivU64x32 ( - MultU64x64 ( - InternalX86GetTimerFrequency (ApicBase), - NanoSeconds - ), - 1000000000u - ) - ); - return NanoSeconds; -} - -/** - Retrieves the current value of a 64-bit free running performance counter. - - The counter can either count up by 1 or count down by 1. If the physical - performance counter counts by a larger increment, then the counter values - must be translated. The properties of the counter can be retrieved from - GetPerformanceCounterProperties(). - - @return The current value of the free running performance counter. - -**/ -UINT64 -EFIAPI -GetPerformanceCounter ( - VOID - ) -{ - return (UINT64)(UINT32)InternalX86GetTimerTick (InternalX86GetApicBase ()); -} - -/** - Retrieves the 64-bit frequency in Hz and the range of performance counter - values. - - If StartValue is not NULL, then the value that the performance counter starts - with immediately after is it rolls over is returned in StartValue. If - EndValue is not NULL, then the value that the performance counter end with - immediately before it rolls over is returned in EndValue. The 64-bit - frequency of the performance counter in Hz is always returned. If StartValue - is less than EndValue, then the performance counter counts up. If StartValue - is greater than EndValue, then the performance counter counts down. For - example, a 64-bit free running counter that counts up would have a StartValue - of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter - that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0. - - @param StartValue The value the performance counter starts with when it - rolls over. - @param EndValue The value that the performance counter ends with before - it rolls over. - - @return The frequency in Hz. - -**/ -UINT64 -EFIAPI -GetPerformanceCounterProperties ( - OUT UINT64 *StartValue, OPTIONAL - OUT UINT64 *EndValue OPTIONAL - ) -{ - UINTN ApicBase; - - ApicBase = InternalX86GetApicBase (); - - if (StartValue != NULL) { - *StartValue = (UINT64)InternalX86GetInitTimerCount (ApicBase); - } - - if (EndValue != NULL) { - *EndValue = 0; - } - - return (UINT64) InternalX86GetTimerFrequency (ApicBase); -} - -/** - Converts elapsed ticks of performance counter to time in nanoseconds. - - This function converts the elapsed ticks of running performance counter to - time value in unit of nanoseconds. - - @param Ticks The number of elapsed ticks of running performance counter. - - @return The elapsed time in nanoseconds. - -**/ -UINT64 -EFIAPI -GetTimeInNanoSecond ( - IN UINT64 Ticks - ) -{ - UINT64 Frequency; - UINT64 NanoSeconds; - UINT64 Remainder; - INTN Shift; - - Frequency = GetPerformanceCounterProperties (NULL, NULL); - - // - // Ticks - // Time = --------- x 1,000,000,000 - // Frequency - // - NanoSeconds = MultU64x32 (DivU64x64Remainder (Ticks, Frequency, &Remainder), 1000000000u); - - // - // Ensure (Remainder * 1,000,000,000) will not overflow 64-bit. - // 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); - NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL); - - return NanoSeconds; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c b/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c deleted file mode 100644 index cd5c81a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.c +++ /dev/null @@ -1,78 +0,0 @@ -/** @file - NULL instance of SmiHandlerProfile Library. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/** - This function is called by SmmChildDispatcher module to report - a new SMI handler is registered, to SmmCore. - - @param HandlerGuid The GUID to identify the type of the handler. - For the SmmChildDispatch protocol, the HandlerGuid - must be the GUID of SmmChildDispatch protocol. - @param Handler The SMI handler. - @param CallerAddress The address of the module who registers the SMI handler. - @param Context The context of the SMI handler. - For the SmmChildDispatch protocol, the Context - must match the one defined for SmmChildDispatch protocol. - @param ContextSize The size of the context in bytes. - For the SmmChildDispatch protocol, the Context - must match the one defined for SmmChildDispatch protocol. - - @retval EFI_SUCCESS The information is recorded. - @retval EFI_UNSUPPORTED The feature is unsupported. - @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information. -**/ -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 - ) -{ - return EFI_UNSUPPORTED; -} - -/** - This function is called by SmmChildDispatcher module to report - an existing SMI handler is unregistered, to SmmCore. - - @param HandlerGuid The GUID to identify the type of the handler. - For the SmmChildDispatch protocol, the HandlerGuid - must be the GUID of SmmChildDispatch protocol. - @param Handler The SMI handler. - @param Context The context of the SMI handler. - If it is NOT NULL, it will be used to check what is registered. - @param ContextSize The size of the context in bytes. - If Context is NOT NULL, it will be used to check what is registered. - - @retval EFI_SUCCESS The original record is removed. - @retval EFI_UNSUPPORTED The feature is unsupported. - @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler. -**/ -EFI_STATUS -EFIAPI -SmiHandlerProfileUnregisterHandler ( - 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/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf deleted file mode 100644 index edfce21..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf +++ /dev/null @@ -1,36 +0,0 @@ -## @file -# NULL instance of SmiHandlerProfile Library. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmiHandlerProfileLibNull - MODULE_UNI_FILE = SmiHandlerProfileLibNull.uni - FILE_GUID = B43D1B52-6251-4E6F-82EC-A599A5EE94C1 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmiHandlerProfileLib|DXE_SMM_DRIVER SMM_CORE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - SmiHandlerProfileLibNull.c - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.uni deleted file mode 100644 index 5d7e75b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// NULL instance of SmiHandlerProfile Library. -// -// NULL instance of SmiHandlerProfile Library. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "NULL instance of SmiHandlerProfile Library" - -#string STR_MODULE_DESCRIPTION #language en-US "NULL instance of SmiHandlerProfile Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.c deleted file mode 100644 index cd44631..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.c +++ /dev/null @@ -1,331 +0,0 @@ -/** @file - Instance of SMM IO check library. - - SMM IO check library library implementation. This library consumes GCD to collect all valid - IO space defined by a platform. - A platform may have its own SmmIoLib instance to exclude more IO space. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmIoLibGcdMemSpace = NULL; -UINTN mSmmIoLibGcdMemNumberOfDesc = 0; - -EFI_PHYSICAL_ADDRESS mSmmIoLibInternalMaximumSupportMemAddress = 0; - -VOID *mSmmIoLibRegistrationEndOfDxe; -VOID *mSmmIoLibRegistrationReadyToLock; - -BOOLEAN mSmmIoLibReadyToLock = FALSE; - -/** - Calculate and save the maximum support address. - -**/ -VOID -SmmIoLibInternalCalculateMaximumSupportAddress ( - VOID - ) -{ - 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; - } else { - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >= 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - MemPhysicalAddressBits = (UINT8) RegEax; - } else { - MemPhysicalAddressBits = 36; - } - } - // - // IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses. - // - ASSERT (MemPhysicalAddressBits <= 52); - if (MemPhysicalAddressBits > 48) { - MemPhysicalAddressBits = 48; - } - - // - // Save the maximum support address in one global variable - // - mSmmIoLibInternalMaximumSupportMemAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, MemPhysicalAddressBits) - 1); - DEBUG ((DEBUG_INFO, "mSmmIoLibInternalMaximumSupportMemAddress = 0x%lx\n", mSmmIoLibInternalMaximumSupportMemAddress)); -} - -/** - This function check if the MMIO resource is valid per processor architecture and - valid per platform design. - - @param BaseAddress The MMIO start address to be checked. - @param Length The MMIO length to be checked. - @param Owner A GUID representing the owner of the resource. - This GUID may be used by producer to correlate the device ownership of the resource. - NULL means no specific owner. - - @retval TRUE This MMIO resource is valid per processor architecture and valid per platform design. - @retval FALSE This MMIO resource is not valid per processor architecture or valid per platform design. -**/ -BOOLEAN -EFIAPI -SmmIsMmioValid ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_GUID *Owner OPTIONAL - ) -{ - UINTN Index; - EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc; - BOOLEAN InValidRegion; - - // - // Check override. - // NOTE: (B:0->L:4G) is invalid for IA32, but (B:1->L:4G-1)/(B:4G-1->L:1) is valid. - // - if ((Length > mSmmIoLibInternalMaximumSupportMemAddress) || - (BaseAddress > mSmmIoLibInternalMaximumSupportMemAddress) || - ((Length != 0) && (BaseAddress > (mSmmIoLibInternalMaximumSupportMemAddress - (Length - 1)))) ) { - // - // Overflow happen - // - DEBUG (( - DEBUG_ERROR, - "SmmIsMmioValid: Overflow: BaseAddress (0x%lx) - Length (0x%lx), MaximumSupportMemAddress (0x%lx)\n", - BaseAddress, - Length, - mSmmIoLibInternalMaximumSupportMemAddress - )); - return FALSE; - } - - // - // Check override for valid MMIO region - // - if (mSmmIoLibReadyToLock) { - InValidRegion = FALSE; - for (Index = 0; Index < mSmmIoLibGcdMemNumberOfDesc; Index ++) { - Desc = &mSmmIoLibGcdMemSpace[Index]; - if ((Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) && - (BaseAddress >= Desc->BaseAddress) && - ((BaseAddress + Length) <= (Desc->BaseAddress + Desc->Length))) { - InValidRegion = TRUE; - } - } - - if (!InValidRegion) { - DEBUG (( - DEBUG_ERROR, - "SmmIsMmioValid: Not in valid MMIO region: BaseAddress (0x%lx) - Length (0x%lx)\n", - BaseAddress, - Length - )); - return FALSE; - } - } - return TRUE; -} - -/** - Merge continuous entries whose type is EfiGcdMemoryTypeMemoryMappedIo. - - @param[in, out] GcdMemoryMap A pointer to the buffer in which firmware places - the current GCD memory map. - @param[in, out] NumberOfDescriptors A pointer to the number of the - GcdMemoryMap buffer. On input, this is the number of - the current GCD memory map. On output, - it is the number of new GCD memory map after merge. -**/ -STATIC -VOID -MergeGcdMmioEntry ( - IN OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMap, - 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; - - GcdMemoryMapEntry = GcdMemoryMap; - NewGcdMemoryMapEntry = GcdMemoryMap; - 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)); - NextGcdMemoryMapEntry = GcdMemoryMapEntry + 1; - - do { - if (((UINTN)NextGcdMemoryMapEntry < (UINTN)GcdMemoryMapEnd) && - (GcdMemoryMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) && (NextGcdMemoryMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) && - ((GcdMemoryMapEntry->BaseAddress + GcdMemoryMapEntry->Length) == NextGcdMemoryMapEntry->BaseAddress)) { - GcdMemoryMapEntry->Length += NextGcdMemoryMapEntry->Length; - if (NewGcdMemoryMapEntry != GcdMemoryMapEntry) { - NewGcdMemoryMapEntry->Length += NextGcdMemoryMapEntry->Length; - } - - NextGcdMemoryMapEntry = NextGcdMemoryMapEntry + 1; - continue; - } else { - GcdMemoryMapEntry = NextGcdMemoryMapEntry - 1; - break; - } - } while (TRUE); - - GcdMemoryMapEntry = GcdMemoryMapEntry + 1; - NewGcdMemoryMapEntry = NewGcdMemoryMapEntry + 1; - } - - *NumberOfDescriptors = ((UINTN)NewGcdMemoryMapEntry - (UINTN)GcdMemoryMap) / sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR); - - return ; -} - -/** - Notification for SMM EndOfDxe protocol. - - @param[in] Protocol Points to the protocol's unique identifier. - @param[in] Interface Points to the interface instance. - @param[in] Handle The handle on which the interface was installed. - - @retval EFI_SUCCESS Notification runs successfully. - @retval EFI_OUT_OF_RESOURCES No enough resources to save GCD MMIO map. -**/ -EFI_STATUS -EFIAPI -SmmIoLibInternalEndOfDxeNotify ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle - ) -{ - UINTN NumberOfDescriptors; - EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemSpaceMap; - EFI_STATUS Status; - - Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemSpaceMap); - if (!EFI_ERROR (Status)) { - - MergeGcdMmioEntry (MemSpaceMap, &NumberOfDescriptors); - - mSmmIoLibGcdMemSpace = AllocateCopyPool (NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap); - ASSERT (mSmmIoLibGcdMemSpace != NULL); - if (mSmmIoLibGcdMemSpace == NULL) { - gBS->FreePool (MemSpaceMap); - return EFI_OUT_OF_RESOURCES; - } - - mSmmIoLibGcdMemNumberOfDesc = NumberOfDescriptors; - gBS->FreePool (MemSpaceMap); - } - - return EFI_SUCCESS; -} - -/** - Notification for SMM ReadyToLock protocol. - - @param[in] Protocol Points to the protocol's unique identifier. - @param[in] Interface Points to the interface instance. - @param[in] Handle The handle on which the interface was installed. - - @retval EFI_SUCCESS Notification runs successfully. -**/ -EFI_STATUS -EFIAPI -SmmIoLibInternalReadyToLockNotify ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle - ) -{ - mSmmIoLibReadyToLock = TRUE; - return EFI_SUCCESS; -} - -/** - The constructor function initializes the Smm IO library - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmIoLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Calculate and save maximum support address - // - SmmIoLibInternalCalculateMaximumSupportAddress (); - - // - // Register EndOfDxe to get GCD resource map - // - Status = gSmst->SmmRegisterProtocolNotify (&gEfiSmmEndOfDxeProtocolGuid, SmmIoLibInternalEndOfDxeNotify, &mSmmIoLibRegistrationEndOfDxe); - ASSERT_EFI_ERROR (Status); - - // - // Register ready to lock so that we can know when to check valid resource region - // - Status = gSmst->SmmRegisterProtocolNotify (&gEfiSmmReadyToLockProtocolGuid, SmmIoLibInternalReadyToLockNotify, &mSmmIoLibRegistrationReadyToLock); - ASSERT_EFI_ERROR (Status); - - return EFI_SUCCESS; -} - -/** - The destructor function frees resource used in the Smm IO library - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The deconstructor always returns EFI_SUCCESS. -**/ -EFI_STATUS -EFIAPI -SmmIoLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - gSmst->SmmRegisterProtocolNotify (&gEfiSmmEndOfDxeProtocolGuid, NULL, &mSmmIoLibRegistrationEndOfDxe); - gSmst->SmmRegisterProtocolNotify (&gEfiSmmReadyToLockProtocolGuid, NULL, &mSmmIoLibRegistrationReadyToLock); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.inf deleted file mode 100644 index 25c04c3..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file -# Instance of SMM IO check library. -# -# SMM IO check library library implementation. This library consumes GCD to collect all valid -# IO space defined by a platform. -# A platform may have its own SmmIoLib instance to exclude more IO space. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmIoLib - MODULE_UNI_FILE = SmmIoLib.uni - FILE_GUID = F0F5A845-E3ED-4C6E-82D6-4ECE85DAC00F - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmmIoLib|DXE_SMM_DRIVER SMM_CORE - CONSTRUCTOR = SmmIoLibConstructor - DESTRUCTOR = SmmIoLibDestructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SmmIoLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - SmmServicesTableLib - UefiBootServicesTableLib - DxeServicesTableLib - DebugLib - BaseMemoryLib - MemoryAllocationLib - HobLib - -[Protocols] - gEfiSmmReadyToLockProtocolGuid ## CONSUMES - gEfiSmmEndOfDxeProtocolGuid ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.uni deleted file mode 100644 index 2498b08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLib/SmmIoLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of SMM IO check library. -// -// SMM IO check library library implementation. This library consumes GCD to collect all valid -// IO space defined by a platform. -// A platform may have its own SmmIoLib instance to exclude more IO space. -// -// Copyright (c) 2017, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of SMM IO check library." - -#string STR_MODULE_DESCRIPTION #language en-US "SMM IO check library library implementation. This library consumes GCD to collect all valid IO space defined by a platform. A platform may have its own SmmIoLib instance to exclude more IO space." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c deleted file mode 100644 index e8f007f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c +++ /dev/null @@ -1,2312 +0,0 @@ -/** @file - High-level Io/Mmio functions. - - All assertions for bit field operations are handled bit field functions in the - Base Library. - - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - The following IoLib instances share the same version of this file: - - BaseIoLibIntrinsic - DxeIoLibCpuIo - PeiIoLibCpuIo - SmmIoLibCpuIo -**/ - -#include "SmmCpuIoLibInternal.h" - -/** - Reads an 8-bit I/O port, performs a bitwise OR, and writes the - result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoOr8 ( - IN UINTN Port, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back - to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAnd8 ( - IN UINTN Port, - IN UINT8 AndData - ) -{ - return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData)); -} - -/** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoAndThenOr8 ( - IN UINTN Port, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in an 8-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoBitFieldRead8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldWrite8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return IoWrite8 ( - Port, - BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 8-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 8-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAnd8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return IoWrite8 ( - Port, - BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 8-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 8-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT8 -EFIAPI -IoBitFieldAndThenOr8 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return IoWrite8 ( - Port, - BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit I/O port, performs a bitwise OR, and writes the - result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoOr16 ( - IN UINTN Port, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back - to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAnd16 ( - IN UINTN Port, - IN UINT16 AndData - ) -{ - return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData)); -} - -/** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoAndThenOr16 ( - IN UINTN Port, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData)); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 16-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoBitFieldRead16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldWrite16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return IoWrite16 ( - Port, - BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 16-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 16-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAnd16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return IoWrite16 ( - Port, - BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 16-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 16-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT16 -EFIAPI -IoBitFieldAndThenOr16 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return IoWrite16 ( - Port, - BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit I/O port, performs a bitwise OR, and writes the - result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoOr32 ( - IN UINTN Port, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) | OrData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back - to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAnd32 ( - IN UINTN Port, - IN UINT32 AndData - ) -{ - return IoWrite32 (Port, IoRead32 (Port) & AndData); -} - -/** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoAndThenOr32 ( - IN UINTN Port, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 32-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoBitFieldRead32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldWrite32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return IoWrite32 ( - Port, - BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 32-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 32-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAnd32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return IoWrite32 ( - Port, - BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 32-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 32-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT32 -EFIAPI -IoBitFieldAndThenOr32 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return IoWrite32 ( - Port, - BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit I/O port, performs a bitwise OR, and writes the - result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoOr64 ( - IN UINTN Port, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) | OrData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back - to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAnd64 ( - IN UINTN Port, - IN UINT64 AndData - ) -{ - return IoWrite64 (Port, IoRead64 (Port) & AndData); -} - -/** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, performs a bitwise OR - between the result of the AND operation and the value specified by OrData, - and writes the result to the 64-bit I/O port specified by Port. The value - written to the I/O port is returned. This function must guarantee that all - I/O read and write operations are serialized. - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoAndThenOr64 ( - IN UINTN Port, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData); -} - -/** - Reads a bit field of an I/O register. - - Reads the bit field in a 64-bit I/O register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Port The I/O port to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoBitFieldRead64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit); -} - -/** - Writes a bit field to an I/O register. - - Writes Value to the bit field of the I/O register. The bit field is specified - by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldWrite64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return IoWrite64 ( - Port, - BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise OR - between the read result and the value specified by OrData, and writes the - result to the 64-bit I/O port specified by Port. The value written to the I/O - port is returned. This function must guarantee that all I/O read and write - operations are serialized. Extra left bits in OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the - result back to the bit field in the 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND between - the read result and the value specified by AndData, and writes the result to - the 64-bit I/O port specified by Port. The value written to the I/O port is - returned. This function must guarantee that all I/O read and write operations - are serialized. Extra left bits in AndData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAnd64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return IoWrite64 ( - Port, - BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 64-bit port. - - Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise OR between the read result and the value specified by - AndData, and writes the result to the 64-bit I/O port specified by Port. The - value written to the I/O port is returned. This function must guarantee that - all I/O read and write operations are serialized. Extra left bits in both - AndData and OrData are stripped. - - If 64-bit I/O port operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Port The I/O port to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with the read value from the I/O port. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the I/O port. - -**/ -UINT64 -EFIAPI -IoBitFieldAndThenOr64 ( - IN UINTN Port, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return IoWrite64 ( - Port, - BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise OR, and writes the - result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result - back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData)); -} - -/** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 8-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in an 8-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 8-bit register is returned. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioWrite8 ( - Address, - BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 8-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 8-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 8-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioWrite8 ( - Address, - BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise OR, and writes the - result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result - back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData)); -} - -/** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 16-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 16-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 16-bit register is returned. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioWrite16 ( - Address, - BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 16-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 16-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 16-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioWrite16 ( - Address, - BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise OR, and writes the - result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) | OrData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result - back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioWrite32 (Address, MmioRead32 (Address) & AndData); -} - -/** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 32-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 32-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 32-bit register is returned. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioWrite32 ( - Address, - BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 32-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 32-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 32-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioWrite32 ( - Address, - BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise OR, and writes the - result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param OrData The value to OR with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioOr64 ( - IN UINTN Address, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) | OrData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result - back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAnd64 ( - IN UINTN Address, - IN UINT64 AndData - ) -{ - return MmioWrite64 (Address, MmioRead64 (Address) & AndData); -} - -/** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, performs a - bitwise OR between the result of the AND operation and the value specified by - OrData, and writes the result to the 64-bit MMIO register specified by - Address. The value written to the MMIO register is returned. This function - must guarantee that all MMIO read and write operations are serialized. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - - @param Address The MMIO register to write. - @param AndData The value to AND with the read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioAndThenOr64 ( - IN UINTN Address, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a MMIO register. - - Reads the bit field in a 64-bit MMIO register. The bit field is specified by - the StartBit and the EndBit. The value of the bit field is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The MMIO register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioBitFieldRead64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a MMIO register. - - Writes Value to the bit field of the MMIO register. The bit field is - specified by the StartBit and the EndBit. All other bits in the destination - MMIO register are preserved. The new value of the 64-bit register is returned. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param Value The new value of the bit field. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldWrite64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 Value - ) -{ - return MmioWrite64 ( - Address, - BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and - writes the result to the 64-bit MMIO register specified by Address. The value - written to the MMIO register is returned. This function must guarantee that - all MMIO read and write operations are serialized. Extra left bits in OrData - are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param OrData The value to OR with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and - writes the result back to the bit field in the 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - between the read result and the value specified by AndData, and writes the - result to the 64-bit MMIO register specified by Address. The value written to - the MMIO register is returned. This function must guarantee that all MMIO - read and write operations are serialized. Extra left bits in AndData are - stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAnd64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise OR, and writes the result back to the bit field in the - 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise OR between the read result and the value - specified by AndData, and writes the result to the 64-bit MMIO register - specified by Address. The value written to the MMIO register is returned. - This function must guarantee that all MMIO read and write operations are - serialized. Extra left bits in both AndData and OrData are stripped. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - If StartBit is greater than 63, then ASSERT(). - If EndBit is greater than 63, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The MMIO register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..63. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..63. - @param AndData The value to AND with read value from the MMIO register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioBitFieldAndThenOr64 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT64 AndData, - IN UINT64 OrData - ) -{ - return MmioWrite64 ( - Address, - BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData) - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c deleted file mode 100644 index d25239c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c +++ /dev/null @@ -1,803 +0,0 @@ -/** @file - I/O Library. - The implementation of I/O operation for this library instance - are based on EFI_CPU_IO_PROTOCOL. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Incorporated. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "SmmCpuIoLibInternal.h" - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all I/O read and write operations are serialized. - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI CPU I/O space. - -**/ -UINT64 -EFIAPI -IoReadWorker ( - IN UINTN Port, - IN EFI_SMM_IO_WIDTH Width - ) -{ - EFI_STATUS Status; - UINT64 Data; - - Status = gSmst->SmmIo.Io.Read (&gSmst->SmmIo, Width, Port, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all I/O read and write operations are serialized. - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return The parameter of Data. - -**/ -UINT64 -EFIAPI -IoWriteWorker ( - IN UINTN Port, - IN EFI_SMM_IO_WIDTH Width, - IN UINT64 Data - ) -{ - EFI_STATUS Status; - - Status = gSmst->SmmIo.Io.Write (&gSmst->SmmIo, Width, Port, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Reads memory-mapped registers in the EFI system memory space. - - Reads the MMIO registers specified by Address with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioReadWorker ( - IN UINTN Address, - IN EFI_SMM_IO_WIDTH Width - ) -{ - EFI_STATUS Status; - UINT64 Data; - - Status = gSmst->SmmIo.Mem.Read (&gSmst->SmmIo, Width, Address, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Writes memory-mapped registers in the EFI system memory space. - - Writes the MMIO registers specified by Address with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioWriteWorker ( - IN UINTN Address, - IN EFI_SMM_IO_WIDTH Width, - IN UINT64 Data - ) -{ - EFI_STATUS Status; - - Status = gSmst->SmmIo.Mem.Write (&gSmst->SmmIo, Width, Address, 1, &Data); - ASSERT_EFI_ERROR (Status); - - return Data; -} - -/** - Reads an 8-bit I/O port. - - Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -IoRead8 ( - IN UINTN Port - ) -{ - return (UINT8)IoReadWorker (Port, SMM_IO_UINT8); -} - -/** - Writes an 8-bit I/O port. - - Writes the 8-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT8 -EFIAPI -IoWrite8 ( - IN UINTN Port, - IN UINT8 Value - ) -{ - return (UINT8)IoWriteWorker (Port, SMM_IO_UINT8, Value); -} - -/** - Reads a 16-bit I/O port. - - Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -IoRead16 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - return (UINT16)IoReadWorker (Port, SMM_IO_UINT16); -} - -/** - Writes a 16-bit I/O port. - - Writes the 16-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT16 -EFIAPI -IoWrite16 ( - IN UINTN Port, - IN UINT16 Value - ) -{ - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - return (UINT16)IoWriteWorker (Port, SMM_IO_UINT16, Value); -} - -/** - Reads a 32-bit I/O port. - - Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -IoRead32 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - return (UINT32)IoReadWorker (Port, SMM_IO_UINT32); -} - -/** - Writes a 32-bit I/O port. - - Writes the 32-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT32 -EFIAPI -IoWrite32 ( - IN UINTN Port, - IN UINT32 Value - ) -{ - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - return (UINT32)IoWriteWorker (Port, SMM_IO_UINT32, Value); -} - -/** - Reads a 64-bit I/O port. - - Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned. - This function must guarantee that all I/O read and write operations are - serialized. - - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -IoRead64 ( - IN UINTN Port - ) -{ - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - return IoReadWorker (Port, SMM_IO_UINT64); -} - -/** - Writes a 64-bit I/O port. - - Writes the 64-bit I/O port specified by Port with the value specified by Value - and returns Value. This function must guarantee that all I/O read and write - operations are serialized. - - If Port is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Value The value to write to the I/O port. - - @return The value written the I/O port. - -**/ -UINT64 -EFIAPI -IoWrite64 ( - IN UINTN Port, - IN UINT64 Value - ) -{ - // - // Make sure Port is aligned on a 64-bit boundary. - // - ASSERT ((Port & 7) == 0); - return IoWriteWorker (Port, SMM_IO_UINT64, Value); -} - -/** - Reads an 8-bit I/O port fifo into a block of memory. - - Reads the 8-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - UINT8 *Buffer8; - - Buffer8 = (UINT8 *)Buffer; - while (Count-- > 0) { - *Buffer8++ = IoRead8 (Port); - } -} - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - UINT8 *Buffer8; - - Buffer8 = (UINT8 *)Buffer; - while (Count-- > 0) { - IoWrite8 (Port, *Buffer8++); - } -} - -/** - Reads a 16-bit I/O port fifo into a block of memory. - - Reads the 16-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - UINT16 *Buffer16; - - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - Buffer16 = (UINT16 *)Buffer; - while (Count-- > 0) { - *Buffer16++ = IoRead16 (Port); - } -} - -/** - Writes a block of memory into a 16-bit I/O port fifo. - - Writes the 16-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 16-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - UINT16 *Buffer16; - - // - // Make sure Port is aligned on a 16-bit boundary. - // - ASSERT ((Port & 1) == 0); - Buffer16 = (UINT16 *)Buffer; - while (Count-- > 0) { - IoWrite16 (Port, *Buffer16++); - } -} - -/** - Reads a 32-bit I/O port fifo into a block of memory. - - Reads the 32-bit I/O fifo port specified by Port. - The port is read Count times, and the read data is - stored in the provided Buffer. - - This function must guarantee that all I/O read and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to read. - @param Count The number of times to read I/O port. - @param Buffer The buffer to store the read data into. - -**/ -VOID -EFIAPI -IoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ) -{ - UINT32 *Buffer32; - - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - Buffer32 = (UINT32 *)Buffer; - while (Count-- > 0) { - *Buffer32++ = IoRead32 (Port); - } -} - -/** - Writes a block of memory into a 32-bit I/O port fifo. - - Writes the 32-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 32-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -IoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ) -{ - UINT32 *Buffer32; - - // - // Make sure Port is aligned on a 32-bit boundary. - // - ASSERT ((Port & 3) == 0); - Buffer32 = (UINT32 *)Buffer; - while (Count-- > 0) { - IoWrite32 (Port, *Buffer32++); - } -} - -/** - Reads an 8-bit MMIO register. - - Reads the 8-bit MMIO register specified by Address. The 8-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - return (UINT8)MmioReadWorker (Address, SMM_IO_UINT8); -} - -/** - Writes an 8-bit MMIO register. - - Writes the 8-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return (UINT8)MmioWriteWorker (Address, SMM_IO_UINT8, Value); -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - return (UINT16)MmioReadWorker (Address, SMM_IO_UINT16); -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - // - // Make sure Address is aligned on a 16-bit boundary. - // - ASSERT ((Address & 1) == 0); - return (UINT16)MmioWriteWorker (Address, SMM_IO_UINT16, Value); -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - return (UINT32)MmioReadWorker (Address, SMM_IO_UINT32); -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - // - // Make sure Address is aligned on a 32-bit boundary. - // - ASSERT ((Address & 3) == 0); - return (UINT32)MmioWriteWorker (Address, SMM_IO_UINT32, Value); -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - returned. This function must guarantee that all MMIO read and write - operations are serialized. - - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & 7) == 0); - return (UINT64)MmioReadWorker (Address, SMM_IO_UINT64); -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-bit MMIO register specified by Address with the value specified - by Value and returns Value. This function must guarantee that all MMIO read - and write operations are serialized. - - If Address is not aligned on a 64-bit boundary, then ASSERT(). - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - // - // Make sure Address is aligned on a 64-bit boundary. - // - ASSERT ((Address & 7) == 0); - return (UINT64)MmioWriteWorker (Address, SMM_IO_UINT64, Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c deleted file mode 100644 index 59ccec0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c +++ /dev/null @@ -1,417 +0,0 @@ -/** @file - I/O Library MMIO Buffer Functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "SmmCpuIoLibInternal.h" - -/** - Copy data from MMIO region to system memory by using 8-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 8-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioReadBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT8 *Buffer - ) -{ - UINT8 *ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = Buffer; - - while (Length-- > 0) { - *(Buffer++) = MmioRead8 (StartAddress++); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 16-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 16-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioReadBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead16 (StartAddress); - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 32-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 32-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioReadBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead32 (StartAddress); - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from MMIO region to system memory by using 64-bit access. - - Copy data from MMIO region specified by starting address StartAddress - to system memory specified by Buffer by using 64-bit access. The total - number of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied from. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer receiving the data read. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioReadBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - OUT UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = Buffer; - - while (Length > 0) { - *(Buffer++) = MmioRead64 (StartAddress); - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 8-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 8-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the - data to write. - - @return Buffer - -**/ -UINT8 * -EFIAPI -MmioWriteBuffer8 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT8 *Buffer - ) -{ - VOID* ReturnBuffer; - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ReturnBuffer = (UINT8 *) Buffer; - - while (Length-- > 0) { - MmioWrite8 (StartAddress++, *(Buffer++)); - } - - return ReturnBuffer; - -} - -/** - Copy data from system memory to MMIO region by using 16-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 16-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 16-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the - data to write. - - @return Buffer - -**/ -UINT16 * -EFIAPI -MmioWriteBuffer16 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT16 *Buffer - ) -{ - UINT16 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0); - - ReturnBuffer = (UINT16 *) Buffer; - - while (Length > 0) { - MmioWrite16 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT16); - Length -= sizeof (UINT16); - } - - return ReturnBuffer; -} - - -/** - Copy data from system memory to MMIO region by using 32-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 32-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 32-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the - data to write. - - @return Buffer - -**/ -UINT32 * -EFIAPI -MmioWriteBuffer32 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT32 *Buffer - ) -{ - UINT32 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT32) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0); - - ReturnBuffer = (UINT32 *) Buffer; - - while (Length > 0) { - MmioWrite32 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT32); - Length -= sizeof (UINT32); - } - - return ReturnBuffer; -} - -/** - Copy data from system memory to MMIO region by using 64-bit access. - - Copy data from system memory specified by Buffer to MMIO region specified - by starting address StartAddress by using 64-bit access. The total number - of byte to be copied is specified by Length. Buffer is returned. - - If StartAddress is not aligned on a 64-bit boundary, then ASSERT(). - - If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). - - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - - @param StartAddress The starting address for the MMIO region to be copied to. - @param Length The size in bytes of the copy. - @param Buffer The pointer to a system memory buffer containing the - data to write. - - @return Buffer - -**/ -UINT64 * -EFIAPI -MmioWriteBuffer64 ( - IN UINTN StartAddress, - IN UINTN Length, - IN CONST UINT64 *Buffer - ) -{ - UINT64 *ReturnBuffer; - - ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); - - ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer)); - - ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); - ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0); - - ReturnBuffer = (UINT64 *) Buffer; - - while (Length > 0) { - MmioWrite64 (StartAddress, *(Buffer++)); - - StartAddress += sizeof (UINT64); - Length -= sizeof (UINT64); - } - - return ReturnBuffer; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h deleted file mode 100644 index 4f764c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmCpuIoLibInternal.h +++ /dev/null @@ -1,118 +0,0 @@ -/** @file - Internal include file of SMM CPU IO Library. - It includes all necessary protocol/library class's header file - for implementation of IoLib library instance. It is included - all source code of this library instance. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SMM_CPUIO_LIB_INTERNAL_H_ -#define _SMM_CPUIO_LIB_INTERNAL_H_ - -#include -#include -#include -#include -#include -#include -#include - - -/** - Reads registers in the EFI CPU I/O space. - - Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all I/O read and write operations are serialized. - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI CPU I/O space. - -**/ -UINT64 -EFIAPI -IoReadWorker ( - IN UINTN Port, - IN EFI_SMM_IO_WIDTH Width - ); - -/** - Writes registers in the EFI CPU I/O space. - - Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all I/O read and write operations are serialized. - - @param Port The base address of the I/O operation. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return The parameter of Data. - -**/ -UINT64 -EFIAPI -IoWriteWorker ( - IN UINTN Port, - IN EFI_SMM_IO_WIDTH Width, - IN UINT64 Data - ); - -/** - Reads memory-mapped registers in the EFI system memory space. - - Reads the MMIO registers specified by Address with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioReadWorker ( - IN UINTN Address, - IN EFI_SMM_IO_WIDTH Width - ); - -/** - Writes memory-mapped registers in the EFI system memory space. - - Writes the MMIO registers specified by Address with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). - This function must guarantee that all MMIO read and write operations are serialized. - - @param Address The MMIO register to read. - The caller is responsible for aligning the Address if required. - @param Width The width of the I/O operation. - @param Data The value to write to the I/O port. - - @return Data read from registers in the EFI system memory space. - -**/ -UINT64 -EFIAPI -MmioWriteWorker ( - IN UINTN Address, - IN EFI_SMM_IO_WIDTH Width, - IN UINT64 Data - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf deleted file mode 100644 index 5cfd4e5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf +++ /dev/null @@ -1,49 +0,0 @@ -## @file -# SMM Instance of I/O Library using SMM CPU I/O 2 Protocol. -# -# I/O Library SMM implementation that uses SMM CPU I/O 2 Protocol for I/O -# and MMIO operations. -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmIoLibSmmCpuIo2 - MODULE_UNI_FILE = SmmIoLibSmmCpuIo2.uni - FILE_GUID = DEEEA15E-4A77-4513-BA75-71D26FEF78A1 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib|DXE_SMM_DRIVER SMM_CORE - PI_SPECIFICATION_VERSION = 0x0001000A - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - IoLibMmioBuffer.c - SmmCpuIoLibInternal.h - IoHighLevel.c - IoLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - SmmServicesTableLib - -[Depex.common.DXE_SMM_DRIVER] - gEfiSmmCpuIo2ProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.uni deleted file mode 100644 index bc800c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// SMM Instance of I/O Library using SMM CPU I/O 2 Protocol. -// -// I/O Library SMM implementation that uses SMM CPU I/O 2 Protocol for I/O -// and MMIO operations. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "The SMM Instance of I/O Library using SMM CPU I/O 2 Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "This I/O Library SMM implementation uses the SMM CPU I/O 2 Protocol for I/O and MMIO operations." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.c deleted file mode 100644 index cf6730c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.c +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - NULL instance of SMM Library. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -/** - Triggers an SMI at boot time. - - This function triggers a software SMM interrupt at boot time. - -**/ -VOID -EFIAPI -TriggerBootServiceSoftwareSmi ( - VOID - ) -{ - return; -} - - -/** - Triggers an SMI at run time. - - This function triggers a software SMM interrupt at run time. - -**/ -VOID -EFIAPI -TriggerRuntimeSoftwareSmi ( - VOID - ) -{ - return; -} - - - -/** - Test if a boot time software SMI happened. - - This function tests if a software SMM interrupt happened. If a software SMM - interrupt happened and it was triggered at boot time, it returns TRUE. Otherwise, - it returns FALSE. - - @retval TRUE A software SMI triggered at boot time happened. - @retval FALSE No software SMI happened or the software SMI was triggered at run time. - -**/ -BOOLEAN -EFIAPI -IsBootServiceSoftwareSmi ( - VOID - ) -{ - return FALSE; -} - - -/** - Test if a run time software SMI happened. - - This function tests if a software SMM interrupt happened. If a software SMM - interrupt happened and it was triggered at run time, it returns TRUE. Otherwise, - it returns FALSE. - - @retval TRUE A software SMI triggered at run time happened. - @retval FALSE No software SMI happened or the software SMI was triggered at boot time. - -**/ -BOOLEAN -EFIAPI -IsRuntimeSoftwareSmi ( - VOID - ) -{ - return FALSE; -} - -/** - Clear APM SMI Status Bit; Set the EOS bit. - -**/ -VOID -EFIAPI -ClearSmi ( - VOID - ) -{ - return; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.inf deleted file mode 100644 index 323e237..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.inf +++ /dev/null @@ -1,37 +0,0 @@ -## @file -# NULL instance of SMM Library. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmLibNull - MODULE_UNI_FILE = SmmLibNull.uni - FILE_GUID = DDADFC93-FBC5-4389-B20F-EC99E4A6AE52 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmmLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - SmmLibNull.c - - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.uni deleted file mode 100644 index 578342c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmLibNull/SmmLibNull.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// NULL instance of SMM Library. -// -// NULL instance of SMM Library. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "NULL instance of SMM Library" - -#string STR_MODULE_DESCRIPTION #language en-US "NULL instance of SMM Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.c deleted file mode 100644 index 5b2fd8b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.c +++ /dev/null @@ -1,658 +0,0 @@ -/** @file - Instance of SMM memory check library. - - SMM memory check library library implementation. This library consumes SMM_ACCESS2_PROTOCOL - to get SMRAM information. In order to use this library instance, the platform should produce - all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware (like SMM Core - and SMM driver) and/or specific dedicated hardware. - - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// -// attributes for reserved memory before it is promoted to system memory -// -#define EFI_MEMORY_PRESENT 0x0100000000000000ULL -#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL -#define EFI_MEMORY_TESTED 0x0400000000000000ULL - -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; - -EFI_GCD_MEMORY_SPACE_DESCRIPTOR *mSmmMemLibGcdMemSpace = NULL; -UINTN mSmmMemLibGcdMemNumberOfDesc = 0; - -EFI_MEMORY_ATTRIBUTES_TABLE *mSmmMemLibMemoryAttributesTable = NULL; - -VOID *mRegistrationEndOfDxe; -VOID *mRegistrationReadyToLock; - -BOOLEAN mSmmMemLibSmmReadyToLock = FALSE; - -/** - Calculate and save the maximum support address. - -**/ -VOID -SmmMemLibInternalCalculateMaximumSupportAddress ( - VOID - ) -{ - 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; - } else { - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >= 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - PhysicalAddressBits = (UINT8) RegEax; - } else { - PhysicalAddressBits = 36; - } - } - // - // IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses. - // - ASSERT (PhysicalAddressBits <= 52); - if (PhysicalAddressBits > 48) { - PhysicalAddressBits = 48; - } - - // - // Save the maximum support address in one global variable - // - mSmmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1); - DEBUG ((EFI_D_INFO, "mSmmMemLibInternalMaximumSupportAddress = 0x%lx\n", mSmmMemLibInternalMaximumSupportAddress)); -} - -/** - This function check if the buffer is valid per processor architecture and not overlap with SMRAM. - - @param Buffer The buffer start address to be checked. - @param Length The buffer length to be checked. - - @retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM. - @retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM. -**/ -BOOLEAN -EFIAPI -SmmIsBufferOutsideSmmValid ( - IN EFI_PHYSICAL_ADDRESS Buffer, - IN UINT64 Length - ) -{ - UINTN Index; - - // - // Check override. - // NOTE: (B:0->L:4G) is invalid for IA32, but (B:1->L:4G-1)/(B:4G-1->L:1) is valid. - // - if ((Length > mSmmMemLibInternalMaximumSupportAddress) || - (Buffer > mSmmMemLibInternalMaximumSupportAddress) || - ((Length != 0) && (Buffer > (mSmmMemLibInternalMaximumSupportAddress - (Length - 1)))) ) { - // - // Overflow happen - // - DEBUG (( - EFI_D_ERROR, - "SmmIsBufferOutsideSmmValid: Overflow: Buffer (0x%lx) - Length (0x%lx), MaximumSupportAddress (0x%lx)\n", - Buffer, - Length, - mSmmMemLibInternalMaximumSupportAddress - )); - return FALSE; - } - - 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))) { - DEBUG (( - EFI_D_ERROR, - "SmmIsBufferOutsideSmmValid: Overlap: Buffer (0x%lx) - Length (0x%lx), ", - Buffer, - Length - )); - DEBUG (( - EFI_D_ERROR, - "CpuStart (0x%lx) - PhysicalSize (0x%lx)\n", - mSmmMemLibInternalSmramRanges[Index].CpuStart, - mSmmMemLibInternalSmramRanges[Index].PhysicalSize - )); - return FALSE; - } - } - - // - // Check override for Valid Communication Region - // - if (mSmmMemLibSmmReadyToLock) { - EFI_MEMORY_DESCRIPTOR *MemoryMap; - BOOLEAN InValidCommunicationRegion; - - InValidCommunicationRegion = FALSE; - MemoryMap = mMemoryMap; - for (Index = 0; Index < mMemoryMapEntryCount; Index++) { - if ((Buffer >= MemoryMap->PhysicalStart) && - (Buffer + Length <= MemoryMap->PhysicalStart + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) { - InValidCommunicationRegion = TRUE; - } - MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, mDescriptorSize); - } - - if (!InValidCommunicationRegion) { - DEBUG (( - EFI_D_ERROR, - "SmmIsBufferOutsideSmmValid: Not in ValidCommunicationRegion: Buffer (0x%lx) - Length (0x%lx)\n", - Buffer, - Length - )); - return FALSE; - } - - // - // Check untested memory as invalid communication buffer. - // - 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))) { - DEBUG (( - EFI_D_ERROR, - "SmmIsBufferOutsideSmmValid: In Untested Memory Region: Buffer (0x%lx) - Length (0x%lx)\n", - Buffer, - Length - )); - return FALSE; - } - } - - // - // Check UEFI runtime memory with EFI_MEMORY_RO as invalid communication buffer. - // - if (mSmmMemLibMemoryAttributesTable != NULL) { - 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->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))) { - DEBUG (( - EFI_D_ERROR, - "SmmIsBufferOutsideSmmValid: In RuntimeCode Region: Buffer (0x%lx) - Length (0x%lx)\n", - Buffer, - Length - )); - return FALSE; - } - } - } - Entry = NEXT_MEMORY_DESCRIPTOR (Entry, mSmmMemLibMemoryAttributesTable->DescriptorSize); - } - } - } - return TRUE; -} - -/** - Copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). - - This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). - It checks if source buffer is valid per processor architecture and not overlap with SMRAM. - If the check passes, it copies memory and returns EFI_SUCCESS. - If the check fails, it return EFI_SECURITY_VIOLATION. - The implementation must be reentrant. - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with SMRAM. - @retval EFI_SUCCESS Memory is copied. - -**/ -EFI_STATUS -EFIAPI -SmmCopyMemToSmram ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)SourceBuffer, Length)) { - DEBUG ((EFI_D_ERROR, "SmmCopyMemToSmram: Security Violation: Source (0x%x), Length (0x%x)\n", SourceBuffer, Length)); - return EFI_SECURITY_VIOLATION; - } - CopyMem (DestinationBuffer, SourceBuffer, Length); - return EFI_SUCCESS; -} - -/** - Copies a source buffer (SMRAM) to a destination buffer (NON-SMRAM). - - This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). - It checks if destination buffer is valid per processor architecture and not overlap with SMRAM. - If the check passes, it copies memory and returns EFI_SUCCESS. - If the check fails, it returns EFI_SECURITY_VIOLATION. - The implementation must be reentrant. - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM. - @retval EFI_SUCCESS Memory is copied. - -**/ -EFI_STATUS -EFIAPI -SmmCopyMemFromSmram ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)DestinationBuffer, Length)) { - DEBUG ((EFI_D_ERROR, "SmmCopyMemFromSmram: Security Violation: Destination (0x%x), Length (0x%x)\n", DestinationBuffer, Length)); - return EFI_SECURITY_VIOLATION; - } - CopyMem (DestinationBuffer, SourceBuffer, Length); - return EFI_SUCCESS; -} - -/** - Copies a source buffer (NON-SMRAM) to a destination buffer (NON-SMRAM). - - This function copies a source buffer (non-SMRAM) to a destination buffer (SMRAM). - It checks if source buffer and destination buffer are valid per processor architecture and not overlap with SMRAM. - If the check passes, it copies memory and returns EFI_SUCCESS. - If the check fails, it returns EFI_SECURITY_VIOLATION. - The implementation must be reentrant, and it must handle the case where source buffer overlaps destination buffer. - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with SMRAM. - @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with SMRAM. - @retval EFI_SUCCESS Memory is copied. - -**/ -EFI_STATUS -EFIAPI -SmmCopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)DestinationBuffer, Length)) { - DEBUG ((EFI_D_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 ((EFI_D_ERROR, "SmmCopyMem: Security Violation: Source (0x%x), Length (0x%x)\n", SourceBuffer, Length)); - return EFI_SECURITY_VIOLATION; - } - CopyMem (DestinationBuffer, SourceBuffer, Length); - return EFI_SUCCESS; -} - -/** - Fills a target buffer (NON-SMRAM) with a byte value. - - This function fills a target buffer (non-SMRAM) with a byte value. - It checks if target buffer is valid per processor architecture and not overlap with SMRAM. - If the check passes, it fills memory and returns EFI_SUCCESS. - If the check fails, it returns EFI_SECURITY_VIOLATION. - - @param Buffer The memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @retval EFI_SECURITY_VIOLATION The Buffer is invalid per processor architecture or overlap with SMRAM. - @retval EFI_SUCCESS Memory is set. - -**/ -EFI_STATUS -EFIAPI -SmmSetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (!SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Length)) { - DEBUG ((EFI_D_ERROR, "SmmSetMem: Security Violation: Source (0x%x), Length (0x%x)\n", Buffer, Length)); - return EFI_SECURITY_VIOLATION; - } - SetMem (Buffer, Length, Value); - return EFI_SUCCESS; -} - -/** - Get GCD memory map. - Only record untested memory as invalid communication buffer. -**/ -VOID -SmmMemLibInternalGetGcdMemoryMap ( - VOID - ) -{ - UINTN NumberOfDescriptors; - EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemSpaceMap; - EFI_STATUS Status; - UINTN Index; - - Status = gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemSpaceMap); - if (EFI_ERROR (Status)) { - 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) - ) { - mSmmMemLibGcdMemNumberOfDesc++; - } - } - - mSmmMemLibGcdMemSpace = AllocateZeroPool (mSmmMemLibGcdMemNumberOfDesc * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR)); - ASSERT (mSmmMemLibGcdMemSpace != NULL); - if (mSmmMemLibGcdMemSpace == NULL) { - mSmmMemLibGcdMemNumberOfDesc = 0; - gBS->FreePool (MemSpaceMap); - 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) - ) { - CopyMem ( - &mSmmMemLibGcdMemSpace[mSmmMemLibGcdMemNumberOfDesc], - &MemSpaceMap[Index], - sizeof(EFI_GCD_MEMORY_SPACE_DESCRIPTOR) - ); - mSmmMemLibGcdMemNumberOfDesc++; - } - } - - gBS->FreePool (MemSpaceMap); -} - -/** - Get UEFI MemoryAttributesTable. -**/ -VOID -SmmMemLibInternalGetUefiMemoryAttributesTable ( - VOID - ) -{ - EFI_STATUS Status; - EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable; - UINTN MemoryAttributesTableSize; - - Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable); - if (!EFI_ERROR (Status) && (MemoryAttributesTable != NULL)) { - MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries; - mSmmMemLibMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable); - ASSERT (mSmmMemLibMemoryAttributesTable != NULL); - } -} - -/** - Notification for SMM EndOfDxe protocol. - - @param[in] Protocol Points to the protocol's unique identifier. - @param[in] Interface Points to the interface instance. - @param[in] Handle The handle on which the interface was installed. - - @retval EFI_SUCCESS Notification runs successfully. -**/ -EFI_STATUS -EFIAPI -SmmLibInternalEndOfDxeNotify ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - 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; - - MemoryMapSize = 0; - MemoryMap = NULL; - Status = gBS->GetMemoryMap ( - &MemoryMapSize, - MemoryMap, - &MapKey, - &DescriptorSize, - &DescriptorVersion - ); - ASSERT (Status == EFI_BUFFER_TOO_SMALL); - - do { - Status = gBS->AllocatePool (EfiBootServicesData, MemoryMapSize, (VOID **)&MemoryMap); - ASSERT (MemoryMap != NULL); - - Status = gBS->GetMemoryMap ( - &MemoryMapSize, - MemoryMap, - &MapKey, - &DescriptorSize, - &DescriptorVersion - ); - if (EFI_ERROR (Status)) { - gBS->FreePool (MemoryMap); - } - } while (Status == EFI_BUFFER_TOO_SMALL); - - // - // Get Count - // - 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; - } - MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize); - } - MemoryMap = MemoryMapStart; - - // - // Get Data - // - mMemoryMap = AllocatePool (mMemoryMapEntryCount*DescriptorSize); - ASSERT (mMemoryMap != NULL); - 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; - } - MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize); - } - mMemoryMap = SmmMemoryMapStart; - MemoryMap = MemoryMapStart; - - gBS->FreePool (MemoryMap); - - // - // Get additional information from GCD memory map. - // - SmmMemLibInternalGetGcdMemoryMap (); - - // - // Get UEFI memory attributes table. - // - SmmMemLibInternalGetUefiMemoryAttributesTable (); - - return EFI_SUCCESS; -} - -/** - Notification for SMM ReadyToLock protocol. - - @param[in] Protocol Points to the protocol's unique identifier. - @param[in] Interface Points to the interface instance. - @param[in] Handle The handle on which the interface was installed. - - @retval EFI_SUCCESS Notification runs successfully. -**/ -EFI_STATUS -EFIAPI -SmmLibInternalReadyToLockNotify ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle - ) -{ - mSmmMemLibSmmReadyToLock = TRUE; - return EFI_SUCCESS; -} -/** - The constructor function initializes the Smm Mem library - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmMemLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; - UINTN Size; - - // - // Get SMRAM information - // - Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess); - ASSERT_EFI_ERROR (Status); - - Size = 0; - Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL); - ASSERT (Status == EFI_BUFFER_TOO_SMALL); - - mSmmMemLibInternalSmramRanges = AllocatePool (Size); - ASSERT (mSmmMemLibInternalSmramRanges != NULL); - - Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmmMemLibInternalSmramRanges); - ASSERT_EFI_ERROR (Status); - - mSmmMemLibInternalSmramCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR); - - // - // Calculate and save maximum support address - // - SmmMemLibInternalCalculateMaximumSupportAddress (); - - // - // Register EndOfDxe to get UEFI memory map - // - Status = gSmst->SmmRegisterProtocolNotify (&gEfiSmmEndOfDxeProtocolGuid, SmmLibInternalEndOfDxeNotify, &mRegistrationEndOfDxe); - ASSERT_EFI_ERROR (Status); - - // - // Register ready to lock so that we can know when to check valid SMRAM region - // - Status = gSmst->SmmRegisterProtocolNotify (&gEfiSmmReadyToLockProtocolGuid, SmmLibInternalReadyToLockNotify, &mRegistrationReadyToLock); - ASSERT_EFI_ERROR (Status); - - return EFI_SUCCESS; -} - -/** - The destructor function frees resource used in the Smm Mem library - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The deconstructor always returns EFI_SUCCESS. -**/ -EFI_STATUS -EFIAPI -SmmMemLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - FreePool (mSmmMemLibInternalSmramRanges); - - gSmst->SmmRegisterProtocolNotify (&gEfiSmmEndOfDxeProtocolGuid, NULL, &mRegistrationEndOfDxe); - gSmst->SmmRegisterProtocolNotify (&gEfiSmmReadyToLockProtocolGuid, NULL, &mRegistrationReadyToLock); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.inf deleted file mode 100644 index 74a45bc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.inf +++ /dev/null @@ -1,62 +0,0 @@ -## @file -# Instance of SMM memory check library. -# -# SMM memory check library library implementation. This library consumes SMM_ACCESS2_PROTOCOL -# to get SMRAM information. In order to use this library instance, the platform should produce -# all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware (like SMM Core -# and SMM driver) and/or specific dedicated hardware. -# -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmMemLib - MODULE_UNI_FILE = SmmMemLib.uni - FILE_GUID = 7F23F839-C81C-4B89-8132-69746FCBCE52 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmmMemLib|DXE_SMM_DRIVER SMM_CORE - CONSTRUCTOR = SmmMemLibConstructor - DESTRUCTOR = SmmMemLibDestructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SmmMemLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - SmmServicesTableLib - UefiBootServicesTableLib - DxeServicesTableLib - DebugLib - BaseMemoryLib - HobLib - MemoryAllocationLib - UefiLib - -[Protocols] - gEfiSmmAccess2ProtocolGuid ## CONSUMES - gEfiSmmReadyToLockProtocolGuid ## CONSUMES - gEfiSmmEndOfDxeProtocolGuid ## CONSUMES - -[Guids] - gEfiMemoryAttributesTableGuid ## CONSUMES ## SystemTable - -[Depex] - gEfiSmmAccess2ProtocolGuid diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.uni deleted file mode 100644 index 9a5e257..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemLib/SmmMemLib.uni +++ /dev/null @@ -1,24 +0,0 @@ -// /** @file -// SMM memory check library. -// -// SMM memory check library library implementation. This library consumes SMM_ACCESS2_PROTOCOL -// to get SMRAM information. In order to use this library instance, the platform should produce -// all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware (like SMM Core -// and SMM driver) and/or specific dedicated hardware. -// -// Copyright (c) 2015, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SMM memory check library" - -#string STR_MODULE_DESCRIPTION #language en-US "SMM memory check library library implementation. This library consumes SMM_ACCESS2_PROTOCOL to get SMRAM information. In order to use this library instance, the platform should produce all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware (like SMM Core and SMM driver) and/or specific dedicated hardware." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c deleted file mode 100644 index 3e98817..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c +++ /dev/null @@ -1,982 +0,0 @@ -/** @file - Support routines for memory allocation routines based - on SMM Services Table services for SMM phase drivers. - - The PI System Management Mode Core Interface Specification only allows the use - of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory - allocations through the SMM Services Table as the SMRAM space should be - reserved after BDS phase. The functions in the Memory Allocation Library use - EfiBootServicesData as the default memory allocation type. For this SMM - specific instance of the Memory Allocation Library, EfiRuntimeServicesData - is used as the default memory type for all allocations. In addition, - allocation for the Reserved memory types are not supported and will always - return NULL. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include -#include - -EFI_SMRAM_DESCRIPTOR *mSmramRanges; -UINTN mSmramRangeCount; - -/** - The constructor function caches SMRAM ranges that are present in the system. - - It will ASSERT() if SMM Access2 Protocol doesn't exist. - It will ASSERT() if SMRAM ranges can't be got. - It will ASSERT() if Resource can't be allocated for cache SMRAM range. - It will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmMemoryAllocationLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; - UINTN Size; - - // - // Locate SMM Access2 Protocol - // - Status = gBS->LocateProtocol ( - &gEfiSmmAccess2ProtocolGuid, - NULL, - (VOID **)&SmmAccess - ); - ASSERT_EFI_ERROR (Status); - - // - // Get SMRAM range information - // - Size = 0; - Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL); - ASSERT (Status == EFI_BUFFER_TOO_SMALL); - - mSmramRanges = (EFI_SMRAM_DESCRIPTOR *) AllocatePool (Size); - ASSERT (mSmramRanges != NULL); - - Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramRanges); - ASSERT_EFI_ERROR (Status); - - mSmramRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR); - - return EFI_SUCCESS; -} - -/** - If SMM driver exits with an error, it must call this routine - to free the allocated resource before the exiting. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The deconstructor always returns EFI_SUCCESS. -**/ -EFI_STATUS -EFIAPI -SmmMemoryAllocationLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - FreePool (mSmramRanges); - - return EFI_SUCCESS; -} - -/** - Check whether the start address of buffer is within any of the SMRAM ranges. - - @param[in] Buffer The pointer to the buffer to be checked. - - @retval TRUE The buffer is in SMRAM ranges. - @retval FALSE The buffer is out of SMRAM ranges. -**/ -BOOLEAN -EFIAPI -BufferInSmram ( - 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))) { - return TRUE; - } - } - - return FALSE; -} - -/** - Allocates one or more 4KB pages of a certain memory type. - - Allocates the number of 4KB pages of a certain memory type and returns a pointer - to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If - Pages is 0, then NULL is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - - if (Pages == 0) { - return NULL; - } - - Status = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - return (VOID *) (UINTN) Memory; -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData. - - Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer - to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If - Pages is 0, then NULL is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiRuntimeServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData. - - Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a - pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. - If Pages is 0, then NULL is returned. If there is not enough memory remaining - to satisfy the request, then NULL is returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiRuntimeServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType. - - Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a - pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. - If Pages is 0, then NULL is returned. If there is not enough memory remaining - to satisfy the request, then NULL is returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPages ( - IN UINTN Pages - ) -{ - return NULL; -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the page allocation - functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. - Buffer must have been allocated on a previous call to the page allocation services - of the Memory Allocation Library. If it is not possible to free allocated pages, - then this function will perform no actions. - - If Buffer was not allocated with a page allocation function in the Memory Allocation - Library, then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreePages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - if (BufferInSmram (Buffer)) { - // - // 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); - } 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); - } - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates one or more 4KB pages of a certain memory type at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of a certain memory type - with an alignment specified by Alignment. The allocated buffer is returned. - If Pages is 0, then NULL is returned. If there is not enough memory at the - specified alignment remaining to satisfy the request, then NULL is returned. - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateAlignedPages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - IN UINTN Alignment - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - UINTN AlignedMemory; - UINTN AlignmentMask; - UINTN UnalignedPages; - UINTN RealPages; - - // - // Alignment must be a power of two or zero. - // - ASSERT ((Alignment & (Alignment - 1)) == 0); - - 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); - // - // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow. - // - ASSERT (RealPages > Pages); - - 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); - if (UnalignedPages > 0) { - // - // Free first unaligned page(s). - // - Status = gSmst->SmmFreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages); - UnalignedPages = RealPages - Pages - UnalignedPages; - if (UnalignedPages > 0) { - // - // Free last unaligned page(s). - // - Status = gSmst->SmmFreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - } else { - // - // Do not over-allocate pages in this case. - // - Status = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - AlignedMemory = (UINTN) Memory; - } - return (VOID *) AlignedMemory; -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData - with an alignment specified by Alignment. The allocated buffer is returned. - If Pages is 0, then NULL is returned. If there is not enough memory at the - specified alignment remaining to satisfy the request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData - with an alignment specified by Alignment. The allocated buffer is returned. - If Pages is 0, then NULL is returned. If there is not enough memory at the - specified alignment remaining to satisfy the request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedRuntimePages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType - with an alignment specified by Alignment. The allocated buffer is returned. - If Pages is 0, then NULL is returned. If there is not enough memory at the - specified alignment remaining to satisfy the request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. - Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedReservedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return NULL; -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the aligned page - allocation functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by - Buffer. Buffer must have been allocated on a previous call to the aligned page - allocation services of the Memory Allocation Library. If it is not possible to - free allocated pages, then this function will perform no actions. - - If Buffer was not allocated with an aligned page allocation function in the - Memory Allocation Library, then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreeAlignedPages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - if (BufferInSmram (Buffer)) { - // - // 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); - } 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); - } - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type - and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePool ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN AllocationSize - ) -{ - EFI_STATUS Status; - VOID *Memory; - - Status = gSmst->SmmAllocatePool (MemoryType, AllocationSize, &Memory); - if (EFI_ERROR (Status)) { - Memory = NULL; - } - return Memory; -} - -/** - Allocates a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData - and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData - and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType - and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to - satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPool ( - IN UINTN AllocationSize - ) -{ - return NULL; -} - -/** - Allocates and zeros a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, - clears the buffer with zeros, and returns a pointer to the allocated buffer. - If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is - not enough memory remaining to satisfy the request, then NULL is returned. - - @param PoolType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateZeroPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = ZeroMem (Memory, AllocationSize); - } - return Memory; -} - -/** - Allocates and zeros a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, - clears the buffer with zeros, and returns a pointer to the allocated buffer. - If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is - not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates and zeros a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, - clears the buffer with zeros, and returns a pointer to the allocated buffer. - If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is - not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates and zeros a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, - clears the buffer with zeros, and returns a pointer to the allocated buffer. - If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is - not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedZeroPool ( - IN UINTN AllocationSize - ) -{ - return NULL; -} - -/** - Copies a buffer to an allocated buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, - copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer - of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateCopyPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - VOID *Memory; - - ASSERT (Buffer != NULL); - ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1)); - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = CopyMem (Memory, Buffer, AllocationSize); - } - return Memory; -} - -/** - Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, - copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer - of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer); -} - -/** - Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, - copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer - of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer); -} - -/** - Copies a buffer to an allocated buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, - copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer - of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return NULL; -} - -/** - Reallocates a buffer of a specified memory type. - - Allocates and zeros the number bytes specified by NewSize from memory of the type - specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize - and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalReallocatePool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - VOID *NewBuffer; - - NewBuffer = InternalAllocateZeroPool (PoolType, NewSize); - if (NewBuffer != NULL && OldBuffer != NULL) { - CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); - FreePool (OldBuffer); - } - return NewBuffer; -} - -/** - Reallocates a buffer of type EfiRuntimeServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize - and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocatePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiRuntimeServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize - and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize - and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateRuntimePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiReservedMemoryType. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize - and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize - and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an - optional parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateReservedPool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return NULL; -} - -/** - Frees a buffer that was previously allocated with one of the pool allocation - functions in the Memory Allocation Library. - - Frees the buffer specified by Buffer. Buffer must have been allocated on a - previous call to the pool allocation services of the Memory Allocation Library. - If it is not possible to free pool resources, then this function will perform - no actions. - - If Buffer was not allocated with a pool allocation function in the Memory - Allocation Library, then ASSERT(). - - @param Buffer The pointer to the buffer to free. - -**/ -VOID -EFIAPI -FreePool ( - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - - if (BufferInSmram (Buffer)) { - // - // When Buffer is in SMRAM range, it should be allocated by gSmst->SmmAllocatePool() service. - // So, gSmst->SmmFreePool() service is used to free it. - // - Status = gSmst->SmmFreePool (Buffer); - } else { - // - // When Buffer is out of SMRAM range, it should be allocated by gBS->AllocatePool() service. - // So, gBS->FreePool() service is used to free it. - // - Status = gBS->FreePool (Buffer); - } - ASSERT_EFI_ERROR (Status); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf deleted file mode 100644 index 1f443f7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf +++ /dev/null @@ -1,50 +0,0 @@ -## @file -# Instance of Memory Allocation Library using SMM Services Table. -# -# Memory Allocation Library that uses services from the SMM Services Table to -# allocate and free memory. -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmMemoryAllocationLib - MODULE_UNI_FILE = SmmMemoryAllocationLib.uni - FILE_GUID = 4DF30A5D-D5B0-4f85-80ED-6B16CD343C8E - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x0001000A - LIBRARY_CLASS = MemoryAllocationLib|DXE_SMM_DRIVER - CONSTRUCTOR = SmmMemoryAllocationLibConstructor - DESTRUCTOR = SmmMemoryAllocationLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemoryAllocationLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - SmmServicesTableLib - UefiBootServicesTableLib - -[Protocols] - gEfiSmmAccess2ProtocolGuid ## CONSUMES - -[Depex] - gEfiSmmAccess2ProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.uni deleted file mode 100644 index 75b26ed..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Memory Allocation Library using SMM Services Table. -// -// Memory Allocation Library that uses services from the SMM Services Table to -// allocate and free memory. -// -// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Memory Allocation Library using SMM Services Table" - -#string STR_MODULE_DESCRIPTION #language en-US "This Memory Allocation Library uses services from the SMM Services Table to allocate and free memory." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c deleted file mode 100644 index befb6a4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/PciExpressLib.c +++ /dev/null @@ -1,1430 +0,0 @@ -/** @file - Functions in this library instance make use of MMIO functions in IoLib to - access memory mapped PCI configuration space. - - All assertions for I/O operations are handled in MMIO functions in the IoLib - Library. - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved. - Portions copyright (c) 2016, American Megatrends, Inc. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include - -/// -/// Module global that contains the base physical address of the PCI Express MMIO range. -/// -UINTN mSmmPciExpressLibPciExpressBaseAddress = 0; - -/** - The constructor function caches the PCI Express Base Address - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor completed successfully. -**/ -EFI_STATUS -EFIAPI -SmmPciExpressLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // Cache the physical address of the PCI Express MMIO range into a module global variable - // - mSmmPciExpressLibPciExpressBaseAddress = (UINTN) PcdGet64 (PcdPciExpressBaseAddress); - - return EFI_SUCCESS; -} - -/** - Assert the validity of a PCI address. A valid PCI address should contain 1's - only in the low 28 bits. - - @param A The address to validate. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A) \ - ASSERT (((A) & ~0xfffffff) == 0) - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration - registers associated with that PCI device may be accessed after SetVirtualAddressMap() - is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciExpressRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address); - return RETURN_UNSUPPORTED; -} - -/** - Gets MMIO address that can be used to access PCI Express location defined by Address. - - This internal functions converts PCI Express address to a CPU MMIO address by adding - PCI Express Base Address stored in a global variable mSmmPciExpressLibPciExpressBaseAddress. - mSmmPciExpressLibPciExpressBaseAddress is initialized in the library constructor from PCD entry - PcdPciExpressBaseAddress. - - @param Address The address that encodes the PCI Bus, Device, Function and Register. - @return MMIO address corresponding to Address. - -**/ -UINTN -GetPciExpressAddress ( - IN UINTN Address - ) -{ - // - // Make sure Address is valid - // - ASSERT_INVALID_PCI_ADDRESS (Address); - return mSmmPciExpressLibPciExpressBaseAddress + Address; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressRead8 ( - IN UINTN Address - ) -{ - return MmioRead8 (GetPciExpressAddress (Address)); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return MmioWrite8 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return MmioOr8 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return MmioAnd8 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioAndThenOr8 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return MmioBitFieldWrite8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return MmioBitFieldOr8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return MmioBitFieldAnd8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciExpressBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return MmioBitFieldAndThenOr8 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressRead16 ( - IN UINTN Address - ) -{ - return MmioRead16 (GetPciExpressAddress (Address)); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - return MmioWrite16 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return MmioOr16 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return MmioAnd16 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioAndThenOr16 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return MmioBitFieldWrite16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return MmioBitFieldOr16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return MmioBitFieldAnd16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciExpressBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return MmioBitFieldAndThenOr16 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressRead32 ( - IN UINTN Address - ) -{ - return MmioRead32 (GetPciExpressAddress (Address)); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - return MmioWrite32 (GetPciExpressAddress (Address), Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return MmioOr32 (GetPciExpressAddress (Address), OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return MmioAnd32 (GetPciExpressAddress (Address), AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioAndThenOr32 ( - GetPciExpressAddress (Address), - AndData, - OrData - ); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return MmioBitFieldRead32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit - ); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return MmioBitFieldWrite32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - Value - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return MmioBitFieldOr32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - OrData - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return MmioBitFieldAnd32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciExpressBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return MmioBitFieldAndThenOr32 ( - GetPciExpressAddress (Address), - StartBit, - EndBit, - AndData, - OrData - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size read data from StartAddress. - -**/ -UINTN -EFIAPI -PciExpressReadBuffer ( - 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); - - 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; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciExpressWriteBuffer ( - 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); - - - 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/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf deleted file mode 100644 index b5e83b5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# Instance of PCI Express Library using the 256 MB PCI Express MMIO window. -# -# PCI Express Library that uses the 256 MB PCI Express MMIO window to perform -# PCI Configuration cycles. Layers on top of an I/O Library instance. -# -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved. -# Portions copyright (c) 2016, American Megatrends, Inc. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPciExpressLib - FILE_GUID = 00D24382-8231-4B18-A4F0-2D94D8FE2E81 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciExpressLib|DXE_SMM_DRIVER SMM_CORE - CONSTRUCTOR = SmmPciExpressLibConstructor - -[Sources] - PciExpressLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - DebugLib - IoLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c deleted file mode 100644 index 4717ff5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c +++ /dev/null @@ -1,1434 +0,0 @@ -/** @file - PCI Library using SMM PCI Root Bridge I/O Protocol. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include -#include -#include -#include -#include -#include - - -/** - Assert the validity of a PCI address. A valid PCI address should contain 1's - only in the low 28 bits. - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A,M) \ - ASSERT (((A) & (~0xfffffff | (M))) == 0) - -/** - Translate PCI Lib address into format of PCI Root Bridge I/O Protocol. - - @param A The address that encodes the PCI Bus, Device, Function and - Register. - -**/ -#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \ - ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) - -// -// Global varible to cache pointer to PCI Root Bridge I/O protocol. -// -EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL *mSmmPciRootBridgeIo = NULL; - -/** - The constructor function caches the pointer to PCI Root Bridge I/O protocol. - - The constructor function locates PCI Root Bridge I/O protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -PciLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gSmst->SmmLocateProtocol (&gEfiSmmPciRootBridgeIoProtocolGuid, NULL, (VOID**) &mSmmPciRootBridgeIo); - ASSERT_EFI_ERROR (Status); - ASSERT (mSmmPciRootBridgeIo != NULL); - - return EFI_SUCCESS; -} - -/** - Internal worker function to read a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service. - It reads and returns the PCI configuration register specified by Address, - the width of data is specified by Width. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to read - - @return The value read from the PCI configuration register. - -**/ -UINT32 -SmmPciLibPciRootBridgeIoReadWorker ( - IN UINTN Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width - ) -{ - UINT32 Data; - - mSmmPciRootBridgeIo->Pci.Read ( - mSmmPciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - - return Data; -} - -/** - Internal worker function to writes a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service. - It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specified by Width. - Data is returned. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to write - @param Data The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -SmmPciLibPciRootBridgeIoWriteWorker ( - IN UINTN Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, - IN UINT32 Data - ) -{ - mSmmPciRootBridgeIo->Pci.Write ( - mSmmPciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - return Data; -} - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - return RETURN_UNSUPPORTED; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciRead8 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciWrite8 ( - Address, - BitFieldWrite8 (PciRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldOr8 (PciRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciWrite8 ( - Address, - BitFieldAnd8 (PciRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldAndThenOr8 (PciRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciRead16 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciWrite16 ( - Address, - BitFieldWrite16 (PciRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldOr16 (PciRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciWrite16 ( - Address, - BitFieldAnd16 (PciRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldAndThenOr16 (PciRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciRead32 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return SmmPciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciWrite32 ( - Address, - BitFieldWrite32 (PciRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldOr32 (PciRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciWrite32 ( - Address, - BitFieldAnd32 (PciRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldAndThenOr32 (PciRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciRead16 (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 = PciRead8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf deleted file mode 100644 index a4d25be..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file -# PCI Library that layers on top of the SMM PCI Root Bridge I/O Protocol. -# -# This library produces the APIs from the PCI Library and implements these APIs -# by calling into SMM PCI Root Bridge I/O Protocol. SMM PCI Root Bridge I/O Protocol is -# typically produced by a chipset specific SMM driver. -# This library binds to the first SMM PCI Root Bridge I/O Protocol in the platform. As a result, -# it should only be used on platforms that contain a single PCI root bridge. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPciLibPciRootBridgeIo - MODULE_UNI_FILE = SmmPciLibPciRootBridgeIo.uni - FILE_GUID = F6994CBA-2351-4ebc-A2DA-20BAC2FE2CF3 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciLib|DXE_SMM_DRIVER SMM_CORE - PI_SPECIFICATION_VERSION = 0x0001000A - CONSTRUCTOR = PciLibConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - PciLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - SmmServicesTableLib - DebugLib - -[Protocols] - gEfiSmmPciRootBridgeIoProtocolGuid ## CONSUMES - -[Depex.common.DXE_SMM_DRIVER] - gEfiSmmPciRootBridgeIoProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.uni deleted file mode 100644 index e2c5b9d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// PCI Library that layers on top of the SMM PCI Root Bridge I/O Protocol. -// -// This library produces the APIs from the PCI Library and implements these APIs -// by calling into SMM PCI Root Bridge I/O Protocol. SMM PCI Root Bridge I/O Protocol is -// typically produced by a chipset specific SMM driver. -// This library binds to the first SMM PCI Root Bridge I/O Protocol in the platform. As a result, -// it should only be used on platforms that contain a single PCI root bridge. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCI Library that layers on top of the SMM PCI Root Bridge I/O Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "This library produces the APIs from the PCI Library and implements these APIs by calling into SMM PCI Root Bridge I/O Protocol. SMM PCI Root Bridge I/O Protocol is typically produced by a chipset-specific SMM driver. This library binds to the first SMM PCI Root Bridge I/O Protocol in the platform. As a result, it should only be used on platforms that contain a single PCI root bridge." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c deleted file mode 100644 index 1b6db7d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c +++ /dev/null @@ -1,1175 +0,0 @@ -/** @file - SMM Periodic SMI Library. - - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -/// -/// Define the number of periodic SMI handler entries that should be allocated to the list -/// of free periodic SMI handlers when the list of free periodic SMI handlers is empty. -/// -#define PERIODIC_SMI_LIBRARY_ALLOCATE_SIZE 0x08 - -/// -/// Signature for a PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure -/// -#define PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE SIGNATURE_32 ('P', 'S', 'M', 'I') - -/// -/// Structure that contains state information for an enabled periodic SMI handler -/// -typedef struct { - /// - /// Signature value that must be set to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE - /// - UINT32 Signature; - /// - /// The link entry to be inserted to the list of periodic SMI handlers. - /// - LIST_ENTRY Link; - /// - /// The dispatch function to called to invoke an enabled periodic SMI handler. - /// - PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction; - /// - /// The context to pass into DispatchFunction - /// - VOID *Context; - /// - /// The tick period in 100 ns units that DispatchFunction should be called. - /// - 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; - /// - /// 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; - /// - /// A pointer to the stack allocated using AllocatePages(). This field will - /// be NULL if StackSize is 0. - /// - VOID *Stack; - /// - /// Spin lock used to wait for an AP to complete the execution of a periodic SMI handler - /// - 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; - /// - /// 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; - /// - /// 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; - /// - /// 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; - /// - /// The handle returned from the Register() function of the SMM Periodic - /// Timer Dispatch Protocol when a periodic SMI handler is enabled. - /// - EFI_HANDLE DispatchHandle; - /// - /// The total number of performance counter ticks that the periodic SMI handler - /// has been executing in its current invocation. - /// - UINT64 DispatchTotalTime; - /// - /// The performance counter value that was captured the last time that the - /// periodic SMI handler called PeriodcSmiExecutionTime(). This allows the - /// time value returned by PeriodcSmiExecutionTime() to be accurate even when - /// the performance counter rolls over. - /// - 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; - /// - /// 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; - /// - /// 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 transferd - /// to the periodic SMI handler that yielded. - /// - 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; -} PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT; - -/** - Macro that returns a pointer to a PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT - structure based on a pointer to a Link field. - -**/ -#define PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK(a) \ - CR ( \ - a, \ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT, \ - Link, \ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE \ - ) - -/// -/// Pointer to the SMM Periodic Timer Disatch Protocol that was located in the constuctor. -/// -EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2 = NULL; - -/// -/// Pointer to a table of supported periodic SMI tick periods in 100 ns units -/// sorted from largest to smallest terminated by a tick period value of 0. -/// This table is allocated using AllocatePool() in the constructor and filled -/// in based on the values returned from the SMM Periodic Timer Dispatch 2 Protocol -/// function GetNextShorterInterval(). -/// -UINT64 *gSmiTickPeriodTable = NULL; - -/// -/// Linked list of free periodic SMI handlers that this library can use. -/// -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); - -/// -/// 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; - -/** - Internal worker function that returns a pointer to the - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the periodic - SMI handler that is currently being executed. If a periodic SMI handler is - not currently being executed, the NULL is returned. - - @retval NULL A periodic SMI handler is not currently being executed. - @retval other Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT - associated with the active periodic SMI handler. - -**/ -PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * -GetActivePeriodicSmiLibraryHandler ( - VOID - ) -{ - return gActivePeriodicSmiLibraryHandler; -} - -/** - Internal worker function that returns a pointer to the - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure associated with the - DispatchHandle that was returned when the periodic SMI handler was enabled - with PeriodicSmiEnable(). If DispatchHandle is NULL, then the active - periodic SMI handler is returned. If DispatchHandle is NULL and there is - no active periodic SMI handler, then NULL is returned. - - @param[in] DispatchHandle DispatchHandle that was returned when the periodic - SMI handler was enabled with PeriodicSmiEnable(). - This is an optional parameter that may be NULL. - If this parameter is NULL, then the active periodic - SMI handler is returned. - - @retval NULL DispatchHandle is NULL and there is no active periodic SMI - handler. - @retval NULL DispatchHandle does not match any of the periodic SMI handlers - that have been enabled with PeriodicSmiEnable(). - @retval other Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT - associated with the DispatchHandle. - -**/ -PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * -LookupPeriodicSmiLibraryHandler ( - IN EFI_HANDLE DispatchHandle OPTIONAL - ) -{ - LIST_ENTRY *Link; - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // If DispatchHandle is NULL, then return the active periodic SMI handler - // - if (DispatchHandle == NULL) { - return GetActivePeriodicSmiLibraryHandler (); - } - - // - // Search the periodic SMI handler entries for a a matching DispatchHandle - // - for ( Link = GetFirstNode (&gPeriodicSmiLibraryHandlers) - ; !IsNull (&gPeriodicSmiLibraryHandlers, Link) - ; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link) - ) { - PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link); - - if (PeriodicSmiLibraryHandler->DispatchHandle == DispatchHandle) { - return PeriodicSmiLibraryHandler; - } - } - - // - // No entries match DispatchHandle, so return NULL - // - return NULL; -} - -/** - Internal worker function that sets that active periodic SMI handler based on - the DispatchHandle that was returned when the periodic SMI handler was enabled - with PeriodicSmiEnable(). If DispatchHandle is NULL, then the - state is updated to show that there is not active periodic SMI handler. - A pointer to the active PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure - is returned. - - @param [in] DispatchHandle DispatchHandle that was returned when the periodic - SMI handler was enabled with PeriodicSmiEnable(). - This is an optional parameter that may be NULL. - If this parameter is NULL, then the state is updated - to show that there is not active periodic SMI handler. - @retval NULL DispatchHandle is NULL. - @retval other Pointer to the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT - associated with DispatchHandle. - -**/ -PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * -SetActivePeriodicSmiLibraryHandler ( - IN EFI_HANDLE DispatchHandle OPTIONAL - ) -{ - if (DispatchHandle == NULL) { - gActivePeriodicSmiLibraryHandler = NULL; - } else { - gActivePeriodicSmiLibraryHandler = LookupPeriodicSmiLibraryHandler (DispatchHandle); - } - return gActivePeriodicSmiLibraryHandler; -} - -/** - Internal worker function that moves the specified periodic SMI handler from the - list of managed periodic SMI handlers to the list of free periodic SMI handlers. - - @param[in] PeriodicSmiLibraryHandler Pointer to the periodic SMI handler to be reclaimed. -**/ -VOID -ReclaimPeriodicSmiLibraryHandler ( - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler - ) -{ - ASSERT (PeriodicSmiLibraryHandler->DispatchHandle == NULL); - if (PeriodicSmiLibraryHandler->Stack != NULL) { - FreePages ( - PeriodicSmiLibraryHandler->Stack, - EFI_SIZE_TO_PAGES (PeriodicSmiLibraryHandler->StackSize) - ); - PeriodicSmiLibraryHandler->Stack = NULL; - } - RemoveEntryList (&PeriodicSmiLibraryHandler->Link); - InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link); -} - -/** - Add the additional entries to the list of free periodic SMI handlers. - The function is assumed to be called only when the list of free periodic SMI - handlers is empty. - - @retval TRUE The additional entries were added. - @retval FALSE There was no available resource for the additional entries. -**/ -BOOLEAN -EnlargeFreePeriodicSmiLibraryHandlerList ( - VOID - ) -{ - UINTN Index; - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // Add the entries to the list - // - for (Index = 0; Index < PERIODIC_SMI_LIBRARY_ALLOCATE_SIZE; Index++) { - PeriodicSmiLibraryHandler = AllocatePool (sizeof (PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT)); - if (PeriodicSmiLibraryHandler == NULL) { - break; - } - PeriodicSmiLibraryHandler->Signature = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE; - InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link); - } - - return (BOOLEAN) (Index > 0); -} - -/** - Internal worker function that returns a free entry for a new periodic - SMI handler. If no free entries are available, then additional - entries are allocated. - - @retval NULL There are not enough resources available to to allocate a free entry. - @retval other Pointer to a free PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure. - -**/ -PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * -FindFreePeriodicSmiLibraryHandler ( - VOID - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - if (IsListEmpty (&gFreePeriodicSmiLibraryHandlers)) { - if (!EnlargeFreePeriodicSmiLibraryHandlerList ()) { - return NULL; - } - } - - // - // Get one from the list of free periodic SMI handlers. - // - PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK ( - GetFirstNode (&gFreePeriodicSmiLibraryHandlers) - ); - RemoveEntryList (&PeriodicSmiLibraryHandler->Link); - InsertTailList (&gPeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link); - - return PeriodicSmiLibraryHandler; -} - -/** - This function returns a pointer to a table of supported periodic - SMI tick periods in 100 ns units sorted from largest to smallest. - The table contains a array of UINT64 values terminated by a tick - period value of 0. The returned table must be treated as read-only - data and must not be freed. - - @return A pointer to a table of UINT64 tick period values in - 100ns units sorted from largest to smallest terminated - by a tick period of 0. - -**/ -UINT64 * -EFIAPI -PeriodicSmiSupportedTickPeriod ( - VOID - ) -{ - // - // Return the table allocated and populated by SmmPeriodicSmiLibConstructor() - // - return gSmiTickPeriodTable; -} - -/** - This function returns the time in 100ns units since the periodic SMI - handler function was called. If the periodic SMI handler was resumed - through PeriodicSmiYield(), then the time returned is the time in - 100ns units since PeriodicSmiYield() returned. - - @return The actual time in 100ns units that the periodic SMI handler - has been executing. If this function is not called from within - an enabled periodic SMI handler, then 0 is returned. - -**/ -UINT64 -EFIAPI -PeriodicSmiExecutionTime ( - VOID - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - UINT64 Current; - UINT64 Count; - - // - // If there is no active periodic SMI handler, then return 0 - // - PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler (); - if (PeriodicSmiLibraryHandler == NULL) { - return 0; - } - - // - // Get the current performance counter value - // - Current = GetPerformanceCounter (); - - // - // Count the number of performance counter ticks since the periodic SMI handler - // was dispatched or the last time this function was called. - // - if (PeriodicSmiLibraryHandler->PerfomanceCounterEndValue > PeriodicSmiLibraryHandler->PerfomanceCounterStartValue) { - // - // The performance counter counts up. Check for roll over condition. - // - if (Current > PeriodicSmiLibraryHandler->DispatchCheckPointTime) { - Count = Current - PeriodicSmiLibraryHandler->DispatchCheckPointTime; - } else { - Count = (Current - PeriodicSmiLibraryHandler->PerfomanceCounterStartValue) + (PeriodicSmiLibraryHandler->PerfomanceCounterEndValue - PeriodicSmiLibraryHandler->DispatchCheckPointTime); - } - } else { - // - // The performance counter counts down. Check for roll over condition. - // - if (PeriodicSmiLibraryHandler->DispatchCheckPointTime > Current) { - Count = PeriodicSmiLibraryHandler->DispatchCheckPointTime - Current; - } else { - Count = (PeriodicSmiLibraryHandler->DispatchCheckPointTime - PeriodicSmiLibraryHandler->PerfomanceCounterEndValue) + (PeriodicSmiLibraryHandler->PerfomanceCounterStartValue - Current); - } - } - - // - // Accumulate the total number of performance counter ticks since the periodic - // SMI handler was dispatched or resumed. - // - PeriodicSmiLibraryHandler->DispatchTotalTime += Count; - - // - // Update the checkpoint value to the current performance counter value - // - PeriodicSmiLibraryHandler->DispatchCheckPointTime = Current; - - // - // Convert the total number of performance counter ticks to 100 ns units - // - return DivU64x64Remainder ( - MultU64x32 (PeriodicSmiLibraryHandler->DispatchTotalTime, 10000000), - PeriodicSmiLibraryHandler->PerfomanceCounterRate, - NULL - ); -} - -/** - This function returns control back to the SMM Foundation. When the next - periodic SMI for the currently executing handler is triggered, the periodic - SMI handler will restarted from its registered DispatchFunction entry point. - If this function is not called from within an enabled periodic SMI handler, - then control is returned to the calling function. - -**/ -VOID -EFIAPI -PeriodicSmiExit ( - VOID - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // If there is no active periodic SMI handler, then return - // - PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler (); - if (PeriodicSmiLibraryHandler == NULL) { - return; - } - - // - // Perform a long jump back to the point when the currently executing dispatch - // function was dispatched. - // - LongJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer, 1); - - // - // Must never return - // - ASSERT (FALSE); - CpuDeadLoop(); -} - -/** - This function yields control back to the SMM Foundation. When the next - periodic SMI for the currently executing handler is triggered, the periodic - SMI handler will be resumed and this function will return. Use of this - function requires a seperate stack for the periodic SMI handler. A non zero - stack size must be specified in PeriodicSmiEnable() for this function to be - used. - - If the stack size passed into PeriodicSmiEnable() was zero, the 0 is returned. - - If this function is not called from within an enabled periodic SMI handler, - then 0 is returned. - - @return The actual time in 100ns units elapsed since this function was - called. A value of 0 indicates an unknown amount of time. - -**/ -UINT64 -EFIAPI -PeriodicSmiYield ( - VOID - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - UINTN SetJumpFlag; - - // - // If there is no active periodic SMI handler, then return - // - PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler (); - if (PeriodicSmiLibraryHandler == NULL) { - return 0; - } - - // - // If PeriodicSmiYield() is called without an allocated stack, then just return - // immediately with an elapsed time of 0. - // - if (PeriodicSmiLibraryHandler->Stack == NULL) { - return 0; - } - - // - // Set a flag so the next periodic SMI event will resume at where SetJump() - // is called below. - // - PeriodicSmiLibraryHandler->YieldFlag = TRUE; - - // - // Save context in YieldJumpBuffer - // - SetJumpFlag = SetJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer); - if (SetJumpFlag == 0) { - // - // The intial call to SetJump() always returns 0. - // If this is the initial call, then exit the current periodic SMI handler - // - PeriodicSmiExit (); - } - - // - // We get here when a LongJump is performed from PeriodicSmiDispatchFunctionOnCpu() - // to resume a periodic SMI handler that called PeriodicSmiYield() on the - // previous time this periodic SMI handler was dispatched. - // - // Clear the flag so the next periodic SMI dispatch will not resume. - // - PeriodicSmiLibraryHandler->YieldFlag = FALSE; - - // - // Return the amount elapsed time that occured while yielded - // - return PeriodicSmiLibraryHandler->ElapsedTime; -} - -/** - Internal worker function that transfers control to an enabled periodic SMI - handler. If the enabled periodic SMI handler was allocated its own stack, - then this function is called on that allocated stack through the BaseLin - function SwitchStack(). - - @param[in] Context1 Context1 parameter passed into SwitchStack(). - @param[in] Context2 Context2 parameter passed into SwitchStack(). - -**/ -VOID -EFIAPI -PeriodicSmiDispatchFunctionSwitchStack ( - IN VOID *Context1, OPTIONAL - IN VOID *Context2 OPTIONAL - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // Convert Context1 to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT * - // - PeriodicSmiLibraryHandler = (PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *)Context1; - - // - // Dispatch the registered handler passing in the context that was registered - // and the amount of time that has elapsed since the previous time this - // periodic SMI handler was dispacthed. - // - PeriodicSmiLibraryHandler->DispatchFunction ( - PeriodicSmiLibraryHandler->Context, - PeriodicSmiLibraryHandler->ElapsedTime - ); - - // - // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit() - // to perform a LongJump() back to PeriodicSmiDispatchFunctionOnCpu(). The - // LongJump() will resume exection on the original stack. - // - PeriodicSmiExit (); -} - -/** - Internal worker function that transfers control to an enabled periodic SMI - handler on the specified logial CPU. This function determines if the periodic - SMI handler yielded and needs to be resumed. It also and switches to an - allocated stack if one was allocated in PeriodicSmiEnable(). - - @param[in] PeriodicSmiLibraryHandler A pointer to the context for the periodic - SMI handler to execute. - -**/ -VOID -EFIAPI -PeriodicSmiDispatchFunctionOnCpu ( - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler - ) -{ - // - // Save context in DispatchJumpBuffer. The intial call to SetJump() always - // returns 0. If this is the initial call, then either resume from a prior - // call to PeriodicSmiYield() or call the DispatchFunction registerd in - // PeriodicSmiEnable() using an allocated stack if one was specified. - // - if (SetJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer) != 0) { - return; - } - - // - // Capture the performance counter value just before the periodic SMI handler - // is resumed so the amount of time the periodic SMI handler executes can be - // calculated. - // - PeriodicSmiLibraryHandler->DispatchTotalTime = 0; - PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter(); - - if (PeriodicSmiLibraryHandler->YieldFlag) { - // - // Perform a long jump back to the point where the previously dispatched - // function called PeriodicSmiYield(). - // - LongJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer, 1); - } else if (PeriodicSmiLibraryHandler->Stack == NULL) { - // - // If Stack is NULL then call DispatchFunction using current stack passing - // in the context that was registered and the amount of time that has - // elapsed since the previous time this periodic SMI handler was dispacthed. - // - PeriodicSmiLibraryHandler->DispatchFunction ( - PeriodicSmiLibraryHandler->Context, - PeriodicSmiLibraryHandler->ElapsedTime - ); - - // - // If this DispatchFunction() returns, then unconditially call PeriodicSmiExit() - // to perform a LongJump() back to this function. - // - PeriodicSmiExit (); - } else { - // - // If Stack is not NULL then call DispatchFunction switching to the allocated stack - // - SwitchStack ( - PeriodicSmiDispatchFunctionSwitchStack, - PeriodicSmiLibraryHandler, - NULL, - (UINT8 *)PeriodicSmiLibraryHandler->Stack + PeriodicSmiLibraryHandler->StackSize - ); - } - - // - // Must never return - // - ASSERT (FALSE); - CpuDeadLoop(); -} - -/** - Internal worker function that transfers control to an enabled periodic SMI - handler on the specified logial CPU. This worker function is only called - using the SMM Services Table function SmmStartupThisAp() to execute the - periodic SMI handler on a logical CPU that is different than the one that is - running the SMM Foundation. When the periodic SMI handler returns, a lock is - released to notify the CPU that is running the SMM Foundation that the periodic - SMI handler execution has finished its execution. - - @param[in, out] Buffer A pointer to the context for the periodic SMI handler. - -**/ -VOID -EFIAPI -PeriodicSmiDispatchFunctionWithLock ( - IN OUT VOID *Buffer - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // Get context - // - PeriodicSmiLibraryHandler = (PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *)Buffer; - - // - // Execute dispatch function on the currently excuting logical CPU - // - PeriodicSmiDispatchFunctionOnCpu (PeriodicSmiLibraryHandler); - - // - // Release the dispatch spin lock - // - ReleaseSpinLock (&PeriodicSmiLibraryHandler->DispatchLock); -} - -/** - Internal worker function that transfers control to a periodic SMI handler that - was enabled using PeriodicSmiEnable(). - - @param[in] DispatchHandle The unique handle assigned to this handler by - SmiHandlerRegister(). - @param[in] Context Points to an optional handler context which was - specified when the handler was registered. - @param[in, out] CommBuffer A pointer to a collection of data in memory that - will be conveyed from a non-SMM environment into - an SMM environment. - @param[in, out] CommBufferSize The size of the CommBuffer. - - @retval EFI_SUCCESS The interrupt was handled and quiesced. - No other handlers should still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other - handlers should still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other - handlers should still be called. - @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced. - -**/ -EFI_STATUS -EFIAPI -PeriodicSmiDispatchFunction ( - IN EFI_HANDLE DispatchHandle, - IN CONST VOID *Context OPTIONAL, - IN OUT VOID *CommBuffer OPTIONAL, - IN OUT UINTN *CommBufferSize OPTIONAL - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - EFI_SMM_PERIODIC_TIMER_CONTEXT *TimerContext; - EFI_STATUS Status; - - // - // Set the active periodic SMI handler - // - PeriodicSmiLibraryHandler = SetActivePeriodicSmiLibraryHandler (DispatchHandle); - if (PeriodicSmiLibraryHandler == NULL) { - return EFI_NOT_FOUND; - } - - // - // Retrieve the elapsed time since the last time this periodic SMI handler was called - // - PeriodicSmiLibraryHandler->ElapsedTime = 0; - if (CommBuffer != NULL) { - TimerContext = (EFI_SMM_PERIODIC_TIMER_CONTEXT *)CommBuffer; - PeriodicSmiLibraryHandler->ElapsedTime = TimerContext->ElapsedTime; - } - - // - // Dispatch the periodic SMI handler - // - if ((PeriodicSmiLibraryHandler->Cpu == PERIODIC_SMI_LIBRARY_ANY_CPU) || - (PeriodicSmiLibraryHandler->Cpu == gSmst->CurrentlyExecutingCpu) ) { - // - // Dispatch on the currently execution CPU if the CPU specified in PeriodicSmiEnable() - // was PERIODIC_SMI_LIBARRY_ANY_CPU or the currently executing CPU matches the CPU - // that was specified in PeriodicSmiEnable(). - // - PeriodicSmiDispatchFunctionOnCpu (PeriodicSmiLibraryHandler); - } else { - // - // Acquire spin lock for ths periodic SMI handler. The AP will release the - // spin lock when it is done executing the periodic SMI handler. - // - AcquireSpinLock (&PeriodicSmiLibraryHandler->DispatchLock); - - // - // Execute the periodic SMI handler on the CPU that was specified in - // PeriodicSmiEnable(). - // - Status = gSmst->SmmStartupThisAp ( - PeriodicSmiDispatchFunctionWithLock, - PeriodicSmiLibraryHandler->Cpu, - PeriodicSmiLibraryHandler - ); - if (!EFI_ERROR (Status)) { - // - // Wait for the AP to release the spin lock. - // - while (!AcquireSpinLockOrFail (&PeriodicSmiLibraryHandler->DispatchLock)) { - CpuPause (); - } - } - - // - // Release the spin lock for the periodic SMI handler. - // - ReleaseSpinLock (&PeriodicSmiLibraryHandler->DispatchLock); - } - - // - // Reclaim the active periodic SMI handler if it was disabled during the current dispatch. - // - if (PeriodicSmiLibraryHandler->DispatchHandle == NULL) { - ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler); - } - - // - // Update state to show that there is no active periodic SMI handler - // - SetActivePeriodicSmiLibraryHandler (NULL); - - return EFI_SUCCESS; -} - -/** - This function enables a periodic SMI handler. - - @param[in, out] DispatchHandle A pointer to the handle associated with the - enabled periodic SMI handler. This is an - optional parameter that may be NULL. If it is - NULL, then the handle will not be returned, - which means that the periodic SMI handler can - never be disabled. - @param[in] DispatchFunction A pointer to a periodic SMI handler function. - @param[in] Context Optional content to pass into DispatchFunction. - @param[in] TickPeriod The requested tick period in 100ns units that - control should be givien to the periodic SMI - handler. Must be one of the supported values - returned by PeriodicSmiSupportedPickPeriod(). - @param[in] Cpu Specifies the CPU that is required to execute - the periodic SMI handler. If Cpu is - PERIODIC_SMI_LIBRARY_ANY_CPU, then the periodic - SMI handler will always be executed on the SMST - CurrentlyExecutingCpu, which may vary across - periodic SMIs. If Cpu is between 0 and the SMST - NumberOfCpus, then the periodic SMI will always - be executed on the requested CPU. - @param[in] StackSize The size, in bytes, of the stack to allocate for - use by the periodic SMI handler. If 0, then the - default stack will be used. - - @retval EFI_INVALID_PARAMETER DispatchFunction is NULL. - @retval EFI_UNSUPPORTED TickPeriod is not a supported tick period. The - supported tick periods can be retrieved using - PeriodicSmiSupportedTickPeriod(). - @retval EFI_INVALID_PARAMETER Cpu is not PERIODIC_SMI_LIBRARY_ANY_CPU or in - the range 0 to SMST NumberOfCpus. - @retval EFI_OUT_OF_RESOURCES There are not enough resources to enable the - periodic SMI handler. - @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the - stack speficied by StackSize. - @retval EFI_SUCCESS The periodic SMI handler was enabled. - -**/ -EFI_STATUS -EFIAPI -PeriodicSmiEnable ( - IN OUT EFI_HANDLE *DispatchHandle, OPTIONAL - IN PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction, - IN CONST VOID *Context, OPTIONAL - IN UINT64 TickPeriod, - IN UINTN Cpu, - IN UINTN StackSize - ) -{ - EFI_STATUS Status; - UINTN Index; - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // Make sure all the input parameters are valid - // - if (DispatchFunction == NULL) { - return EFI_INVALID_PARAMETER; - } - - for (Index = 0; gSmiTickPeriodTable[Index] != 0; Index++) { - if (gSmiTickPeriodTable[Index] == TickPeriod) { - break; - } - } - if (gSmiTickPeriodTable[Index] == 0) { - return EFI_UNSUPPORTED; - } - - if (Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU && Cpu >= gSmst->NumberOfCpus) { - return EFI_INVALID_PARAMETER; - } - - // - // Find a free periodic SMI handler entry - // - PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler(); - if (PeriodicSmiLibraryHandler == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Initialize a new periodic SMI handler entry - // - PeriodicSmiLibraryHandler->YieldFlag = FALSE; - PeriodicSmiLibraryHandler->DispatchHandle = NULL; - PeriodicSmiLibraryHandler->DispatchFunction = DispatchFunction; - PeriodicSmiLibraryHandler->Context = (VOID *)Context; - PeriodicSmiLibraryHandler->Cpu = Cpu; - PeriodicSmiLibraryHandler->StackSize = ALIGN_VALUE (StackSize, EFI_PAGE_SIZE); - if (PeriodicSmiLibraryHandler->StackSize > 0) { - PeriodicSmiLibraryHandler->Stack = AllocatePages (EFI_SIZE_TO_PAGES (PeriodicSmiLibraryHandler->StackSize)); - 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, - &PeriodicSmiLibraryHandler->PerfomanceCounterEndValue - ); - PeriodicSmiLibraryHandler->RegisterContext.Period = TickPeriod; - PeriodicSmiLibraryHandler->RegisterContext.SmiTickInterval = TickPeriod; - Status = gSmmPeriodicTimerDispatch2->Register ( - gSmmPeriodicTimerDispatch2, - PeriodicSmiDispatchFunction, - &PeriodicSmiLibraryHandler->RegisterContext, - &PeriodicSmiLibraryHandler->DispatchHandle - ); - if (EFI_ERROR (Status)) { - PeriodicSmiLibraryHandler->DispatchHandle = NULL; - ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler); - return EFI_OUT_OF_RESOURCES; - } - - // - // Return the registered handle if the optional DispatchHandle parameter is not NULL - // - if (DispatchHandle != NULL) { - *DispatchHandle = PeriodicSmiLibraryHandler->DispatchHandle; - } - return EFI_SUCCESS; -} - -/** - This function disables a periodic SMI handler that has been previously - enabled with PeriodicSmiEnable(). - - @param[in] DispatchHandle A handle associated with a previously enabled periodic - SMI handler. This is an optional parameter that may - be NULL. If it is NULL, then the active periodic SMI - handlers is disabled. - - @retval FALSE DispatchHandle is NULL and there is no active periodic SMI handler. - @retval FALSE The periodic SMI handler specified by DispatchHandle has - not been enabled with PeriodicSmiEnable(). - @retval TRUE The periodic SMI handler specified by DispatchHandle has - been disabled. If DispatchHandle is NULL, then the active - periodic SMI handler has been disabled. - -**/ -BOOLEAN -EFIAPI -PeriodicSmiDisable ( - IN EFI_HANDLE DispatchHandle OPTIONAL - ) -{ - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - EFI_STATUS Status; - - // - // Lookup the periodic SMI handler specified by DispatchHandle - // - PeriodicSmiLibraryHandler = LookupPeriodicSmiLibraryHandler (DispatchHandle); - if (PeriodicSmiLibraryHandler == NULL) { - return FALSE; - } - - // - // Unregister the periodic SMI handler from the SMM Periodic Timer Dispatch 2 Protocol - // - Status = gSmmPeriodicTimerDispatch2->UnRegister ( - gSmmPeriodicTimerDispatch2, - PeriodicSmiLibraryHandler->DispatchHandle - ); - if (EFI_ERROR (Status)) { - return FALSE; - } - - // - // Mark the entry for the disabled periodic SMI handler as free, and - // call ReclaimPeriodicSmiLibraryHandler to move it to the list of free - // periodic SMI handlers. - // - PeriodicSmiLibraryHandler->DispatchHandle = NULL; - if (PeriodicSmiLibraryHandler != GetActivePeriodicSmiLibraryHandler ()) { - ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler); - } - - return TRUE; -} - -/** - This constructor function caches the pointer to the SMM Periodic Timer - Dispatch 2 Protocol and collects the list SMI tick rates that the hardware - supports. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmPeriodicSmiLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - UINT64 *SmiTickInterval; - UINTN Count; - - // - // Locate the SMM Periodic Timer Dispatch 2 Protocol - // - Status = gSmst->SmmLocateProtocol ( - &gEfiSmmPeriodicTimerDispatch2ProtocolGuid, - NULL, - (VOID **)&gSmmPeriodicTimerDispatch2 - ); - ASSERT_EFI_ERROR (Status); - ASSERT (gSmmPeriodicTimerDispatch2 != NULL); - - // - // Count the number of periodic SMI tick intervals that the SMM Periodic Timer - // Dipatch 2 Protocol supports. - // - SmiTickInterval = NULL; - Count = 0; - do { - Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval ( - gSmmPeriodicTimerDispatch2, - &SmiTickInterval - ); - Count++; - } while (SmiTickInterval != NULL); - - // - // Allocate a buffer for the table of supported periodic SMI tick periods. - // - gSmiTickPeriodTable = AllocateZeroPool (Count * sizeof (UINT64)); - ASSERT (gSmiTickPeriodTable != NULL); - - // - // Fill in the table of supported periodic SMI tick periods. - // - SmiTickInterval = NULL; - Count = 0; - do { - gSmiTickPeriodTable[Count] = 0; - Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval ( - gSmmPeriodicTimerDispatch2, - &SmiTickInterval - ); - if (SmiTickInterval != NULL) { - gSmiTickPeriodTable[Count] = *SmiTickInterval; - } - Count++; - } while (SmiTickInterval != NULL); - - // - // Allocate buffer for initial set of periodic SMI handlers - // - EnlargeFreePeriodicSmiLibraryHandlerList (); - - return EFI_SUCCESS; -} - -/** - The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 - Protocol and collects the list SMI tick rates that the hardware supports. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmPeriodicSmiLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - LIST_ENTRY *Link; - PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; - - // - // Free the table of supported periodic SMI tick rates - // - if (gSmiTickPeriodTable != NULL) { - FreePool (gSmiTickPeriodTable); - } - - // - // Disable all periodic SMI handlers - // - for (Link = GetFirstNode (&gPeriodicSmiLibraryHandlers); !IsNull (&gPeriodicSmiLibraryHandlers, Link);) { - PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link); - Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link); - PeriodicSmiDisable (PeriodicSmiLibraryHandler->DispatchHandle); - } - - // - // Free all the periodic SMI handler entries - // - for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) { - PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link); - Link = RemoveEntryList (Link); - FreePool (PeriodicSmiLibraryHandler); - } - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf deleted file mode 100644 index 943588b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf +++ /dev/null @@ -1,52 +0,0 @@ -## @file -# SMM Periodic SMI Library. -# -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPeriodicSmiLib - MODULE_UNI_FILE = SmmPeriodicSmiLib.uni - FILE_GUID = AED5F3FB-4CFF-4b60-9E43-1541B55C8267 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmmPeriodicSmiLib|DXE_SMM_DRIVER - PI_SPECIFICATION_VERSION = 0x0001000A - CONSTRUCTOR = SmmPeriodicSmiLibConstructor - DESTRUCTOR = SmmPeriodicSmiLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SmmPeriodicSmiLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - SynchronizationLib - DebugLib - TimerLib - MemoryAllocationLib - SmmServicesTableLib - -[Protocols] - gEfiSmmPeriodicTimerDispatch2ProtocolGuid ## CONSUMES - -[Depex] - gEfiSmmPeriodicTimerDispatch2ProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.uni deleted file mode 100644 index bc59e9c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// SMM Periodic SMI Library. -// -// SMM Periodic SMI Library. -// -// Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SMM Periodic SMI Library" - -#string STR_MODULE_DESCRIPTION #language en-US "SMM Periodic SMI Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c deleted file mode 100644 index 1ee4726..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c +++ /dev/null @@ -1,85 +0,0 @@ -/** @file - SMM Services Table Library. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -EFI_SMM_SYSTEM_TABLE2 *gSmst = NULL; - -/** - The constructor function caches the pointer of SMM Services Table. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_SMM_BASE2_PROTOCOL *InternalSmmBase2; - - InternalSmmBase2 = NULL; - // - // Retrieve SMM Base2 Protocol, Do not use gBS from UefiBootServicesTableLib on purpose - // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the - // SMM driver explicity declares that dependency. - // - Status = SystemTable->BootServices->LocateProtocol ( - &gEfiSmmBase2ProtocolGuid, - NULL, - (VOID **)&InternalSmmBase2 - ); - ASSERT_EFI_ERROR (Status); - ASSERT (InternalSmmBase2 != NULL); - - // - // We are in SMM, retrieve the pointer to SMM System Table - // - InternalSmmBase2->GetSmstLocation (InternalSmmBase2, &gSmst); - ASSERT (gSmst != NULL); - - return EFI_SUCCESS; -} - -/** - This function allows the caller to determine if the driver is executing in - System Management Mode(SMM). - - This function returns TRUE if the driver is executing in SMM and FALSE if the - driver is not executing in SMM. - - @retval TRUE The driver is executing in System Management Mode (SMM). - @retval FALSE The driver is not executing in System Management Mode (SMM). - -**/ -BOOLEAN -EFIAPI -InSmm ( - VOID - ) -{ - // - // We are already in SMM - // - return TRUE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf deleted file mode 100644 index 4a3d7dc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# SMM Services Table Library. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmServicesTableLib - MODULE_UNI_FILE = SmmServicesTableLib.uni - FILE_GUID = 064B4C5B-C5EF-4eff-85DF-65518EF1314D - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SmmServicesTableLib|DXE_SMM_DRIVER - PI_SPECIFICATION_VERSION = 0x0001000A - CONSTRUCTOR = SmmServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SmmServicesTableLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - -[Protocols] - gEfiSmmBase2ProtocolGuid ## CONSUMES - -[Depex] - gEfiSmmBase2ProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.uni deleted file mode 100644 index 935682d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// SMM Services Table Library. -// -// SMM Services Table Library. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "SMM Services Table Library" - -#string STR_MODULE_DESCRIPTION #language en-US "SMM Services Table Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c deleted file mode 100644 index f745280..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c +++ /dev/null @@ -1,87 +0,0 @@ -/** @file - Entry point to a Standalone MM driver. - -Copyright (c) 2015, Intel Corporation. All rights reserved.
-Copyright (c) 2016 - 2018, ARM Ltd. All rights reserved.
-Copyright (c) 2018, Linaro, Limited. All rights reserved.
- -This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -/** - The entry point of PE/COFF Image for a Standalone MM Driver. - - This function is the entry point for a Standalone MM Driver. - This function must call ProcessLibraryConstructorList() and - ProcessModuleEntryPointList(). - If the return status from ProcessModuleEntryPointList() - is an error status, then ProcessLibraryDestructorList() must be called. - The return value from ProcessModuleEntryPointList() is returned. - If _gMmRevision is not zero and SystemTable->Hdr.Revision is - less than _gMmRevision, then return EFI_INCOMPATIBLE_VERSION. - - @param ImageHandle The image handle of the Standalone MM Driver. - @param MmSystemTable A pointer to the MM System Table. - - @retval EFI_SUCCESS The Standalone MM Driver exited normally. - @retval EFI_INCOMPATIBLE_VERSION _gMmRevision is greater than - MmSystemTable->Hdr.Revision. - @retval Other Return value from - ProcessModuleEntryPointList(). - -**/ -EFI_STATUS -EFIAPI -_ModuleEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable - ) -{ - EFI_STATUS Status; - - if (_gMmRevision != 0) { - // - // Make sure that the MM spec revision of the platform - // is >= MM spec revision of the driver - // - if (MmSystemTable->Hdr.Revision < _gMmRevision) { - return EFI_INCOMPATIBLE_VERSION; - } - } - - // - // Call constructor for all libraries - // - ProcessLibraryConstructorList (ImageHandle, MmSystemTable); - - // - // Call the driver entry point - // - Status = ProcessModuleEntryPointList (ImageHandle, MmSystemTable); - - // - // If all of the drivers returned errors, then invoke all of the library destructors - // - if (EFI_ERROR (Status)) { - ProcessLibraryDestructorList (ImageHandle, MmSystemTable); - } - - // - // Return the cumulative return status code from all of the driver entry points - // - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf deleted file mode 100644 index d88e13e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf +++ /dev/null @@ -1,43 +0,0 @@ -## @file -# Module entry point library for Standalone MM driver. -# -# Copyright (c) 2015, Intel Corporation. All rights reserved.
-# Copyright (c) 2016-2018, ARM Ltd. All rights reserved.
-# Copyright (c) 2018, Linaro, Limited. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x0001001B - BASE_NAME = StandaloneMmDriverEntryPoint - MODULE_UNI_FILE = StandaloneMmDriverEntryPoint.uni - FILE_GUID = 5ca126c0-b598-4f4b-abb9-b6e7d077aea9 - MODULE_TYPE = MM_STANDALONE - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x00010032 - LIBRARY_CLASS = StandaloneMmDriverEntryPoint|MM_STANDALONE - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - StandaloneMmDriverEntryPoint.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - MmServicesTableLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni deleted file mode 100644 index 5896813..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// -// Module entry point library for standalone MM driver -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
-// Copyright (c) 2018, Linaro, Limited. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for standalone MM driver" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for standalone MM driver." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c deleted file mode 100644 index e7637db..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - MM Services Table Library. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2018, Linaro, Ltd. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -EFI_MM_SYSTEM_TABLE *gMmst = NULL; - -/** - The constructor function caches the pointer of the MM Services Table. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param MmSystemTable A pointer to the MM System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -StandaloneMmServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_MM_SYSTEM_TABLE *MmSystemTable - ) -{ - gMmst = MmSystemTable; - ASSERT (gMmst != NULL); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf deleted file mode 100644 index 8ef0882..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# Standalone MM Services Table Library. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x0001001B - BASE_NAME = StandaloneMmServicesTableLib - MODULE_UNI_FILE = StandaloneMmServicesTableLib.uni - FILE_GUID = eaa4684f-fb4e-41f3-9967-307d5b409182 - MODULE_TYPE = MM_STANDALONE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MmServicesTableLib|MM_STANDALONE - PI_SPECIFICATION_VERSION = 0x00010032 - CONSTRUCTOR = StandaloneMmServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - StandaloneMmServicesTableLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib diff --git a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni deleted file mode 100644 index 37efb93..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni +++ /dev/null @@ -1,20 +0,0 @@ -// /** @file -// -// Standalone MM Services Table Library. -// -// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-// Copyright (c) 2018, Linaro, Ltd. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Standalone MM Services Table Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Standalone MM Services Table Library." diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c deleted file mode 100644 index 5618055..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c +++ /dev/null @@ -1,121 +0,0 @@ -/** @file - Entry point library instance to a UEFI application. - -Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include - - -/** - Entry point to UEFI Application. - - This function is the entry point for a UEFI Application. This function must call - ProcessLibraryConstructorList(), ProcessModuleEntryPointList(), and ProcessLibraryDestructorList(). - The return value from ProcessModuleEntryPointList() is returned. - If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison, - then return EFI_INCOMPATIBLE_VERSION. - - @param ImageHandle The image handle of the UEFI Application. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The UEFI Application exited normally. - @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision. - @retval Other Return value from ProcessModuleEntryPointList(). - -**/ -EFI_STATUS -EFIAPI -_ModuleEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - if (_gUefiDriverRevision != 0) { - // - // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application. - // - if (SystemTable->Hdr.Revision < _gUefiDriverRevision) { - return EFI_INCOMPATIBLE_VERSION; - } - } - - // - // Call constructor for all libraries. - // - ProcessLibraryConstructorList (ImageHandle, SystemTable); - - // - // Call the module's entry point - // - Status = ProcessModuleEntryPointList (ImageHandle, SystemTable); - - // - // Process destructor for all libraries. - // - ProcessLibraryDestructorList (ImageHandle, SystemTable); - - // - // Return the return status code from the driver entry point - // - return Status; -} - - -/** - Invokes the library destructors for all dependent libraries and terminates - the UEFI Application. - - This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit() - with a status specified by Status. - - @param Status Status returned by the application that is exiting. - -**/ -VOID -EFIAPI -Exit ( - IN EFI_STATUS Status - ) - -{ - ProcessLibraryDestructorList (gImageHandle, gST); - - gBS->Exit (gImageHandle, Status, 0, NULL); -} - - -/** - Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). - - @param ImageHandle The image handle of the UEFI Application. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The UEFI Application exited normally. - @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision. - @retval Other Return value from ProcessModuleEntryPointList(). - -**/ -EFI_STATUS -EFIAPI -EfiMain ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return _ModuleEntryPoint (ImageHandle, SystemTable); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf deleted file mode 100644 index 8a03ef5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file -# Module entry point library for UEFI Application. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiApplicationEntryPoint - MODULE_UNI_FILE = UefiApplicationEntryPoint.uni - FILE_GUID = DADE8301-CB29-4fd5-8148-56FD246C5B88 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiApplicationEntryPoint|UEFI_APPLICATION - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - ApplicationEntryPoint.c - - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - BaseLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.uni deleted file mode 100644 index f81c388..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Module entry point library for UEFI Application. -// -// Module entry point library for UEFI Application. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for UEFI Application" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for UEFI Application." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c deleted file mode 100644 index ebc9a4b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - This library retrieve the EFI_BOOT_SERVICES pointer from EFI system table in - library's constructor. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include - -EFI_HANDLE gImageHandle = NULL; -EFI_SYSTEM_TABLE *gST = NULL; -EFI_BOOT_SERVICES *gBS = NULL; - -/** - The constructor function caches the pointer of Boot Services Table. - - The constructor function caches the pointer of Boot Services Table through System Table. - It will ASSERT() if the pointer of System Table is NULL. - It will ASSERT() if the pointer of Boot Services Table is NULL. - It will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -UefiBootServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // Cache the Image Handle - // - gImageHandle = ImageHandle; - ASSERT (gImageHandle != NULL); - - // - // Cache pointer to the EFI System Table - // - gST = SystemTable; - ASSERT (gST != NULL); - - // - // Cache pointer to the EFI Boot Services Table - // - gBS = SystemTable->BootServices; - ASSERT (gBS != NULL); - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf deleted file mode 100644 index f47b177..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf +++ /dev/null @@ -1,40 +0,0 @@ -## @file -# UEFI Boot Services Table Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiBootServicesTableLib - MODULE_UNI_FILE = UefiBootServicesTableLib.uni - FILE_GUID = ff5c7a2c-ab7a-4366-8616-11c6e53247b6 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiBootServicesTableLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - - CONSTRUCTOR = UefiBootServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiBootServicesTableLib.c - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni deleted file mode 100644 index 1c98829..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// UEFI Boot Services Table Library implementation. -// -// UEFI Boot Services Table Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "UEFI Boot Services Table Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "UEFI Boot Services Table Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/DebugLib.c deleted file mode 100644 index 991e429..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/DebugLib.c +++ /dev/null @@ -1,278 +0,0 @@ -/** @file - UEFI Debug Library that sends messages to the Console Output Device in the EFI System Table. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format Format string for the debug message to print. - @param ... A variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ - CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Check driver debug mask value and global mask - // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) { - return; - } - - // - // Convert the DEBUG() message to a Unicode String - // - VA_START (Marker, Format); - UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, Marker); - VA_END (Marker); - - - // - // Send the print string to the Console Output device - // - if ((gST != NULL) && (gST->ConOut != NULL)) { - gST->ConOut->OutputString (gST->ConOut, Buffer); - } -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated - the assert condition. - @param LineNumber The line number in the source file that generated the - assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ - CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Generate the ASSERT() message in Unicode format - // - UnicodeSPrintAsciiFormat ( - Buffer, - sizeof (Buffer), - "ASSERT [%a] %a(%d): %a\n", - gEfiCallerBaseName, - FileName, - LineNumber, - Description - ); - - // - // Send the print string to the Console Output device - // - if ((gST != NULL) && (gST->ConOut != NULL)) { - gST->ConOut->OutputString (gST->ConOut, Buffer); - } - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf deleted file mode 100644 index c957f2f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf +++ /dev/null @@ -1,54 +0,0 @@ -## @file -# Instance of Debug Library using Console Output Device. -# -# Debug Lib that sends messages to the Console Output Device in the EFI System Table. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDebugLibConOut - MODULE_UNI_FILE = UefiDebugLibConOut.uni - FILE_GUID = 5cddfaf3-e9a7-4d16-bdce-1e002df475bb - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - - -[Sources] - DebugLib.c - - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - BaseLib - PcdLib - PrintLib - UefiBootServicesTableLib - DebugPrintErrorLevelLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.uni deleted file mode 100644 index 34e6bcf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Debug Library using Console Output Device. -// -// Debug Lib that sends messages to the Console Output Device in the EFI System Table. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Library using Console Output Device" - -#string STR_MODULE_DESCRIPTION #language en-US "Debug Lib that sends messages to the Console Output Device in the EFI System Table." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c deleted file mode 100644 index a3b3f28..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c +++ /dev/null @@ -1,331 +0,0 @@ -/** @file - UEFI Debug Library that sends messages to EFI_DEBUGPORT_PROTOCOL.Write. - - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 - -// -// Define the timeout for EFI_DEBUGPORT_PROTOCOL.Write -// -#define WRITE_TIMEOUT 1000 - - -EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL; - -/** - Send message to DebugPort Protocol. - - If mDebugPort is NULL, i.e. EFI_DEBUGPORT_PROTOCOL is not located, - EFI_DEBUGPORT_PROTOCOL is located first. - Then, Buffer is sent via EFI_DEBUGPORT_PROTOCOL.Write. - - @param Buffer The message to be sent. - @param BufferLength The byte length of Buffer. -**/ -VOID -UefiDebugLibDebugPortProtocolWrite ( - IN CONST CHAR8 *Buffer, - IN UINTN BufferLength - ) -{ - UINTN Length; - EFI_STATUS Status; - - // - // If mDebugPort is NULL, initialize first. - // - if (mDebugPort == NULL) { - Status = gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort); - if (EFI_ERROR (Status)) { - return; - } - - mDebugPort->Reset (mDebugPort); - } - - // - // EFI_DEBUGPORT_PROTOCOL.Write is called until all message is sent. - // - while (BufferLength > 0) { - Length = BufferLength; - - Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *) Buffer); - if (EFI_ERROR (Status) || BufferLength < Length) { - break; - } - - Buffer += Length; - BufferLength -= Length; - } -} - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format Format string for the debug message to print. - @param ... A variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Check driver debug mask value and global mask - // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) { - return; - } - - // - // Convert the DEBUG() message to an ASCII String - // - VA_START (Marker, Format); - AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker); - VA_END (Marker); - - // - // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write. - // - UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer)); -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated - the assert condition. - @param LineNumber The line number in the source file that generated the - assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Generate the ASSERT() message in ASCII format - // - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "ASSERT [%a] %a(%d): %a\n", - gEfiCallerBaseName, - FileName, - LineNumber, - Description - ); - - // - // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write. - // - UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer)); - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf deleted file mode 100644 index 4775744..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf +++ /dev/null @@ -1,57 +0,0 @@ -## @file -# Instance of Debug Library using EFI_DEBUGPORT_PROTOCOL. -# -# Debug Lib that sends messages to EFI_DEBUGPORT_PROTOCOL.Write. -# -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDebugLibDebugPortProtocol - MODULE_UNI_FILE = UefiDebugLibDebugPortProtocol.uni - FILE_GUID = 102287b4-6b12-4D41-91e1-ebee1f3aa614 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - - -[Sources] - DebugLib.c - - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - BaseLib - PcdLib - PrintLib - UefiBootServicesTableLib - DebugPrintErrorLevelLib - -[Protocols] - gEfiDebugPortProtocolGuid ## CONSUMES - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.uni deleted file mode 100644 index 890f314..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Debug Library using EFI_DEBUGPORT_PROTOCOL. -// -// Debug Lib that sends messages to EFI_DEBUGPORT_PROTOCOL.Write. -// -// Copyright (c) 2015, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Library using EFI_DEBUGPORT_PROTOCOL" - -#string STR_MODULE_DESCRIPTION #language en-US "Debug Lib that sends messages to EFI_DEBUGPORT_PROTOCOL.Write." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c deleted file mode 100644 index 181f9da..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c +++ /dev/null @@ -1,279 +0,0 @@ -/** @file - UEFI Debug Lib that sends messages to the Standard Error Device in the EFI System Table. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include -#include -#include -#include -#include - -// -// Define the maximum debug and assert message length that this library supports -// -#define MAX_DEBUG_MESSAGE_LENGTH 0x100 - - -/** - Prints a debug message to the debug output device if the specified error level is enabled. - - If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function - GetDebugPrintErrorLevel (), then print the message specified by Format and the - associated variable argument list to the debug output device. - - If Format is NULL, then ASSERT(). - - @param ErrorLevel The error level of the debug message. - @param Format The format string for the debug message to print. - @param ... The variable argument list whose contents are accessed - based on the format string specified by Format. - -**/ -VOID -EFIAPI -DebugPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - ... - ) -{ - CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - VA_LIST Marker; - - // - // If Format is NULL, then ASSERT(). - // - ASSERT (Format != NULL); - - // - // Check driver debug mask value and global mask - // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) { - return; - } - - // - // Convert the DEBUG() message to a Unicode String - // - VA_START (Marker, Format); - UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, Marker); - VA_END (Marker); - - // - // Send the print string to the Standard Error device - // - if ((gST != NULL) && (gST->StdErr != NULL)) { - gST->StdErr->OutputString (gST->StdErr, Buffer); - } -} - - -/** - Prints an assert message containing a filename, line number, and description. - This may be followed by a breakpoint or a dead loop. - - Print a message of the form "ASSERT (): \n" - to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of - PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if - DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then - CpuDeadLoop() is called. If neither of these bits are set, then this function - returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recursion. If DebugAssert() is called while - processing another DebugAssert(), then DebugAssert() must return immediately. - - If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. - - @param FileName The pointer to the name of the source file that generated - the assert condition. - @param LineNumber The line number in the source file that generated the - assert condition - @param Description The pointer to the description of the assert condition. - -**/ -VOID -EFIAPI -DebugAssert ( - IN CONST CHAR8 *FileName, - IN UINTN LineNumber, - IN CONST CHAR8 *Description - ) -{ - CHAR16 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - - // - // Generate the ASSERT() message in Unicode format - // - UnicodeSPrintAsciiFormat ( - Buffer, - sizeof (Buffer), - "ASSERT [%a] %a(%d): %a\n", - gEfiCallerBaseName, - FileName, - LineNumber, - Description - ); - - // - // Send the print string to the Standard Error device - // - if ((gST != NULL) && (gST->StdErr != NULL)) { - gST->StdErr->OutputString (gST->StdErr, Buffer); - } - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings - // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} - - -/** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. - - This function fills Length bytes of Buffer with the value specified by - PcdDebugClearMemoryValue, and returns Buffer. - - If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue. - @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - - @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue. - -**/ -VOID * -EFIAPI -DebugClearMemory ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - // - // If Buffer is NULL, then ASSERT(). - // - ASSERT (Buffer != NULL); - - // - // SetMem() checks for the the ASSERT() condition on Length and returns Buffer - // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); -} - - -/** - Returns TRUE if ASSERT() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugAssertEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugPrintEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CODE() macros are enabled. - - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugCodeEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); -} - - -/** - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of - PcdDebugProperyMask is set. Otherwise FALSE is returned. - - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. - -**/ -BOOLEAN -EFIAPI -DebugClearMemoryEnabled ( - VOID - ) -{ - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); -} - -/** - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel. - - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel. - - @retval TRUE Current ErrorLevel is supported. - @retval FALSE Current ErrorLevel is not supported. - -**/ -BOOLEAN -EFIAPI -DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel - ) -{ - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf deleted file mode 100644 index 6b34baf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf +++ /dev/null @@ -1,52 +0,0 @@ -## @file -# Instance of Debug Library using the Standard Error Device. -# -# Debug Lib that sends messages to the the Standard Error Device in the EFI System Table. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDebugLibStdErr - MODULE_UNI_FILE = UefiDebugLibStdErr.uni - FILE_GUID = b57a1df6-ffdb-4247-a3df-3a562176751a - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DebugLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - BaseLib - PcdLib - PrintLib - UefiBootServicesTableLib - DebugPrintErrorLevelLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.uni deleted file mode 100644 index 50f217a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Debug Library using the Standard Error Device. -// -// Debug Lib that sends messages to the the Standard Error Device in the EFI System Table. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Library using the Standard Error Device" - -#string STR_MODULE_DESCRIPTION #language en-US "This Debug Lib sends messages to the Standard Error Device in the EFI System Table." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c deleted file mode 100644 index 56905e7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ /dev/null @@ -1,3672 +0,0 @@ -/** @file - DevicePathFromText protocol as defined in the UEFI 2.0 specification. - -Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiDevicePathLib.h" - -/** - - Duplicates a string. - - @param Src Source string. - - @return The duplicated string. - -**/ -CHAR16 * -UefiDevicePathLibStrDuplicate ( - IN CONST CHAR16 *Src - ) -{ - return AllocateCopyPool (StrSize (Src), Src); -} - -/** - - Get parameter in a pair of parentheses follow the given node name. - For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1". - - @param Str Device Path Text. - @param NodeName Name of the node. - - @return Parameter text for the node. - -**/ -CHAR16 * -GetParamByNodeName ( - IN CHAR16 *Str, - IN CHAR16 *NodeName - ) -{ - CHAR16 *ParamStr; - CHAR16 *StrPointer; - UINTN NodeNameLength; - UINTN ParameterLength; - - // - // Check whether the node name matchs - // - NodeNameLength = StrLen (NodeName); - if (StrnCmp (Str, NodeName, NodeNameLength) != 0) { - return NULL; - } - - ParamStr = Str + NodeNameLength; - if (!IS_LEFT_PARENTH (*ParamStr)) { - return NULL; - } - - // - // Skip the found '(' and find first occurrence of ')' - // - ParamStr++; - ParameterLength = 0; - StrPointer = ParamStr; - while (!IS_NULL (*StrPointer)) { - if (IS_RIGHT_PARENTH (*StrPointer)) { - break; - } - StrPointer++; - ParameterLength++; - } - if (IS_NULL (*StrPointer)) { - // - // ')' not found - // - return NULL; - } - - ParamStr = AllocateCopyPool ((ParameterLength + 1) * sizeof (CHAR16), ParamStr); - if (ParamStr == NULL) { - return NULL; - } - // - // Terminate the parameter string - // - ParamStr[ParameterLength] = L'\0'; - - return ParamStr; -} - -/** - Gets current sub-string from a string list, before return - the list header is moved to next sub-string. The sub-string is separated - by the specified character. For example, the separator is ',', the string - list is "2,0,3", it returns "2", the remain list move to "0,3" - - @param List A string list separated by the specified separator - @param Separator The separator character - - @return A pointer to the current sub-string - -**/ -CHAR16 * -SplitStr ( - IN OUT CHAR16 **List, - IN CHAR16 Separator - ) -{ - CHAR16 *Str; - CHAR16 *ReturnStr; - - Str = *List; - ReturnStr = Str; - - if (IS_NULL (*Str)) { - return ReturnStr; - } - - // - // Find first occurrence of the separator - // - while (!IS_NULL (*Str)) { - if (*Str == Separator) { - break; - } - Str++; - } - - if (*Str == Separator) { - // - // Find a sub-string, terminate it - // - *Str = L'\0'; - Str++; - } - - // - // Move to next sub-string - // - *List = Str; - - return ReturnStr; -} - -/** - Gets the next parameter string from the list. - - @param List A string list separated by the specified separator - - @return A pointer to the current sub-string - -**/ -CHAR16 * -GetNextParamStr ( - IN OUT CHAR16 **List - ) -{ - // - // The separator is comma - // - return SplitStr (List, L','); -} - -/** - Get one device node from entire device path text. - - @param DevicePath On input, the current Device Path node; on output, the next device path node - @param IsInstanceEnd This node is the end of a device path instance - - @return A device node text or NULL if no more device node available - -**/ -CHAR16 * -GetNextDeviceNodeStr ( - IN OUT CHAR16 **DevicePath, - OUT BOOLEAN *IsInstanceEnd - ) -{ - CHAR16 *Str; - CHAR16 *ReturnStr; - UINTN ParenthesesStack; - - Str = *DevicePath; - if (IS_NULL (*Str)) { - return NULL; - } - - // - // Skip the leading '/', '(', ')' and ',' - // - while (!IS_NULL (*Str)) { - if (!IS_SLASH (*Str) && - !IS_COMMA (*Str) && - !IS_LEFT_PARENTH (*Str) && - !IS_RIGHT_PARENTH (*Str)) { - break; - } - Str++; - } - - ReturnStr = Str; - - // - // Scan for the separator of this device node, '/' or ',' - // - ParenthesesStack = 0; - while (!IS_NULL (*Str)) { - if ((IS_COMMA (*Str) || IS_SLASH (*Str)) && (ParenthesesStack == 0)) { - break; - } - - if (IS_LEFT_PARENTH (*Str)) { - ParenthesesStack++; - } else if (IS_RIGHT_PARENTH (*Str)) { - ParenthesesStack--; - } - - Str++; - } - - if (ParenthesesStack != 0) { - // - // The '(' doesn't pair with ')', invalid device path text - // - return NULL; - } - - if (IS_COMMA (*Str)) { - *IsInstanceEnd = TRUE; - *Str = L'\0'; - Str++; - } else { - *IsInstanceEnd = FALSE; - if (!IS_NULL (*Str)) { - *Str = L'\0'; - Str++; - } - } - - *DevicePath = Str; - - return ReturnStr; -} - - -/** - Return whether the integer string is a hex string. - - @param Str The integer string - - @retval TRUE Hex string - @retval FALSE Decimal string - -**/ -BOOLEAN -IsHexStr ( - IN CHAR16 *Str - ) -{ - // - // skip preceeding white space - // - while ((*Str != 0) && *Str == L' ') { - Str ++; - } - // - // skip preceeding zeros - // - while ((*Str != 0) && *Str == L'0') { - Str ++; - } - - return (BOOLEAN) (*Str == L'x' || *Str == L'X'); -} - -/** - - Convert integer string to uint. - - @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal. - - @return A UINTN value represented by Str - -**/ -UINTN -Strtoi ( - IN CHAR16 *Str - ) -{ - if (IsHexStr (Str)) { - return StrHexToUintn (Str); - } else { - return StrDecimalToUintn (Str); - } -} - -/** - - Convert integer string to 64 bit data. - - @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal. - @param Data A pointer to the UINT64 value represented by Str - -**/ -VOID -Strtoi64 ( - IN CHAR16 *Str, - OUT UINT64 *Data - ) -{ - if (IsHexStr (Str)) { - *Data = StrHexToUint64 (Str); - } else { - *Data = StrDecimalToUint64 (Str); - } -} - -/** - Converts a Unicode string to ASCII string. - - @param Str The equivalent Unicode string - @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points - to the next ASCII string next to it - -**/ -VOID -StrToAscii ( - IN CHAR16 *Str, - IN OUT CHAR8 **AsciiStr - ) -{ - CHAR8 *Dest; - - Dest = *AsciiStr; - while (!IS_NULL (*Str)) { - *(Dest++) = (CHAR8) *(Str++); - } - *Dest = 0; - - // - // Return the string next to it - // - *AsciiStr = Dest + 1; -} - -/** - Converts a generic text device path node to device path structure. - - @param Type The type of the device path node. - @param TextDeviceNode The input text device path node. - - @return A pointer to device path structure. -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextGenericPath ( - IN UINT8 Type, - IN CHAR16 *TextDeviceNode - ) -{ - EFI_DEVICE_PATH_PROTOCOL *Node; - CHAR16 *SubtypeStr; - CHAR16 *DataStr; - UINTN DataLength; - - SubtypeStr = GetNextParamStr (&TextDeviceNode); - DataStr = GetNextParamStr (&TextDeviceNode); - - if (DataStr == NULL) { - DataLength = 0; - } else { - DataLength = StrLen (DataStr) / 2; - } - Node = CreateDeviceNode ( - Type, - (UINT8) Strtoi (SubtypeStr), - (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength) - ); - - StrHexToBytes (DataStr, DataLength * 2, (UINT8 *) (Node + 1), DataLength); - return Node; -} - -/** - Converts a generic text device path node to device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPath ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *TypeStr; - - TypeStr = GetNextParamStr (&TextDeviceNode); - - return DevPathFromTextGenericPath ((UINT8) Strtoi (TypeStr), TextDeviceNode); -} - -/** - Converts a generic hardware text device path node to Hardware device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to Hardware device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextHardwarePath ( - IN CHAR16 *TextDeviceNode - ) -{ - return DevPathFromTextGenericPath (HARDWARE_DEVICE_PATH, TextDeviceNode); -} - -/** - Converts a text device path node to Hardware PCI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to Hardware PCI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPci ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->Function = (UINT8) Strtoi (FunctionStr); - Pci->Device = (UINT8) Strtoi (DeviceStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Pci; -} - -/** - Converts a text device path node to Hardware PC card device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to Hardware PC card device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPcCard ( - 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->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Pccard; -} - -/** - Converts a text device path node to Hardware memory map device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to Hardware memory map device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextMemoryMapped ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *MemoryTypeStr; - CHAR16 *StartingAddressStr; - CHAR16 *EndingAddressStr; - MEMMAP_DEVICE_PATH *MemMap; - - MemoryTypeStr = GetNextParamStr (&TextDeviceNode); - StartingAddressStr = GetNextParamStr (&TextDeviceNode); - EndingAddressStr = GetNextParamStr (&TextDeviceNode); - MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode ( - HARDWARE_DEVICE_PATH, - HW_MEMMAP_DP, - (UINT16) sizeof (MEMMAP_DEVICE_PATH) - ); - - MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr); - Strtoi64 (StartingAddressStr, &MemMap->StartingAddress); - Strtoi64 (EndingAddressStr, &MemMap->EndingAddress); - - return (EFI_DEVICE_PATH_PROTOCOL *) MemMap; -} - -/** - Converts a text device path node to Vendor device path structure based on the input Type - and SubType. - - @param TextDeviceNode The input Text device path node. - @param Type The type of device path node. - @param SubType The subtype of device path node. - - @return A pointer to the newly-created Vendor device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -ConvertFromTextVendor ( - IN CHAR16 *TextDeviceNode, - IN UINT8 Type, - IN UINT8 SubType - ) -{ - CHAR16 *GuidStr; - CHAR16 *DataStr; - UINTN Length; - VENDOR_DEVICE_PATH *Vendor; - - GuidStr = GetNextParamStr (&TextDeviceNode); - - DataStr = GetNextParamStr (&TextDeviceNode); - Length = StrLen (DataStr); - // - // Two hex characters make up 1 buffer byte - // - Length = (Length + 1) / 2; - - 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); - - return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; -} - -/** - Converts a text device path node to Vendor Hardware device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor Hardware device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenHw ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextVendor ( - TextDeviceNode, - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP - ); -} - -/** - Converts a text device path node to Hardware Controller device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Hardware Controller device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextCtrl ( - 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); - - return (EFI_DEVICE_PATH_PROTOCOL *) Controller; -} - -/** - Converts a text device path node to BMC device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created BMC device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextBmc ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->InterfaceType = (UINT8) Strtoi (InterfaceTypeStr); - WriteUnaligned64 ( - (UINT64 *) (&BmcDp->BaseAddress), - StrHexToUint64 (BaseAddressStr) - ); - - return (EFI_DEVICE_PATH_PROTOCOL *) BmcDp; -} - -/** - Converts a generic ACPI text device path node to ACPI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to ACPI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAcpiPath ( - IN CHAR16 *TextDeviceNode - ) -{ - return DevPathFromTextGenericPath (ACPI_DEVICE_PATH, TextDeviceNode); -} - -/** - Converts a string to EisaId. - - @param Text The input string. - - @return UINT32 EISA ID. -**/ -UINT32 -EisaIdFromText ( - 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) - ; -} - -/** - Converts a text device path node to ACPI HID device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created ACPI HID device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAcpi ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *HIDStr; - CHAR16 *UIDStr; - ACPI_HID_DEVICE_PATH *Acpi; - - HIDStr = GetNextParamStr (&TextDeviceNode); - UIDStr = GetNextParamStr (&TextDeviceNode); - 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); - - return (EFI_DEVICE_PATH_PROTOCOL *) Acpi; -} - -/** - Converts a text device path node to ACPI HID device path structure. - - @param TextDeviceNode The input Text device path node. - @param PnPId The input plug and play identification. - - @return A pointer to the newly-created ACPI HID device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -ConvertFromTextAcpi ( - IN CHAR16 *TextDeviceNode, - IN UINT32 PnPId - ) -{ - CHAR16 *UIDStr; - 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->HID = EFI_PNP_ID (PnPId); - Acpi->UID = (UINT32) Strtoi (UIDStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Acpi; -} - -/** - Converts a text device path node to PCI root device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created PCI root device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPciRoot ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0a03); -} - -/** - Converts a text device path node to PCIE root device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created PCIE root device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPcieRoot ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0a08); -} - -/** - Converts a text device path node to Floppy device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Floppy device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFloppy ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0604); -} - -/** - Converts a text device path node to Keyboard device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Keyboard device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextKeyboard ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0301); -} - -/** - Converts a text device path node to Serial device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Serial device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextSerial ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0501); -} - -/** - Converts a text device path node to Parallel Port device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Parallel Port device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextParallelPort ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextAcpi (TextDeviceNode, 0x0401); -} - -/** - Converts a text device path node to ACPI extension device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created ACPI extension device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAcpiEx ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *HIDStr; - CHAR16 *CIDStr; - CHAR16 *UIDStr; - CHAR16 *HIDSTRStr; - CHAR16 *CIDSTRStr; - CHAR16 *UIDSTRStr; - CHAR8 *AsciiStr; - UINT16 Length; - ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx; - - HIDStr = GetNextParamStr (&TextDeviceNode); - CIDStr = GetNextParamStr (&TextDeviceNode); - UIDStr = GetNextParamStr (&TextDeviceNode); - HIDSTRStr = GetNextParamStr (&TextDeviceNode); - 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 - ); - - AcpiEx->HID = EisaIdFromText (HIDStr); - AcpiEx->CID = EisaIdFromText (CIDStr); - AcpiEx->UID = (UINT32) Strtoi (UIDStr); - - 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; -} - -/** - Converts a text device path node to ACPI extension device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created ACPI extension device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAcpiExp ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *HIDStr; - CHAR16 *CIDStr; - CHAR16 *UIDSTRStr; - CHAR8 *AsciiStr; - UINT16 Length; - ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx; - - 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 - ); - - AcpiEx->HID = EisaIdFromText (HIDStr); - // - // According to UEFI spec, the CID parametr is optional and has a default value of 0. - // 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') { - AcpiEx->CID = 0; - } else { - AcpiEx->CID = EisaIdFromText (CIDStr); - } - AcpiEx->UID = 0; - - AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH)); - // - // HID string is NULL - // - *AsciiStr = '\0'; - // - // Convert UID string - // - AsciiStr++; - StrToAscii (UIDSTRStr, &AsciiStr); - // - // CID string is NULL - // - *AsciiStr = '\0'; - - return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx; -} - -/** - Converts a text device path node to ACPI _ADR device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created ACPI _ADR device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAcpiAdr ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *DisplayDeviceStr; - ACPI_ADR_DEVICE_PATH *AcpiAdr; - UINTN Index; - UINTN Length; - - 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++) { - DisplayDeviceStr = GetNextParamStr (&TextDeviceNode); - if (IS_NULL (*DisplayDeviceStr)) { - break; - } - if (Index > 0) { - Length = DevicePathNodeLength (AcpiAdr); - AcpiAdr = ReallocatePool ( - Length, - Length + sizeof (UINT32), - AcpiAdr - ); - ASSERT (AcpiAdr != NULL); - SetDevicePathNodeLength (AcpiAdr, Length + sizeof (UINT32)); - } - - (&AcpiAdr->ADR)[Index] = (UINT32) Strtoi (DisplayDeviceStr); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr; -} - -/** - Converts a generic messaging text device path node to messaging device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to messaging device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextMsg ( - IN CHAR16 *TextDeviceNode - ) -{ - return DevPathFromTextGenericPath (MESSAGING_DEVICE_PATH, TextDeviceNode); -} - -/** - Converts a text device path node to Parallel Port device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Parallel Port device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextAta ( -IN CHAR16 *TextDeviceNode -) -{ - 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) - ); - - PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode); - SlaveMasterStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - - if (StrCmp (PrimarySecondaryStr, L"Primary") == 0) { - Atapi->PrimarySecondary = 0; - } else if (StrCmp (PrimarySecondaryStr, L"Secondary") == 0) { - Atapi->PrimarySecondary = 1; - } else { - Atapi->PrimarySecondary = (UINT8) Strtoi (PrimarySecondaryStr); - } - if (StrCmp (SlaveMasterStr, L"Master") == 0) { - Atapi->SlaveMaster = 0; - } else if (StrCmp (SlaveMasterStr, L"Slave") == 0) { - Atapi->SlaveMaster = 1; - } else { - Atapi->SlaveMaster = (UINT8) Strtoi (SlaveMasterStr); - } - - Atapi->Lun = (UINT16) Strtoi (LunStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Atapi; -} - -/** - Converts a text device path node to SCSI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created SCSI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextScsi ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *PunStr; - CHAR16 *LunStr; - SCSI_DEVICE_PATH *Scsi; - - PunStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - 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); - - return (EFI_DEVICE_PATH_PROTOCOL *) Scsi; -} - -/** - Converts a text device path node to Fibre device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Fibre device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFibre ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *WWNStr; - CHAR16 *LunStr; - FIBRECHANNEL_DEVICE_PATH *Fibre; - - WWNStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - 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; -} - -/** - Converts a text device path node to FibreEx device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created FibreEx device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFibreEx ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *WWNStr; - CHAR16 *LunStr; - FIBRECHANNELEX_DEVICE_PATH *FibreEx; - - WWNStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - 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)); - - *(UINT64 *) (&FibreEx->WWN) = SwapBytes64 (*(UINT64 *) (&FibreEx->WWN)); - *(UINT64 *) (&FibreEx->Lun) = SwapBytes64 (*(UINT64 *) (&FibreEx->Lun)); - - return (EFI_DEVICE_PATH_PROTOCOL *) FibreEx; -} - -/** - Converts a text device path node to 1394 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created 1394 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromText1394 ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - F1394DevPath->Reserved = 0; - F1394DevPath->Guid = StrHexToUint64 (GuidStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath; -} - -/** - Converts a text device path node to USB device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsb ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Usb->ParentPortNumber = (UINT8) Strtoi (PortStr); - Usb->InterfaceNumber = (UINT8) Strtoi (InterfaceStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Usb; -} - -/** - Converts a text device path node to I20 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created I20 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextI2O ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *TIDStr; - I2O_DEVICE_PATH *I2ODevPath; - - TIDStr = GetNextParamStr (&TextDeviceNode); - I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode ( - MESSAGING_DEVICE_PATH, - MSG_I2O_DP, - (UINT16) sizeof (I2O_DEVICE_PATH) - ); - - I2ODevPath->Tid = (UINT32) Strtoi (TIDStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath; -} - -/** - Converts a text device path node to Infini Band device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Infini Band device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextInfiniband ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *FlagsStr; - CHAR16 *GuidStr; - CHAR16 *SidStr; - CHAR16 *TidStr; - CHAR16 *DidStr; - INFINIBAND_DEVICE_PATH *InfiniBand; - - FlagsStr = GetNextParamStr (&TextDeviceNode); - GuidStr = GetNextParamStr (&TextDeviceNode); - 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->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; -} - -/** - Converts a text device path node to Vendor-Defined Messaging device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor-Defined Messaging device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenMsg ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextVendor ( - TextDeviceNode, - MESSAGING_DEVICE_PATH, - MSG_VENDOR_DP - ); -} - -/** - Converts a text device path node to Vendor defined PC-ANSI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor defined PC-ANSI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenPcAnsi ( - IN CHAR16 *TextDeviceNode - ) -{ - VENDOR_DEVICE_PATH *Vendor; - - 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; -} - -/** - Converts a text device path node to Vendor defined VT100 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor defined VT100 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenVt100 ( - IN CHAR16 *TextDeviceNode - ) -{ - VENDOR_DEVICE_PATH *Vendor; - - 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; -} - -/** - Converts a text device path node to Vendor defined VT100 Plus device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor defined VT100 Plus device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenVt100Plus ( - IN CHAR16 *TextDeviceNode - ) -{ - VENDOR_DEVICE_PATH *Vendor; - - 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; -} - -/** - Converts a text device path node to Vendor defined UTF8 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor defined UTF8 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenUtf8 ( - IN CHAR16 *TextDeviceNode - ) -{ - VENDOR_DEVICE_PATH *Vendor; - - 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; -} - -/** - Converts a text device path node to UART Flow Control device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created UART Flow Control device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUartFlowCtrl ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid); - if (StrCmp (ValueStr, L"XonXoff") == 0) { - UartFlowControl->FlowControlMap = 2; - } else if (StrCmp (ValueStr, L"Hardware") == 0) { - UartFlowControl->FlowControlMap = 1; - } else { - UartFlowControl->FlowControlMap = 0; - } - - return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl; -} - -/** - Converts a text device path node to Serial Attached SCSI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Serial Attached SCSI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextSAS ( - 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; - - AddressStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - RTPStr = GetNextParamStr (&TextDeviceNode); - SASSATAStr = GetNextParamStr (&TextDeviceNode); - LocationStr = GetNextParamStr (&TextDeviceNode); - 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) - ); - - CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid); - Strtoi64 (AddressStr, &Sas->SasAddress); - Strtoi64 (LunStr, &Sas->Lun); - 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); - if (Uint16 == 0) { - Info = 0x1; - } else { - Info = (UINT16) (0x2 | ((Uint16 - 1) << 8)); - } - - if (StrCmp (SASSATAStr, L"SATA") == 0) { - Info |= BIT4; - } - - // - // Location is an integer between 0 and 1 or else - // the keyword Internal (0) or External (1). - // - if (StrCmp (LocationStr, L"External") == 0) { - Uint16 = 1; - } else if (StrCmp (LocationStr, L"Internal") == 0) { - Uint16 = 0; - } else { - Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0); - } - Info |= (Uint16 << 5); - - // - // Connect is an integer between 0 and 3 or else - // the keyword Direct (0) or Expanded (1). - // - if (StrCmp (ConnectStr, L"Expanded") == 0) { - Uint16 = 1; - } else if (StrCmp (ConnectStr, L"Direct") == 0) { - Uint16 = 0; - } else { - Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1)); - } - Info |= (Uint16 << 6); - - } else { - Info = (UINT16) Strtoi (SASSATAStr); - } - - Sas->DeviceTopology = Info; - Sas->Reserved = (UINT32) Strtoi (ReservedStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Sas; -} - -/** - Converts a text device path node to Serial Attached SCSI Ex device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Serial Attached SCSI Ex device path structure. - -**/ -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; - - AddressStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - RTPStr = GetNextParamStr (&TextDeviceNode); - SASSATAStr = GetNextParamStr (&TextDeviceNode); - 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) - ); - - Strtoi64 (AddressStr, &SasAddress); - 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); - if (Uint16 == 0) { - Info = 0x1; - } else { - Info = (UINT16) (0x2 | ((Uint16 - 1) << 8)); - } - - if (StrCmp (SASSATAStr, L"SATA") == 0) { - Info |= BIT4; - } - - // - // Location is an integer between 0 and 1 or else - // the keyword Internal (0) or External (1). - // - if (StrCmp (LocationStr, L"External") == 0) { - Uint16 = 1; - } else if (StrCmp (LocationStr, L"Internal") == 0) { - Uint16 = 0; - } else { - Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0); - } - Info |= (Uint16 << 5); - - // - // Connect is an integer between 0 and 3 or else - // the keyword Direct (0) or Expanded (1). - // - if (StrCmp (ConnectStr, L"Expanded") == 0) { - Uint16 = 1; - } else if (StrCmp (ConnectStr, L"Direct") == 0) { - Uint16 = 0; - } else { - Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1)); - } - Info |= (Uint16 << 6); - - } else { - Info = (UINT16) Strtoi (SASSATAStr); - } - - SasEx->DeviceTopology = Info; - - return (EFI_DEVICE_PATH_PROTOCOL *) SasEx; -} - -/** - Converts a text device path node to NVM Express Namespace device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created NVM Express Namespace device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextNVMe ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->NamespaceId = (UINT32) Strtoi (NamespaceIdStr); - Uuid = (UINT8 *) &Nvme->NamespaceUuid; - - Index = sizeof (Nvme->NamespaceUuid) / sizeof (UINT8); - while (Index-- != 0) { - Uuid[Index] = (UINT8) StrHexToUintn (SplitStr (&NamespaceUuidStr, L'-')); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) Nvme; -} - -/** - Converts a text device path node to UFS device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created UFS device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUfs ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->Pun = (UINT8) Strtoi (PunStr); - Ufs->Lun = (UINT8) Strtoi (LunStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Ufs; -} - -/** - Converts a text device path node to SD (Secure Digital) device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created SD device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextSd ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->SlotNumber = (UINT8) Strtoi (SlotNumberStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Sd; -} - -/** - Converts a text device path node to EMMC (Embedded MMC) device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created EMMC device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextEmmc ( - 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->SlotNumber = (UINT8) Strtoi (SlotNumberStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Emmc; -} - -/** - Converts a text device path node to Debug Port device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Debug Port device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextDebugPort ( - IN CHAR16 *TextDeviceNode - ) -{ - VENDOR_DEVICE_PATH *Vend; - - 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; -} - -/** - Converts a text device path node to MAC device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created MAC device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextMAC ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *AddressStr; - CHAR16 *IfTypeStr; - 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) - ); - - MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr); - - Length = sizeof (EFI_MAC_ADDRESS); - if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) { - Length = 6; - } - - StrHexToBytes (AddressStr, Length * 2, MACDevPath->MacAddress.Addr, Length); - - return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath; -} - - -/** - Converts a text format to the network protocol ID. - - @param Text String of protocol field. - - @return Network protocol ID . - -**/ -UINTN -NetworkProtocolFromText ( - IN CHAR16 *Text - ) -{ - if (StrCmp (Text, L"UDP") == 0) { - return RFC_1700_UDP_PROTOCOL; - } - - if (StrCmp (Text, L"TCP") == 0) { - return RFC_1700_TCP_PROTOCOL; - } - - return Strtoi (Text); -} - - -/** - Converts a text device path node to IPV4 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created IPV4 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextIPv4 ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *RemoteIPStr; - CHAR16 *ProtocolStr; - CHAR16 *TypeStr; - CHAR16 *LocalIPStr; - CHAR16 *GatewayIPStr; - 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) - ); - - StrToIpv4Address (RemoteIPStr, NULL, &IPv4->RemoteIpAddress, NULL); - IPv4->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr); - if (StrCmp (TypeStr, L"Static") == 0) { - IPv4->StaticIpAddress = TRUE; - } else { - IPv4->StaticIpAddress = FALSE; - } - - 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); - } else { - ZeroMem (&IPv4->GatewayIpAddress, sizeof (IPv4->GatewayIpAddress)); - ZeroMem (&IPv4->SubnetMask, sizeof (IPv4->SubnetMask)); - } - - IPv4->LocalPort = 0; - IPv4->RemotePort = 0; - - return (EFI_DEVICE_PATH_PROTOCOL *) IPv4; -} - -/** - Converts a text device path node to IPV6 device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created IPV6 device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextIPv6 ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *RemoteIPStr; - CHAR16 *ProtocolStr; - CHAR16 *TypeStr; - CHAR16 *LocalIPStr; - CHAR16 *GatewayIPStr; - 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) - ); - - StrToIpv6Address (RemoteIPStr, NULL, &IPv6->RemoteIpAddress, NULL); - IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr); - if (StrCmp (TypeStr, L"Static") == 0) { - IPv6->IpAddressOrigin = 0; - } else if (StrCmp (TypeStr, L"StatelessAutoConfigure") == 0) { - IPv6->IpAddressOrigin = 1; - } else { - IPv6->IpAddressOrigin = 2; - } - - StrToIpv6Address (LocalIPStr, NULL, &IPv6->LocalIpAddress, NULL); - if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*PrefixLengthStr)) { - StrToIpv6Address (GatewayIPStr, NULL, &IPv6->GatewayIpAddress, NULL); - IPv6->PrefixLength = (UINT8) Strtoi (PrefixLengthStr); - } else { - ZeroMem (&IPv6->GatewayIpAddress, sizeof (IPv6->GatewayIpAddress)); - IPv6->PrefixLength = 0; - } - - IPv6->LocalPort = 0; - IPv6->RemotePort = 0; - - return (EFI_DEVICE_PATH_PROTOCOL *) IPv6; -} - -/** - Converts a text device path node to UART device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created UART device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUart ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *BaudStr; - CHAR16 *DataBitsStr; - CHAR16 *ParityStr; - 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) - ); - - 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)); - switch (*ParityStr) { - case L'D': - Uart->Parity = 0; - break; - - case L'N': - Uart->Parity = 1; - break; - - case L'E': - Uart->Parity = 2; - break; - - case L'O': - Uart->Parity = 3; - break; - - case L'M': - Uart->Parity = 4; - break; - - case L'S': - Uart->Parity = 5; - break; - - default: - Uart->Parity = (UINT8) Strtoi (ParityStr); - break; - } - - if (StrCmp (StopBitsStr, L"D") == 0) { - Uart->StopBits = (UINT8) 0; - } else if (StrCmp (StopBitsStr, L"1") == 0) { - Uart->StopBits = (UINT8) 1; - } else if (StrCmp (StopBitsStr, L"1.5") == 0) { - Uart->StopBits = (UINT8) 2; - } else if (StrCmp (StopBitsStr, L"2") == 0) { - Uart->StopBits = (UINT8) 3; - } else { - Uart->StopBits = (UINT8) Strtoi (StopBitsStr); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) Uart; -} - -/** - Converts a text device path node to USB class device path structure. - - @param TextDeviceNode The input Text device path node. - @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text. - - @return A pointer to the newly-created USB class device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -ConvertFromTextUsbClass ( - IN CHAR16 *TextDeviceNode, - IN USB_CLASS_TEXT *UsbClassText - ) -{ - 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) - ); - - 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); - } - } else { - UsbClass->DeviceClass = UsbClassText->Class; - } - if (UsbClassText->SubClassExist) { - SubClassStr = GetNextParamStr (&TextDeviceNode); - if (*SubClassStr == L'\0') { - UsbClass->DeviceSubClass = 0xFF; - } else { - UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr); - } - } else { - UsbClass->DeviceSubClass = UsbClassText->SubClass; - } - - ProtocolStr = GetNextParamStr (&TextDeviceNode); - - if (*VIDStr == L'\0') { - UsbClass->VendorId = 0xFFFF; - } else { - UsbClass->VendorId = (UINT16) Strtoi (VIDStr); - } - if (*PIDStr == L'\0') { - UsbClass->ProductId = 0xFFFF; - } else { - UsbClass->ProductId = (UINT16) Strtoi (PIDStr); - } - if (*ProtocolStr == L'\0') { - UsbClass->DeviceProtocol = 0xFF; - } else { - UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass; -} - - -/** - Converts a text device path node to USB class device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB class device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbClass ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = TRUE; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB audio device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB audio device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbAudio ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_AUDIO; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB CDC Control device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB CDC Control device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbCDCControl ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_CDCCONTROL; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB HID device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB HID device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbHID ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_HID; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB Image device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB Image device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbImage ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_IMAGE; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB Print device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB Print device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbPrinter ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_PRINTER; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB mass storage device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB mass storage device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbMassStorage ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_MASS_STORAGE; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB HUB device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB HUB device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbHub ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_HUB; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB CDC data device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB CDC data device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbCDCData ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_CDCDATA; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB smart card device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB smart card device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbSmartCard ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_SMART_CARD; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB video device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB video device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbVideo ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_VIDEO; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB diagnostic device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB diagnostic device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbDiagnostic ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_DIAGNOSTIC; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB wireless device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB wireless device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbWireless ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_WIRELESS; - UsbClassText.SubClassExist = TRUE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB device firmware update device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB device firmware update device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbDeviceFirmwareUpdate ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_RESERVE; - UsbClassText.SubClassExist = FALSE; - UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB IRDA bridge device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB IRDA bridge device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbIrdaBridge ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_RESERVE; - UsbClassText.SubClassExist = FALSE; - UsbClassText.SubClass = USB_SUBCLASS_IRDA_BRIDGE; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB text and measurement device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB text and measurement device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbTestAndMeasurement ( - IN CHAR16 *TextDeviceNode - ) -{ - USB_CLASS_TEXT UsbClassText; - - UsbClassText.ClassExist = FALSE; - UsbClassText.Class = USB_CLASS_RESERVE; - UsbClassText.SubClassExist = FALSE; - UsbClassText.SubClass = USB_SUBCLASS_TEST; - - return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); -} - -/** - Converts a text device path node to USB WWID device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created USB WWID device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUsbWwid ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *VIDStr; - CHAR16 *PIDStr; - CHAR16 *InterfaceNumStr; - CHAR16 *SerialNumberStr; - 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'\"' - ) { - 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); - - // - // 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), - SerialNumberStr, - SerialNumberStrLen * sizeof (CHAR16) - ); - - return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid; -} - -/** - Converts a text device path node to Logic Unit device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Logic Unit device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUnit ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->Lun = (UINT8) Strtoi (LunStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit; -} - -/** - Converts a text device path node to iSCSI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created iSCSI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextiSCSI ( - 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; - - NameStr = GetNextParamStr (&TextDeviceNode); - PortalGroupStr = GetNextParamStr (&TextDeviceNode); - LunStr = GetNextParamStr (&TextDeviceNode); - HeaderDigestStr = GetNextParamStr (&TextDeviceNode); - 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)) - ); - - AsciiStr = ISCSIDevPath->TargetName; - StrToAscii (NameStr, &AsciiStr); - - ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr); - Strtoi64 (LunStr, &Lun); - WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun)); - - Options = 0x0000; - if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) { - Options |= 0x0002; - } - - if (StrCmp (DataDigestStr, L"CRC32C") == 0) { - Options |= 0x0008; - } - - if (StrCmp (AuthenticationStr, L"None") == 0) { - Options |= 0x0800; - } - - if (StrCmp (AuthenticationStr, L"CHAP_UNI") == 0) { - Options |= 0x1000; - } - - ISCSIDevPath->LoginOption = (UINT16) Options; - - if (IS_NULL (*ProtocolStr) || (StrCmp (ProtocolStr, L"TCP") == 0)) { - ISCSIDevPath->NetworkProtocol = 0; - } else { - // - // Undefined and reserved. - // - ISCSIDevPath->NetworkProtocol = 1; - } - - return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath; -} - -/** - Converts a text device path node to VLAN device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created VLAN device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVlan ( - 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->VlanId = (UINT16) Strtoi (VlanStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Vlan; -} - -/** - Converts a text device path node to Bluetooth device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Bluetooth device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextBluetooth ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - StrHexToBytes ( - BluetoothStr, - sizeof (BLUETOOTH_ADDRESS) * 2, - BluetoothDp->BD_ADDR.Address, - sizeof (BLUETOOTH_ADDRESS) - ); - return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothDp; -} - -/** - Converts a text device path node to Wi-Fi device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Wi-Fi device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextWiFi ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - if (NULL != SSIdStr) { - DataLen = StrLen (SSIdStr); - if (StrLen (SSIdStr) > 32) { - SSIdStr[32] = L'\0'; - DataLen = 32; - } - - UnicodeStrToAsciiStrS (SSIdStr, AsciiStr, sizeof (AsciiStr)); - CopyMem (WiFiDp->SSId, AsciiStr, DataLen); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp; -} - -/** - Converts a text device path node to Bluetooth LE device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Bluetooth LE device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextBluetoothLE ( - IN CHAR16 *TextDeviceNode - ) -{ - 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->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr); - StrHexToBytes ( - BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2, - BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address) - ); - return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp; -} - -/** - Converts a text device path node to DNS device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created DNS device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextDns ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *DeviceNodeStr; - CHAR16 *DeviceNodeStrPtr; - UINT32 DnsServerIpCount; - UINT16 DnsDeviceNodeLength; - DNS_DEVICE_PATH *DnsDeviceNode; - UINT32 DnsServerIpIndex; - CHAR16 *DnsServerIp; - - - // - // Count the DNS server address number. - // - DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode); - if (DeviceNodeStr == NULL) { - return NULL; - } - - DeviceNodeStrPtr = DeviceNodeStr; - - DnsServerIpCount = 0; - while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') { - GetNextParamStr (&DeviceNodeStrPtr); - DnsServerIpCount ++; - } - - FreePool (DeviceNodeStr); - DeviceNodeStr = NULL; - - // - // One or more instances of the DNS server address in EFI_IP_ADDRESS, - // otherwise, NULL will be returned. - // - if (DnsServerIpCount == 0) { - return NULL; - } - - // - // 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 - ); - if (DnsDeviceNode == NULL) { - return NULL; - } - - // - // Confirm the DNS server address is IPv4 or IPv6 type. - // - DeviceNodeStrPtr = TextDeviceNode; - while (!IS_NULL (*DeviceNodeStrPtr)) { - if (*DeviceNodeStrPtr == L'.') { - DnsDeviceNode->IsIPv6 = 0x00; - break; - } - - if (*DeviceNodeStrPtr == L':') { - DnsDeviceNode->IsIPv6 = 0x01; - break; - } - - DeviceNodeStrPtr++; - } - - for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) { - DnsServerIp = GetNextParamStr (&TextDeviceNode); - if (DnsDeviceNode->IsIPv6 == 0x00) { - StrToIpv4Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL); - } else { - StrToIpv6Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL); - } - } - - return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode; -} - -/** - Converts a text device path node to URI device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created URI device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextUri ( - IN CHAR16 *TextDeviceNode - ) -{ - CHAR16 *UriStr; - UINTN UriLength; - URI_DEVICE_PATH *Uri; - - 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) - ); - - while (UriLength-- != 0) { - Uri->Uri[UriLength] = (CHAR8) UriStr[UriLength]; - } - - return (EFI_DEVICE_PATH_PROTOCOL *) Uri; -} - -/** - Converts a media text device path node to media device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to media device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextMediaPath ( - IN CHAR16 *TextDeviceNode - ) -{ - return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH, TextDeviceNode); -} - -/** - Converts a text device path node to HD device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created HD device path structure. - -**/ -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) - ); - - Hd->PartitionNumber = (UINT32) Strtoi (PartitionStr); - - ZeroMem (Hd->Signature, 16); - Hd->MBRType = (UINT8) 0; - - if (StrCmp (TypeStr, L"MBR") == 0) { - Hd->SignatureType = SIGNATURE_TYPE_MBR; - Hd->MBRType = 0x01; - - 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); - } else { - Hd->SignatureType = (UINT8) Strtoi (TypeStr); - } - - Strtoi64 (StartStr, &Hd->PartitionStart); - Strtoi64 (SizeStr, &Hd->PartitionSize); - - return (EFI_DEVICE_PATH_PROTOCOL *) Hd; -} - -/** - Converts a text device path node to CDROM device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created CDROM device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextCDROM ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr); - Strtoi64 (StartStr, &CDROMDevPath->PartitionStart); - Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize); - - return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath; -} - -/** - Converts a text device path node to Vendor-defined media device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Vendor-defined media device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVenMedia ( - IN CHAR16 *TextDeviceNode - ) -{ - return ConvertFromTextVendor ( - TextDeviceNode, - MEDIA_DEVICE_PATH, - MEDIA_VENDOR_DP - ); -} - -/** - Converts a text device path node to File device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created File device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFilePath ( - 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) - ); - - StrCpyS (File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode); - - return (EFI_DEVICE_PATH_PROTOCOL *) File; -} - -/** - Converts a text device path node to Media protocol device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Media protocol device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextMedia ( - 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) - ); - - StrToGuid (GuidStr, &Media->Protocol); - - return (EFI_DEVICE_PATH_PROTOCOL *) Media; -} - -/** - Converts a text device path node to firmware volume device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created firmware volume device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFv ( - 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) - ); - - StrToGuid (GuidStr, &Fv->FvName); - - return (EFI_DEVICE_PATH_PROTOCOL *) Fv; -} - -/** - Converts a text device path node to firmware file device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created firmware file device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextFvFile ( - 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) - ); - - StrToGuid (GuidStr, &FvFile->FvFileName); - - return (EFI_DEVICE_PATH_PROTOCOL *) FvFile; -} - -/** - Converts a text device path node to text relative offset device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextRelativeOffsetRange ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingOffsetStr, &Offset->StartingOffset); - Strtoi64 (EndingOffsetStr, &Offset->EndingOffset); - - return (EFI_DEVICE_PATH_PROTOCOL *) Offset; -} - -/** - Converts a text device path node to text ram disk device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextRamDisk ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingAddrStr, &StartingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr); - Strtoi64 (EndingAddrStr, &EndingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr); - RamDisk->Instance = (UINT16) Strtoi (InstanceStr); - StrToGuid (TypeGuidStr, &RamDisk->TypeGuid); - - return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk; -} - -/** - Converts a text device path node to text virtual disk device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVirtualDisk ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingAddrStr, &StartingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr); - Strtoi64 (EndingAddrStr, &EndingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr); - RamDisk->Instance = (UINT16) Strtoi (InstanceStr); - CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid); - - return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk; -} - -/** - Converts a text device path node to text virtual cd device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextVirtualCd ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingAddrStr, &StartingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr); - Strtoi64 (EndingAddrStr, &EndingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr); - RamDisk->Instance = (UINT16) Strtoi (InstanceStr); - CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid); - - return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk; -} - -/** - Converts a text device path node to text persistent virtual disk device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPersistentVirtualDisk ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingAddrStr, &StartingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr); - Strtoi64 (EndingAddrStr, &EndingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr); - RamDisk->Instance = (UINT16) Strtoi (InstanceStr); - CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid); - - return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk; -} - -/** - Converts a text device path node to text persistent virtual cd device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created Text device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextPersistentVirtualCd ( - IN CHAR16 *TextDeviceNode - ) -{ - 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) - ); - - Strtoi64 (StartingAddrStr, &StartingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr); - Strtoi64 (EndingAddrStr, &EndingAddr); - WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr); - RamDisk->Instance = (UINT16) Strtoi (InstanceStr); - CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid); - - return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk; -} - -/** - Converts a BBS text device path node to BBS device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to BBS device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextBbsPath ( - IN CHAR16 *TextDeviceNode - ) -{ - return DevPathFromTextGenericPath (BBS_DEVICE_PATH, TextDeviceNode); -} - -/** - Converts a text device path node to BIOS Boot Specification device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created BIOS Boot Specification device path structure. - -**/ -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)) - ); - - if (StrCmp (TypeStr, L"Floppy") == 0) { - Bbs->DeviceType = BBS_TYPE_FLOPPY; - } else if (StrCmp (TypeStr, L"HD") == 0) { - Bbs->DeviceType = BBS_TYPE_HARDDRIVE; - } else if (StrCmp (TypeStr, L"CDROM") == 0) { - Bbs->DeviceType = BBS_TYPE_CDROM; - } else if (StrCmp (TypeStr, L"PCMCIA") == 0) { - Bbs->DeviceType = BBS_TYPE_PCMCIA; - } else if (StrCmp (TypeStr, L"USB") == 0) { - Bbs->DeviceType = BBS_TYPE_USB; - } else if (StrCmp (TypeStr, L"Network") == 0) { - Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK; - } else { - Bbs->DeviceType = (UINT16) Strtoi (TypeStr); - } - - AsciiStr = Bbs->String; - StrToAscii (IdStr, &AsciiStr); - - Bbs->StatusFlag = (UINT16) Strtoi (FlagsStr); - - return (EFI_DEVICE_PATH_PROTOCOL *) Bbs; -} - -/** - Converts a text device path node to SATA device path structure. - - @param TextDeviceNode The input Text device path node. - - @return A pointer to the newly-created SATA device path structure. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -DevPathFromTextSata ( - IN CHAR16 *TextDeviceNode - ) -{ - 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); - - // - // According to UEFI spec, if PMPN is not provided, the default is 0xFFFF - // - 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} -}; - -/** - Convert text to the binary representation of a device node. - - @param TextDeviceNode TextDeviceNode points to the text representation of a device - node. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was - insufficient memory or text unsupported. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ) -{ - DEVICE_PATH_FROM_TEXT FromText; - CHAR16 *ParamStr; - EFI_DEVICE_PATH_PROTOCOL *DeviceNode; - CHAR16 *DeviceNodeStr; - UINTN Index; - - if ((TextDeviceNode == NULL) || (IS_NULL (*TextDeviceNode))) { - return NULL; - } - - ParamStr = NULL; - FromText = NULL; - DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode); - ASSERT (DeviceNodeStr != NULL); - - for (Index = 0; mUefiDevicePathLibDevPathFromTextTable[Index].Function != NULL; Index++) { - ParamStr = GetParamByNodeName (DeviceNodeStr, mUefiDevicePathLibDevPathFromTextTable[Index].DevicePathNodeText); - if (ParamStr != NULL) { - FromText = mUefiDevicePathLibDevPathFromTextTable[Index].Function; - break; - } - } - - if (FromText == NULL) { - // - // A file path - // - FromText = DevPathFromTextFilePath; - DeviceNode = FromText (DeviceNodeStr); - } else { - DeviceNode = FromText (ParamStr); - FreePool (ParamStr); - } - - FreePool (DeviceNodeStr); - - return DeviceNode; -} - -/** - Convert text to the binary representation of a device path. - - - @param TextDevicePath TextDevicePath points to the text representation of a device - path. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or - there was insufficient memory. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibConvertTextToDevicePath ( - 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; - - if ((TextDevicePath == NULL) || (IS_NULL (*TextDevicePath))) { - return NULL; - } - - DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH); - ASSERT (DevicePath != NULL); - SetDevicePathEndNode (DevicePath); - - DevicePathStr = UefiDevicePathLibStrDuplicate (TextDevicePath); - - Str = DevicePathStr; - while ((DeviceNodeStr = GetNextDeviceNodeStr (&Str, &IsInstanceEnd)) != NULL) { - DeviceNode = UefiDevicePathLibConvertTextToDeviceNode (DeviceNodeStr); - - NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode); - FreePool (DevicePath); - FreePool (DeviceNode); - DevicePath = NewDevicePath; - - if (IsInstanceEnd) { - DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH); - ASSERT (DeviceNode != NULL); - SetDevicePathEndNode (DeviceNode); - DeviceNode->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; - - NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode); - FreePool (DevicePath); - FreePool (DeviceNode); - DevicePath = NewDevicePath; - } - } - - FreePool (DevicePathStr); - return DevicePath; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c deleted file mode 100644 index 3be5e53..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c +++ /dev/null @@ -1,2461 +0,0 @@ -/** @file - DevicePathToText protocol as defined in the UEFI 2.0 specification. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiDevicePathLib.h" - -/** - Concatenates a formatted unicode string to allocated pool. The caller must - free the resulting buffer. - - @param Str Tracks the allocated pool, size in use, and - amount of pool allocated. - @param Fmt The format string - @param ... Variable arguments based on the format string. - - @return Allocated buffer with the formatted string printed in it. - The caller must free the allocated buffer. The buffer - allocation is not packed. - -**/ -CHAR16 * -EFIAPI -UefiDevicePathLibCatPrint ( - IN OUT POOL_PRINT *Str, - IN CHAR16 *Fmt, - ... - ) -{ - UINTN Count; - VA_LIST Args; - - VA_START (Args, Fmt); - Count = SPrintLength (Fmt, 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 - ); - ASSERT (Str->Str != NULL); - } - VA_START (Args, Fmt); - UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args); - Str->Count += Count; - - VA_END (Args); - return Str->Str; -} - -/** - Converts a PCI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextPci ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - PCI_DEVICE_PATH *Pci; - - Pci = DevPath; - UefiDevicePathLibCatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function); -} - -/** - Converts a PC Card device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextPccard ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - PCCARD_DEVICE_PATH *Pccard; - - Pccard = DevPath; - UefiDevicePathLibCatPrint (Str, L"PcCard(0x%x)", Pccard->FunctionNumber); -} - -/** - Converts a Memory Map device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextMemMap ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEMMAP_DEVICE_PATH *MemMap; - - MemMap = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"MemoryMapped(0x%x,0x%lx,0x%lx)", - MemMap->MemoryType, - MemMap->StartingAddress, - MemMap->EndingAddress - ); -} - -/** - Converts a Vendor device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextVendor ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - VENDOR_DEVICE_PATH *Vendor; - CHAR16 *Type; - UINTN Index; - UINTN DataLength; - UINT32 FlowControlMap; - UINT16 Info; - - 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; - } - - 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)) { - 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 { - 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 ; - } - } - break; - - case MEDIA_DEVICE_PATH: - Type = L"Media"; - break; - - default: - Type = L"?"; - break; - } - - DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH); - UefiDevicePathLibCatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid); - 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")"); -} - -/** - Converts a Controller device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextController ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - CONTROLLER_DEVICE_PATH *Controller; - - Controller = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"Ctrl(0x%x)", - Controller->ControllerNumber - ); -} - -/** - Converts a BMC device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextBmc ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - BMC_DEVICE_PATH *Bmc; - - Bmc = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"BMC(0x%x,0x%lx)", - Bmc->InterfaceType, - ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress)) - ); -} - -/** - Converts a ACPI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextAcpi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - ACPI_HID_DEVICE_PATH *Acpi; - - 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 0x0a08: - UefiDevicePathLibCatPrint (Str, L"PcieRoot(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 0x0501: - UefiDevicePathLibCatPrint (Str, L"Serial(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; - } - } else { - UefiDevicePathLibCatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID); - } -} - -/** - Converts a ACPI extended HID device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextAcpiEx ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx; - CHAR8 *HIDStr; - CHAR8 *UIDStr; - CHAR8 *CIDStr; - CHAR16 HIDText[11]; - CHAR16 CIDText[11]; - - AcpiEx = DevPath; - 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)) { - 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 (AcpiEx->UID == 0) { - UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", UIDStr); - } else { - UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", AcpiEx->UID); - } - return; - } - } - - // - // Converts EISA identification to string. - // - UnicodeSPrint ( - HIDText, - sizeof (HIDText), - L"%c%c%c%04X", - ((AcpiEx->HID >> 10) & 0x1f) + 'A' - 1, - ((AcpiEx->HID >> 5) & 0x1f) + 'A' - 1, - ((AcpiEx->HID >> 0) & 0x1f) + 'A' - 1, - (AcpiEx->HID >> 16) & 0xFFFF - ); - UnicodeSPrint ( - CIDText, - sizeof (CIDText), - L"%c%c%c%04X", - ((AcpiEx->CID >> 10) & 0x1f) + 'A' - 1, - ((AcpiEx->CID >> 5) & 0x1f) + 'A' - 1, - ((AcpiEx->CID >> 0) & 0x1f) + 'A' - 1, - (AcpiEx->CID >> 16) & 0xFFFF - ); - - if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) { - // - // use AcpiExp() - // - if (AcpiEx->CID == 0) { - UefiDevicePathLibCatPrint ( - Str, - L"AcpiExp(%s,0,%a)", - HIDText, - UIDStr - ); - } else { - UefiDevicePathLibCatPrint ( - Str, - L"AcpiExp(%s,%s,%a)", - HIDText, - CIDText, - UIDStr - ); - } - } else { - if (DisplayOnly) { - // - // display only - // - if (AcpiEx->HID == 0) { - UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr); - } else { - UefiDevicePathLibCatPrint (Str, L"AcpiEx(%s,", HIDText); - } - - if (AcpiEx->CID == 0) { - UefiDevicePathLibCatPrint (Str, L"%a,", CIDStr); - } else { - UefiDevicePathLibCatPrint (Str, L"%s,", CIDText); - } - - if (AcpiEx->UID == 0) { - UefiDevicePathLibCatPrint (Str, L"%a)", UIDStr); - } else { - UefiDevicePathLibCatPrint (Str, L"0x%x)", AcpiEx->UID); - } - } else { - UefiDevicePathLibCatPrint ( - Str, - L"AcpiEx(%s,%s,0x%x,%a,%a,%a)", - HIDText, - CIDText, - AcpiEx->UID, - HIDStr, - CIDStr, - UIDStr - ); - } - } -} - -/** - Converts a ACPI address device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextAcpiAdr ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - 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); - - 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")"); -} - -/** - Converts a ATAPI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextAtapi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - ATAPI_DEVICE_PATH *Atapi; - - Atapi = DevPath; - - if (DisplayOnly) { - UefiDevicePathLibCatPrint (Str, L"Ata(0x%x)", Atapi->Lun); - } else { - UefiDevicePathLibCatPrint ( - Str, - L"Ata(%s,%s,0x%x)", - (Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary", - (Atapi->SlaveMaster == 1) ? L"Slave" : L"Master", - Atapi->Lun - ); - } -} - -/** - Converts a SCSI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextScsi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - SCSI_DEVICE_PATH *Scsi; - - Scsi = DevPath; - UefiDevicePathLibCatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun); -} - -/** - Converts a Fibre device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextFibre ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - FIBRECHANNEL_DEVICE_PATH *Fibre; - - Fibre = DevPath; - UefiDevicePathLibCatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun); -} - -/** - Converts a FibreEx device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextFibreEx ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - FIBRECHANNELEX_DEVICE_PATH *FibreEx; - UINTN Index; - - FibreEx = DevPath; - UefiDevicePathLibCatPrint (Str, L"FibreEx(0x"); - 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")"); -} - -/** - Converts a Sas Ex device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextSasEx ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - SASEX_DEVICE_PATH *SasEx; - UINTN Index; - - SasEx = DevPath; - UefiDevicePathLibCatPrint (Str, L"SasEx(0x"); - - 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)) { - UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0"); - } else if (((SasEx->DeviceTopology & 0x0f) <= 2) && ((SasEx->DeviceTopology & BIT7) == 0)) { - UefiDevicePathLibCatPrint ( - Str, - L"%s,%s,%s,", - ((SasEx->DeviceTopology & BIT4) != 0) ? L"SATA" : L"SAS", - ((SasEx->DeviceTopology & BIT5) != 0) ? L"External" : L"Internal", - ((SasEx->DeviceTopology & BIT6) != 0) ? L"Expanded" : L"Direct" - ); - if ((SasEx->DeviceTopology & 0x0f) == 1) { - UefiDevicePathLibCatPrint (Str, L"0"); - } else { - // - // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256 - // - UefiDevicePathLibCatPrint (Str, L"0x%x", ((SasEx->DeviceTopology >> 8) & 0xff) + 1); - } - } else { - UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0", SasEx->DeviceTopology); - } - - UefiDevicePathLibCatPrint (Str, L")"); - return ; - -} - -/** - Converts a NVM Express Namespace device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextNVMe ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - NVME_NAMESPACE_DEVICE_PATH *Nvme; - UINT8 *Uuid; - - Nvme = DevPath; - 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] - ); -} - -/** - Converts a UFS device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUfs ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - UFS_DEVICE_PATH *Ufs; - - Ufs = DevPath; - UefiDevicePathLibCatPrint (Str, L"UFS(0x%x,0x%x)", Ufs->Pun, Ufs->Lun); -} - -/** - Converts a SD (Secure Digital) device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextSd ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - SD_DEVICE_PATH *Sd; - - Sd = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"SD(0x%x)", - Sd->SlotNumber - ); -} - -/** - Converts a EMMC (Embedded MMC) device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextEmmc ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - EMMC_DEVICE_PATH *Emmc; - - Emmc = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"eMMC(0x%x)", - Emmc->SlotNumber - ); -} - -/** - Converts a 1394 device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToText1394 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - F1394_DEVICE_PATH *F1394DevPath; - - F1394DevPath = DevPath; - // - // Guid has format of IEEE-EUI64 - // - UefiDevicePathLibCatPrint (Str, L"I1394(%016lx)", F1394DevPath->Guid); -} - -/** - Converts a USB device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUsb ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - USB_DEVICE_PATH *Usb; - - Usb = DevPath; - UefiDevicePathLibCatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber); -} - -/** - Converts a USB WWID device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUsbWWID ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - USB_WWID_DEVICE_PATH *UsbWWId; - CHAR16 *SerialNumberStr; - CHAR16 *NewStr; - UINT16 Length; - - 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) { - // - // 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; - SerialNumberStr = NewStr; - } - - UefiDevicePathLibCatPrint ( - Str, - L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")", - UsbWWId->VendorId, - UsbWWId->ProductId, - UsbWWId->InterfaceNumber, - SerialNumberStr - ); -} - -/** - Converts a Logic Unit device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextLogicalUnit ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit; - - LogicalUnit = DevPath; - UefiDevicePathLibCatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun); -} - -/** - Converts a USB class device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUsbClass ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - 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_CDCCONTROL: - UefiDevicePathLibCatPrint (Str, L"UsbCDCControl"); - break; - - case USB_CLASS_HID: - UefiDevicePathLibCatPrint (Str, L"UsbHID"); - break; - - case USB_CLASS_IMAGE: - UefiDevicePathLibCatPrint (Str, L"UsbImage"); - break; - - case USB_CLASS_PRINTER: - UefiDevicePathLibCatPrint (Str, L"UsbPrinter"); - break; - - case USB_CLASS_MASS_STORAGE: - UefiDevicePathLibCatPrint (Str, L"UsbMassStorage"); - break; - - case USB_CLASS_HUB: - UefiDevicePathLibCatPrint (Str, L"UsbHub"); - break; - - case USB_CLASS_CDCDATA: - UefiDevicePathLibCatPrint (Str, L"UsbCDCData"); - break; - - case USB_CLASS_SMART_CARD: - UefiDevicePathLibCatPrint (Str, L"UsbSmartCard"); - break; - - case USB_CLASS_VIDEO: - UefiDevicePathLibCatPrint (Str, L"UsbVideo"); - break; - - case USB_CLASS_DIAGNOSTIC: - UefiDevicePathLibCatPrint (Str, L"UsbDiagnostic"); - break; - - case USB_CLASS_WIRELESS: - UefiDevicePathLibCatPrint (Str, L"UsbWireless"); - break; - - default: - IsKnownSubClass = FALSE; - break; - } - - if (IsKnownSubClass) { - UefiDevicePathLibCatPrint ( - Str, - L"(0x%x,0x%x,0x%x,0x%x)", - UsbClass->VendorId, - UsbClass->ProductId, - UsbClass->DeviceSubClass, - UsbClass->DeviceProtocol - ); - return; - } - - if (UsbClass->DeviceClass == USB_CLASS_RESERVE) { - if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) { - UefiDevicePathLibCatPrint ( - Str, - L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)", - UsbClass->VendorId, - UsbClass->ProductId, - UsbClass->DeviceProtocol - ); - return; - } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) { - UefiDevicePathLibCatPrint ( - Str, - L"UsbIrdaBridge(0x%x,0x%x,0x%x)", - UsbClass->VendorId, - UsbClass->ProductId, - UsbClass->DeviceProtocol - ); - return; - } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) { - UefiDevicePathLibCatPrint ( - Str, - L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)", - UsbClass->VendorId, - UsbClass->ProductId, - UsbClass->DeviceProtocol - ); - return; - } - } - - UefiDevicePathLibCatPrint ( - Str, - L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)", - UsbClass->VendorId, - UsbClass->ProductId, - UsbClass->DeviceClass, - UsbClass->DeviceSubClass, - UsbClass->DeviceProtocol - ); -} - -/** - Converts a SATA device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextSata ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - SATA_DEVICE_PATH *Sata; - - Sata = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"Sata(0x%x,0x%x,0x%x)", - Sata->HBAPortNumber, - Sata->PortMultiplierPortNumber, - Sata->Lun - ); -} - -/** - Converts a I20 device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextI2O ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - I2O_DEVICE_PATH *I2ODevPath; - - I2ODevPath = DevPath; - UefiDevicePathLibCatPrint (Str, L"I2O(0x%x)", I2ODevPath->Tid); -} - -/** - Converts a MAC address device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextMacAddr ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MAC_ADDR_DEVICE_PATH *MacDevPath; - UINTN HwAddressSize; - UINTN Index; - - MacDevPath = DevPath; - - HwAddressSize = sizeof (EFI_MAC_ADDRESS); - if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) { - HwAddressSize = 6; - } - - UefiDevicePathLibCatPrint (Str, L"MAC("); - - for (Index = 0; Index < HwAddressSize; Index++) { - UefiDevicePathLibCatPrint (Str, L"%02x", MacDevPath->MacAddress.Addr[Index]); - } - - UefiDevicePathLibCatPrint (Str, L",0x%x)", MacDevPath->IfType); -} - -/** - Converts network protocol string to its text representation. - - @param Str The string representative of input device. - @param Protocol The network protocol ID. - -**/ -VOID -CatNetworkProtocol ( - IN OUT POOL_PRINT *Str, - IN UINT16 Protocol - ) -{ - if (Protocol == RFC_1700_TCP_PROTOCOL) { - UefiDevicePathLibCatPrint (Str, L"TCP"); - } else if (Protocol == RFC_1700_UDP_PROTOCOL) { - UefiDevicePathLibCatPrint (Str, L"UDP"); - } else { - UefiDevicePathLibCatPrint (Str, L"0x%x", Protocol); - } -} - -/** - Converts IP v4 address to its text representation. - - @param Str The string representative of input device. - @param Address The IP v4 address. -**/ -VOID -CatIPv4Address ( - 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]); -} - -/** - Converts IP v6 address to its text representation. - - @param Str The string representative of input device. - @param Address The IP v6 address. -**/ -VOID -CatIPv6Address ( - 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] - ); -} - -/** - Converts a IPv4 device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextIPv4 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - IPv4_DEVICE_PATH *IPDevPath; - - IPDevPath = DevPath; - UefiDevicePathLibCatPrint (Str, L"IPv4("); - CatIPv4Address (Str, &IPDevPath->RemoteIpAddress); - - if (DisplayOnly) { - UefiDevicePathLibCatPrint (Str, L")"); - return ; - } - - UefiDevicePathLibCatPrint (Str, L","); - CatNetworkProtocol (Str, IPDevPath->Protocol); - - UefiDevicePathLibCatPrint (Str, L",%s,", IPDevPath->StaticIpAddress ? L"Static" : L"DHCP"); - CatIPv4Address (Str, &IPDevPath->LocalIpAddress); - if (DevicePathNodeLength (IPDevPath) == sizeof (IPv4_DEVICE_PATH)) { - UefiDevicePathLibCatPrint (Str, L","); - CatIPv4Address (Str, &IPDevPath->GatewayIpAddress); - UefiDevicePathLibCatPrint (Str, L","); - CatIPv4Address (Str, &IPDevPath->SubnetMask); - } - UefiDevicePathLibCatPrint (Str, L")"); -} - -/** - Converts a IPv6 device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextIPv6 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - IPv6_DEVICE_PATH *IPDevPath; - - IPDevPath = DevPath; - UefiDevicePathLibCatPrint (Str, L"IPv6("); - CatIPv6Address (Str, &IPDevPath->RemoteIpAddress); - if (DisplayOnly) { - UefiDevicePathLibCatPrint (Str, L")"); - return ; - } - - UefiDevicePathLibCatPrint (Str, L","); - CatNetworkProtocol (Str, IPDevPath->Protocol); - - switch (IPDevPath->IpAddressOrigin) { - case 0: - UefiDevicePathLibCatPrint (Str, L",Static,"); - break; - case 1: - UefiDevicePathLibCatPrint (Str, L",StatelessAutoConfigure,"); - break; - default: - UefiDevicePathLibCatPrint (Str, L",StatefulAutoConfigure,"); - break; - } - - CatIPv6Address (Str, &IPDevPath->LocalIpAddress); - - if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) { - UefiDevicePathLibCatPrint (Str, L",0x%x,", IPDevPath->PrefixLength); - CatIPv6Address (Str, &IPDevPath->GatewayIpAddress); - } - UefiDevicePathLibCatPrint (Str, L")"); -} - -/** - Converts an Infini Band device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextInfiniBand ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - INFINIBAND_DEVICE_PATH *InfiniBand; - - InfiniBand = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)", - InfiniBand->ResourceFlags, - InfiniBand->PortGid, - InfiniBand->ServiceId, - InfiniBand->TargetPortId, - InfiniBand->DeviceId - ); -} - -/** - Converts a UART device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUart ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - UART_DEVICE_PATH *Uart; - CHAR8 Parity; - - Uart = DevPath; - switch (Uart->Parity) { - case 0: - Parity = 'D'; - break; - - case 1: - Parity = 'N'; - break; - - case 2: - Parity = 'E'; - break; - - case 3: - Parity = 'O'; - break; - - case 4: - Parity = 'M'; - break; - - case 5: - Parity = 'S'; - break; - - default: - Parity = 'x'; - break; - } - - if (Uart->BaudRate == 0) { - UefiDevicePathLibCatPrint (Str, L"Uart(DEFAULT,"); - } else { - UefiDevicePathLibCatPrint (Str, L"Uart(%ld,", Uart->BaudRate); - } - - if (Uart->DataBits == 0) { - UefiDevicePathLibCatPrint (Str, L"DEFAULT,"); - } else { - UefiDevicePathLibCatPrint (Str, L"%d,", Uart->DataBits); - } - - UefiDevicePathLibCatPrint (Str, L"%c,", Parity); - - switch (Uart->StopBits) { - case 0: - UefiDevicePathLibCatPrint (Str, L"D)"); - break; - - case 1: - UefiDevicePathLibCatPrint (Str, L"1)"); - break; - - case 2: - UefiDevicePathLibCatPrint (Str, L"1.5)"); - break; - - case 3: - UefiDevicePathLibCatPrint (Str, L"2)"); - break; - - default: - UefiDevicePathLibCatPrint (Str, L"x)"); - break; - } -} - -/** - Converts an iSCSI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextiSCSI ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; - UINT16 Options; - UINTN Index; - - ISCSIDevPath = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"iSCSI(%a,0x%x,0x", - ISCSIDevPath->TargetName, - ISCSIDevPath->TargetPortalGroupTag - ); - 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"); - if (((Options >> 11) & 0x0001) != 0) { - UefiDevicePathLibCatPrint (Str, L"%s,", L"None"); - } else if (((Options >> 12) & 0x0001) != 0) { - 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"); -} - -/** - Converts a VLAN device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextVlan ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - VLAN_DEVICE_PATH *Vlan; - - Vlan = DevPath; - UefiDevicePathLibCatPrint (Str, L"Vlan(%d)", Vlan->VlanId); -} - -/** - Converts a Bluetooth device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextBluetooth ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - BLUETOOTH_DEVICE_PATH *Bluetooth; - - Bluetooth = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"Bluetooth(%02x%02x%02x%02x%02x%02x)", - Bluetooth->BD_ADDR.Address[0], - Bluetooth->BD_ADDR.Address[1], - Bluetooth->BD_ADDR.Address[2], - Bluetooth->BD_ADDR.Address[3], - Bluetooth->BD_ADDR.Address[4], - Bluetooth->BD_ADDR.Address[5] - ); -} - -/** - Converts a Wi-Fi device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextWiFi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - WIFI_DEVICE_PATH *WiFi; - UINT8 SSId[33]; - - WiFi = DevPath; - - SSId[32] = '\0'; - CopyMem (SSId, WiFi->SSId, 32); - - UefiDevicePathLibCatPrint (Str, L"Wi-Fi(%a)", SSId); -} - -/** - Converts a Bluetooth device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextBluetoothLE ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - BLUETOOTH_LE_DEVICE_PATH *BluetoothLE; - - BluetoothLE = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)", - BluetoothLE->Address.Address[0], - BluetoothLE->Address.Address[1], - BluetoothLE->Address.Address[2], - BluetoothLE->Address.Address[3], - BluetoothLE->Address.Address[4], - BluetoothLE->Address.Address[5], - BluetoothLE->Address.Type - ); -} - -/** - Converts a DNS device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextDns ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - DNS_DEVICE_PATH *DnsDevPath; - UINT32 DnsServerIpCount; - UINT32 DnsServerIpIndex; - - DnsDevPath = DevPath; - DnsServerIpCount = (UINT32) (DevicePathNodeLength(DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS); - - UefiDevicePathLibCatPrint (Str, L"Dns("); - - for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) { - if (DnsDevPath->IsIPv6 == 0x00) { - CatIPv4Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v4)); - } else { - CatIPv6Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v6)); - } - - if (DnsServerIpIndex < DnsServerIpCount - 1) { - UefiDevicePathLibCatPrint (Str, L","); - } - } - - UefiDevicePathLibCatPrint (Str, L")"); -} - -/** - Converts a URI device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextUri ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - 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); - ASSERT (UriStr != NULL); - - CopyMem (UriStr, Uri->Uri, UriLength); - UriStr[UriLength] = '\0'; - UefiDevicePathLibCatPrint (Str, L"Uri(%a)", UriStr); - FreePool (UriStr); -} - -/** - Converts a Hard drive device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextHardDrive ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - 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_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; - } - - UefiDevicePathLibCatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize); -} - -/** - Converts a CDROM device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextCDROM ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - CDROM_DEVICE_PATH *Cd; - - Cd = DevPath; - if (DisplayOnly) { - UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry); - return ; - } - - UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize); -} - -/** - Converts a File device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextFilePath ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - FILEPATH_DEVICE_PATH *Fp; - - Fp = DevPath; - UefiDevicePathLibCatPrint (Str, L"%s", Fp->PathName); -} - -/** - Converts a Media protocol device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextMediaProtocol ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEDIA_PROTOCOL_DEVICE_PATH *MediaProt; - - MediaProt = DevPath; - UefiDevicePathLibCatPrint (Str, L"Media(%g)", &MediaProt->Protocol); -} - -/** - Converts a Firmware Volume device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextFv ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEDIA_FW_VOL_DEVICE_PATH *Fv; - - Fv = DevPath; - UefiDevicePathLibCatPrint (Str, L"Fv(%g)", &Fv->FvName); -} - -/** - Converts a Firmware Volume File device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextFvFile ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile; - - FvFile = DevPath; - UefiDevicePathLibCatPrint (Str, L"FvFile(%g)", &FvFile->FvFileName); -} - -/** - Converts a Relative Offset device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathRelativeOffsetRange ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset; - - Offset = DevPath; - UefiDevicePathLibCatPrint ( - Str, - L"Offset(0x%lx,0x%lx)", - Offset->StartingOffset, - Offset->EndingOffset - ); -} - -/** - Converts a Ram Disk device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextRamDisk ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - MEDIA_RAM_DISK_DEVICE_PATH *RamDisk; - - RamDisk = DevPath; - - if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid)) { - UefiDevicePathLibCatPrint ( - Str, - L"VirtualDisk(0x%lx,0x%lx,%d)", - LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], - LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], - RamDisk->Instance - ); - } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) { - UefiDevicePathLibCatPrint ( - Str, - L"VirtualCD(0x%lx,0x%lx,%d)", - LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], - LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], - RamDisk->Instance - ); - } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) { - UefiDevicePathLibCatPrint ( - Str, - L"PersistentVirtualDisk(0x%lx,0x%lx,%d)", - LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], - LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], - RamDisk->Instance - ); - } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) { - UefiDevicePathLibCatPrint ( - Str, - L"PersistentVirtualCD(0x%lx,0x%lx,%d)", - LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], - LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], - RamDisk->Instance - ); - } else { - UefiDevicePathLibCatPrint ( - Str, - L"RamDisk(0x%lx,0x%lx,%d,%g)", - LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], - LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], - RamDisk->Instance, - &RamDisk->TypeGuid - ); - } -} - -/** - Converts a BIOS Boot Specification device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextBBS ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - BBS_BBS_DEVICE_PATH *Bbs; - CHAR16 *Type; - - Bbs = DevPath; - switch (Bbs->DeviceType) { - case BBS_TYPE_FLOPPY: - Type = L"Floppy"; - break; - - case BBS_TYPE_HARDDRIVE: - Type = L"HD"; - break; - - case BBS_TYPE_CDROM: - Type = L"CDROM"; - break; - - case BBS_TYPE_PCMCIA: - Type = L"PCMCIA"; - break; - - case BBS_TYPE_USB: - Type = L"USB"; - break; - - case BBS_TYPE_EMBEDDED_NETWORK: - Type = L"Network"; - break; - - default: - Type = NULL; - break; - } - - if (Type != NULL) { - UefiDevicePathLibCatPrint (Str, L"BBS(%s,%a", Type, Bbs->String); - } else { - UefiDevicePathLibCatPrint (Str, L"BBS(0x%x,%a", Bbs->DeviceType, Bbs->String); - } - - if (DisplayOnly) { - UefiDevicePathLibCatPrint (Str, L")"); - return ; - } - - UefiDevicePathLibCatPrint (Str, L",0x%x)", Bbs->StatusFlag); -} - -/** - Converts an End-of-Device-Path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextEndInstance ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - 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} -}; - -/** - Converts an unknown device path structure to its string representative. - - @param Str The string representative of input device. - @param DevPath The input device path structure. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - -**/ -VOID -DevPathToTextNodeGeneric ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - EFI_DEVICE_PATH_PROTOCOL *Node; - UINTN Index; - - Node = DevPath; - - for (Index = 0; mUefiDevicePathLibToTextTableGeneric[Index].Text != NULL; Index++) { - if (DevicePathType (Node) == mUefiDevicePathLibToTextTableGeneric[Index].Type) { - break; - } - } - - if (mUefiDevicePathLibToTextTableGeneric[Index].Text == NULL) { - // - // It's a node whose type cannot be recognized - // - UefiDevicePathLibCatPrint (Str, L"Path(%d,%d", DevicePathType (Node), DevicePathSubType (Node)); - } else { - // - // It's a node whose type can be recognized - // - UefiDevicePathLibCatPrint (Str, L"%s(%d", mUefiDevicePathLibToTextTableGeneric[Index].Text, DevicePathSubType (Node)); - } - - 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]); - } - } - - 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} -}; - -/** - Converts a device node to its string representation. - - @param DeviceNode A Pointer to the device node to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device node or NULL if DeviceNode - is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -UefiDevicePathLibConvertDeviceNodeToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - POOL_PRINT Str; - UINTN Index; - DEVICE_PATH_TO_TEXT ToText; - - if (DeviceNode == NULL) { - return NULL; - } - - ZeroMem (&Str, sizeof (Str)); - - // - // Process the device path node - // If not found, use a generic function - // - ToText = DevPathToTextNodeGeneric; - for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) { - if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type && - DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType - ) { - ToText = mUefiDevicePathLibToTextTable[Index].Function; - break; - } - } - - // - // Print this node - // - ToText (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts); - - ASSERT (Str.Str != NULL); - return Str.Str; -} - -/** - Converts a device path to its text representation. - - @param DevicePath A Pointer to the device to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device path or - NULL if DeviceNode is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -UefiDevicePathLibConvertDevicePathToText ( - 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; - - if (DevicePath == NULL) { - return NULL; - } - - ZeroMem (&Str, sizeof (Str)); - - // - // Process each device path node - // - Node = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath; - while (!IsDevicePathEnd (Node)) { - // - // Find the handler to dump this device path node - // If not found, use a generic function - // - ToText = DevPathToTextNodeGeneric; - for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) { - - if (DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type && - DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType - ) { - ToText = mUefiDevicePathLibToTextTable[Index].Function; - break; - } - } - // - // Put a path separator in if needed - // - if ((Str.Count != 0) && (ToText != DevPathToTextEndInstance)) { - if (Str.Str[Str.Count] != L',') { - UefiDevicePathLibCatPrint (&Str, L"/"); - } - } - - AlignedNode = AllocateCopyPool (DevicePathNodeLength (Node), Node); - // - // Print this node of the device path - // - ToText (&Str, AlignedNode, DisplayOnly, AllowShortcuts); - FreePool (AlignedNode); - - // - // Next device path node - // - Node = NextDevicePathNode (Node); - } - - if (Str.Str == NULL) { - return AllocateZeroPool (sizeof (CHAR16)); - } else { - return Str.Str; - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c deleted file mode 100644 index a70865f..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c +++ /dev/null @@ -1,903 +0,0 @@ -/** @file - Device Path services. The thing to remember is device paths are built out of - nodes. The device path is terminated by an end node that is length - sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL) - all over this file. - - The only place where multi-instance device paths are supported is in - environment varibles. Multi-instance device paths should never be placed - on a Handle. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiDevicePathLib.h" - -// -// Template for an end-of-device path node. -// -GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLibEndDevicePath = { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - END_DEVICE_PATH_LENGTH, - 0 - } -}; - -/** - Determine whether a given device path is valid. - - @param DevicePath A pointer to a device path data structure. - @param MaxSize The maximum size of the device path data structure. - - @retval TRUE DevicePath is valid. - @retval FALSE DevicePath is NULL. - @retval FALSE Maxsize is less than sizeof(EFI_DEVICE_PATH_PROTOCOL). - @retval FALSE The length of any node node in the DevicePath is less - than sizeof (EFI_DEVICE_PATH_PROTOCOL). - @retval FALSE If MaxSize is not zero, the size of the DevicePath - exceeds MaxSize. - @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node - count of the DevicePath exceeds PcdMaximumDevicePathNodeCount. -**/ -BOOLEAN -EFIAPI -IsDevicePathValid ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN UINTN MaxSize - ) -{ - UINTN Count; - UINTN Size; - UINTN NodeLength; - - // - //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)) { - return FALSE; - } - - if (MaxSize == 0) { - MaxSize = MAX_UINTN; - } - - for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) { - NodeLength = DevicePathNodeLength (DevicePath); - if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { - return FALSE; - } - - if (NodeLength > MAX_UINTN - Size) { - return FALSE; - } - Size += NodeLength; - - // - // Validate next node before touch it. - // - if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) { - return FALSE; - } - - if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) { - Count++; - if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) { - return FALSE; - } - } - - // - // FilePath must be a NULL-terminated string. - // - if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH && - DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP && - *(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) { - return FALSE; - } - } - - // - // Only return TRUE when the End Device Path node is valid. - // - return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH); -} - - -/** - Returns the Type field of a device path node. - - Returns the Type field of the device path node specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The Type field of the device path node specified by Node. - -**/ -UINT8 -EFIAPI -DevicePathType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type; -} - -/** - Returns the SubType field of a device path node. - - Returns the SubType field of the device path node specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The SubType field of the device path node specified by Node. - -**/ -UINT8 -EFIAPI -DevicePathSubType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType; -} - -/** - Returns the 16-bit Length field of a device path node. - - Returns the 16-bit Length field of the device path node specified by Node. - Node is not required to be aligned on a 16-bit boundary, so it is recommended - that a function such as ReadUnaligned16() be used to extract the contents of - the Length field. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The 16-bit Length field of the device path node specified by Node. - -**/ -UINTN -EFIAPI -DevicePathNodeLength ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]); -} - -/** - Returns a pointer to the next node in a device path. - - Returns a pointer to the device path node that follows the device path node - specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return a pointer to the device path node that follows the device path node - specified by Node. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -NextDevicePathNode ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node)); -} - -/** - Determines if a device path node is an end node of a device path. - This includes nodes that are the end of a device path instance and nodes that - are the end of an entire device path. - - Determines if the device path node specified by Node is an end node of a device path. - This includes nodes that are the end of a device path instance and nodes that are the - end of an entire device path. If Node represents an end node of a device path, - then TRUE is returned. Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is an end node of a - device path. - @retval FALSE The device path node specified by Node is not an end node of - a device path. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEndType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE); -} - -/** - Determines if a device path node is an end node of an entire device path. - - Determines if a device path node specified by Node is an end node of an entire - device path. If Node represents the end of an entire device path, then TRUE is - returned. Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is the end of an entire - device path. - @retval FALSE The device path node specified by Node is not the end of an - entire device path. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEnd ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE); -} - -/** - Determines if a device path node is an end node of a device path instance. - - Determines if a device path node specified by Node is an end node of a device - path instance. If Node represents the end of a device path instance, then TRUE - is returned. Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is the end of a device - path instance. - @retval FALSE The device path node specified by Node is not the end of a - device path instance. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEndInstance ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE); -} - -/** - Sets the length, in bytes, of a device path node. - - Sets the length of the device path node specified by Node to the value specified - by NodeLength. NodeLength is returned. Node is not required to be aligned on - a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16() - be used to set the contents of the Length field. - - If Node is NULL, then ASSERT(). - If NodeLength >= SIZE_64KB, then ASSERT(). - If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT(). - - @param Node A pointer to a device path node data structure. - @param Length The length, in bytes, of the device path node. - - @return Length - -**/ -UINT16 -EFIAPI -SetDevicePathNodeLength ( - IN OUT VOID *Node, - IN UINTN Length - ) -{ - ASSERT (Node != NULL); - ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB)); - return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length)); -} - -/** - Fills in all the fields of a device path node that is the end of an entire device path. - - Fills in all the fields of a device path node specified by Node so Node represents - the end of an entire device path. The Type field of Node is set to - END_DEVICE_PATH_TYPE, the SubType field of Node is set to - END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to - END_DEVICE_PATH_LENGTH. Node is not required to be aligned on a 16-bit boundary, - so it is recommended that a function such as WriteUnaligned16() be used to set - the contents of the Length field. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - -**/ -VOID -EFIAPI -SetDevicePathEndNode ( - OUT VOID *Node - ) -{ - ASSERT (Node != NULL); - CopyMem (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath)); -} - -/** - Returns the size of a device path in bytes. - - This function returns the size, in bytes, of the device path data structure - specified by DevicePath including the end of device path node. - If DevicePath is NULL or invalid, then 0 is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval 0 If DevicePath is NULL or invalid. - @retval Others The size of a device path in bytes. - -**/ -UINTN -EFIAPI -UefiDevicePathLibGetDevicePathSize ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - CONST EFI_DEVICE_PATH_PROTOCOL *Start; - - if (DevicePath == NULL) { - return 0; - } - - if (!IsDevicePathValid (DevicePath, 0)) { - return 0; - } - - // - // Search for the end of the device path structure - // - Start = DevicePath; - while (!IsDevicePathEnd (DevicePath)) { - DevicePath = NextDevicePathNode (DevicePath); - } - - // - // Compute the size and add back in the size of the end device path structure - // - return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath); -} - -/** - Creates a new copy of an existing device path. - - This function allocates space for a new copy of the device path specified by DevicePath. - If DevicePath is NULL, then NULL is returned. If the memory is successfully - allocated, then the contents of DevicePath are copied to the newly allocated - buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - - @retval NULL DevicePath is NULL or invalid. - @retval Others A pointer to the duplicated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibDuplicateDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - UINTN Size; - - // - // Compute the size - // - Size = GetDevicePathSize (DevicePath); - if (Size == 0) { - return NULL; - } - - // - // Allocate space for duplicate device path - // - - return AllocateCopyPool (Size, DevicePath); -} - -/** - Creates a new device path by appending a second device path to a first device path. - - This function creates a new device path by appending a copy of SecondDevicePath - to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path - device node from SecondDevicePath is retained. The newly created device path is - returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of - SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored, - and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and - SecondDevicePath are NULL, then a copy of an end-of-device-path is returned. - - If there is not enough memory for the newly allocated buffer, then NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param FirstDevicePath A pointer to a device path data structure. - @param SecondDevicePath A pointer to a device path data structure. - - @retval NULL If there is not enough memory for the newly allocated buffer. - @retval NULL If FirstDevicePath or SecondDevicePath is invalid. - @retval Others A pointer to the new device path if success. - Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL - ) -{ - UINTN Size; - UINTN Size1; - UINTN Size2; - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePath2; - - // - // If there's only 1 path, just duplicate it. - // - if (FirstDevicePath == NULL) { - return DuplicateDevicePath ((SecondDevicePath != NULL) ? SecondDevicePath : &mUefiDevicePathLibEndDevicePath); - } - - if (SecondDevicePath == NULL) { - return DuplicateDevicePath (FirstDevicePath); - } - - if (!IsDevicePathValid (FirstDevicePath, 0) || !IsDevicePathValid (SecondDevicePath, 0)) { - return NULL; - } - - // - // 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; - - NewDevicePath = AllocatePool (Size); - - if (NewDevicePath != NULL) { - NewDevicePath = CopyMem (NewDevicePath, FirstDevicePath, Size1); - // - // Over write FirstDevicePath EndNode and do the copy - // - DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + - (Size1 - END_DEVICE_PATH_LENGTH)); - CopyMem (DevicePath2, SecondDevicePath, Size2); - } - - return NewDevicePath; -} - -/** - Creates a new path by appending the device node to the device path. - - This function creates a new device path by appending a copy of the device node - specified by DevicePathNode to a copy of the device path specified by DevicePath - in an allocated buffer. The end-of-device-path device node is moved after the - end of the appended device node. - If DevicePathNode is NULL then a copy of DevicePath is returned. - If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device - path device node is returned. - If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path - device node is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathNode A pointer to a single device path node. - - @retval NULL If there is not enough memory for the new device path. - @retval Others A pointer to the new device path if success. - A copy of DevicePathNode followed by an end-of-device-path node - if both FirstDevicePath and SecondDevicePath are NULL. - A copy of an end-of-device-path node if both FirstDevicePath - and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePathNode ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL - ) -{ - EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; - EFI_DEVICE_PATH_PROTOCOL *NextNode; - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - UINTN NodeLength; - - if (DevicePathNode == NULL) { - return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath); - } - // - // Build a Node that has a terminator on it - // - NodeLength = DevicePathNodeLength (DevicePathNode); - - TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH); - if (TempDevicePath == NULL) { - return NULL; - } - TempDevicePath = CopyMem (TempDevicePath, DevicePathNode, NodeLength); - // - // Add and end device path node to convert Node to device path - // - NextNode = NextDevicePathNode (TempDevicePath); - SetDevicePathEndNode (NextNode); - // - // Append device paths - // - NewDevicePath = AppendDevicePath (DevicePath, TempDevicePath); - - FreePool (TempDevicePath); - - return NewDevicePath; -} - -/** - Creates a new device path by appending the specified device path instance to the specified device - path. - - This function creates a new device path by appending a copy of the device path - instance specified by DevicePathInstance to a copy of the device path specified - by DevicePath in a allocated buffer. - The end-of-device-path device node is moved after the end of the appended device - path instance and a new end-of-device-path-instance node is inserted between. - If DevicePath is NULL, then a copy if DevicePathInstance is returned. - If DevicePathInstance is NULL, then NULL is returned. - If DevicePath or DevicePathInstance is invalid, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathInstance A pointer to a device path instance. - - @return A pointer to the new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePathInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL - ) -{ - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; - UINTN SrcSize; - UINTN InstanceSize; - - if (DevicePath == NULL) { - return DuplicateDevicePath (DevicePathInstance); - } - - if (DevicePathInstance == NULL) { - return NULL; - } - - if (!IsDevicePathValid (DevicePath, 0) || !IsDevicePathValid (DevicePathInstance, 0)) { - return NULL; - } - - SrcSize = GetDevicePathSize (DevicePath); - InstanceSize = GetDevicePathSize (DevicePathInstance); - - NewDevicePath = AllocatePool (SrcSize + InstanceSize); - if (NewDevicePath != NULL) { - - TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);; - - while (!IsDevicePathEnd (TempDevicePath)) { - TempDevicePath = NextDevicePathNode (TempDevicePath); - } - - TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; - TempDevicePath = NextDevicePathNode (TempDevicePath); - CopyMem (TempDevicePath, DevicePathInstance, InstanceSize); - } - - return NewDevicePath; -} - -/** - Creates a copy of the current device path instance and returns a pointer to the next device path - instance. - - This function creates a copy of the current device path instance. It also updates - DevicePath to point to the next device path instance in the device path (or NULL - if no more) and updates Size to hold the size of the device path instance copy. - If DevicePath is NULL, then NULL is returned. - If DevicePath points to a invalid device path, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - If Size is NULL, then ASSERT(). - - @param DevicePath On input, this holds the pointer to the current - device path instance. On output, this holds - the pointer to the next device path instance - or NULL if there are no more device path - instances in the device path pointer to a - device path data structure. - @param Size On output, this holds the size of the device - path instance, in bytes or zero, if DevicePath - is NULL. - - @return A pointer to the current device path instance. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibGetNextDevicePathInstance ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT UINTN *Size - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *ReturnValue; - UINT8 Temp; - - ASSERT (Size != NULL); - - if (DevicePath == NULL || *DevicePath == NULL) { - *Size = 0; - return NULL; - } - - if (!IsDevicePathValid (*DevicePath, 0)) { - return NULL; - } - - // - // Find the end of the device path instance - // - DevPath = *DevicePath; - while (!IsDevicePathEndType (DevPath)) { - DevPath = NextDevicePathNode (DevPath); - } - - // - // Compute the size of the device path instance - // - *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; - - // - // If DevPath is the end of an entire device path, then another instance - // does not follow, so *DevicePath is set to NULL. - // - if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) { - *DevicePath = NULL; - } else { - *DevicePath = NextDevicePathNode (DevPath); - } - - return ReturnValue; -} - -/** - Creates a device node. - - This function creates a new device node in a newly allocated buffer of size - NodeLength and initializes the device path node header with NodeType and NodeSubType. - The new device path node is returned. - If NodeLength is smaller than a device path header, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param NodeType The device node type for the new device node. - @param NodeSubType The device node sub-type for the new device node. - @param NodeLength The length of the new device node. - - @return The new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibCreateDeviceNode ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - - if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { - // - // NodeLength is less than the size of the header. - // - return NULL; - } - - DevicePath = AllocateZeroPool (NodeLength); - if (DevicePath != NULL) { - DevicePath->Type = NodeType; - DevicePath->SubType = NodeSubType; - SetDevicePathNodeLength (DevicePath, NodeLength); - } - - return DevicePath; -} - -/** - Determines if a device path is single or multi-instance. - - This function returns TRUE if the device path specified by DevicePath is - multi-instance. - Otherwise, FALSE is returned. - If DevicePath is NULL or invalid, then FALSE is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE DevicePath is multi-instance. - @retval FALSE DevicePath is not multi-instance, or DevicePath - is NULL or invalid. - -**/ -BOOLEAN -EFIAPI -UefiDevicePathLibIsDevicePathMultiInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - CONST EFI_DEVICE_PATH_PROTOCOL *Node; - - if (DevicePath == NULL) { - return FALSE; - } - - if (!IsDevicePathValid (DevicePath, 0)) { - return FALSE; - } - - Node = DevicePath; - while (!IsDevicePathEnd (Node)) { - if (IsDevicePathEndInstance (Node)) { - return TRUE; - } - - Node = NextDevicePathNode (Node); - } - - return FALSE; -} - - -/** - Retrieves the device path protocol from a handle. - - This function returns the device path protocol from the handle specified by Handle. - If Handle is NULL or Handle does not contain a device path protocol, then NULL - is returned. - - @param Handle The handle from which to retrieve the device - path protocol. - - @return The device path protocol from the handle specified by Handle. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DevicePathFromHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_STATUS Status; - - Status = gBS->HandleProtocol ( - Handle, - &gEfiDevicePathProtocolGuid, - (VOID *) &DevicePath - ); - if (EFI_ERROR (Status)) { - DevicePath = NULL; - } - return DevicePath; -} - -/** - Allocates a device path for a file and appends it to an existing device path. - - If Device is a valid device handle that contains a device path protocol, then a device path for - the file specified by FileName is allocated and appended to the device path associated with the - handle Device. The allocated device path is returned. If Device is NULL or Device is a handle - that does not support the device path protocol, then a device path containing a single device - path node for the file specified by FileName is allocated and returned. - The memory for the new device path is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - If FileName is NULL, then ASSERT(). - If FileName is not aligned on a 16-bit boundary, then ASSERT(). - - @param Device A pointer to a device handle. This parameter - is optional and may be NULL. - @param FileName A pointer to a Null-terminated Unicode string. - - @return The allocated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -FileDevicePath ( - IN EFI_HANDLE Device, OPTIONAL - IN CONST CHAR16 *FileName - ) -{ - UINTN Size; - FILEPATH_DEVICE_PATH *FilePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *FileDevicePath; - - DevicePath = NULL; - - Size = StrSize (FileName); - FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH); - if (FileDevicePath != NULL) { - FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath; - FilePath->Header.Type = MEDIA_DEVICE_PATH; - FilePath->Header.SubType = MEDIA_FILEPATH_DP; - CopyMem (&FilePath->PathName, FileName, Size); - SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH); - SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header)); - - if (Device != NULL) { - DevicePath = DevicePathFromHandle (Device); - } - - DevicePath = AppendDevicePath (DevicePath, FileDevicePath); - FreePool (FileDevicePath); - } - - return DevicePath; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c deleted file mode 100644 index 369733e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c +++ /dev/null @@ -1,360 +0,0 @@ -/** @file - Device Path services. The thing to remember is device paths are built out of - nodes. The device path is terminated by an end node that is length - sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL) - all over this file. - - The only place where multi-instance device paths are supported is in - environment varibles. Multi-instance device paths should never be placed - on a Handle. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "UefiDevicePathLib.h" - -/** - Returns the size of a device path in bytes. - - This function returns the size, in bytes, of the device path data structure - specified by DevicePath including the end of device path node. - If DevicePath is NULL or invalid, then 0 is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval 0 If DevicePath is NULL or invalid. - @retval Others The size of a device path in bytes. - -**/ -UINTN -EFIAPI -GetDevicePathSize ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return UefiDevicePathLibGetDevicePathSize (DevicePath); -} - -/** - Creates a new copy of an existing device path. - - This function allocates space for a new copy of the device path specified by DevicePath. - If DevicePath is NULL, then NULL is returned. If the memory is successfully - allocated, then the contents of DevicePath are copied to the newly allocated - buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - - @retval NULL DevicePath is NULL or invalid. - @retval Others A pointer to the duplicated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DuplicateDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return UefiDevicePathLibDuplicateDevicePath (DevicePath); -} - -/** - Creates a new device path by appending a second device path to a first device path. - - This function creates a new device path by appending a copy of SecondDevicePath - to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path - device node from SecondDevicePath is retained. The newly created device path is - returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of - SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored, - and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and - SecondDevicePath are NULL, then a copy of an end-of-device-path is returned. - - If there is not enough memory for the newly allocated buffer, then NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param FirstDevicePath A pointer to a device path data structure. - @param SecondDevicePath A pointer to a device path data structure. - - @retval NULL If there is not enough memory for the newly allocated buffer. - @retval NULL If FirstDevicePath or SecondDevicePath is invalid. - @retval Others A pointer to the new device path if success. - Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL - ) -{ - return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath); -} - -/** - Creates a new path by appending the device node to the device path. - - This function creates a new device path by appending a copy of the device node - specified by DevicePathNode to a copy of the device path specified by DevicePath - in an allocated buffer. The end-of-device-path device node is moved after the - end of the appended device node. - If DevicePathNode is NULL then a copy of DevicePath is returned. - If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device - path device node is returned. - If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path - device node is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathNode A pointer to a single device path node. - - @retval NULL If there is not enough memory for the new device path. - @retval Others A pointer to the new device path if success. - A copy of DevicePathNode followed by an end-of-device-path node - if both FirstDevicePath and SecondDevicePath are NULL. - A copy of an end-of-device-path node if both FirstDevicePath - and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathNode ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL - ) -{ - return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode); -} - -/** - Creates a new device path by appending the specified device path instance to the specified device - path. - - This function creates a new device path by appending a copy of the device path - instance specified by DevicePathInstance to a copy of the device path specified - by DevicePath in a allocated buffer. - The end-of-device-path device node is moved after the end of the appended device - path instance and a new end-of-device-path-instance node is inserted between. - If DevicePath is NULL, then a copy if DevicePathInstance is returned. - If DevicePathInstance is NULL, then NULL is returned. - If DevicePath or DevicePathInstance is invalid, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathInstance A pointer to a device path instance. - - @return A pointer to the new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL - ) -{ - return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance); -} - -/** - Creates a copy of the current device path instance and returns a pointer to the next device path - instance. - - This function creates a copy of the current device path instance. It also updates - DevicePath to point to the next device path instance in the device path (or NULL - if no more) and updates Size to hold the size of the device path instance copy. - If DevicePath is NULL, then NULL is returned. - If DevicePath points to a invalid device path, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - If Size is NULL, then ASSERT(). - - @param DevicePath On input, this holds the pointer to the current - device path instance. On output, this holds - the pointer to the next device path instance - or NULL if there are no more device path - instances in the device path pointer to a - device path data structure. - @param Size On output, this holds the size of the device - path instance, in bytes or zero, if DevicePath - is NULL. - - @return A pointer to the current device path instance. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -GetNextDevicePathInstance ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT UINTN *Size - ) -{ - return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size); -} - -/** - Creates a device node. - - This function creates a new device node in a newly allocated buffer of size - NodeLength and initializes the device path node header with NodeType and NodeSubType. - The new device path node is returned. - If NodeLength is smaller than a device path header, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param NodeType The device node type for the new device node. - @param NodeSubType The device node sub-type for the new device node. - @param NodeLength The length of the new device node. - - @return The new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -CreateDeviceNode ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ) -{ - return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength); -} - -/** - Determines if a device path is single or multi-instance. - - This function returns TRUE if the device path specified by DevicePath is - multi-instance. - Otherwise, FALSE is returned. - If DevicePath is NULL or invalid, then FALSE is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE DevicePath is multi-instance. - @retval FALSE DevicePath is not multi-instance, or DevicePath - is NULL or invalid. - -**/ -BOOLEAN -EFIAPI -IsDevicePathMultiInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath); -} - -/** - Converts a device node to its string representation. - - @param DeviceNode A Pointer to the device node to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device node or NULL if DeviceNode - is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDeviceNodeToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - return UefiDevicePathLibConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts); -} - -/** - Converts a device path to its text representation. - - @param DevicePath A Pointer to the device to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device path or - NULL if DeviceNode is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDevicePathToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts); -} - -/** - Convert text to the binary representation of a device node. - - @param TextDeviceNode TextDeviceNode points to the text representation of a device - node. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was - insufficient memory or text unsupported. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ) -{ - return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode); -} - -/** - Convert text to the binary representation of a device path. - - - @param TextDevicePath TextDevicePath points to the text representation of a device - path. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or - there was insufficient memory. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDevicePath ( - IN CONST CHAR16 *TextDevicePath - ) -{ - return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h deleted file mode 100644 index d9dc09b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h +++ /dev/null @@ -1,457 +0,0 @@ -/** @file - Definition for Device Path library. - -Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_DEVICE_PATH_LIB_H_ -#define _UEFI_DEVICE_PATH_LIB_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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; -} POOL_PRINT; - -typedef -EFI_DEVICE_PATH_PROTOCOL * -(*DEVICE_PATH_FROM_TEXT) ( - IN CHAR16 *Str - ); - -typedef -VOID -(*DEVICE_PATH_TO_TEXT) ( - IN OUT POOL_PRINT *Str, - IN VOID *DevicePath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ); - -typedef struct { - UINT8 Type; - UINT8 SubType; - DEVICE_PATH_TO_TEXT Function; -} DEVICE_PATH_TO_TEXT_TABLE; - -typedef struct { - UINT8 Type; - CHAR16 *Text; -} DEVICE_PATH_TO_TEXT_GENERIC_TABLE; - -typedef struct { - CHAR16 *DevicePathNodeText; - DEVICE_PATH_FROM_TEXT Function; -} DEVICE_PATH_FROM_TEXT_TABLE; - -typedef struct { - 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 - -#pragma pack(1) - -typedef struct { - 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]; -} VENDOR_DEFINED_MESSAGING_DEVICE_PATH; - -typedef struct { - 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]; -} 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]; -} ISCSI_DEVICE_PATH_WITH_NAME; - -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - EFI_GUID Guid; - UINT8 VendorDefinedData[1]; -} VENDOR_DEVICE_PATH_WITH_DATA; - -#pragma pack() - -/** - Returns the size of a device path in bytes. - - This function returns the size, in bytes, of the device path data structure - specified by DevicePath including the end of device path node. - If DevicePath is NULL or invalid, then 0 is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval 0 If DevicePath is NULL or invalid. - @retval Others The size of a device path in bytes. - -**/ -UINTN -EFIAPI -UefiDevicePathLibGetDevicePathSize ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - -/** - Creates a new copy of an existing device path. - - This function allocates space for a new copy of the device path specified by DevicePath. - If DevicePath is NULL, then NULL is returned. If the memory is successfully - allocated, then the contents of DevicePath are copied to the newly allocated - buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - - @retval NULL DevicePath is NULL or invalid. - @retval Others A pointer to the duplicated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibDuplicateDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - -/** - Creates a new device path by appending a second device path to a first device path. - - This function creates a new device path by appending a copy of SecondDevicePath - to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path - device node from SecondDevicePath is retained. The newly created device path is - returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of - SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored, - and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and - SecondDevicePath are NULL, then a copy of an end-of-device-path is returned. - - If there is not enough memory for the newly allocated buffer, then NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param FirstDevicePath A pointer to a device path data structure. - @param SecondDevicePath A pointer to a device path data structure. - - @retval NULL If there is not enough memory for the newly allocated buffer. - @retval NULL If FirstDevicePath or SecondDevicePath is invalid. - @retval Others A pointer to the new device path if success. - Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL - ); - -/** - Creates a new path by appending the device node to the device path. - - This function creates a new device path by appending a copy of the device node - specified by DevicePathNode to a copy of the device path specified by DevicePath - in an allocated buffer. The end-of-device-path device node is moved after the - end of the appended device node. - If DevicePathNode is NULL then a copy of DevicePath is returned. - If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device - path device node is returned. - If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path - device node is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathNode A pointer to a single device path node. - - @retval NULL If there is not enough memory for the new device path. - @retval Others A pointer to the new device path if success. - A copy of DevicePathNode followed by an end-of-device-path node - if both FirstDevicePath and SecondDevicePath are NULL. - A copy of an end-of-device-path node if both FirstDevicePath - and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePathNode ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL - ); - -/** - Creates a new device path by appending the specified device path instance to the specified device - path. - - This function creates a new device path by appending a copy of the device path - instance specified by DevicePathInstance to a copy of the device path specified - by DevicePath in a allocated buffer. - The end-of-device-path device node is moved after the end of the appended device - path instance and a new end-of-device-path-instance node is inserted between. - If DevicePath is NULL, then a copy if DevicePathInstance is returned. - If DevicePathInstance is NULL, then NULL is returned. - If DevicePath or DevicePathInstance is invalid, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathInstance A pointer to a device path instance. - - @return A pointer to the new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibAppendDevicePathInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL - ); - -/** - Creates a copy of the current device path instance and returns a pointer to the next device path - instance. - - This function creates a copy of the current device path instance. It also updates - DevicePath to point to the next device path instance in the device path (or NULL - if no more) and updates Size to hold the size of the device path instance copy. - If DevicePath is NULL, then NULL is returned. - If DevicePath points to a invalid device path, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - If Size is NULL, then ASSERT(). - - @param DevicePath On input, this holds the pointer to the current - device path instance. On output, this holds - the pointer to the next device path instance - or NULL if there are no more device path - instances in the device path pointer to a - device path data structure. - @param Size On output, this holds the size of the device - path instance, in bytes or zero, if DevicePath - is NULL. - - @return A pointer to the current device path instance. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibGetNextDevicePathInstance ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT UINTN *Size - ); - -/** - Creates a device node. - - This function creates a new device node in a newly allocated buffer of size - NodeLength and initializes the device path node header with NodeType and NodeSubType. - The new device path node is returned. - If NodeLength is smaller than a device path header, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param NodeType The device node type for the new device node. - @param NodeSubType The device node sub-type for the new device node. - @param NodeLength The length of the new device node. - - @return The new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibCreateDeviceNode ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ); - -/** - Determines if a device path is single or multi-instance. - - This function returns TRUE if the device path specified by DevicePath is - multi-instance. - Otherwise, FALSE is returned. - If DevicePath is NULL or invalid, then FALSE is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE DevicePath is multi-instance. - @retval FALSE DevicePath is not multi-instance, or DevicePath - is NULL or invalid. - -**/ -BOOLEAN -EFIAPI -UefiDevicePathLibIsDevicePathMultiInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - - -/** - Converts a device path to its text representation. - - @param DevicePath A Pointer to the device to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device path or - NULL if DeviceNode is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -UefiDevicePathLibConvertDevicePathToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ); - -/** - Converts a device node to its string representation. - - @param DeviceNode A Pointer to the device node to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device node or NULL if DeviceNode - is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -UefiDevicePathLibConvertDeviceNodeToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ); - -/** - Convert text to the binary representation of a device node. - - @param TextDeviceNode TextDeviceNode points to the text representation of a device - node. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was - insufficient memory or text unsupported. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ); - -/** - Convert text to the binary representation of a device path. - - - @param TextDevicePath TextDevicePath points to the text representation of a device - path. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or - there was insufficient memory. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -UefiDevicePathLibConvertTextToDevicePath ( - IN CONST CHAR16 *TextDevicePath - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf deleted file mode 100644 index 71b1dbb..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf +++ /dev/null @@ -1,79 +0,0 @@ -## @file -# Instance of Device Path Library based on Memory Allocation Library. -# -# Device Path Library that layers on top of the Memory Allocation Library. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDevicePathLib - MODULE_UNI_FILE = UefiDevicePathLib.uni - FILE_GUID = 91c1677a-e57f-4191-8b8e-eb7711a716e0 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DevicePathLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE MM_STANDALONE - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DevicePathUtilities.c - DevicePathToText.c - DevicePathFromText.c - UefiDevicePathLib.c - UefiDevicePathLib.h - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - MemoryAllocationLib - DebugLib - BaseMemoryLib - PcdLib - PrintLib - -[Guids] - ## SOMETIMES_CONSUMES ## GUID - gEfiVTUTF8Guid - ## SOMETIMES_CONSUMES ## GUID - gEfiVT100Guid - ## SOMETIMES_CONSUMES ## GUID - gEfiVT100PlusGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPcAnsiGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiUartDevicePathGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiSasDevicePathGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiVirtualDiskGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiVirtualCdGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPersistentVirtualDiskGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPersistentVirtualCdGuid - -[Protocols] - gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES - gEfiDebugPortProtocolGuid ## UNDEFINED - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.uni deleted file mode 100644 index 9ea680d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Instance of Device Path Library based on Memory Allocation Library. -// -// Device Path Library that layers on top of the Memory Allocation Library. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Device Path Library based on Memory Allocation Library" - -#string STR_MODULE_DESCRIPTION #language en-US "This Device Path Library layers on top of the Memory Allocation Library." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c deleted file mode 100644 index 8ba8ed9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c +++ /dev/null @@ -1,484 +0,0 @@ -/** @file - Device Path services. The thing to remember is device paths are built out of - nodes. The device path is terminated by an end node that is length - sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL) - all over this file. - - The only place where multi-instance device paths are supported is in - environment varibles. Multi-instance device paths should never be placed - on a Handle. - - Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#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; - -/** - The constructor function caches the pointer to DevicePathUtilites protocol, - DevicePathToText protocol and DevicePathFromText protocol. - - The constructor function locates these three protocols from protocol database. - It will caches the pointer to local protocol instance if that operation fails - and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -UefiDevicePathLibOptionalDevicePathProtocolConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol ( - &gEfiDevicePathUtilitiesProtocolGuid, - NULL, - (VOID**) &mDevicePathLibDevicePathUtilities - ); - ASSERT_EFI_ERROR (Status); - ASSERT (mDevicePathLibDevicePathUtilities != NULL); - return Status; -} - -/** - Returns the size of a device path in bytes. - - This function returns the size, in bytes, of the device path data structure - specified by DevicePath including the end of device path node. - If DevicePath is NULL or invalid, then 0 is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval 0 If DevicePath is NULL or invalid. - @retval Others The size of a device path in bytes. - -**/ -UINTN -EFIAPI -GetDevicePathSize ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->GetDevicePathSize (DevicePath); - } else { - return UefiDevicePathLibGetDevicePathSize (DevicePath); - } -} - -/** - Creates a new copy of an existing device path. - - This function allocates space for a new copy of the device path specified by DevicePath. - If DevicePath is NULL, then NULL is returned. If the memory is successfully - allocated, then the contents of DevicePath are copied to the newly allocated - buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - - @retval NULL DevicePath is NULL or invalid. - @retval Others A pointer to the duplicated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DuplicateDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->DuplicateDevicePath (DevicePath); - } else { - return UefiDevicePathLibDuplicateDevicePath (DevicePath); - } -} - -/** - Creates a new device path by appending a second device path to a first device path. - - This function creates a new device path by appending a copy of SecondDevicePath - to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path - device node from SecondDevicePath is retained. The newly created device path is - returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of - SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored, - and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and - SecondDevicePath are NULL, then a copy of an end-of-device-path is returned. - - If there is not enough memory for the newly allocated buffer, then NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param FirstDevicePath A pointer to a device path data structure. - @param SecondDevicePath A pointer to a device path data structure. - - @retval NULL If there is not enough memory for the newly allocated buffer. - @retval NULL If FirstDevicePath or SecondDevicePath is invalid. - @retval Others A pointer to the new device path if success. - Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->AppendDevicePath (FirstDevicePath, SecondDevicePath); - } else { - return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath); - } -} - -/** - Creates a new path by appending the device node to the device path. - - This function creates a new device path by appending a copy of the device node - specified by DevicePathNode to a copy of the device path specified by DevicePath - in an allocated buffer. The end-of-device-path device node is moved after the - end of the appended device node. - If DevicePathNode is NULL then a copy of DevicePath is returned. - If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device - path device node is returned. - If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path - device node is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathNode A pointer to a single device path node. - - @retval NULL If there is not enough memory for the new device path. - @retval Others A pointer to the new device path if success. - A copy of DevicePathNode followed by an end-of-device-path node - if both FirstDevicePath and SecondDevicePath are NULL. - A copy of an end-of-device-path node if both FirstDevicePath - and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathNode ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->AppendDeviceNode (DevicePath, DevicePathNode); - } else { - return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode); - } -} - -/** - Creates a new device path by appending the specified device path instance to the specified device - path. - - This function creates a new device path by appending a copy of the device path - instance specified by DevicePathInstance to a copy of the device path specified - by DevicePath in a allocated buffer. - The end-of-device-path device node is moved after the end of the appended device - path instance and a new end-of-device-path-instance node is inserted between. - If DevicePath is NULL, then a copy if DevicePathInstance is returned. - If DevicePathInstance is NULL, then NULL is returned. - If DevicePath or DevicePathInstance is invalid, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathInstance A pointer to a device path instance. - - @return A pointer to the new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->AppendDevicePathInstance (DevicePath, DevicePathInstance); - } else { - return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance); - } -} - -/** - Creates a copy of the current device path instance and returns a pointer to the next device path - instance. - - This function creates a copy of the current device path instance. It also updates - DevicePath to point to the next device path instance in the device path (or NULL - if no more) and updates Size to hold the size of the device path instance copy. - If DevicePath is NULL, then NULL is returned. - If DevicePath points to a invalid device path, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - If Size is NULL, then ASSERT(). - - @param DevicePath On input, this holds the pointer to the current - device path instance. On output, this holds - the pointer to the next device path instance - or NULL if there are no more device path - instances in the device path pointer to a - device path data structure. - @param Size On output, this holds the size of the device - path instance, in bytes or zero, if DevicePath - is NULL. - - @return A pointer to the current device path instance. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -GetNextDevicePathInstance ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT UINTN *Size - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->GetNextDevicePathInstance (DevicePath, Size); - } else { - return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size); - } -} - -/** - Creates a device node. - - This function creates a new device node in a newly allocated buffer of size - NodeLength and initializes the device path node header with NodeType and NodeSubType. - The new device path node is returned. - If NodeLength is smaller than a device path header, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param NodeType The device node type for the new device node. - @param NodeSubType The device node sub-type for the new device node. - @param NodeLength The length of the new device node. - - @return The new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -CreateDeviceNode ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength); - } else { - return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength); - } -} - -/** - Determines if a device path is single or multi-instance. - - This function returns TRUE if the device path specified by DevicePath is - multi-instance. - Otherwise, FALSE is returned. - If DevicePath is NULL or invalid, then FALSE is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE DevicePath is multi-instance. - @retval FALSE DevicePath is not multi-instance, or DevicePath - is NULL or invalid. - -**/ -BOOLEAN -EFIAPI -IsDevicePathMultiInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - if (mDevicePathLibDevicePathUtilities != NULL) { - return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (DevicePath); - } else { - return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath); - } -} - -/** - Locate and return the protocol instance identified by the ProtocolGuid. - - @param ProtocolGuid The GUID of the protocol. - - @return A pointer to the protocol instance or NULL when absent. -**/ -VOID * -UefiDevicePathLibLocateProtocol ( - EFI_GUID *ProtocolGuid - ) -{ - EFI_STATUS Status; - VOID *Protocol; - Status = gBS->LocateProtocol ( - ProtocolGuid, - NULL, - (VOID**) &Protocol - ); - if (EFI_ERROR (Status)) { - return NULL; - } else { - return Protocol; - } -} - -/** - Converts a device node to its string representation. - - @param DeviceNode A Pointer to the device node to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device node or NULL if DeviceNode - is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDeviceNodeToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - if (mDevicePathLibDevicePathToText == NULL) { - mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid); - } - if (mDevicePathLibDevicePathToText != NULL) { - return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts); - } - - return UefiDevicePathLibConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts); -} - -/** - Converts a device path to its text representation. - - @param DevicePath A Pointer to the device to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device path or - NULL if DeviceNode is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDevicePathToText ( - 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); - } - - return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts); -} - -/** - Convert text to the binary representation of a device node. - - @param TextDeviceNode TextDeviceNode points to the text representation of a device - node. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was - insufficient memory or text unsupported. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ) -{ - if (mDevicePathLibDevicePathFromText == NULL) { - mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid); - } - if (mDevicePathLibDevicePathFromText != NULL) { - return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode); - } - - return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode); -} - -/** - Convert text to the binary representation of a device path. - - - @param TextDevicePath TextDevicePath points to the text representation of a device - path. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or - there was insufficient memory. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDevicePath ( - IN CONST CHAR16 *TextDevicePath - ) -{ - if (mDevicePathLibDevicePathFromText == NULL) { - mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid); - } - if (mDevicePathLibDevicePathFromText != NULL) { - return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath); - } - - return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf deleted file mode 100644 index 521f6ca..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf +++ /dev/null @@ -1,89 +0,0 @@ -## @file -# Instance of Device Path Library based on Device Path Protocol. -# -# Device Path Library that layers on top of the UEFI 2.0 Device Path Protocol. -# If the DevicePathFromText/DevicePathToText protocol doesn't exist, the library -# uses its internal conversion logic. -# -# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDevicePathLibOptionalDevicePathProtocol - MODULE_UNI_FILE = UefiDevicePathLibOptionalDevicePathProtocol.uni - FILE_GUID = 3E1C696D-FCF0-45a7-85A7-E86C2A1C1080 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DevicePathLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - - CONSTRUCTOR = UefiDevicePathLibOptionalDevicePathProtocolConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DevicePathUtilities.c - DevicePathToText.c - DevicePathFromText.c - UefiDevicePathLibOptionalDevicePathProtocol.c - UefiDevicePathLib.h - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - UefiBootServicesTableLib - MemoryAllocationLib - DebugLib - BaseMemoryLib - PcdLib - PrintLib - -[Guids] - ## SOMETIMES_CONSUMES ## GUID - gEfiVTUTF8Guid - ## SOMETIMES_CONSUMES ## GUID - gEfiVT100Guid - ## SOMETIMES_CONSUMES ## GUID - gEfiVT100PlusGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPcAnsiGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiUartDevicePathGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiSasDevicePathGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiVirtualDiskGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiVirtualCdGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPersistentVirtualDiskGuid - ## SOMETIMES_CONSUMES ## GUID - gEfiPersistentVirtualCdGuid - -[Protocols] - gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES - gEfiDevicePathUtilitiesProtocolGuid ## CONSUMES - gEfiDevicePathToTextProtocolGuid ## SOMETIMES_CONSUMES - gEfiDevicePathFromTextProtocolGuid ## SOMETIMES_CONSUMES - gEfiDebugPortProtocolGuid ## UNDEFINED - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiDevicePathUtilitiesProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.uni deleted file mode 100644 index 3a42133..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of Device Path Library based on Device Path Protocol. -// -// Device Path Library that layers on top of the UEFI 2.0 Device Path Protocol. -// If the DevicePathFromText/DevicePathToText protocol doesn't exist, the library -// uses its internal conversion logic. -// -// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Device Path Library based on Device Path Protocol." - -#string STR_MODULE_DESCRIPTION #language en-US "Instance of Device Path Library based on Device Path Protocol." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c deleted file mode 100644 index b79c863..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c +++ /dev/null @@ -1,871 +0,0 @@ -/** @file - Library instance that implement UEFI Device Path Library class based on protocol - gEfiDevicePathUtilitiesProtocolGuid. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -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. -// -GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLibEndDevicePath = { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - END_DEVICE_PATH_LENGTH, - 0 - } -}; - -/** - The constructor function caches the pointer to DevicePathUtilites protocol. - - The constructor function locates DevicePathUtilities protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -DevicePathLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol ( - &gEfiDevicePathUtilitiesProtocolGuid, - NULL, - (VOID**) &mDevicePathLibDevicePathUtilities - ); - ASSERT_EFI_ERROR (Status); - ASSERT (mDevicePathLibDevicePathUtilities != NULL); - return Status; -} - -/** - Determine whether a given device path is valid. - If DevicePath is NULL, then ASSERT(). - - @param DevicePath A pointer to a device path data structure. - @param MaxSize The maximum size of the device path data structure. - - @retval TRUE DevicePath is valid. - @retval FALSE The length of any node node in the DevicePath is less - than sizeof (EFI_DEVICE_PATH_PROTOCOL). - @retval FALSE If MaxSize is not zero, the size of the DevicePath - exceeds MaxSize. - @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node - count of the DevicePath exceeds PcdMaximumDevicePathNodeCount. -**/ -BOOLEAN -EFIAPI -IsDevicePathValid ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN UINTN MaxSize - ) -{ - UINTN Count; - UINTN Size; - UINTN NodeLength; - - ASSERT (DevicePath != NULL); - - if (MaxSize == 0) { - MaxSize = MAX_UINTN; - } - - // - // Validate the input size big enough to touch the first node. - // - if (MaxSize < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { - return FALSE; - } - - for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) { - NodeLength = DevicePathNodeLength (DevicePath); - if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { - return FALSE; - } - - if (NodeLength > MAX_UINTN - Size) { - return FALSE; - } - Size += NodeLength; - - // - // Validate next node before touch it. - // - if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) { - return FALSE; - } - - if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) { - Count++; - if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) { - return FALSE; - } - } - - // - // FilePath must be a NULL-terminated string. - // - if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH && - DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP && - *(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) { - return FALSE; - } - } - - // - // Only return TRUE when the End Device Path node is valid. - // - return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH); -} - -/** - Returns the Type field of a device path node. - - Returns the Type field of the device path node specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The Type field of the device path node specified by Node. - -**/ -UINT8 -EFIAPI -DevicePathType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type; -} - -/** - Returns the SubType field of a device path node. - - Returns the SubType field of the device path node specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The SubType field of the device path node specified by Node. - -**/ -UINT8 -EFIAPI -DevicePathSubType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType; -} - -/** - Returns the 16-bit Length field of a device path node. - - Returns the 16-bit Length field of the device path node specified by Node. - Node is not required to be aligned on a 16-bit boundary, so it is recommended - that a function such as ReadUnaligned16() be used to extract the contents of - the Length field. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return The 16-bit Length field of the device path node specified by Node. - -**/ -UINTN -EFIAPI -DevicePathNodeLength ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]); -} - -/** - Returns a pointer to the next node in a device path. - - Returns a pointer to the device path node that follows the device path node - specified by Node. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @return a pointer to the device path node that follows the device path node - specified by Node. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -NextDevicePathNode ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node)); -} - -/** - Determines if a device path node is an end node of a device path. - This includes nodes that are the end of a device path instance and nodes that - are the end of an entire device path. - - Determines if the device path node specified by Node is an end node of a device path. - This includes nodes that are the end of a device path instance and nodes that are the - end of an entire device path. If Node represents an end node of a device path, - then TRUE is returned. Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is an end node of a device path. - @retval FALSE The device path node specified by Node is not an end node of - a device path. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEndType ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE); -} - -/** - Determines if a device path node is an end node of an entire device path. - - Determines if a device path node specified by Node is an end node of an entire - device path. - If Node represents the end of an entire device path, then TRUE is returned. - Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is the end of an entire device path. - @retval FALSE The device path node specified by Node is not the end of an entire device path. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEnd ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE); -} - -/** - Determines if a device path node is an end node of a device path instance. - - Determines if a device path node specified by Node is an end node of a device - path instance. - If Node represents the end of a device path instance, then TRUE is returned. - Otherwise, FALSE is returned. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - - @retval TRUE The device path node specified by Node is the end of a device - path instance. - @retval FALSE The device path node specified by Node is not the end of a - device path instance. - -**/ -BOOLEAN -EFIAPI -IsDevicePathEndInstance ( - IN CONST VOID *Node - ) -{ - ASSERT (Node != NULL); - return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE); -} - -/** - Sets the length, in bytes, of a device path node. - - Sets the length of the device path node specified by Node to the value specified - by NodeLength. NodeLength is returned. Node is not required to be aligned on - a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16() - be used to set the contents of the Length field. - - If Node is NULL, then ASSERT(). - If NodeLength >= SIZE_64KB, then ASSERT(). - If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT(). - - @param Node A pointer to a device path node data structure. - @param Length The length, in bytes, of the device path node. - - @return Length - -**/ -UINT16 -EFIAPI -SetDevicePathNodeLength ( - IN OUT VOID *Node, - IN UINTN Length - ) -{ - ASSERT (Node != NULL); - ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB)); - return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length)); -} - -/** - Fills in all the fields of a device path node that is the end of an entire device path. - - Fills in all the fields of a device path node specified by Node so Node represents - the end of an entire device path. The Type field of Node is set to - END_DEVICE_PATH_TYPE, the SubType field of Node is set to - END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to - END_DEVICE_PATH_LENGTH. Node is not required to be aligned on a 16-bit boundary, - so it is recommended that a function such as WriteUnaligned16() be used to set - the contents of the Length field. - - If Node is NULL, then ASSERT(). - - @param Node A pointer to a device path node data structure. - -**/ -VOID -EFIAPI -SetDevicePathEndNode ( - OUT VOID *Node - ) -{ - ASSERT (Node != NULL); - CopyMem (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath)); -} - -/** - Returns the size of a device path in bytes. - - This function returns the size, in bytes, of the device path data structure - specified by DevicePath including the end of device path node. - If DevicePath is NULL or invalid, then 0 is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval 0 If DevicePath is NULL or invalid. - @retval Others The size of a device path in bytes. - -**/ -UINTN -EFIAPI -GetDevicePathSize ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return mDevicePathLibDevicePathUtilities->GetDevicePathSize (DevicePath); -} - -/** - Creates a new copy of an existing device path. - - This function allocates space for a new copy of the device path specified by - DevicePath. If DevicePath is NULL, then NULL is returned. - If the memory is successfully allocated, then the - contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer - is returned. Otherwise, NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - - @retval NULL If DevicePath is NULL or invalid. - @retval Others A pointer to the duplicated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DuplicateDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return mDevicePathLibDevicePathUtilities->DuplicateDevicePath (DevicePath); -} - -/** - Creates a new device path by appending a second device path to a first device path. - - This function creates a new device path by appending a copy of SecondDevicePath to a copy of - FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from - SecondDevicePath is retained. The newly created device path is returned. - If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned. - If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned. - If both FirstDevicePath and SecondDevicePath are NULL, then a copy of an end-of-device-path is - returned. - If there is not enough memory for the newly allocated buffer, then NULL is returned. - The memory for the new device path is allocated from EFI boot services memory. It is the - responsibility of the caller to free the memory allocated. - - @param FirstDevicePath A pointer to a device path data structure. - @param SecondDevicePath A pointer to a device path data structure. - - @retval NULL If there is not enough memory for the newly allocated buffer. - @retval NULL If FirstDevicePath or SecondDevicePath is invalid. - @retval Others A pointer to the new device path if success. - Or a copy an end-of-device-path if both FirstDevicePath and - SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePath ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL - ) -{ - return mDevicePathLibDevicePathUtilities->AppendDevicePath (FirstDevicePath, SecondDevicePath); -} - -/** - Creates a new path by appending the device node to the device path. - - This function creates a new device path by appending a copy of the device node - specified by DevicePathNode to a copy of the device path specified by DevicePath - in an allocated buffer. - The end-of-device-path device node is moved after the end of the appended device node. - If DevicePathNode is NULL then a copy of DevicePath is returned. - If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device - path device node is returned. - If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path - device node is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathNode A pointer to a single device path node. - - @retval NULL If there is not enough memory for the new device path. - @retval Others A pointer to the new device path if success. - A copy of DevicePathNode followed by an end-of-device-path node - if both FirstDevicePath and SecondDevicePath are NULL. - A copy of an end-of-device-path node if both FirstDevicePath - and SecondDevicePath are NULL. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathNode ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL - ) -{ - return mDevicePathLibDevicePathUtilities->AppendDeviceNode (DevicePath, DevicePathNode); -} - -/** - Creates a new device path by appending the specified device path instance to - the specified device path. - - This function creates a new device path by appending a copy of the device path - instance specified by DevicePathInstance to a copy of the device path specified - by DevicePath in a allocated buffer. - The end-of-device-path device node is moved after the end of the appended device - path instance and a new end-of-device-path-instance node is inserted between. - If DevicePath is NULL, then a copy if DevicePathInstance is returned. - If DevicePathInstance is NULL, then NULL is returned. - If DevicePath or DevicePathInstance is invalid, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param DevicePath A pointer to a device path data structure. - @param DevicePathInstance A pointer to a device path instance. - - @return A pointer to the new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -AppendDevicePathInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL - ) -{ - return mDevicePathLibDevicePathUtilities->AppendDevicePathInstance (DevicePath, DevicePathInstance); -} - -/** - Creates a copy of the current device path instance and returns a pointer to the - next device path instance. - - This function creates a copy of the current device path instance. It also updates - DevicePath to point to the next device path instance in the device path (or NULL - if no more) and updates Size to hold the size of the device path instance copy. - If DevicePath is NULL, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - If Size is NULL, then ASSERT(). - - @param DevicePath On input, this holds the pointer to the current - device path instance. On output, this holds - the pointer to the next device path instance - or NULL if there are no more device path - instances in the device path pointer to a - device path data structure. - @param Size On output, this holds the size of the device - path instance, in bytes or zero, if DevicePath - is NULL. - - @return A pointer to the current device path instance. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -GetNextDevicePathInstance ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, - OUT UINTN *Size - ) -{ - ASSERT (Size != NULL); - return mDevicePathLibDevicePathUtilities->GetNextDevicePathInstance (DevicePath, Size); -} - -/** - Creates a device node. - - This function creates a new device node in a newly allocated buffer of size - NodeLength and initializes the device path node header with NodeType and NodeSubType. - The new device path node is returned. - If NodeLength is smaller than a device path header, then NULL is returned. - If there is not enough memory to allocate space for the new device path, then - NULL is returned. - The memory is allocated from EFI boot services memory. It is the responsibility - of the caller to free the memory allocated. - - @param NodeType The device node type for the new device node. - @param NodeSubType The device node sub-type for the new device node. - @param NodeLength The length of the new device node. - - @return The new device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -CreateDeviceNode ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ) -{ - return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength); -} - -/** - Determines if a device path is single or multi-instance. - - This function returns TRUE if the device path specified by DevicePath is - multi-instance. - Otherwise, FALSE is returned. - If DevicePath is NULL or invalid, then FALSE is returned. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE DevicePath is multi-instance. - @retval FALSE DevicePath is not multi-instance, or DevicePath - is NULL or invalid. - -**/ -BOOLEAN -EFIAPI -IsDevicePathMultiInstance ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (DevicePath); -} - -/** - Retrieves the device path protocol from a handle. - - This function returns the device path protocol from the handle specified by Handle. - If Handle is NULL or Handle does not contain a device path protocol, then NULL - is returned. - - @param Handle The handle from which to retrieve the device - path protocol. - - @return The device path protocol from the handle specified by Handle. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DevicePathFromHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_STATUS Status; - - Status = gBS->HandleProtocol ( - Handle, - &gEfiDevicePathProtocolGuid, - (VOID *) &DevicePath - ); - if (EFI_ERROR (Status)) { - DevicePath = NULL; - } - return DevicePath; -} - -/** - Allocates a device path for a file and appends it to an existing device path. - - If Device is a valid device handle that contains a device path protocol, then - a device path for the file specified by FileName is allocated and appended to - the device path associated with the handle Device. The allocated device path - is returned. If Device is NULL or Device is a handle that does not support the - device path protocol, then a device path containing a single device path node - for the file specified by FileName is allocated and returned. - The memory for the new device path is allocated from EFI boot services memory. - It is the responsibility of the caller to free the memory allocated. - - If FileName is NULL, then ASSERT(). - If FileName is not aligned on a 16-bit boundary, then ASSERT(). - - @param Device A pointer to a device handle. This parameter - is optional and may be NULL. - @param FileName A pointer to a Null-terminated Unicode string. - - @return The allocated device path. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -FileDevicePath ( - IN EFI_HANDLE Device, OPTIONAL - IN CONST CHAR16 *FileName - ) -{ - UINTN Size; - FILEPATH_DEVICE_PATH *FilePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *FileDevicePath; - - DevicePath = NULL; - - Size = StrSize (FileName); - FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH); - if (FileDevicePath != NULL) { - FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath; - FilePath->Header.Type = MEDIA_DEVICE_PATH; - FilePath->Header.SubType = MEDIA_FILEPATH_DP; - CopyMem (&FilePath->PathName, FileName, Size); - SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH); - SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header)); - - if (Device != NULL) { - DevicePath = DevicePathFromHandle (Device); - } - - DevicePath = AppendDevicePath (DevicePath, FileDevicePath); - FreePool (FileDevicePath); - } - - return DevicePath; -} - -/** - Locate and return the protocol instance identified by the ProtocolGuid. - - @param ProtocolGuid The GUID of the protocol. - - @return A pointer to the protocol instance or NULL when absent. -**/ -VOID * -UefiDevicePathLibLocateProtocol ( - EFI_GUID *ProtocolGuid - ) -{ - EFI_STATUS Status; - VOID *Protocol; - Status = gBS->LocateProtocol ( - ProtocolGuid, - NULL, - (VOID**) &Protocol - ); - if (EFI_ERROR (Status)) { - return NULL; - } else { - return Protocol; - } -} - -/** - Converts a device node to its string representation. - - @param DeviceNode A Pointer to the device node to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device node or NULL if DeviceNode - is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDeviceNodeToText ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortcuts - ) -{ - if (mDevicePathLibDevicePathToText == NULL) { - mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid); - } - if (mDevicePathLibDevicePathToText != NULL) { - return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts); - } else { - return NULL; - } -} - -/** - Converts a device path to its text representation. - - @param DevicePath A Pointer to the device to be converted. - @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation - of the display node is used, where applicable. If DisplayOnly - is FALSE, then the longer text representation of the display node - is used. - @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text - representation for a device node can be used, where applicable. - - @return A pointer to the allocated text representation of the device path or - NULL if DeviceNode is NULL or there was insufficient memory. - -**/ -CHAR16 * -EFIAPI -ConvertDevicePathToText ( - 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 { - return NULL; - } -} - -/** - Convert text to the binary representation of a device node. - - @param TextDeviceNode TextDeviceNode points to the text representation of a device - node. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was - insufficient memory or text unsupported. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ) -{ - if (mDevicePathLibDevicePathFromText == NULL) { - mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid); - } - if (mDevicePathLibDevicePathFromText != NULL) { - return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode); - } else { - return NULL; - } -} - -/** - Convert text to the binary representation of a device path. - - - @param TextDevicePath TextDevicePath points to the text representation of a device - path. Conversion starts with the first character and continues - until the first non-device node character. - - @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or - there was insufficient memory. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -ConvertTextToDevicePath ( - IN CONST CHAR16 *TextDevicePath - ) -{ - if (mDevicePathLibDevicePathFromText == NULL) { - mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid); - } - if (mDevicePathLibDevicePathFromText != NULL) { - return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath); - } else { - return NULL; - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf deleted file mode 100644 index 3b285f7..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf +++ /dev/null @@ -1,61 +0,0 @@ -## @file -# Instance of Device Path Library based on Device Path Utilities Protocol. -# -# Device Path Library that layers on top of the UEFI 2.0 Device Path Utilities Protocol. -# This library is not available for EFI 1.10 modules. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDevicePathLibDevicePathProtocol - MODULE_UNI_FILE = UefiDevicePathLibDevicePathProtocol.uni - FILE_GUID = 050EB8C6-C12E-4b86-892B-40985E8B3137 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DevicePathLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - - CONSTRUCTOR = DevicePathLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiDevicePathLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - UefiBootServicesTableLib - BaseMemoryLib - MemoryAllocationLib - BaseLib - DebugLib - PcdLib - -[Protocols] - gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES - gEfiDevicePathUtilitiesProtocolGuid ## CONSUMES - gEfiDevicePathToTextProtocolGuid ## SOMETIMES_CONSUMES - gEfiDevicePathFromTextProtocolGuid ## SOMETIMES_CONSUMES - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiDevicePathUtilitiesProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.uni deleted file mode 100644 index 6f78e46..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Device Path Library based on Device Path Utilities Protocol. -// -// Device Path Library that layers on top of the UEFI 2.0 Device Path Utilities Protocol. -// This library is not available for EFI 1.10 modules. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Device Path Library based on Device Path Utilities Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "The Device Path Library that layers on top of the UEFI 2.0 Device Path Utilities Protocol. This library is not available for EFI 1.10 modules." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c deleted file mode 100644 index 47f1e0d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c +++ /dev/null @@ -1,173 +0,0 @@ -/** @file - Entry point to a EFI/DXE driver. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -#include - -#include - -#include -#include -#include -#include - - -/** - Unloads an image from memory. - - This function is a callback that a driver registers to do cleanup - when the UnloadImage boot service function is called. - - @param ImageHandle The handle to the image to unload. - - @return Status returned by all unload(). - -**/ -EFI_STATUS -EFIAPI -_DriverUnloadHandler ( - EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - - // - // If an UnloadImage() handler is specified, then call it - // - Status = ProcessModuleUnloadList (ImageHandle); - - // - // If the driver specific unload handler does not return an error, then call all of the - // library destructors. If the unload handler returned an error, then the driver can not be - // unloaded, and the library destructors should not be called - // - if (!EFI_ERROR (Status)) { - ProcessLibraryDestructorList (ImageHandle, gST); - } - - // - // Return the status from the driver specific unload handler - // - return Status; -} - - -/** - The entry point of PE/COFF Image for a DXE Driver, DXE Runtime Driver, DXE SMM - Driver, or UEFI Driver. - - This function is the entry point for a DXE Driver, DXE Runtime Driver, DXE SMM Driver, - or UEFI Driver. This function must call ProcessLibraryConstructorList() and - ProcessModuleEntryPointList(). If the return status from ProcessModuleEntryPointList() - is an error status, then ProcessLibraryDestructorList() must be called. The return - value from ProcessModuleEntryPointList() is returned. If _gDriverUnloadImageCount - is greater than zero, then an unload handler must be registered for this image - and the unload handler must invoke ProcessModuleUnloadList(). - If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than - _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION. - - - @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, - DXE SMM Driver, or UEFI Driver. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM - Driver, or UEFI Driver exited normally. - @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than - SystemTable->Hdr.Revision. - @retval Other Return value from ProcessModuleEntryPointList(). - -**/ -EFI_STATUS -EFIAPI -_ModuleEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - - if (_gUefiDriverRevision != 0) { - // - // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the driver - // - if (SystemTable->Hdr.Revision < _gUefiDriverRevision) { - return EFI_INCOMPATIBLE_VERSION; - } - } - - // - // Call constructor for all libraries - // - ProcessLibraryConstructorList (ImageHandle, SystemTable); - - // - // Install unload handler... - // - if (_gDriverUnloadImageCount != 0) { - Status = gBS->HandleProtocol ( - ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **)&LoadedImage - ); - ASSERT_EFI_ERROR (Status); - LoadedImage->Unload = _DriverUnloadHandler; - } - - // - // Call the driver entry point - // - Status = ProcessModuleEntryPointList (ImageHandle, SystemTable); - - // - // If all of the drivers returned errors, then invoke all of the library destructors - // - if (EFI_ERROR (Status)) { - ProcessLibraryDestructorList (ImageHandle, SystemTable); - } - - // - // Return the cummalative return status code from all of the driver entry points - // - return Status; -} - - -/** - Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). - - This function is required to call _ModuleEntryPoint() passing in ImageHandle, - and SystemTable. - - @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE - SMM Driver, or UEFI Driver. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM - Driver, or UEFI Driver exited normally. - @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than - SystemTable->Hdr.Revision. - @retval Other Return value from ProcessModuleEntryPointList(). -**/ -EFI_STATUS -EFIAPI -EfiMain ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return _ModuleEntryPoint (ImageHandle, SystemTable); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf deleted file mode 100644 index e0fd421..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf +++ /dev/null @@ -1,67 +0,0 @@ -## @file -# Module entry point library for UEFI driver, DXE driver and SMM driver. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiDriverEntryPoint - MODULE_UNI_FILE = UefiDriverEntryPoint.uni - FILE_GUID = 331deb15-454b-48d8-9b74-70d01f3f3556 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiDriverEntryPoint|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER SMM_CORE DXE_SMM_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DriverEntryPoint.c - - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - BaseLib - - -[Protocols] - gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES - - -# -# For UEFI drivers, these architectural protocols defined in PI 1.0 spec need -# to be appended and merged to the final dependency section. -# -[Depex.common.UEFI_DRIVER] - gEfiBdsArchProtocolGuid AND - gEfiCpuArchProtocolGuid AND - gEfiMetronomeArchProtocolGuid AND - gEfiMonotonicCounterArchProtocolGuid AND - gEfiRealTimeClockArchProtocolGuid AND - gEfiResetArchProtocolGuid AND - gEfiRuntimeArchProtocolGuid AND - gEfiSecurityArchProtocolGuid AND - gEfiTimerArchProtocolGuid AND - gEfiVariableWriteArchProtocolGuid AND - gEfiVariableArchProtocolGuid AND - gEfiWatchdogTimerArchProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.uni deleted file mode 100644 index 3cbbde4..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// Module entry point library for UEFI driver, DXE driver and SMM driver. -// -// Module entry point library for UEFI driver, DXE driver and SMM driver. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Module entry point library for UEFI driver, DXE driver and SMM driver" - -#string STR_MODULE_DESCRIPTION #language en-US "Module entry point library for UEFI driver, DXE driver and SMM driver." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c deleted file mode 100644 index d94e820..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c +++ /dev/null @@ -1,1272 +0,0 @@ -/** @file - Provides interface to EFI_FILE_HANDLE functionality. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -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) - -/** - This function will retrieve the information about the file for the handle - specified and store it in allocated pool memory. - - This function allocates a buffer to store the file's information. It is the - caller's responsibility to free the buffer - - @param FileHandle The file handle of the file for which information is - being requested. - - @retval NULL information could not be retrieved. - - @return the information about the file -**/ -EFI_FILE_INFO* -EFIAPI -FileHandleGetInfo ( - IN EFI_FILE_HANDLE FileHandle - ) -{ - EFI_FILE_INFO *FileInfo; - UINTN FileInfoSize; - EFI_STATUS Status; - - if (FileHandle == NULL) { - return (NULL); - } - - // - // Get the required size to allocate - // - FileInfoSize = 0; - FileInfo = NULL; - Status = FileHandle->GetInfo(FileHandle, - &gEfiFileInfoGuid, - &FileInfoSize, - NULL); - if (Status == EFI_BUFFER_TOO_SMALL){ - // - // error is expected. getting size to allocate - // - FileInfo = AllocateZeroPool(FileInfoSize); - // - // now get the information - // - Status = FileHandle->GetInfo(FileHandle, - &gEfiFileInfoGuid, - &FileInfoSize, - FileInfo); - // - // if we got an error free the memory and return NULL - // - if (EFI_ERROR(Status) && (FileInfo != NULL)) { - FreePool(FileInfo); - FileInfo = NULL; - } - } - return (FileInfo); -} - -/** - This function sets the information about the file for the opened handle - specified. - - @param[in] FileHandle The file handle of the file for which information - is being set. - - @param[in] FileInfo The information to set. - - @retval EFI_SUCCESS The information was set. - @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid. - @retval EFI_UNSUPPORTED The FileHandle does not support FileInfo. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -FileHandleSetInfo ( - IN EFI_FILE_HANDLE FileHandle, - IN CONST EFI_FILE_INFO *FileInfo - ) -{ - - if (FileHandle == NULL || FileInfo == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Set the info - // - return (FileHandle->SetInfo(FileHandle, - &gEfiFileInfoGuid, - (UINTN)FileInfo->Size, - (EFI_FILE_INFO*)FileInfo)); -} - -/** - This function reads information from an opened file. - - If FileHandle is not a directory, the function reads the requested number of - bytes from the file at the file's current position and returns them in Buffer. - If the read goes beyond the end of the file, the read length is truncated to the - end of the file. The file's current position is increased by the number of bytes - returned. If FileHandle is a directory, the function reads the directory entry - at the file's current position and returns the entry in Buffer. If the Buffer - is not large enough to hold the current directory entry, then - EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated. - BufferSize is set to be the size of the buffer needed to read the entry. On - success, the current position is updated to the next directory entry. If there - are no more directory entries, the read returns a zero-length buffer. - EFI_FILE_INFO is the structure returned as the directory entry. - - @param FileHandle the opened file handle - @param BufferSize on input the size of buffer in bytes. on return - the number of bytes written. - @param Buffer the buffer to put read data into. - - @retval EFI_SUCCESS Data was read. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required - size. - -**/ -EFI_STATUS -EFIAPI -FileHandleRead( - IN EFI_FILE_HANDLE FileHandle, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the read based on EFI_FILE_PROTOCOL - // - return (FileHandle->Read(FileHandle, BufferSize, Buffer)); -} - - -/** - Write data to a file. - - This function writes the specified number of bytes to the file at the current - file position. The current file position is advanced the actual number of bytes - written, which is returned in BufferSize. Partial writes only occur when there - has been a data error during the write attempt (such as "volume space full"). - The file is automatically grown to hold the data if required. Direct writes to - opened directories are not supported. - - @param FileHandle The opened file for writing - @param BufferSize on input the number of bytes in Buffer. On output - the number of bytes written. - @param Buffer the buffer containing data to write is stored. - - @retval EFI_SUCCESS Data was written. - @retval EFI_UNSUPPORTED Writes to an open directory are not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write-protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -FileHandleWrite( - IN EFI_FILE_HANDLE FileHandle, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the write based on EFI_FILE_PROTOCOL - // - return (FileHandle->Write(FileHandle, BufferSize, Buffer)); -} - -/** - Close an open file handle. - - This function closes a specified file handle. All "dirty" cached file data is - flushed to the device, and the file is closed. In all cases the handle is - closed. - -@param FileHandle the file handle to close. - -@retval EFI_SUCCESS the file handle was closed successfully. -**/ -EFI_STATUS -EFIAPI -FileHandleClose ( - IN EFI_FILE_HANDLE FileHandle - ) -{ - EFI_STATUS Status; - - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the Close based on EFI_FILE_PROTOCOL - // - Status = FileHandle->Close(FileHandle); - return Status; -} - -/** - Delete a file and close the handle - - This function closes and deletes a file. In all cases the file handle is closed. - If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is - returned, but the handle is still closed. - - @param FileHandle the file handle to delete - - @retval EFI_SUCCESS the file was closed successfully - @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not - deleted - @retval INVALID_PARAMETER One of the parameters has an invalid value. -**/ -EFI_STATUS -EFIAPI -FileHandleDelete ( - IN EFI_FILE_HANDLE FileHandle - ) -{ - EFI_STATUS Status; - - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the Delete based on EFI_FILE_PROTOCOL - // - Status = FileHandle->Delete(FileHandle); - return Status; -} - -/** - Set the current position in a file. - - This function sets the current file position for the handle to the position - supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only - absolute positioning is supported, and seeking past the end of the file is - allowed (a subsequent write would grow the file). Seeking to position - 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file. - If FileHandle is a directory, the only position that may be set is zero. This - has the effect of starting the read process of the directory entries over. - - @param FileHandle The file handle on which the position is being set - @param Position Byte position from beginning of file - - @retval EFI_SUCCESS Operation completed successfully. - @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on - directories. - @retval INVALID_PARAMETER One of the parameters has an invalid value. -**/ -EFI_STATUS -EFIAPI -FileHandleSetPosition ( - IN EFI_FILE_HANDLE FileHandle, - IN UINT64 Position - ) -{ - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the SetPosition based on EFI_FILE_PROTOCOL - // - return (FileHandle->SetPosition(FileHandle, Position)); -} - -/** - Gets a file's current position - - This function retrieves the current file position for the file handle. For - directories, the current file position has no meaning outside of the file - system driver and as such the operation is not supported. An error is returned - if FileHandle is a directory. - - @param FileHandle The open file handle on which to get the position. - @param Position Byte position from beginning of file. - - @retval EFI_SUCCESS the operation completed successfully. - @retval INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED the request is not valid on directories. -**/ -EFI_STATUS -EFIAPI -FileHandleGetPosition ( - IN EFI_FILE_HANDLE FileHandle, - OUT UINT64 *Position - ) -{ - if (Position == NULL || FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the GetPosition based on EFI_FILE_PROTOCOL - // - return (FileHandle->GetPosition(FileHandle, Position)); -} -/** - Flushes data on a file - - This function flushes all modified data associated with a file to a device. - - @param FileHandle The file handle on which to flush data - - @retval EFI_SUCCESS The data was flushed. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened for read only. -**/ -EFI_STATUS -EFIAPI -FileHandleFlush ( - IN EFI_FILE_HANDLE FileHandle - ) -{ - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Perform the Flush based on EFI_FILE_PROTOCOL - // - return (FileHandle->Flush(FileHandle)); -} - -/** - Function to determine if a given handle is a directory handle. - - Open the file information on the DirHandle and verify that the Attribute - includes EFI_FILE_DIRECTORY bit set. - - @param[in] DirHandle Handle to open file. - - @retval EFI_SUCCESS DirHandle is a directory. - @retval EFI_INVALID_PARAMETER DirHandle is NULL. - The file information returns from FileHandleGetInfo is NULL. - @retval EFI_NOT_FOUND DirHandle is not a directory. -**/ -EFI_STATUS -EFIAPI -FileHandleIsDirectory ( - IN EFI_FILE_HANDLE DirHandle - ) -{ - EFI_FILE_INFO *DirInfo; - - if (DirHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // get the file information for DirHandle - // - DirInfo = FileHandleGetInfo (DirHandle); - - // - // Parse DirInfo - // - if (DirInfo == NULL) { - // - // We got nothing... - // - return (EFI_INVALID_PARAMETER); - } - if ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0) { - // - // Attributes say this is not a directory - // - FreePool (DirInfo); - return (EFI_NOT_FOUND); - } - // - // all good... - // - FreePool (DirInfo); - return (EFI_SUCCESS); -} - -/** Retrieve first entry from a directory. - - This function takes an open directory handle and gets information from the - first entry in the directory. A buffer is allocated to contain - the information and a pointer to the buffer is returned in *Buffer. The - caller can use FileHandleFindNextFile() to get subsequent directory entries. - - The buffer will be freed by FileHandleFindNextFile() when the last directory - entry is read. Otherwise, the caller must free the buffer, using FreePool, - when finished with it. - - @param[in] DirHandle The file handle of the directory to search. - @param[out] Buffer The pointer to pointer to buffer for file's information. - - @retval EFI_SUCCESS Found the first file. - @retval EFI_NOT_FOUND Cannot find the directory. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @return Others status of FileHandleGetInfo, FileHandleSetPosition, - or FileHandleRead -**/ -EFI_STATUS -EFIAPI -FileHandleFindFirstFile ( - IN EFI_FILE_HANDLE DirHandle, - OUT EFI_FILE_INFO **Buffer - ) -{ - EFI_STATUS Status; - UINTN BufferSize; - - if (Buffer == NULL || DirHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // verify that DirHandle is a directory - // - Status = FileHandleIsDirectory(DirHandle); - if (EFI_ERROR(Status)) { - return (Status); - } - - // - // 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){ - return (EFI_OUT_OF_RESOURCES); - } - - // - // reset to the beginning of the directory - // - Status = FileHandleSetPosition(DirHandle, 0); - if (EFI_ERROR(Status)) { - FreePool(*Buffer); - *Buffer = NULL; - return (Status); - } - - // - // 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); - *Buffer = NULL; - if (BufferSize == 0) { - return (EFI_NOT_FOUND); - } - return (Status); - } - return (EFI_SUCCESS); -} - -/** Retrieve next entries from a directory. - - To use this function, the caller must first call the FileHandleFindFirstFile() - function to get the first directory entry. Subsequent directory entries are - retrieved by using the FileHandleFindNextFile() function. This function can - be called several times to get each entry from the directory. If the call of - FileHandleFindNextFile() retrieved the last directory entry, the next call of - this function will set *NoFile to TRUE and free the buffer. - - @param[in] DirHandle The file handle of the directory. - @param[out] Buffer The pointer to buffer for file's information. - @param[out] NoFile The pointer to boolean when last file is found. - - @retval EFI_SUCCESS Found the next file, or reached last file - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. -**/ -EFI_STATUS -EFIAPI -FileHandleFindNextFile( - IN EFI_FILE_HANDLE DirHandle, - OUT EFI_FILE_INFO *Buffer, - OUT BOOLEAN *NoFile - ) -{ - EFI_STATUS Status; - UINTN BufferSize; - - if (DirHandle == NULL || Buffer == NULL || NoFile == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // This BufferSize MUST stay equal to the originally allocated one in GetFirstFile - // - BufferSize = FIND_XXXXX_FILE_BUFFER_SIZE; - - // - // read in the info about the next file - // - Status = FileHandleRead (DirHandle, &BufferSize, Buffer); - ASSERT(Status != EFI_BUFFER_TOO_SMALL); - if (EFI_ERROR(Status)) { - return (Status); - } - - // - // If we read 0 bytes (but did not have erros) we already read in the last file. - // - if (BufferSize == 0) { - FreePool(Buffer); - *NoFile = TRUE; - } - - return (EFI_SUCCESS); -} - -/** - Retrieve the size of a file. - - This function extracts the file size info from the FileHandle's EFI_FILE_INFO - data. - - @param[in] FileHandle The file handle from which size is retrieved. - @param[out] Size The pointer to size. - - @retval EFI_SUCCESS Operation was completed successfully. - @retval EFI_DEVICE_ERROR Cannot access the file. - @retval EFI_INVALID_PARAMETER FileHandle is NULL. - Size is NULL. -**/ -EFI_STATUS -EFIAPI -FileHandleGetSize ( - IN EFI_FILE_HANDLE FileHandle, - OUT UINT64 *Size - ) -{ - EFI_FILE_INFO *FileInfo; - - if (FileHandle == NULL || Size == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // get the FileInfo structure - // - FileInfo = FileHandleGetInfo(FileHandle); - if (FileInfo == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // Assign the Size pointer to the correct value - // - *Size = FileInfo->FileSize; - - // - // free the FileInfo memory - // - FreePool(FileInfo); - - return (EFI_SUCCESS); -} - -/** - Set the size of a file. - - This function changes the file size info from the FileHandle's EFI_FILE_INFO - data. - - @param[in] FileHandle The file handle whose size is to be changed. - @param[in] Size The new size. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR Cannot access the file. - @retval EFI_INVALID_PARAMETER FileHandle is NULL. -**/ -EFI_STATUS -EFIAPI -FileHandleSetSize ( - IN EFI_FILE_HANDLE FileHandle, - IN UINT64 Size - ) -{ - EFI_FILE_INFO *FileInfo; - EFI_STATUS Status; - - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // get the FileInfo structure - // - FileInfo = FileHandleGetInfo(FileHandle); - if (FileInfo == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // Assign the FileSize pointer to the new value - // - FileInfo->FileSize = Size; - - Status = FileHandleSetInfo(FileHandle, FileInfo); - // - // free the FileInfo memory - // - FreePool(FileInfo); - - return (Status); -} - -/** - Safely append (on the left) with automatic string resizing given length of Destination and - desired length of copy from Source. - - append the first D characters of Source to the end of Destination, where D is - the lesser of Count and the StrLen() of Source. If appending those D characters - will fit within Destination (whose Size is given as CurrentSize) and - still leave room for a NULL terminator, then those characters are appended, - starting at the original terminating NULL of Destination, and a new terminating - NULL is appended. - - If appending D characters onto Destination will result in a overflow of the size - given in CurrentSize the string will be grown such that the copy can be performed - and CurrentSize will be updated to the new size. - - If Source is NULL, there is nothing to append, just return the current buffer in - Destination. - - if Destination is NULL, then return error - if Destination's current length (including NULL terminator) is already more then - CurrentSize, then ASSERT() - - @param[in, out] Destination The String to append onto - @param[in, out] CurrentSize on call the number of bytes in Destination. On - return possibly the new size (still in bytes). if NULL - then allocate whatever is needed. - @param[in] Source The String to append from - @param[in] Count Maximum number of characters to append. if 0 then - all are appended. - - @return Destination return the resultant string. -**/ -CHAR16* -EFIAPI -StrnCatGrowLeft ( - IN OUT CHAR16 **Destination, - IN OUT UINTN *CurrentSize, - IN CONST CHAR16 *Source, - IN UINTN Count - ) -{ - UINTN DestinationStartSize; - UINTN NewSize; - UINTN CopySize; - - if (Destination == NULL) { - return (NULL); - } - - // - // If there's nothing to do then just return Destination - // - if (Source == NULL) { - return (*Destination); - } - - // - // allow for NULL pointers address as Destination - // - if (*Destination != NULL) { - ASSERT(CurrentSize != 0); - DestinationStartSize = StrSize(*Destination); - ASSERT(DestinationStartSize <= *CurrentSize); - } else { - DestinationStartSize = 0; -// ASSERT(*CurrentSize == 0); - } - - // - // Append all of Source? - // - if (Count == 0) { - Count = StrSize(Source); - } - - // - // Test and grow if required - // - if (CurrentSize != NULL) { - NewSize = *CurrentSize; - while (NewSize < (DestinationStartSize + Count)) { - NewSize += 2 * Count; - } - *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination); - *CurrentSize = NewSize; - } else { - *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); - return (*Destination); -} - -/** - Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on the - directory 'stack'. If the file is a directory, then append the '\' char at the - end of name string. If it's not a directory, then the last '\' should not be - added. - - if Handle is NULL, return EFI_INVALID_PARAMETER - - @param[in] Handle Handle to the Directory or File to create path to. - @param[out] FullFileName pointer to pointer to generated full file name. It - is the responsibility of the caller to free this memory - with a call to FreePool(). - @retval EFI_SUCCESS the operation was sucessful and the FullFileName is valid. - @retval EFI_INVALID_PARAMETER Handle was NULL. - @retval EFI_INVALID_PARAMETER FullFileName was NULL. - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -EFIAPI -FileHandleGetFileName ( - 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; - - Size = 0; - - // - // Check our parameters - // - 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)) { - // - // Reverse out the current directory on the device - // - for (;;) { - FileInfo = FileHandleGetInfo(CurrentHandle); - if (FileInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - break; - } else { - // - // We got info... do we have a name? if yes precede the current path with it... - // - if (StrLen (FileInfo->FileName) == 0) { - if (*FullFileName == NULL) { - ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != NULL)); - *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0); - } - 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, FileInfo->FileName, 0); - *FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0); - FreePool(FileInfo); - } - } - // - // Move to the parent directory - // - Status = CurrentHandle->Open (CurrentHandle, &NextHigherHandle, L"..", EFI_FILE_MODE_READ, 0); - if (EFI_ERROR (Status)) { - break; - } - - FileHandleClose(CurrentHandle); - CurrentHandle = NextHigherHandle; - } - } else if (Status == EFI_NOT_FOUND) { - Status = EFI_SUCCESS; - 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 (CurrentHandle != NULL) { - CurrentHandle->Close (CurrentHandle); - } - - if (EFI_ERROR(Status) && *FullFileName != NULL) { - FreePool(*FullFileName); - } - - return (Status); -} - -/** - Function to read a single line from a file. The \n is not included in the returned - buffer. The returned buffer must be callee freed. - - If the position upon start is 0, then the Ascii Boolean will be set. This should be - maintained and not changed for all operations with the same file. - - @param[in] Handle FileHandle to read from. - @param[in, out] Ascii Boolean value for indicating whether the file is Ascii (TRUE) or UCS2 (FALSE); - - @return The line of text from the file. - - @sa FileHandleReadLine -**/ -CHAR16* -EFIAPI -FileHandleReturnLine( - IN EFI_FILE_HANDLE Handle, - IN OUT BOOLEAN *Ascii - ) -{ - CHAR16 *RetVal; - UINTN Size; - EFI_STATUS Status; - - Size = 0; - RetVal = NULL; - - Status = FileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii); - if (Status == EFI_BUFFER_TOO_SMALL) { - RetVal = AllocateZeroPool(Size); - Status = FileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii); - } - ASSERT_EFI_ERROR(Status); - if (EFI_ERROR(Status) && (RetVal != NULL)) { - FreePool(RetVal); - RetVal = NULL; - } - return (RetVal); -} - -/** - Function to read a single line (up to but not including the \n) from a file. - - If the position upon start is 0, then the Ascii Boolean will be set. This should be - maintained and not changed for all operations with the same file. - The function will not return the \r and \n character in buffer. When an empty line is - read a CHAR_NULL character will be returned in buffer. - - @param[in] Handle FileHandle to read from. - @param[in, out] Buffer The pointer to buffer to read into. - @param[in, out] Size The pointer to number of bytes in Buffer. - @param[in] Truncate If the buffer is large enough, this has no effect. - If the buffer is is too small and Truncate is TRUE, - the line will be truncated. - If the buffer is is too small and Truncate is FALSE, - then no read will occur. - - @param[in, out] Ascii Boolean value for indicating whether the file is - Ascii (TRUE) or UCS2 (FALSE). - - @retval EFI_SUCCESS The operation was successful. The line is stored in - Buffer. - @retval EFI_INVALID_PARAMETER Handle was NULL. - @retval EFI_INVALID_PARAMETER Size was NULL. - @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line. - Size was updated to the minimum space required. - @sa FileHandleRead -**/ -EFI_STATUS -EFIAPI -FileHandleReadLine( - IN EFI_FILE_HANDLE Handle, - IN OUT CHAR16 *Buffer, - IN OUT UINTN *Size, - IN BOOLEAN Truncate, - IN OUT BOOLEAN *Ascii - ) -{ - EFI_STATUS Status; - CHAR16 CharBuffer; - UINT64 FileSize; - UINTN CharSize; - UINTN CountSoFar; - UINTN CrCount; - UINT64 OriginalFilePosition; - - if (Handle == NULL - ||Size == NULL - ||(Buffer==NULL&&*Size!=0) - ){ - return (EFI_INVALID_PARAMETER); - } - - if (Buffer != NULL && *Size != 0) { - *Buffer = CHAR_NULL; - } - - Status = FileHandleGetSize (Handle, &FileSize); - if (EFI_ERROR (Status)) { - return Status; - } else if (FileSize == 0) { - *Ascii = TRUE; - return EFI_SUCCESS; - } - - FileHandleGetPosition(Handle, &OriginalFilePosition); - if (OriginalFilePosition == 0) { - CharSize = sizeof(CHAR16); - Status = FileHandleRead(Handle, &CharSize, &CharBuffer); - ASSERT_EFI_ERROR(Status); - if (CharBuffer == gUnicodeFileTag) { - *Ascii = FALSE; - } else { - *Ascii = TRUE; - FileHandleSetPosition(Handle, OriginalFilePosition); - } - } - - CrCount = 0; - for (CountSoFar = 0;;CountSoFar++){ - CharBuffer = 0; - if (*Ascii) { - CharSize = sizeof(CHAR8); - } else { - CharSize = sizeof(CHAR16); - } - 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) - ) { - 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 we ran out of space tell when... - // - if ((CountSoFar+1-CrCount)*sizeof(CHAR16) > *Size){ - *Size = (CountSoFar+1-CrCount)*sizeof(CHAR16); - if (!Truncate) { - if (Buffer != NULL && *Size != 0) { - ZeroMem(Buffer, *Size); - } - FileHandleSetPosition(Handle, OriginalFilePosition); - return (EFI_BUFFER_TOO_SMALL); - } else { - DEBUG((DEBUG_WARN, "The line was truncated in FileHandleReadLine")); - return (EFI_SUCCESS); - } - } - - return (Status); -} - -/** - Function to write a line of text to a file. - - If the file is a Unicode file (with UNICODE file tag) then write the unicode - text. - If the file is an ASCII file then write the ASCII text. - If the size of file is zero (without file tag at the beginning) then write - ASCII text as default. - - @param[in] Handle FileHandle to write to. - @param[in] Buffer Buffer to write, if NULL the function will - take no action and return EFI_SUCCESS. - - @retval EFI_SUCCESS The data was written. - Buffer is NULL. - @retval EFI_INVALID_PARAMETER Handle is NULL. - @retval EFI_OUT_OF_RESOURCES Unable to allocate temporary space for ASCII - string due to out of resources. - - @sa FileHandleWrite -**/ -EFI_STATUS -EFIAPI -FileHandleWriteLine( - IN EFI_FILE_HANDLE Handle, - IN CHAR16 *Buffer - ) -{ - EFI_STATUS Status; - CHAR16 CharBuffer; - UINTN Size; - UINTN Index; - UINTN CharSize; - UINT64 FileSize; - UINT64 OriginalFilePosition; - BOOLEAN Ascii; - CHAR8 *AsciiBuffer; - - if (Buffer == NULL) { - return (EFI_SUCCESS); - } - - if (Handle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Ascii = FALSE; - AsciiBuffer = NULL; - - Status = FileHandleGetPosition(Handle, &OriginalFilePosition); - if (EFI_ERROR(Status)) { - return Status; - } - - Status = FileHandleSetPosition(Handle, 0); - if (EFI_ERROR(Status)) { - return Status; - } - - Status = FileHandleGetSize(Handle, &FileSize); - if (EFI_ERROR(Status)) { - return Status; - } - - if (FileSize == 0) { - Ascii = TRUE; - } else { - CharSize = sizeof (CHAR16); - Status = FileHandleRead (Handle, &CharSize, &CharBuffer); - ASSERT_EFI_ERROR (Status); - if (CharBuffer == gUnicodeFileTag) { - Ascii = FALSE; - } else { - Ascii = TRUE; - } - } - - Status = FileHandleSetPosition(Handle, OriginalFilePosition); - if (EFI_ERROR(Status)) { - return Status; - } - - if (Ascii) { - 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); - return EFI_INVALID_PARAMETER; - } - } - - 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"); - } else { - if (OriginalFilePosition == 0) { - 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)) { - return (Status); - } - Size = StrSize(L"\r\n") - sizeof(CHAR16); - Status = FileHandleWrite(Handle, &Size, L"\r\n"); - } - - if (AsciiBuffer != NULL) { - FreePool (AsciiBuffer); - } - return Status; -} - -/** - function to take a formatted argument and print it to a file. - - @param[in] Handle the file handle for the file to write to - @param[in] Format the format argument (see printlib for format specifier) - @param[in] ... the variable arguments for the format - - @retval EFI_SUCCESS the operation was successful - @return other a return value from FileHandleWriteLine - - @sa FileHandleWriteLine -**/ -EFI_STATUS -EFIAPI -FileHandlePrintLine( - IN EFI_FILE_HANDLE Handle, - IN CONST CHAR16 *Format, - ... - ) -{ - VA_LIST Marker; - CHAR16 *Buffer; - EFI_STATUS Status; - - // - // Get a buffer to print into - // - Buffer = AllocateZeroPool (PcdGet16 (PcdUefiFileHandleLibPrintBufferSize)); - if (Buffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - // - // Print into our buffer - // - VA_START (Marker, Format); - UnicodeVSPrint (Buffer, PcdGet16 (PcdUefiFileHandleLibPrintBufferSize), Format, Marker); - VA_END (Marker); - - // - // Print buffer into file - // - Status = FileHandleWriteLine(Handle, Buffer); - - // - // Cleanup and return - // - FreePool(Buffer); - return (Status); -} - -/** - Function to determine if a FILE_HANDLE is at the end of the file. - - This will NOT work on directories. - - If Handle is NULL, then return False. - - @param[in] Handle the file handle - - @retval TRUE the position is at the end of the file - @retval FALSE the position is not at the end of the file -**/ -BOOLEAN -EFIAPI -FileHandleEof( - IN EFI_FILE_HANDLE Handle - ) -{ - EFI_FILE_INFO *Info; - UINT64 Pos; - BOOLEAN RetVal; - - if (Handle == NULL) { - return (FALSE); - } - - FileHandleGetPosition(Handle, &Pos); - Info = FileHandleGetInfo (Handle); - - if (Info == NULL) { - return (FALSE); - } - - FileHandleSetPosition(Handle, Pos); - - if (Pos == Info->FileSize) { - RetVal = TRUE; - } else { - RetVal = FALSE; - } - - FreePool (Info); - - return (RetVal); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf deleted file mode 100644 index ff6bb08..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Provides interface to shell functionality for shell commands and applications. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiFileHandleLib - MODULE_UNI_FILE = UefiFileHandleLib.uni - FILE_GUID = 9495D344-9D8A-41f3-8D17-E2FD238C4E71 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = FileHandleLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiFileHandleLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - PrintLib - PcdLib - -[Protocols] - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd.common] - gEfiMdePkgTokenSpaceGuid.PcdUefiFileHandleLibPrintBufferSize ## SOMETIMES_CONSUMES diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.uni deleted file mode 100644 index 23eca00..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.uni +++ /dev/null @@ -1,26 +0,0 @@ -// /** @file -// Provides interface to shell functionality for shell commands and applications. -// -// Provides interface to shell functionality for shell commands and applications. -// -// Copyright (c) 2015, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - -#string STR_MODULE_ABSTRACT -#language en-US -"Provides interface to shell functionality for shell commands and applications." - -#string STR_MODULE_DESCRIPTION -#language en-US -"Provides interface to shell functionality for shell commands and applications." - - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Acpi.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Acpi.c deleted file mode 100644 index f94c451..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Acpi.c +++ /dev/null @@ -1,428 +0,0 @@ -/** @file - This module provides help function for finding ACPI table. - - Copyright (c) 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiLibInternal.h" -#include -#include - -/** - This function scans ACPI table in XSDT/RSDT. - - @param Sdt ACPI XSDT/RSDT. - @param TablePointerSize Size of table pointer: 8(XSDT) or 4(RSDT). - @param Signature ACPI table signature. - @param PreviousTable Pointer to previous returned table to locate - next table, or NULL to locate first table. - @param PreviousTableLocated Pointer to the indicator about whether the - previous returned table could be located, or - NULL if PreviousTable is NULL. - - If PreviousTable is NULL and PreviousTableLocated is not NULL, then ASSERT(). - If PreviousTable is not NULL and PreviousTableLocated is NULL, then ASSERT(). - - @return ACPI table or NULL if not found. - -**/ -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 - ) -{ - UINTN Index; - UINTN EntryCount; - UINT64 EntryPtr; - UINTN BasePtr; - EFI_ACPI_COMMON_HEADER *Table; - - if (PreviousTableLocated != NULL) { - ASSERT (PreviousTable != NULL); - *PreviousTableLocated = FALSE; - } else { - ASSERT (PreviousTable == NULL); - } - - if (Sdt == NULL) { - return NULL; - } - - EntryCount = (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / TablePointerSize; - - BasePtr = (UINTN)(Sdt + 1); - for (Index = 0; Index < EntryCount; Index ++) { - EntryPtr = 0; - CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), TablePointerSize); - Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr)); - if ((Table != NULL) && (Table->Signature == Signature)) { - if (PreviousTable != NULL) { - if (Table == PreviousTable) { - *PreviousTableLocated = TRUE; - } else if (*PreviousTableLocated) { - // - // Return next table. - // - return Table; - } - } else { - // - // Return first table. - // - return Table; - } - - } - } - - return NULL; -} - -/** - To locate FACS in FADT. - - @param Fadt FADT table pointer. - - @return FACS table pointer or NULL if not found. - -**/ -EFI_ACPI_COMMON_HEADER * -LocateAcpiFacsFromFadt ( - IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt - ) -{ - EFI_ACPI_COMMON_HEADER *Facs; - UINT64 Data64; - - if (Fadt == NULL) { - return NULL; - } - - 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)); - if (Data64 != 0) { - Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64; - } else { - Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->FirmwareCtrl; - } - } - return Facs; -} - -/** - To locate DSDT in FADT. - - @param Fadt FADT table pointer. - - @return DSDT table pointer or NULL if not found. - -**/ -EFI_ACPI_COMMON_HEADER * -LocateAcpiDsdtFromFadt ( - IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt - ) -{ - EFI_ACPI_COMMON_HEADER *Dsdt; - UINT64 Data64; - - if (Fadt == NULL) { - return NULL; - } - - 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)); - if (Data64 != 0) { - Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64; - } else { - Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->Dsdt; - } - } - return Dsdt; -} - -/** - To locate ACPI table in ACPI ConfigurationTable. - - @param AcpiGuid The GUID used to get ACPI ConfigurationTable. - @param Signature ACPI table signature. - @param PreviousTable Pointer to previous returned table to locate - next table, or NULL to locate first table. - @param PreviousTableLocated Pointer to the indicator to return whether the - previous returned table could be located or not, - or NULL if PreviousTable is NULL. - - If PreviousTable is NULL and PreviousTableLocated is not NULL, then ASSERT(). - If PreviousTable is not NULL and PreviousTableLocated is NULL, then ASSERT(). - If AcpiGuid is NULL, then ASSERT(). - - @return ACPI table or NULL if not found. - -**/ -EFI_ACPI_COMMON_HEADER * -LocateAcpiTableInAcpiConfigurationTable ( - IN EFI_GUID *AcpiGuid, - IN UINT32 Signature, - IN EFI_ACPI_COMMON_HEADER *PreviousTable, OPTIONAL - OUT BOOLEAN *PreviousTableLocated OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_ACPI_COMMON_HEADER *Table; - EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; - EFI_ACPI_DESCRIPTION_HEADER *Rsdt; - EFI_ACPI_DESCRIPTION_HEADER *Xsdt; - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; - - if (PreviousTableLocated != NULL) { - ASSERT (PreviousTable != NULL); - *PreviousTableLocated = FALSE; - } else { - ASSERT (PreviousTable == NULL); - } - - Rsdp = NULL; - // - // Get ACPI ConfigurationTable (RSD_PTR) - // - Status = EfiGetSystemConfigurationTable(AcpiGuid, (VOID **)&Rsdp); - if (EFI_ERROR (Status) || (Rsdp == NULL)) { - return NULL; - } - - Table = NULL; - - // - // Search XSDT - // - if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) { - 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 - ); - Table = LocateAcpiDsdtFromFadt (Fadt); - } else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) { - ASSERT (PreviousTable == NULL); - // - // 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 - ); - Table = LocateAcpiFacsFromFadt (Fadt); - } else { - Table = ScanTableInSDT ( - Xsdt, - sizeof (UINT64), - Signature, - PreviousTable, - PreviousTableLocated - ); - } - } - - if (Table != NULL) { - return Table; - } else if ((PreviousTableLocated != NULL) && - *PreviousTableLocated) { - // - // PreviousTable could be located in XSDT, - // but next table could not be located in XSDT. - // - return NULL; - } - - // - // Search RSDT - // - 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 - ); - Table = LocateAcpiDsdtFromFadt (Fadt); - } else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) { - ASSERT (PreviousTable == NULL); - // - // 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 - ); - Table = LocateAcpiFacsFromFadt (Fadt); - } else { - Table = ScanTableInSDT ( - Rsdt, - sizeof (UINT32), - Signature, - PreviousTable, - PreviousTableLocated - ); - } - - return Table; -} - -/** - This function locates next ACPI table in XSDT/RSDT based on Signature and - previous returned Table. - - If PreviousTable is NULL: - This function will locate the first ACPI table in XSDT/RSDT based on - Signature in gEfiAcpi20TableGuid system configuration table first, and then - gEfiAcpi10TableGuid system configuration table. - This function will locate in XSDT first, and then RSDT. - For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in - FADT. - For FACS, this function will locate XFirmwareCtrl in FADT first, and then - FirmwareCtrl in FADT. - - If PreviousTable is not NULL: - 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration - table, then this function will just locate next table in XSDT in - gEfiAcpi20TableGuid system configuration table. - 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration - table, then this function will just locate next table in RSDT in - gEfiAcpi20TableGuid system configuration table. - 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration - table, then this function will just locate next table in RSDT in - gEfiAcpi10TableGuid system configuration table. - - It's not supported that PreviousTable is not NULL but PreviousTable->Signature - is not same with Signature, NULL will be returned. - - @param Signature ACPI table signature. - @param PreviousTable Pointer to previous returned table to locate next - table, or NULL to locate first table. - - @return Next ACPI table or NULL if not found. - -**/ -EFI_ACPI_COMMON_HEADER * -EFIAPI -EfiLocateNextAcpiTable ( - IN UINT32 Signature, - IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL - ) -{ - EFI_ACPI_COMMON_HEADER *Table; - BOOLEAN TempPreviousTableLocated; - BOOLEAN *PreviousTableLocated; - - if (PreviousTable != NULL) { - if (PreviousTable->Signature != Signature) { - // - // PreviousTable->Signature is not same with Signature. - // - 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)) { - // - // There is only one FADT/DSDT/FACS table, - // so don't try to locate next one. - // - return NULL; - } - - PreviousTableLocated = &TempPreviousTableLocated; - *PreviousTableLocated = FALSE; - } else { - PreviousTableLocated = NULL; - } - - Table = LocateAcpiTableInAcpiConfigurationTable ( - &gEfiAcpi20TableGuid, - Signature, - PreviousTable, - PreviousTableLocated - ); - if (Table != NULL) { - return Table; - } else if ((PreviousTableLocated != NULL) && - *PreviousTableLocated) { - // - // PreviousTable could be located in gEfiAcpi20TableGuid system - // configuration table, but next table could not be located in - // gEfiAcpi20TableGuid system configuration table. - // - return NULL; - } - - return LocateAcpiTableInAcpiConfigurationTable ( - &gEfiAcpi10TableGuid, - Signature, - PreviousTable, - PreviousTableLocated - ); -} - -/** - This function locates first ACPI table in XSDT/RSDT based on Signature. - - This function will locate the first ACPI table in XSDT/RSDT based on - Signature in gEfiAcpi20TableGuid system configuration table first, and then - gEfiAcpi10TableGuid system configuration table. - This function will locate in XSDT first, and then RSDT. - For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in - FADT. - For FACS, this function will locate XFirmwareCtrl in FADT first, and then - FirmwareCtrl in FADT. - - @param Signature ACPI table signature. - - @return First ACPI table or NULL if not found. - -**/ -EFI_ACPI_COMMON_HEADER * -EFIAPI -EfiLocateFirstAcpiTable ( - IN UINT32 Signature - ) -{ - return EfiLocateNextAcpiTable (Signature, NULL); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Console.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Console.c deleted file mode 100644 index cf443dd..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/Console.c +++ /dev/null @@ -1,572 +0,0 @@ -/** @file - This module provide help function for displaying unicode string. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - - -#include "UefiLibInternal.h" - -typedef struct { - CHAR16 WChar; - UINT32 Width; -} UNICODE_WIDTH_ENTRY; - -#define NARROW_CHAR 0xFFF0 -#define WIDE_CHAR 0xFFF1 - -GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = { - // - // General script area - // - {(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 - * time and table size. The merge will omit the reserved code. - * - * Remove the above item if below is un-commented. - * - {(CHAR16)0x007F, 1}, // C0 controls and basic Latin. 0x0000-0x007F - {(CHAR16)0x00FF, 1}, // C1 controls and Latin-1 support. 0x0080-0x00FF - {(CHAR16)0x017F, 1}, // Latin extended-A. 0x0100-0x017F - {(CHAR16)0x024F, 1}, // Latin extended-B. 0x0180-0x024F - {(CHAR16)0x02AF, 1}, // IPA extensions. 0x0250-0x02AF - {(CHAR16)0x02FF, 1}, // Spacing modifier letters. 0x02B0-0x02FF - {(CHAR16)0x036F, 1}, // Combining diacritical marks. 0x0300-0x036F - {(CHAR16)0x03FF, 1}, // Greek. 0x0370-0x03FF - {(CHAR16)0x04FF, 1}, // Cyrillic. 0x0400-0x04FF - {(CHAR16)0x052F, 0}, // Unassigned. As Armenian in ver3.0. 0x0500-0x052F - {(CHAR16)0x058F, 1}, // Armenian. 0x0530-0x058F - {(CHAR16)0x05FF, 1}, // Hebrew. 0x0590-0x05FF - {(CHAR16)0x06FF, 1}, // Arabic. 0x0600-0x06FF - {(CHAR16)0x08FF, 0}, // Unassigned. 0x0700-0x08FF - {(CHAR16)0x097F, 1}, // Devanagari. 0x0900-0x097F - {(CHAR16)0x09FF, 1}, // Bengali. 0x0980-0x09FF - {(CHAR16)0x0A7F, 1}, // Gurmukhi. 0x0A00-0x0A7F - {(CHAR16)0x0AFF, 1}, // Gujarati. 0x0A80-0x0AFF - {(CHAR16)0x0B7F, 1}, // Oriya. 0x0B00-0x0B7F - {(CHAR16)0x0BFF, 1}, // Tamil. (See page 7-92). 0x0B80-0x0BFF - {(CHAR16)0x0C7F, 1}, // Telugu. 0x0C00-0x0C7F - {(CHAR16)0x0CFF, 1}, // Kannada. (See page 7-100). 0x0C80-0x0CFF - {(CHAR16)0x0D7F, 1}, // Malayalam (See page 7-104). 0x0D00-0x0D7F - {(CHAR16)0x0DFF, 0}, // Unassigned. 0x0D80-0x0DFF - {(CHAR16)0x0E7F, 1}, // Thai. 0x0E00-0x0E7F - {(CHAR16)0x0EFF, 1}, // Lao. 0x0E80-0x0EFF - {(CHAR16)0x0FBF, 1}, // Tibetan. 0x0F00-0x0FBF - {(CHAR16)0x109F, 0}, // Unassigned. 0x0FC0-0x109F - {(CHAR16)0x10FF, 1}, // Georgian. 0x10A0-0x10FF - {(CHAR16)0x11FF, 1}, // Hangul Jamo. 0x1100-0x11FF - {(CHAR16)0x1DFF, 0}, // Unassigned. 0x1200-0x1DFF - {(CHAR16)0x1EFF, 1}, // Latin extended additional. 0x1E00-0x1EFF - {(CHAR16)0x1FFF, 1}, // Greek extended. 0x1F00-0x1FFF - * - */ - - // - // Symbol area - // - {(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 - * time and table size. The merge will omit the reserved code. - * - * Remove the above item if below is un-commented. - * - {(CHAR16)0x206F, 1}, // General punctuation. (See page7-154). 0x200-0x206F - {(CHAR16)0x209F, 1}, // Superscripts and subscripts. 0x2070-0x209F - {(CHAR16)0x20CF, 1}, // Currency symbols. 0x20A0-0x20CF - {(CHAR16)0x20FF, 1}, // Combining diacritical marks for symbols. 0x20D0-0x20FF - {(CHAR16)0x214F, 1}, // Letterlike sympbols. 0x2100-0x214F - {(CHAR16)0x218F, 1}, // Number forms. 0x2150-0x218F - {(CHAR16)0x21FF, 1}, // Arrows. 0x2190-0x21FF - {(CHAR16)0x22FF, 1}, // Mathematical operators. 0x2200-0x22FF - {(CHAR16)0x23FF, 1}, // Miscellaneous technical. 0x2300-0x23FF - {(CHAR16)0x243F, 1}, // Control pictures. 0x2400-0x243F - {(CHAR16)0x245F, 1}, // Optical character recognition. 0x2440-0x245F - {(CHAR16)0x24FF, 1}, // Enclosed alphanumerics. 0x2460-0x24FF - {(CHAR16)0x257F, 1}, // Box drawing. 0x2500-0x257F - {(CHAR16)0x259F, 1}, // Block elements. 0x2580-0x259F - {(CHAR16)0x25FF, 1}, // Geometric shapes. 0x25A0-0x25FF - {(CHAR16)0x26FF, 1}, // Miscellaneous symbols. 0x2600-0x26FF - {(CHAR16)0x27BF, 1}, // Dingbats. 0x2700-0x27BF - {(CHAR16)0x2FFF, 0}, // Reserved. 0x27C0-0x2FFF - * - */ - - // - // CJK phonetics and symbol area - // - {(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 - * time and table size. The merge will omit the reserved code. - * - * Remove the above item if below is un-commented. - * - {(CHAR16)0x303F, 2}, // CJK symbols and punctuation. 0x3000-0x303F - {(CHAR16)0x309F, 2}, // Hiragana. 0x3040-0x309F - {(CHAR16)0x30FF, 2}, // Katakana. 0x30A0-0x30FF - {(CHAR16)0x312F, 2}, // Bopomofo. 0x3100-0x312F - {(CHAR16)0x318F, 2}, // Hangul compatibility jamo. 0x3130-0x318F - {(CHAR16)0x319F, 2}, // Kanbun. 0x3190-0x319F - {(CHAR16)0x31FF, 0}, // Reserved. As Bopomofo extended in ver3.0. 0x31A0-0x31FF - {(CHAR16)0x32FF, 2}, // Enclosed CJK letters and months. 0x3200-0x32FF - {(CHAR16)0x33FF, 2}, // CJK compatibility. 0x3300-0x33FF - * - */ - - // - // CJK ideograph area - // - {(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 - * time and table size. The merge will omit the reserved code. - * - * Remove the above item if below is un-commented. - * - {(CHAR16)0x4DFF, 0}, // Reserved. 0x3400-0x4DBF as CJK unified ideographs - // extension A in ver3.0. 0x3400-0x4DFF - {(CHAR16)0x9FFF, 2}, // CJK unified ideographs. 0x4E00-0x9FFF - * - */ - - // - // Reserved - // - {(CHAR16)0xABFF, 0}, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0 - // as Yi radicals in ver3.0. 0xA000-0xABFF - // - // Hangul syllables - // - {(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 - * time and table size. The merge will omit the reserved code. - * - * Remove the above item if below is un-commented. - * - {(CHAR16)0xD7A3, 2}, // Hangul syllables. 0xAC00-0xD7A3 - {(CHAR16)0xD7FF, 0}, // Reserved. 0xD7A3-0xD7FF - * - */ - - // - // Surrogates area - // - {(CHAR16)0xDFFF, 0}, // Surrogates, not used now. 0xD800-0xDFFF - - // - // Private use area - // - {(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 -}; - -/** - Retrieves the width of a Unicode character. - - This function computes and returns the width of the Unicode character specified - by UnicodeChar. - - @param UnicodeChar A Unicode character. - - @retval 0 The width if UnicodeChar could not be determined. - @retval 1 UnicodeChar is a narrow glyph. - @retval 2 UnicodeChar is a wide glyph. - -**/ -UINTN -EFIAPI -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; - while (Low <= High) { - Index = (Low + High) >> 1; - Item = &(mUnicodeWidthTable[Index]); - if (Index == 0) { - if (UnicodeChar <= Item->WChar) { - break; - } - - return 0; - } - - if (UnicodeChar > Item->WChar) { - Low = Index + 1; - } else if (UnicodeChar <= mUnicodeWidthTable[Index - 1].WChar) { - High = Index - 1; - } else { - // - // Index - 1 < UnicodeChar <= Index. Found - // - break; - } - } - - if (Low <= High) { - return Item->Width; - } - - return 0; -} - -/** - Computes the display length of a Null-terminated Unicode String. - - This function computes and returns the display length of the Null-terminated - Unicode string specified by String. If String is NULL then 0 is returned. If - any of the widths of the Unicode characters in String can not be determined, - then 0 is returned. The display width of String can be computed by summing the - display widths of each Unicode character in String. Unicode characters that - are narrow glyphs have a width of 1, and Unicode characters that are width glyphs - have a width of 2. If String is not aligned on a 16-bit boundary, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @return The display length of the Null-terminated Unicode string specified by String. - -**/ -UINTN -EFIAPI -UnicodeStringDisplayLength ( - IN CONST CHAR16 *String - ) -{ - UINTN Length; - UINTN Width; - - if (String == NULL) { - return 0; - } - - Length = 0; - while (*String != 0) { - Width = GetGlyphWidth (*String); - if (Width == 0) { - return 0; - } - - Length += Width; - String++; - } - - return Length; -} - -/** - Count the storage space of a Unicode string. - - This function handles the Unicode string with NARROW_CHAR - and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR - does not count in the resultant output. If a WIDE_CHAR is - hit, then 2 Unicode character will consume an output storage - space with size of CHAR16 till a NARROW_CHAR is hit. - - @param String The input string to be counted. - @param LimitLen Whether need to limit the string length. - @param MaxWidth The max length this function supported. - @param Offset The max index of the string can be show out. - - @return Storage space for the input string. - -**/ -UINTN -UefiLibGetStringWidth ( - IN CHAR16 *String, - IN BOOLEAN LimitLen, - IN UINTN MaxWidth, - OUT UINTN *Offset - ) -{ - UINTN Index; - UINTN Count; - UINTN IncrementValue; - - if (String == NULL) { - return 0; - } - - 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++) { - Count = Count + IncrementValue; - - if (LimitLen && Count > MaxWidth) { - break; - } - } - - // - // We hit the null-terminator, we now have a count - // - if (String[Index] == 0) { - break; - } - - if (LimitLen && Count > MaxWidth) { - *Offset = Index; - break; - } - - // - // We encountered a narrow directive - strip it from the size calculation since it doesn't get printed - // and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2) - // - if (String[Index] == NARROW_CHAR) { - // - // Skip to the next character - // - Index++; - IncrementValue = 1; - } else { - // - // Skip to the next character - // - Index++; - IncrementValue = 2; - } - } while (String[Index] != 0); - - return Count * sizeof (CHAR16); -} - -/** - Draws a dialog box to the console output device specified by - ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke - from the console input device specified by ConIn defined in the - EFI_SYSTEM_TABLE. - - If there are no strings in the variable argument list, then ASSERT(). - If all the strings in the variable argument list are empty, then ASSERT(). - - @param[in] Attribute Specifies the foreground and background color of the popup. - @param[out] Key A pointer to the EFI_KEY value of the key that was - pressed. This is an optional parameter that may be NULL. - If it is NULL then no wait for a keypress will be performed. - @param[in] ... The variable argument list that contains pointers to Null- - terminated Unicode strings to display in the dialog box. - The variable argument list is terminated by a NULL. - -**/ -VOID -EFIAPI -CreatePopUp ( - IN UINTN Attribute, - OUT EFI_INPUT_KEY *Key, OPTIONAL - ... - ) -{ - EFI_STATUS Status; - VA_LIST Args; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; - EFI_SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode; - UINTN Columns; - UINTN Rows; - UINTN Column; - UINTN Row; - UINTN NumberOfLines; - UINTN MaxLength; - CHAR16 *String; - UINTN Length; - CHAR16 *Line; - UINTN EventIndex; - CHAR16 *TmpString; - - // - // Determine the length of the longest line in the popup and the the total - // number of lines in the popup - // - VA_START (Args, Key); - MaxLength = 0; - NumberOfLines = 0; - while ((String = VA_ARG (Args, CHAR16 *)) != NULL) { - MaxLength = MAX (MaxLength, UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2); - NumberOfLines++; - } - VA_END (Args); - - // - // If the total number of lines in the popup is zero, then ASSERT() - // - ASSERT (NumberOfLines != 0); - - // - // If the maximum length of all the strings is zero, then ASSERT() - // - ASSERT (MaxLength != 0); - - // - // Cache a pointer to the Simple Text Output Protocol in the EFI System Table - // - ConOut = gST->ConOut; - - // - // Save the current console cursor position and attributes - // - CopyMem (&SavedConsoleMode, ConOut->Mode, sizeof (SavedConsoleMode)); - - // - // Retrieve the number of columns and rows in the current console mode - // - ConOut->QueryMode (ConOut, SavedConsoleMode.Mode, &Columns, &Rows); - - // - // Disable cursor and set the foreground and background colors specified by Attribute - // - ConOut->EnableCursor (ConOut, FALSE); - ConOut->SetAttribute (ConOut, Attribute); - - // - // Limit NumberOfLines to height of the screen minus 3 rows for the box itself - // - NumberOfLines = MIN (NumberOfLines, Rows - 3); - - // - // Limit MaxLength to width of the screen minus 2 columns for the box itself - // - MaxLength = MIN (MaxLength, Columns - 2); - - // - // Compute the starting row and starting column for the popup - // - Row = (Rows - (NumberOfLines + 3)) / 2; - Column = (Columns - (MaxLength + 2)) / 2; - - // - // Allocate a buffer for a single line of the popup with borders and a Null-terminator - // - Line = AllocateZeroPool ((MaxLength + 3) * sizeof (CHAR16)); - ASSERT (Line != NULL); - - // - // Draw top of popup box - // - SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL); - Line[0] = BOXDRAW_DOWN_RIGHT; - Line[MaxLength + 1] = BOXDRAW_DOWN_LEFT; - Line[MaxLength + 2] = L'\0'; - ConOut->SetCursorPosition (ConOut, Column, Row++); - ConOut->OutputString (ConOut, Line); - - // - // Draw middle of the popup with strings - // - VA_START (Args, Key); - while ((String = VA_ARG (Args, CHAR16 *)) != NULL && NumberOfLines > 0) { - SetMem16 (Line, (MaxLength + 2) * 2, L' '); - Line[0] = BOXDRAW_VERTICAL; - Line[MaxLength + 1] = BOXDRAW_VERTICAL; - Line[MaxLength + 2] = L'\0'; - ConOut->SetCursorPosition (ConOut, Column, Row); - ConOut->OutputString (ConOut, Line); - Length = UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2; - if (Length <= MaxLength) { - // - // Length <= MaxLength - // - ConOut->SetCursorPosition (ConOut, Column + 1 + (MaxLength - Length) / 2, Row++); - ConOut->OutputString (ConOut, String); - } else { - // - // Length > MaxLength - // - UefiLibGetStringWidth (String, TRUE, MaxLength, &Length); - TmpString = AllocateZeroPool ((Length + 1) * sizeof (CHAR16)); - ASSERT (TmpString != NULL); - StrnCpyS (TmpString, Length + 1, String, Length - 3); - StrCatS (TmpString, Length + 1, L"..."); - - ConOut->SetCursorPosition (ConOut, Column + 1, Row++); - ConOut->OutputString (ConOut, TmpString); - FreePool (TmpString); - } - NumberOfLines--; - } - VA_END (Args); - - // - // Draw bottom of popup box - // - SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL); - Line[0] = BOXDRAW_UP_RIGHT; - Line[MaxLength + 1] = BOXDRAW_UP_LEFT; - Line[MaxLength + 2] = L'\0'; - ConOut->SetCursorPosition (ConOut, Column, Row++); - ConOut->OutputString (ConOut, Line); - - // - // Free the allocated line buffer - // - FreePool (Line); - - // - // Restore the cursor visibility, position, and attributes - // - ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible); - ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow); - ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute); - - // - // Wait for a keystroke - // - if (Key != NULL) { - while (TRUE) { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key); - if (!EFI_ERROR (Status)) { - break; - } - - // - // If we encounter error, continue to read another key in. - // - if (Status != EFI_NOT_READY) { - continue; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - } - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiDriverModel.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiDriverModel.c deleted file mode 100644 index 8e7d933..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiDriverModel.c +++ /dev/null @@ -1,2026 +0,0 @@ -/** @file - Library functions that abstract driver model protocols - installation and uninstallation. - - Copyright (c) 2019, NVIDIA Corporation. All rights reserved. - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "UefiLibInternal.h" - -/** - Installs and completes the initialization of a Driver Binding Protocol instance. - - Installs the Driver Binding Protocol specified by DriverBinding onto the handle - specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding - is installed onto a newly created handle. DriverBindingHandle is typically the same - as the driver's ImageHandle, but it can be different if the driver produces multiple - Driver Binding Protocols. - If DriverBinding is NULL, then ASSERT(). - If DriverBinding can not be installed onto a handle, then ASSERT(). - - @param ImageHandle The image handle of the driver. - @param SystemTable The EFI System Table that was passed to the driver's entry point. - @param DriverBinding A Driver Binding Protocol instance that this driver is producing. - @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this - parameter is NULL, then a new handle is created. - - @retval EFI_SUCCESS The protocol installation successfully completed. - @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol. - @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). - -**/ -EFI_STATUS -EFIAPI -EfiLibInstallDriverBinding ( - IN CONST EFI_HANDLE ImageHandle, - IN CONST EFI_SYSTEM_TABLE *SystemTable, - IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, - IN EFI_HANDLE DriverBindingHandle - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - // - // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol - // - DriverBinding->ImageHandle = ImageHandle; - DriverBinding->DriverBindingHandle = DriverBindingHandle; - - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - // - // ASSERT if the call to InstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - return Status; -} - - - -/** - Uninstalls a Driver Binding Protocol instance. - - If DriverBinding is NULL, then ASSERT(). - If DriverBinding can not be uninstalled, then ASSERT(). - - @param DriverBinding A Driver Binding Protocol instance that this driver produced. - - @retval EFI_SUCCESS The protocol uninstallation successfully completed. - @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). - -**/ -EFI_STATUS -EFIAPI -EfiLibUninstallDriverBinding ( - IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - // - // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - 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. - - Initializes a driver by installing the Driver Binding Protocol together with the - optional Component Name, optional Driver Configure and optional Driver Diagnostic - Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL, - then the protocols are installed onto a newly created handle. DriverBindingHandle - is typically the same as the driver's ImageHandle, but it can be different if the - driver produces multiple Driver Binding Protocols. - If DriverBinding is NULL, then ASSERT(). - If the installation fails, then ASSERT(). - - @param ImageHandle The image handle of the driver. - @param SystemTable The EFI System Table that was passed to the driver's entry point. - @param DriverBinding A Driver Binding Protocol instance that this driver is producing. - @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this - parameter is NULL, then a new handle is created. - @param ComponentName A Component Name Protocol instance that this driver is producing. - @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. - @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. - - @retval EFI_SUCCESS The protocol installation successfully completed. - @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. - -**/ -EFI_STATUS -EFIAPI -EfiLibInstallAllDriverProtocols ( - 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_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL - IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - // - // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol - // - DriverBinding->ImageHandle = ImageHandle; - DriverBinding->DriverBindingHandle = DriverBindingHandle; - - if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { - if (DriverConfiguration == NULL) { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - NULL - ); - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } - } else { - if (DriverConfiguration == NULL) { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } - } - - // - // ASSERT if the call to InstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - return Status; -} - - - -/** - Uninstalls a Driver Binding Protocol instance and optionally uninstalls the - Component Name, Driver Configuration and Driver Diagnostics Protocols. - - If DriverBinding is NULL, then ASSERT(). - If the uninstallation fails, then ASSERT(). - - @param DriverBinding A Driver Binding Protocol instance that this driver produced. - @param ComponentName A Component Name Protocol instance that this driver produced. - @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced. - @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced. - - @retval EFI_SUCCESS The protocol uninstallation successfully completed. - @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). - -**/ -EFI_STATUS -EFIAPI -EfiLibUninstallAllDriverProtocols ( - IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, - IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL - IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL - IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { - if (DriverConfiguration == NULL) { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - NULL - ); - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } - } else { - if (DriverConfiguration == NULL) { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } - } - - // - // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - return Status; -} - - - -/** - Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols. - - Initializes a driver by installing the Driver Binding Protocol together with the - optional Component Name and optional Component Name 2 protocols onto the driver's - DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed - onto a newly created handle. DriverBindingHandle is typically the same as the driver's - ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols. - If DriverBinding is NULL, then ASSERT(). - If the installation fails, then ASSERT(). - - @param ImageHandle The image handle of the driver. - @param SystemTable The EFI System Table that was passed to the driver's entry point. - @param DriverBinding A Driver Binding Protocol instance that this driver is producing. - @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this - parameter is NULL, then a new handle is created. - @param ComponentName A Component Name Protocol instance that this driver is producing. - @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. - - @retval EFI_SUCCESS The protocol installation successfully completed. - @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. - -**/ -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 - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - // - // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol - // - DriverBinding->ImageHandle = ImageHandle; - DriverBinding->DriverBindingHandle = DriverBindingHandle; - - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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 - ); - } - } - - // - // ASSERT if the call to InstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - return Status; -} - - - -/** - Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols. - - If DriverBinding is NULL, then ASSERT(). - If the uninstallation fails, then ASSERT(). - - @param DriverBinding A Driver Binding Protocol instance that this driver produced. - @param ComponentName A Component Name Protocol instance that this driver produced. - @param ComponentName2 A Component Name 2 Protocol instance that this driver produced. - - @retval EFI_SUCCESS The protocol installation successfully completed. - @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). - -**/ -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 - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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 - ); - } - } - - // - // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - 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. - - Initializes a driver by installing the Driver Binding Protocol together with the optional - Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2, - optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle. - DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver - produces multiple Driver Binding Protocols. - If DriverBinding is NULL, then ASSERT(). - If the installation fails, then ASSERT(). - - - @param ImageHandle The image handle of the driver. - @param SystemTable The EFI System Table that was passed to the driver's entry point. - @param DriverBinding A Driver Binding Protocol instance that this driver is producing. - @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this - parameter is NULL, then a new handle is created. - @param ComponentName A Component Name Protocol instance that this driver is producing. - @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. - @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. - @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing. - @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. - @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing. - - @retval EFI_SUCCESS The protocol installation successfully completed. - @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. - -**/ -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 - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - // - // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol - // - DriverBinding->ImageHandle = ImageHandle; - DriverBinding->DriverBindingHandle = DriverBindingHandle; - - 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)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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 - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } - } else { - if (DriverConfiguration == NULL) { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } - } - - // - // ASSERT if the call to InstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - 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. - - If DriverBinding is NULL, then ASSERT(). - If the installation fails, then ASSERT(). - - - @param DriverBinding A Driver Binding Protocol instance that this driver produced. - @param ComponentName A Component Name Protocol instance that this driver produced. - @param ComponentName2 A Component Name 2 Protocol instance that this driver produced. - @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced. - @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver produced. - @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced. - @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver produced. - - @retval EFI_SUCCESS The protocol uninstallation successfully completed. - @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). - -**/ -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 - ) -{ - EFI_STATUS Status; - - ASSERT (DriverBinding != NULL); - - 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)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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 - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } - } else { - if (DriverConfiguration == NULL) { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &gEfiDriverBindingProtocolGuid, DriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, - &gEfiDriverConfigurationProtocolGuid, DriverConfiguration, - &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2, - &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics, - NULL - ); - } - } else { - if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } else { - 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, - NULL - ); - } else { - Status = gBS->UninstallMultipleProtocolInterfaces ( - DriverBinding->DriverBindingHandle, - &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, - NULL - ); - } - } - } - } - } - } - - // - // ASSERT if the call to UninstallMultipleProtocolInterfaces() failed - // - ASSERT_EFI_ERROR (Status); - - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.c deleted file mode 100644 index 7296846..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.c +++ /dev/null @@ -1,2001 +0,0 @@ -/** @file - The UEFI Library provides functions and macros that simplify the development of - UEFI Drivers and UEFI Applications. These functions and macros help manage EFI - events, build simple locks utilizing EFI Task Priority Levels (TPLs), install - EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, - and print messages on the console output and standard error devices. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "UefiLibInternal.h" - -/** - Empty constructor function that is required to resolve dependencies between - libraries. - - ** DO NOT REMOVE ** - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor executed correctly. - -**/ -EFI_STATUS -EFIAPI -UefiLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return EFI_SUCCESS; -} - -/** - Compare whether two names of languages are identical. - - @param Language1 Name of language 1. - @param Language2 Name of language 2. - - @retval TRUE Language 1 and language 2 are the same. - @retval FALSE Language 1 and language 2 are not the same. - -**/ -BOOLEAN -CompareIso639LanguageCode ( - IN CONST CHAR8 *Language1, - IN CONST CHAR8 *Language2 - ) -{ - UINT32 Name1; - UINT32 Name2; - - Name1 = ReadUnaligned24 ((CONST UINT32 *) Language1); - Name2 = ReadUnaligned24 ((CONST UINT32 *) Language2); - - return (BOOLEAN) (Name1 == Name2); -} - -/** - Retrieves a pointer to the system configuration table from the EFI System Table - based on a specified GUID. - - This function searches the list of configuration tables stored in the EFI System Table - for a table with a GUID that matches TableGuid. If a match is found, then a pointer to - the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID - is not found, then EFI_NOT_FOUND is returned. - If TableGuid is NULL, then ASSERT(). - If Table is NULL, then ASSERT(). - - @param TableGuid The pointer to table's GUID type. - @param Table The pointer to the table associated with TableGuid in the EFI System Table. - - @retval EFI_SUCCESS A configuration table matching TableGuid was found. - @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found. - -**/ -EFI_STATUS -EFIAPI -EfiGetSystemConfigurationTable ( - IN EFI_GUID *TableGuid, - OUT VOID **Table - ) -{ - EFI_SYSTEM_TABLE *SystemTable; - UINTN Index; - - ASSERT (TableGuid != NULL); - ASSERT (Table != NULL); - - SystemTable = gST; - *Table = NULL; - for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) { - if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) { - *Table = SystemTable->ConfigurationTable[Index].VendorTable; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - Creates and returns a notification event and registers that event with all the protocol - instances specified by ProtocolGuid. - - This function causes the notification function to be executed for every protocol of type - ProtocolGuid instance that exists in the system when this function is invoked. If there are - no instances of ProtocolGuid in the handle database at the time this function is invoked, - then the notification function is still executed one time. In addition, every time a protocol - of type ProtocolGuid instance is installed or reinstalled, the notification function is also - executed. This function returns the notification event that was created. - If ProtocolGuid is NULL, then ASSERT(). - If NotifyTpl is not a legal TPL value, then ASSERT(). - If NotifyFunction is NULL, then ASSERT(). - If Registration is NULL, then ASSERT(). - - - @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired. - @param NotifyTpl Supplies the task priority level of the event notifications. - @param NotifyFunction Supplies the function to notify when the event is signaled. - @param NotifyContext The context parameter to pass to NotifyFunction. - @param Registration A pointer to a memory location to receive the registration value. - This value is passed to LocateHandle() to obtain new handles that - have been added that support the ProtocolGuid-specified protocol. - - @return The notification event that was created. - -**/ -EFI_EVENT -EFIAPI -EfiCreateProtocolNotifyEvent( - IN EFI_GUID *ProtocolGuid, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN VOID *NotifyContext, OPTIONAL - OUT VOID **Registration - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; - - ASSERT (ProtocolGuid != NULL); - ASSERT (NotifyFunction != NULL); - ASSERT (Registration != NULL); - - // - // Create the event - // - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - NotifyTpl, - NotifyFunction, - NotifyContext, - &Event - ); - ASSERT_EFI_ERROR (Status); - - // - // Register for protocol notifications on this event - // - - Status = gBS->RegisterProtocolNotify ( - ProtocolGuid, - Event, - Registration - ); - - ASSERT_EFI_ERROR (Status); - - // - // Kick the event so we will perform an initial pass of - // current installed drivers - // - - gBS->SignalEvent (Event); - return Event; -} - -/** - Creates a named event that can be signaled with EfiNamedEventSignal(). - - This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext. - This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more - listeners on the same event named by the GUID specified by Name. - If Name is NULL, then ASSERT(). - If NotifyTpl is not a legal TPL value, then ASSERT(). - If NotifyFunction is NULL, then ASSERT(). - - @param Name Supplies the GUID name of the event. - @param NotifyTpl Supplies the task priority level of the event notifications. - @param NotifyFunction Supplies the function to notify when the event is signaled. - @param NotifyContext The context parameter to pass to NotifyFunction. - @param Registration A pointer to a memory location to receive the registration value. - - @retval EFI_SUCCESS A named event was created. - @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event. - -**/ -EFI_STATUS -EFIAPI -EfiNamedEventListen ( - IN CONST EFI_GUID *Name, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN CONST VOID *NotifyContext, OPTIONAL - OUT VOID *Registration OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; - VOID *RegistrationLocal; - - ASSERT (Name != NULL); - ASSERT (NotifyFunction != NULL); - ASSERT (NotifyTpl <= TPL_HIGH_LEVEL); - - // - // Create event - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - NotifyTpl, - NotifyFunction, - (VOID *) NotifyContext, - &Event - ); - ASSERT_EFI_ERROR (Status); - - // - // The Registration is not optional to RegisterProtocolNotify(). - // To make it optional to EfiNamedEventListen(), may need to substitute with a local. - // - if (Registration != NULL) { - RegistrationLocal = Registration; - } else { - RegistrationLocal = &RegistrationLocal; - } - - // - // Register for an installation of protocol interface - // - - Status = gBS->RegisterProtocolNotify ( - (EFI_GUID *) Name, - Event, - RegistrationLocal - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Signals a named event created with EfiNamedEventListen(). - - This function signals the named event specified by Name. The named event must have been - created with EfiNamedEventListen(). - If Name is NULL, then ASSERT(). - - @param Name Supplies the GUID name of the event. - - @retval EFI_SUCCESS A named event was signaled. - @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event. - -**/ -EFI_STATUS -EFIAPI -EfiNamedEventSignal ( - IN CONST EFI_GUID *Name - ) -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - ASSERT(Name != NULL); - - Handle = NULL; - Status = gBS->InstallProtocolInterface ( - &Handle, - (EFI_GUID *) Name, - EFI_NATIVE_INTERFACE, - NULL - ); - ASSERT_EFI_ERROR (Status); - - Status = gBS->UninstallProtocolInterface ( - Handle, - (EFI_GUID *) Name, - NULL - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Signals an event group by placing a new event in the group temporarily and - signaling it. - - @param[in] EventGroup Supplies the unique identifier of the event - group to signal. - - @retval EFI_SUCCESS The event group was signaled successfully. - @retval EFI_INVALID_PARAMETER EventGroup is NULL. - @return Error codes that report problems about event - creation or signaling. -**/ -EFI_STATUS -EFIAPI -EfiEventGroupSignal ( - IN CONST EFI_GUID *EventGroup - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; - - if (EventGroup == NULL) { - return EFI_INVALID_PARAMETER; - } - - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - EfiEventEmptyFunction, - NULL, - EventGroup, - &Event - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->SignalEvent (Event); - gBS->CloseEvent (Event); - - return Status; -} - -/** - An empty function that can be used as NotifyFunction parameter of - CreateEvent() or CreateEventEx(). - - @param Event Event whose notification function is being invoked. - @param Context The pointer to the notification function's context, - which is implementation-dependent. - -**/ -VOID -EFIAPI -EfiEventEmptyFunction ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ -} - -/** - Returns the current TPL. - - This function returns the current TPL. There is no EFI service to directly - retrieve the current TPL. Instead, the RaiseTPL() function is used to raise - the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level - can then immediately be restored back to the current TPL level with a call - to RestoreTPL(). - - @return The current TPL. - -**/ -EFI_TPL -EFIAPI -EfiGetCurrentTpl ( - VOID - ) -{ - EFI_TPL Tpl; - - Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); - gBS->RestoreTPL (Tpl); - - return Tpl; -} - - -/** - Initializes a basic mutual exclusion lock. - - This function initializes a basic mutual exclusion lock to the released state - and returns the lock. Each lock provides mutual exclusion access at its task - priority level. Since there is no preemption or multiprocessor support in EFI, - acquiring the lock only consists of raising to the locks TPL. - If Lock is NULL, then ASSERT(). - If Priority is not a valid TPL value, then ASSERT(). - - @param Lock A pointer to the lock data structure to initialize. - @param Priority EFI TPL is associated with the lock. - - @return The lock. - -**/ -EFI_LOCK * -EFIAPI -EfiInitializeLock ( - IN OUT EFI_LOCK *Lock, - IN EFI_TPL Priority - ) -{ - ASSERT (Lock != NULL); - ASSERT (Priority <= TPL_HIGH_LEVEL); - - Lock->Tpl = Priority; - Lock->OwnerTpl = TPL_APPLICATION; - Lock->Lock = EfiLockReleased ; - return Lock; -} - -/** - Acquires ownership of a lock. - - This function raises the system's current task priority level to the task - priority level of the mutual exclusion lock. Then, it places the lock in the - acquired state. - If Lock is NULL, then ASSERT(). - If Lock is not initialized, then ASSERT(). - If Lock is already in the acquired state, then ASSERT(). - - @param Lock A pointer to the lock to acquire. - -**/ -VOID -EFIAPI -EfiAcquireLock ( - IN EFI_LOCK *Lock - ) -{ - ASSERT (Lock != NULL); - ASSERT (Lock->Lock == EfiLockReleased); - - Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl); - Lock->Lock = EfiLockAcquired; -} - -/** - Acquires ownership of a lock. - - This function raises the system's current task priority level to the task priority - level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state. - If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. - Otherwise, EFI_SUCCESS is returned. - If Lock is NULL, then ASSERT(). - If Lock is not initialized, then ASSERT(). - - @param Lock A pointer to the lock to acquire. - - @retval EFI_SUCCESS The lock was acquired. - @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned. - -**/ -EFI_STATUS -EFIAPI -EfiAcquireLockOrFail ( - IN EFI_LOCK *Lock - ) -{ - - ASSERT (Lock != NULL); - ASSERT (Lock->Lock != EfiLockUninitialized); - - if (Lock->Lock == EfiLockAcquired) { - // - // Lock is already owned, so bail out - // - return EFI_ACCESS_DENIED; - } - - Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl); - - Lock->Lock = EfiLockAcquired; - - return EFI_SUCCESS; -} - -/** - Releases ownership of a lock. - - This function transitions a mutual exclusion lock from the acquired state to - the released state, and restores the system's task priority level to its - previous level. - If Lock is NULL, then ASSERT(). - If Lock is not initialized, then ASSERT(). - If Lock is already in the released state, then ASSERT(). - - @param Lock A pointer to the lock to release. - -**/ -VOID -EFIAPI -EfiReleaseLock ( - IN EFI_LOCK *Lock - ) -{ - EFI_TPL Tpl; - - ASSERT (Lock != NULL); - ASSERT (Lock->Lock == EfiLockAcquired); - - Tpl = Lock->OwnerTpl; - - Lock->Lock = EfiLockReleased; - - gBS->RestoreTPL (Tpl); -} - -/** - Tests whether a controller handle is being managed by a specific driver. - - This function tests whether the driver specified by DriverBindingHandle is - currently managing the controller specified by ControllerHandle. This test - is performed by evaluating if the the protocol specified by ProtocolGuid is - present on ControllerHandle and is was opened by DriverBindingHandle with an - attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. - If ProtocolGuid is NULL, then ASSERT(). - - @param ControllerHandle A handle for a controller to test. - @param DriverBindingHandle Specifies the driver binding handle for the - driver. - @param ProtocolGuid Specifies the protocol that the driver specified - by DriverBindingHandle opens in its Start() - function. - - @retval EFI_SUCCESS ControllerHandle is managed by the driver - specified by DriverBindingHandle. - @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver - specified by DriverBindingHandle. - -**/ -EFI_STATUS -EFIAPI -EfiTestManagedDevice ( - IN CONST EFI_HANDLE ControllerHandle, - IN CONST EFI_HANDLE DriverBindingHandle, - IN CONST EFI_GUID *ProtocolGuid - ) -{ - EFI_STATUS Status; - VOID *ManagedInterface; - - ASSERT (ProtocolGuid != NULL); - - Status = gBS->OpenProtocol ( - ControllerHandle, - (EFI_GUID *) ProtocolGuid, - &ManagedInterface, - DriverBindingHandle, - ControllerHandle, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - if (!EFI_ERROR (Status)) { - gBS->CloseProtocol ( - ControllerHandle, - (EFI_GUID *) ProtocolGuid, - DriverBindingHandle, - ControllerHandle - ); - return EFI_UNSUPPORTED; - } - - if (Status != EFI_ALREADY_STARTED) { - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - -/** - Tests whether a child handle is a child device of the controller. - - This function tests whether ChildHandle is one of the children of - ControllerHandle. This test is performed by checking to see if the protocol - specified by ProtocolGuid is present on ControllerHandle and opened by - ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. - If ProtocolGuid is NULL, then ASSERT(). - - @param ControllerHandle A handle for a (parent) controller to test. - @param ChildHandle A child handle to test. - @param ProtocolGuid Supplies the protocol that the child controller - opens on its parent controller. - - @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle. - @retval EFI_UNSUPPORTED ChildHandle is not a child of the - ControllerHandle. - -**/ -EFI_STATUS -EFIAPI -EfiTestChildHandle ( - 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; - - ASSERT (ProtocolGuid != NULL); - - // - // Retrieve the list of agents that are consuming the specific protocol - // on ControllerHandle. - // - Status = gBS->OpenProtocolInformation ( - ControllerHandle, - (EFI_GUID *) ProtocolGuid, - &OpenInfoBuffer, - &EntryCount - ); - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } - - // - // Inspect if ChildHandle is one of the agents. - // - Status = EFI_UNSUPPORTED; - for (Index = 0; Index < EntryCount; Index++) { - if ((OpenInfoBuffer[Index].ControllerHandle == ChildHandle) && - (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - Status = EFI_SUCCESS; - break; - } - } - - FreePool (OpenInfoBuffer); - return Status; -} - -/** - This function looks up a Unicode string in UnicodeStringTable. - - If Language is a member of SupportedLanguages and a Unicode string is found in - UnicodeStringTable that matches the language code specified by Language, then it - is returned in UnicodeString. - - @param Language A pointer to the ISO 639-2 language code for the - Unicode string to look up and return. - @param SupportedLanguages A pointer to the set of ISO 639-2 language codes - that the Unicode string table supports. Language - must be a member of this set. - @param UnicodeStringTable A pointer to the table of Unicode strings. - @param UnicodeString A pointer to the Unicode string from UnicodeStringTable - that matches the language specified by Language. - - @retval EFI_SUCCESS The Unicode string that matches the language - specified by Language was found - in the table of Unicode strings UnicodeStringTable, - and it was returned in UnicodeString. - @retval EFI_INVALID_PARAMETER Language is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is NULL. - @retval EFI_UNSUPPORTED SupportedLanguages is NULL. - @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. - @retval EFI_UNSUPPORTED The language specified by Language is not a - member of SupportedLanguages. - @retval EFI_UNSUPPORTED The language specified by Language is not - supported by UnicodeStringTable. - -**/ -EFI_STATUS -EFIAPI -LookupUnicodeString ( - IN CONST CHAR8 *Language, - IN CONST CHAR8 *SupportedLanguages, - IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, - OUT CHAR16 **UnicodeString - ) -{ - // - // Make sure the parameters are valid - // - if (Language == NULL || UnicodeString == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // 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) { - return EFI_UNSUPPORTED; - } - - // - // Make sure Language is in the set of Supported Languages - // - 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 - // - *UnicodeString = UnicodeStringTable->UnicodeString; - return EFI_SUCCESS; - } - - UnicodeStringTable++; - } - - return EFI_UNSUPPORTED; - } - - SupportedLanguages += 3; - } - - return EFI_UNSUPPORTED; -} - - - -/** - This function looks up a Unicode string in UnicodeStringTable. - - If Language is a member of SupportedLanguages and a Unicode string is found in - UnicodeStringTable that matches the language code specified by Language, then - it is returned in UnicodeString. - - @param Language A pointer to an ASCII string containing the ISO 639-2 or the - RFC 4646 language code for the Unicode string to look up and - return. If Iso639Language is TRUE, then this ASCII string is - not assumed to be Null-terminated, and only the first three - characters are used. If Iso639Language is FALSE, then this ASCII - string must be Null-terminated. - @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a - set of ISO 639-2 or RFC 4646 language codes that the Unicode - string table supports. Language must be a member of this set. - If Iso639Language is TRUE, then this string contains one or more - ISO 639-2 language codes with no separator characters. If Iso639Language - is FALSE, then is string contains one or more RFC 4646 language - codes separated by ';'. - @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE - is defined in "Related Definitions". - @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable - that matches the language specified by Language. - @param Iso639Language Specifies the supported language code format. If it is TRUE, then - Language and SupportedLanguages follow ISO 639-2 language code format. - Otherwise, they follow RFC 4646 language code format. - - - @retval EFI_SUCCESS The Unicode string that matches the language specified by Language - was found in the table of Unicode strings UnicodeStringTable, and - it was returned in UnicodeString. - @retval EFI_INVALID_PARAMETER Language is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is NULL. - @retval EFI_UNSUPPORTED SupportedLanguages is NULL. - @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. - @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages. - @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable. - -**/ -EFI_STATUS -EFIAPI -LookupUnicodeString2 ( - IN CONST CHAR8 *Language, - IN CONST CHAR8 *SupportedLanguages, - IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, - OUT CHAR16 **UnicodeString, - IN BOOLEAN Iso639Language - ) -{ - BOOLEAN Found; - UINTN Index; - CHAR8 *LanguageString; - - // - // Make sure the parameters are valid - // - if (Language == NULL || UnicodeString == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // 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) { - return EFI_UNSUPPORTED; - } - - // - // Make sure Language is in the set of Supported Languages - // - Found = FALSE; - while (*SupportedLanguages != 0) { - if (Iso639Language) { - if (CompareIso639LanguageCode (Language, SupportedLanguages)) { - Found = TRUE; - break; - } - SupportedLanguages += 3; - } else { - for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++); - if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) { - Found = TRUE; - break; - } - SupportedLanguages += Index; - for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++); - } - } - - // - // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED - // - if (!Found) { - return EFI_UNSUPPORTED; - } - - // - // Search the Unicode String Table for the matching Language specifier - // - 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) { - *UnicodeString = UnicodeStringTable->UnicodeString; - return EFI_SUCCESS; - } - LanguageString += Index; - for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++); - } - UnicodeStringTable++; - } - - return EFI_UNSUPPORTED; -} - - -/** - This function adds a Unicode string to UnicodeStringTable. - - If Language is a member of SupportedLanguages then UnicodeString is added to - UnicodeStringTable. New buffers are allocated for both Language and - UnicodeString. The contents of Language and UnicodeString are copied into - these new buffers. These buffers are automatically freed when - FreeUnicodeStringTable() is called. - - @param Language A pointer to the ISO 639-2 language code for the Unicode - string to add. - @param SupportedLanguages A pointer to the set of ISO 639-2 language codes - that the Unicode string table supports. - Language must be a member of this set. - @param UnicodeStringTable A pointer to the table of Unicode strings. - @param UnicodeString A pointer to the Unicode string to add. - - @retval EFI_SUCCESS The Unicode string that matches the language - specified by Language was found in the table of - Unicode strings UnicodeStringTable, and it was - returned in UnicodeString. - @retval EFI_INVALID_PARAMETER Language is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. - @retval EFI_UNSUPPORTED SupportedLanguages is NULL. - @retval EFI_ALREADY_STARTED A Unicode string with language Language is - already present in UnicodeStringTable. - @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another - Unicode string to UnicodeStringTable. - @retval EFI_UNSUPPORTED The language specified by Language is not a - member of SupportedLanguages. - -**/ -EFI_STATUS -EFIAPI -AddUnicodeString ( - IN CONST CHAR8 *Language, - IN CONST CHAR8 *SupportedLanguages, - IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, - IN CONST CHAR16 *UnicodeString - ) -{ - UINTN NumberOfEntries; - EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable; - EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable; - UINTN UnicodeStringLength; - - // - // Make sure the parameter are valid - // - if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // If there are no supported languages, then a Unicode String can not be added - // - if (SupportedLanguages == NULL) { - return EFI_UNSUPPORTED; - } - - // - // If the Unicode String is empty, then a Unicode String can not be added - // - if (UnicodeString[0] == 0) { - return EFI_INVALID_PARAMETER; - } - - // - // Make sure Language is a member of SupportedLanguages - // - while (*SupportedLanguages != 0) { - if (CompareIso639LanguageCode (Language, SupportedLanguages)) { - - // - // Determine the size of the Unicode String Table by looking for a NULL Language entry - // - NumberOfEntries = 0; - if (*UnicodeStringTable != NULL) { - OldUnicodeStringTable = *UnicodeStringTable; - while (OldUnicodeStringTable->Language != NULL) { - if (CompareIso639LanguageCode (Language, OldUnicodeStringTable->Language)) { - return EFI_ALREADY_STARTED; - } - - OldUnicodeStringTable++; - NumberOfEntries++; - } - } - - // - // Allocate space for a new Unicode String Table. It must hold the current number of - // entries, plus 1 entry for the new Unicode String, plus 1 entry for the end of table - // marker - // - NewUnicodeStringTable = AllocatePool ((NumberOfEntries + 2) * sizeof (EFI_UNICODE_STRING_TABLE)); - if (NewUnicodeStringTable == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // If the current Unicode String Table contains any entries, then copy them to the - // newly allocated Unicode String Table. - // - if (*UnicodeStringTable != NULL) { - CopyMem ( - NewUnicodeStringTable, - *UnicodeStringTable, - NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE) - ); - } - - // - // Allocate space for a copy of the Language specifier - // - NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (3, Language); - if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) { - FreePool (NewUnicodeStringTable); - return EFI_OUT_OF_RESOURCES; - } - - // - // Compute the length of the Unicode String - // - 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 - ); - if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) { - FreePool (NewUnicodeStringTable[NumberOfEntries].Language); - FreePool (NewUnicodeStringTable); - return EFI_OUT_OF_RESOURCES; - } - - // - // Mark the end of the Unicode String Table - // - NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL; - NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL; - - // - // Free the old Unicode String Table - // - if (*UnicodeStringTable != NULL) { - FreePool (*UnicodeStringTable); - } - - // - // Point UnicodeStringTable at the newly allocated Unicode String Table - // - *UnicodeStringTable = NewUnicodeStringTable; - - return EFI_SUCCESS; - } - - SupportedLanguages += 3; - } - - return EFI_UNSUPPORTED; -} - - -/** - This function adds the Null-terminated Unicode string specified by UnicodeString - to UnicodeStringTable. - - If Language is a member of SupportedLanguages then UnicodeString is added to - UnicodeStringTable. New buffers are allocated for both Language and UnicodeString. - The contents of Language and UnicodeString are copied into these new buffers. - These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called. - - @param Language A pointer to an ASCII string containing the ISO 639-2 or - the RFC 4646 language code for the Unicode string to add. - If Iso639Language is TRUE, then this ASCII string is not - assumed to be Null-terminated, and only the first three - chacters are used. If Iso639Language is FALSE, then this - ASCII string must be Null-terminated. - @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains - a set of ISO 639-2 or RFC 4646 language codes that the Unicode - string table supports. Language must be a member of this set. - If Iso639Language is TRUE, then this string contains one or more - ISO 639-2 language codes with no separator characters. - If Iso639Language is FALSE, then is string contains one or more - RFC 4646 language codes separated by ';'. - @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE - is defined in "Related Definitions". - @param UnicodeString A pointer to the Unicode string to add. - @param Iso639Language Specifies the supported language code format. If it is TRUE, - then Language and SupportedLanguages follow ISO 639-2 language code format. - Otherwise, they follow RFC 4646 language code format. - - @retval EFI_SUCCESS The Unicode string that matches the language specified by - Language was found in the table of Unicode strings UnicodeStringTable, - and it was returned in UnicodeString. - @retval EFI_INVALID_PARAMETER Language is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is NULL. - @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. - @retval EFI_UNSUPPORTED SupportedLanguages is NULL. - @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in - UnicodeStringTable. - @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable. - @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages. - -**/ -EFI_STATUS -EFIAPI -AddUnicodeString2 ( - IN CONST CHAR8 *Language, - IN CONST CHAR8 *SupportedLanguages, - IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, - IN CONST CHAR16 *UnicodeString, - IN BOOLEAN Iso639Language - ) -{ - UINTN NumberOfEntries; - EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable; - EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable; - UINTN UnicodeStringLength; - BOOLEAN Found; - UINTN Index; - CHAR8 *LanguageString; - - // - // Make sure the parameter are valid - // - if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // If there are no supported languages, then a Unicode String can not be added - // - if (SupportedLanguages == NULL) { - return EFI_UNSUPPORTED; - } - - // - // If the Unicode String is empty, then a Unicode String can not be added - // - if (UnicodeString[0] == 0) { - return EFI_INVALID_PARAMETER; - } - - // - // Make sure Language is a member of SupportedLanguages - // - Found = FALSE; - while (*SupportedLanguages != 0) { - if (Iso639Language) { - if (CompareIso639LanguageCode (Language, SupportedLanguages)) { - Found = TRUE; - break; - } - SupportedLanguages += 3; - } else { - for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++); - if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) { - Found = TRUE; - break; - } - SupportedLanguages += Index; - for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++); - } - } - - // - // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED - // - if (!Found) { - return EFI_UNSUPPORTED; - } - - // - // Determine the size of the Unicode String Table by looking for a NULL Language entry - // - NumberOfEntries = 0; - if (*UnicodeStringTable != NULL) { - OldUnicodeStringTable = *UnicodeStringTable; - while (OldUnicodeStringTable->Language != NULL) { - LanguageString = OldUnicodeStringTable->Language; - - while (*LanguageString != 0) { - 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++); - } - OldUnicodeStringTable++; - NumberOfEntries++; - } - } - - // - // Allocate space for a new Unicode String Table. It must hold the current number of - // entries, plus 1 entry for the new Unicode String, plus 1 entry for the end of table - // marker - // - NewUnicodeStringTable = AllocatePool ((NumberOfEntries + 2) * sizeof (EFI_UNICODE_STRING_TABLE)); - if (NewUnicodeStringTable == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // If the current Unicode String Table contains any entries, then copy them to the - // newly allocated Unicode String Table. - // - if (*UnicodeStringTable != NULL) { - CopyMem ( - NewUnicodeStringTable, - *UnicodeStringTable, - NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE) - ); - } - - // - // Allocate space for a copy of the Language specifier - // - NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize(Language), Language); - if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) { - FreePool (NewUnicodeStringTable); - return EFI_OUT_OF_RESOURCES; - } - - // - // Compute the length of the Unicode String - // - for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++); - - // - // Allocate space for a copy of the Unicode String - // - NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (StrSize (UnicodeString), UnicodeString); - if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) { - FreePool (NewUnicodeStringTable[NumberOfEntries].Language); - FreePool (NewUnicodeStringTable); - return EFI_OUT_OF_RESOURCES; - } - - // - // Mark the end of the Unicode String Table - // - NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL; - NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL; - - // - // Free the old Unicode String Table - // - if (*UnicodeStringTable != NULL) { - FreePool (*UnicodeStringTable); - } - - // - // Point UnicodeStringTable at the newly allocated Unicode String Table - // - *UnicodeStringTable = NewUnicodeStringTable; - - return EFI_SUCCESS; -} - -/** - This function frees the table of Unicode strings in UnicodeStringTable. - - If UnicodeStringTable is NULL, then EFI_SUCCESS is returned. - Otherwise, each language code, and each Unicode string in the Unicode string - table are freed, and EFI_SUCCESS is returned. - - @param UnicodeStringTable A pointer to the table of Unicode strings. - - @retval EFI_SUCCESS The Unicode string table was freed. - -**/ -EFI_STATUS -EFIAPI -FreeUnicodeStringTable ( - IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable - ) -{ - UINTN Index; - - // - // If the Unicode String Table is NULL, then it is already freed - // - if (UnicodeStringTable == NULL) { - return EFI_SUCCESS; - } - - // - // 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 - // - FreePool (UnicodeStringTable[Index].Language); - - // - // Free the Unicode String from the Unicode String Table - // - if (UnicodeStringTable[Index].UnicodeString != NULL) { - FreePool (UnicodeStringTable[Index].UnicodeString); - } - } - - // - // Free the Unicode String Table itself - // - FreePool (UnicodeStringTable); - - return EFI_SUCCESS; -} - -#ifndef DISABLE_NEW_DEPRECATED_INTERFACES - -/** - [ATTENTION] This function will be deprecated for security reason. - - Returns a pointer to an allocated buffer that contains the contents of a - variable retrieved through the UEFI Runtime Service GetVariable(). The - returned buffer is allocated using AllocatePool(). The caller is responsible - for freeing this buffer with FreePool(). - - If Name is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param[in] Name The pointer to a Null-terminated Unicode string. - @param[in] Guid The pointer to an EFI_GUID structure - - @retval NULL The variable could not be retrieved. - @retval NULL There are not enough resources available for the variable contents. - @retval Other A pointer to allocated buffer containing the variable contents. - -**/ -VOID * -EFIAPI -GetVariable ( - IN CONST CHAR16 *Name, - IN CONST EFI_GUID *Guid - ) -{ - EFI_STATUS Status; - UINTN Size; - VOID *Value; - - ASSERT (Name != NULL); - ASSERT (Guid != NULL); - - // - // Try to get the variable size. - // - Value = NULL; - Size = 0; - Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &Size, Value); - if (Status != EFI_BUFFER_TOO_SMALL) { - return NULL; - } - - // - // Allocate buffer to get the variable. - // - Value = AllocatePool (Size); - if (Value == NULL) { - return NULL; - } - - // - // Get the variable data. - // - Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &Size, Value); - if (EFI_ERROR (Status)) { - FreePool(Value); - return NULL; - } - - return Value; -} - -/** - [ATTENTION] This function will be deprecated for security reason. - - Returns a pointer to an allocated buffer that contains the contents of a - variable retrieved through the UEFI Runtime Service GetVariable(). This - function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. - The returned buffer is allocated using AllocatePool(). The caller is - responsible for freeing this buffer with FreePool(). - - If Name is NULL, then ASSERT(). - - @param[in] Name The pointer to a Null-terminated Unicode string. - - @retval NULL The variable could not be retrieved. - @retval NULL There are not enough resources available for the variable contents. - @retval Other A pointer to allocated buffer containing the variable contents. - -**/ -VOID * -EFIAPI -GetEfiGlobalVariable ( - IN CONST CHAR16 *Name - ) -{ - return GetVariable (Name, &gEfiGlobalVariableGuid); -} -#endif - -/** - Returns the status whether get the variable success. The function retrieves - variable through the UEFI Runtime Service GetVariable(). The - returned buffer is allocated using AllocatePool(). The caller is responsible - for freeing this buffer with FreePool(). - - If Name is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - If Value is NULL, then ASSERT(). - - @param[in] Name The pointer to a Null-terminated Unicode string. - @param[in] Guid The pointer to an EFI_GUID structure - @param[out] Value The buffer point saved the variable info. - @param[out] Size The buffer size of the variable. - - @return EFI_OUT_OF_RESOURCES Allocate buffer failed. - @return EFI_SUCCESS Find the specified variable. - @return Others Errors Return errors from call to gRT->GetVariable. - -**/ -EFI_STATUS -EFIAPI -GetVariable2 ( - IN CONST CHAR16 *Name, - IN CONST EFI_GUID *Guid, - OUT VOID **Value, - OUT UINTN *Size OPTIONAL - ) -{ - EFI_STATUS Status; - UINTN BufferSize; - - ASSERT (Name != NULL && Guid != NULL && Value != NULL); - - // - // Try to get the variable size. - // - BufferSize = 0; - *Value = NULL; - if (Size != NULL) { - *Size = 0; - } - - Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); - if (Status != EFI_BUFFER_TOO_SMALL) { - return Status; - } - - // - // Allocate buffer to get the variable. - // - *Value = AllocatePool (BufferSize); - ASSERT (*Value != NULL); - if (*Value == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get the variable data. - // - Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); - if (EFI_ERROR (Status)) { - FreePool(*Value); - *Value = NULL; - } - - if (Size != NULL) { - *Size = BufferSize; - } - - return Status; -} - -/** Return the attributes of the variable. - - Returns the status whether get the variable success. The function retrieves - variable through the UEFI Runtime Service GetVariable(). The - returned buffer is allocated using AllocatePool(). The caller is responsible - for freeing this buffer with FreePool(). The attributes are returned if - the caller provides a valid Attribute parameter. - - If Name is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - If Value is NULL, then ASSERT(). - - @param[in] Name The pointer to a Null-terminated Unicode string. - @param[in] Guid The pointer to an EFI_GUID structure - @param[out] Value The buffer point saved the variable info. - @param[out] Size The buffer size of the variable. - @param[out] Attr The pointer to the variable attributes as found in var store - - @retval EFI_OUT_OF_RESOURCES Allocate buffer failed. - @retval EFI_SUCCESS Find the specified variable. - @retval Others Errors Return errors from call to gRT->GetVariable. - -**/ -EFI_STATUS -EFIAPI -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); - - // - // Try to get the variable size. - // - BufferSize = 0; - *Value = NULL; - if (Size != NULL) { - *Size = 0; - } - - if (Attr != NULL) { - *Attr = 0; - } - - Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value); - if (Status != EFI_BUFFER_TOO_SMALL) { - return Status; - } - - // - // Allocate buffer to get the variable. - // - *Value = AllocatePool(BufferSize); - ASSERT(*Value != NULL); - if (*Value == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get the variable data. - // - Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value); - if (EFI_ERROR(Status)) { - FreePool(*Value); - *Value = NULL; - } - - if (Size != NULL) { - *Size = BufferSize; - } - - return Status; -} - -/** - Returns a pointer to an allocated buffer that contains the contents of a - variable retrieved through the UEFI Runtime Service GetVariable(). This - function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. - The returned buffer is allocated using AllocatePool(). The caller is - responsible for freeing this buffer with FreePool(). - - If Name is NULL, then ASSERT(). - If Value is NULL, then ASSERT(). - - @param[in] Name The pointer to a Null-terminated Unicode string. - @param[out] Value The buffer point saved the variable info. - @param[out] Size The buffer size of the variable. - - @return EFI_OUT_OF_RESOURCES Allocate buffer failed. - @return EFI_SUCCESS Find the specified variable. - @return Others Errors Return errors from call to gRT->GetVariable. - -**/ -EFI_STATUS -EFIAPI -GetEfiGlobalVariable2 ( - IN CONST CHAR16 *Name, - OUT VOID **Value, - OUT UINTN *Size OPTIONAL - ) -{ - return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); -} - -/** - Returns a pointer to an allocated buffer that contains the best matching language - from a set of supported languages. - - This function supports both ISO 639-2 and RFC 4646 language codes, but language - code types may not be mixed in a single call to this function. The language - code returned is allocated using AllocatePool(). The caller is responsible for - freeing the allocated buffer using FreePool(). This function supports a variable - argument list that allows the caller to pass in a prioritized list of language - codes to test against all the language codes in SupportedLanguages. - - If SupportedLanguages is NULL, then ASSERT(). - - @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that - contains a set of language codes in the format - specified by Iso639Language. - @param[in] Iso639Language If not zero, then all language codes are assumed to be - in ISO 639-2 format. If zero, then all language - codes are assumed to be in RFC 4646 language format - @param[in] ... A variable argument list that contains pointers to - Null-terminated ASCII strings that contain one or more - language codes in the format specified by Iso639Language. - The first language code from each of these language - code lists is used to determine if it is an exact or - close match to any of the language codes in - SupportedLanguages. Close matches only apply to RFC 4646 - language codes, and the matching algorithm from RFC 4647 - is used to determine if a close match is present. If - an exact or close match is found, then the matching - language code from SupportedLanguages is returned. If - no matches are found, then the next variable argument - parameter is evaluated. The variable argument list - is terminated by a NULL. - - @retval NULL The best matching language could not be found in SupportedLanguages. - @retval NULL There are not enough resources available to return the best matching - language. - @retval Other A pointer to a Null-terminated ASCII string that is the best matching - language in SupportedLanguages. - -**/ -CHAR8 * -EFIAPI -GetBestLanguage ( - IN CONST CHAR8 *SupportedLanguages, - IN UINTN Iso639Language, - ... - ) -{ - VA_LIST Args; - CHAR8 *Language; - UINTN CompareLength; - UINTN LanguageLength; - CONST CHAR8 *Supported; - CHAR8 *BestLanguage; - - ASSERT (SupportedLanguages != NULL); - - VA_START (Args, Iso639Language); - while ((Language = VA_ARG (Args, CHAR8 *)) != NULL) { - // - // Default to ISO 639-2 mode - // - CompareLength = 3; - LanguageLength = MIN (3, AsciiStrLen (Language)); - - // - // 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++); - } - - // - // Trim back the length of Language used until it is empty - // - while (LanguageLength > 0) { - // - // Loop through all language codes in SupportedLanguages - // - for (Supported = SupportedLanguages; *Supported != '\0'; Supported += CompareLength) { - // - // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages - // - if (Iso639Language == 0) { - // - // Skip ';' characters in 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++); - // - // If Language is longer than the Supported, then skip to the next language - // - if (LanguageLength > CompareLength) { - continue; - } - } - // - // See if the first LanguageLength characters in Supported match Language - // - if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) { - VA_END (Args); - // - // Allocate, copy, and return the best matching language code from SupportedLanguages - // - BestLanguage = AllocateZeroPool (CompareLength + 1); - if (BestLanguage == NULL) { - return NULL; - } - return CopyMem (BestLanguage, Supported, CompareLength); - } - } - - if (Iso639Language != 0) { - // - // If ISO 639 mode, then each language can only be tested once - // - LanguageLength = 0; - } else { - // - // If RFC 4646 mode, then trim Language from the right to the next '-' character - // - for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--); - } - } - } - VA_END (Args); - - // - // No matches were found - // - return NULL; -} - -/** - Returns an array of protocol instance that matches the given protocol. - - @param[in] Protocol Provides the protocol to search for. - @param[out] NoProtocols The number of protocols returned in Buffer. - @param[out] Buffer A pointer to the buffer to return the requested - array of protocol instances that match Protocol. - The returned buffer is allocated using - EFI_BOOT_SERVICES.AllocatePool(). The caller is - responsible for freeing this buffer with - EFI_BOOT_SERVICES.FreePool(). - - @retval EFI_SUCCESS The array of protocols was returned in Buffer, - and the number of protocols in Buffer was - returned in NoProtocols. - @retval EFI_NOT_FOUND No protocols found. - @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the - matching results. - @retval EFI_INVALID_PARAMETER Protocol is NULL. - @retval EFI_INVALID_PARAMETER NoProtocols is NULL. - @retval EFI_INVALID_PARAMETER Buffer is NULL. - -**/ -EFI_STATUS -EFIAPI -EfiLocateProtocolBuffer ( - IN EFI_GUID *Protocol, - OUT UINTN *NoProtocols, - OUT VOID ***Buffer - ) -{ - EFI_STATUS Status; - UINTN NoHandles; - EFI_HANDLE *HandleBuffer; - UINTN Index; - - // - // Check input parameters - // - if (Protocol == NULL || NoProtocols == NULL || Buffer == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // Initialze output parameters - // - *NoProtocols = 0; - *Buffer = NULL; - - // - // Retrieve the array of handles that support Protocol - // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - Protocol, - NULL, - &NoHandles, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Allocate array of protocol instances - // - Status = gBS->AllocatePool ( - EfiBootServicesData, - NoHandles * sizeof (VOID *), - (VOID **)Buffer - ); - if (EFI_ERROR (Status)) { - // - // Free the handle buffer - // - gBS->FreePool (HandleBuffer); - return EFI_OUT_OF_RESOURCES; - } - ZeroMem (*Buffer, NoHandles * sizeof (VOID *)); - - // - // Lookup Protocol on each handle in HandleBuffer to fill in the array of - // protocol instances. Handle case where protocol instance was present when - // LocateHandleBuffer() was called, but is not present when HandleProtocol() - // is called. - // - for (Index = 0, *NoProtocols = 0; Index < NoHandles; Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - Protocol, - &((*Buffer)[*NoProtocols]) - ); - if (!EFI_ERROR (Status)) { - (*NoProtocols)++; - } - } - - // - // Free the handle buffer - // - gBS->FreePool (HandleBuffer); - - // - // Make sure at least one protocol instance was found - // - if (*NoProtocols == 0) { - gBS->FreePool (*Buffer); - *Buffer = NULL; - return EFI_NOT_FOUND; - } - - return EFI_SUCCESS; -} - -/** - Open or create a file or directory, possibly creating the chain of - directories leading up to the directory. - - EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on - FilePath, and opens the root directory of that filesystem with - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume(). - - On the remaining device path, the longest initial sequence of - FILEPATH_DEVICE_PATH nodes is node-wise traversed with - EFI_FILE_PROTOCOL.Open(). - - (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes - includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single - pathname component, then EfiOpenFileByDevicePath() ensures that the specified - series of subdirectories exist on return.) - - The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is - output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If - there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the - filesystem, then the EFI_FILE_PROTOCOL of the root directory of the - filesystem is output to the caller. If a device path node that is different - from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the - traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output. - - @param[in,out] FilePath On input, the device path to the file or directory - to open or create. The caller is responsible for - ensuring that the device path pointed-to by FilePath - is well-formed. On output, FilePath points one past - the last node in the original device path that has - been successfully processed. FilePath is set on - output even if EfiOpenFileByDevicePath() returns an - error. - - @param[out] File On error, File is set to NULL. On success, File is - set to the EFI_FILE_PROTOCOL of the root directory - of the filesystem, if there are no - FILEPATH_DEVICE_PATH nodes in FilePath; otherwise, - File is set to the EFI_FILE_PROTOCOL identified by - the last node in FilePath. - - @param[in] OpenMode The OpenMode parameter to pass to - EFI_FILE_PROTOCOL.Open(). - - @param[in] Attributes The Attributes parameter to pass to - EFI_FILE_PROTOCOL.Open(). - - @retval EFI_SUCCESS The file or directory has been opened or - created. - - @retval EFI_INVALID_PARAMETER FilePath is NULL; or File is NULL; or FilePath - contains a device path node, past the node - that identifies - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a - FILEPATH_DEVICE_PATH node. - - @retval EFI_OUT_OF_RESOURCES Memory allocation failed. - - @return Error codes propagated from the - LocateDevicePath() and OpenProtocol() boot - services, and from the - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume() - and EFI_FILE_PROTOCOL.Open() member functions. -**/ -EFI_STATUS -EFIAPI -EfiOpenFileByDevicePath ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, - OUT EFI_FILE_PROTOCOL **File, - IN UINT64 OpenMode, - 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; - - if (File == NULL) { - return EFI_INVALID_PARAMETER; - } - *File = NULL; - - if (FilePath == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // Look up the filesystem. - // - Status = gBS->LocateDevicePath ( - &gEfiSimpleFileSystemProtocolGuid, - FilePath, - &FileSystemHandle - ); - if (EFI_ERROR (Status)) { - return Status; - } - Status = gBS->OpenProtocol ( - FileSystemHandle, - &gEfiSimpleFileSystemProtocolGuid, - (VOID **)&FileSystem, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Open the root directory of the filesystem. After this operation succeeds, - // we have to release LastFile on error. - // - Status = FileSystem->OpenVolume (FileSystem, &LastFile); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Traverse the device path nodes relative to the filesystem. - // - while (!IsDevicePathEnd (*FilePath)) { - if (DevicePathType (*FilePath) != MEDIA_DEVICE_PATH || - DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP) { - Status = EFI_INVALID_PARAMETER; - goto CloseLastFile; - } - FilePathNode = (FILEPATH_DEVICE_PATH *)*FilePath; - - // - // FilePathNode->PathName may be unaligned, and the UEFI specification - // requires pointers that are passed to protocol member functions to be - // aligned. Create an aligned copy of the pathname if necessary. - // - if ((UINTN)FilePathNode->PathName % sizeof *FilePathNode->PathName == 0) { - AlignedPathName = NULL; - PathName = FilePathNode->PathName; - } else { - AlignedPathName = AllocateCopyPool ( - (DevicePathNodeLength (FilePathNode) - - SIZE_OF_FILEPATH_DEVICE_PATH), - FilePathNode->PathName - ); - if (AlignedPathName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto CloseLastFile; - } - PathName = AlignedPathName; - } - - // - // Open or create the file corresponding to the next pathname fragment. - // - Status = LastFile->Open ( - LastFile, - &NextFile, - PathName, - OpenMode, - Attributes - ); - - // - // Release any AlignedPathName on both error and success paths; PathName is - // no longer needed. - // - if (AlignedPathName != NULL) { - FreePool (AlignedPathName); - } - if (EFI_ERROR (Status)) { - goto CloseLastFile; - } - - // - // Advance to the next device path node. - // - LastFile->Close (LastFile); - LastFile = NextFile; - *FilePath = NextDevicePathNode (FilePathNode); - } - - *File = LastFile; - return EFI_SUCCESS; - -CloseLastFile: - LastFile->Close (LastFile); - - // - // We are on the error path; we must have set an error Status for returning - // to the caller. - // - ASSERT (EFI_ERROR (Status)); - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.inf deleted file mode 100644 index b40c8cf..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.inf +++ /dev/null @@ -1,93 +0,0 @@ -## @file -# Instance of UEFI Library. -# -# The UEFI Library provides functions and macros that simplify the development of -# UEFI Drivers and UEFI Applications. These functions and macros help manage EFI -# events, build simple locks utilizing EFI Task Priority Levels (TPLs), install -# EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, -# and print messages on the console output and standard error devices. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiLib - MODULE_UNI_FILE = UefiLib.uni - FILE_GUID = 3a004ba5-efe0-4a61-9f1a-267a46ae5ba9 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - CONSTRUCTOR = UefiLibConstructor - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiLibPrint.c - UefiNotTiano.c - UefiDriverModel.c - Console.c - UefiLib.c - UefiLibInternal.h - Acpi.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - PrintLib - PcdLib - MemoryAllocationLib - DebugLib - BaseMemoryLib - BaseLib - UefiBootServicesTableLib - DevicePathLib - UefiRuntimeServicesTableLib - -[Guids] - gEfiEventReadyToBootGuid ## SOMETIMES_CONSUMES ## Event - gEfiEventLegacyBootGuid ## SOMETIMES_CONSUMES ## Event - gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## Variable - gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable - -[Protocols] - gEfiDriverBindingProtocolGuid ## SOMETIMES_PRODUCES - gEfiSimpleTextOutProtocolGuid ## SOMETIMES_CONSUMES - gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES - gEfiHiiFontProtocolGuid ## SOMETIMES_CONSUMES - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - gEfiUgaDrawProtocolGuid | gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## SOMETIMES_CONSUMES # Consumes if gEfiGraphicsOutputProtocolGuid uninstalled - gEfiComponentNameProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable ## SOMETIMES_PRODUCES # User chooses to produce it - gEfiComponentName2ProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable ## SOMETIMES_PRODUCES # User chooses to produce it - gEfiDriverConfigurationProtocolGuid ## SOMETIMES_PRODUCES # User chooses to produce it - gEfiDriverConfiguration2ProtocolGuid ## SOMETIMES_PRODUCES # User chooses to produce it - gEfiDriverDiagnosticsProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable ## SOMETIMES_PRODUCES # User chooses to produce it - gEfiDriverDiagnostics2ProtocolGuid| NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## SOMETIMES_PRODUCES # User chooses to produce it - - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## SOMETIMES_CONSUMES - -[FeaturePcd] - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.uni deleted file mode 100644 index d8bf83e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLib.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// Instance of UEFI Library. -// -// The UEFI Library provides functions and macros that simplify the development of -// UEFI Drivers and UEFI Applications. These functions and macros help manage EFI -// events, build simple locks utilizing EFI Task Priority Levels (TPLs), install -// EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, -// and print messages on the console output and standard error devices. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of UEFI Library" - -#string STR_MODULE_DESCRIPTION #language en-US "The UEFI Library provides functions and macros that simplify the development of UEFI Drivers and UEFI Applications. These functions and macros help manage EFI events, build simple locks utilizing EFI Task Priority Levels (TPLs), install EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, and print messages on the console output and standard error devices." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibInternal.h deleted file mode 100644 index 4a3145c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibInternal.h +++ /dev/null @@ -1,44 +0,0 @@ -/** @file - Internal include file for UefiLib. - - Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef __UEFI_LIB_INTERNAL_H_ -#define __UEFI_LIB_INTERNAL_H_ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c deleted file mode 100644 index d93686b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c +++ /dev/null @@ -1,822 +0,0 @@ -/** @file - Mde UEFI library API implementation. - Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiLibInternal.h" - -GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { - { 0x00, 0x00, 0x00, 0x00 }, - { 0x98, 0x00, 0x00, 0x00 }, - { 0x00, 0x98, 0x00, 0x00 }, - { 0x98, 0x98, 0x00, 0x00 }, - { 0x00, 0x00, 0x98, 0x00 }, - { 0x98, 0x00, 0x98, 0x00 }, - { 0x00, 0x98, 0x98, 0x00 }, - { 0x98, 0x98, 0x98, 0x00 }, - { 0x10, 0x10, 0x10, 0x00 }, - { 0xff, 0x10, 0x10, 0x00 }, - { 0x10, 0xff, 0x10, 0x00 }, - { 0xff, 0xff, 0x10, 0x00 }, - { 0x10, 0x10, 0xff, 0x00 }, - { 0xf0, 0x10, 0xff, 0x00 }, - { 0x10, 0xff, 0xff, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 } -}; - -/** - Internal function which prints a formatted Unicode string to the console output device - specified by Console - - This function prints a formatted Unicode string to the console output device - specified by Console and returns the number of Unicode characters that printed - to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, - then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console. - If Format is NULL, then ASSERT(). - If Format is not aligned on a 16-bit boundary, then ASSERT(). - - @param Format A Null-terminated Unicode format string. - @param Console The output console. - @param Marker A VA_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced - output buffer, not including the Null-terminator. -**/ -UINTN -InternalPrint ( - IN CONST CHAR16 *Format, - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, - IN VA_LIST Marker - ) -{ - EFI_STATUS Status; - UINTN Return; - CHAR16 *Buffer; - UINTN BufferSize; - - ASSERT (Format != NULL); - ASSERT (((UINTN) Format & BIT0) == 0); - ASSERT (Console != NULL); - - BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16); - - Buffer = (CHAR16 *) AllocatePool(BufferSize); - ASSERT (Buffer != NULL); - - Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker); - - if (Console != NULL && Return > 0) { - // - // To be extra safe make sure Console has been initialized - // - Status = Console->OutputString (Console, Buffer); - if (EFI_ERROR (Status)) { - Return = 0; - } - } - - FreePool (Buffer); - - return Return; -} - -/** - Prints a formatted Unicode string to the console output device specified by - ConOut defined in the EFI_SYSTEM_TABLE. - - This function prints a formatted Unicode string to the console output device - specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode - characters that printed to ConOut. If the length of the formatted Unicode - string is greater than PcdUefiLibMaxPrintBufferSize, then only the first - PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. - If Format is NULL, then ASSERT(). - If Format is not aligned on a 16-bit boundary, then ASSERT(). - If gST->ConOut is NULL, then ASSERT(). - - @param Format A Null-terminated Unicode format string. - @param ... A Variable argument list whose contents are accessed based - on the format string specified by Format. - - @return The number of Unicode characters printed to ConOut. - -**/ -UINTN -EFIAPI -Print ( - IN CONST CHAR16 *Format, - ... - ) -{ - VA_LIST Marker; - UINTN Return; - - VA_START (Marker, Format); - - Return = InternalPrint (Format, gST->ConOut, Marker); - - VA_END (Marker); - - return Return; -} - -/** - Prints a formatted Unicode string to the console output device specified by - StdErr defined in the EFI_SYSTEM_TABLE. - - This function prints a formatted Unicode string to the console output device - specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode - characters that printed to StdErr. If the length of the formatted Unicode - string is greater than PcdUefiLibMaxPrintBufferSize, then only the first - PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. - If Format is NULL, then ASSERT(). - If Format is not aligned on a 16-bit boundary, then ASSERT(). - If gST->StdErr is NULL, then ASSERT(). - - @param Format A Null-terminated Unicode format string. - @param ... Variable argument list whose contents are accessed based - on the format string specified by Format. - - @return The number of Unicode characters printed to StdErr. - -**/ -UINTN -EFIAPI -ErrorPrint ( - IN CONST CHAR16 *Format, - ... - ) -{ - VA_LIST Marker; - UINTN Return; - - VA_START (Marker, Format); - - 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 - - This function prints a formatted ASCII string to the console output device - specified by Console and returns the number of ASCII characters that printed - to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, - then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console. - - If Format is NULL, then ASSERT(). - - @param Format A Null-terminated ASCII format string. - @param Console The output console. - @param Marker VA_LIST marker for the variable argument list. - - @return The number of Unicode characters in the produced - output buffer not including the Null-terminator. - -**/ -UINTN -AsciiInternalPrint ( - IN CONST CHAR8 *Format, - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, - IN VA_LIST Marker - ) -{ - EFI_STATUS Status; - UINTN Return; - CHAR16 *Buffer; - UINTN BufferSize; - - ASSERT (Format != NULL); - ASSERT (Console != NULL); - - BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16); - - Buffer = (CHAR16 *) AllocatePool(BufferSize); - ASSERT (Buffer != NULL); - - Return = UnicodeVSPrintAsciiFormat (Buffer, BufferSize, Format, Marker); - - if (Console != NULL) { - // - // To be extra safe make sure Console has been initialized - // - Status = Console->OutputString (Console, Buffer); - if (EFI_ERROR (Status)) { - Return = 0; - } - } - - FreePool (Buffer); - - return Return; -} - -/** - Prints a formatted ASCII string to the console output device specified by - ConOut defined in the EFI_SYSTEM_TABLE. - - This function prints a formatted ASCII string to the console output device - specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII - characters that printed to ConOut. If the length of the formatted ASCII - string is greater than PcdUefiLibMaxPrintBufferSize, then only the first - PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. - If Format is NULL, then ASSERT(). - If gST->ConOut is NULL, then ASSERT(). - - @param Format A Null-terminated ASCII format string. - @param ... Variable argument list whose contents are accessed based - on the format string specified by Format. - - @return The number of ASCII characters printed to ConOut. - -**/ -UINTN -EFIAPI -AsciiPrint ( - IN CONST CHAR8 *Format, - ... - ) -{ - VA_LIST Marker; - UINTN Return; - ASSERT (Format != NULL); - - VA_START (Marker, Format); - - Return = AsciiInternalPrint( Format, gST->ConOut, Marker); - - VA_END (Marker); - - return Return; -} - -/** - Prints a formatted ASCII string to the console output device specified by - StdErr defined in the EFI_SYSTEM_TABLE. - - This function prints a formatted ASCII string to the console output device - specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII - characters that printed to StdErr. If the length of the formatted ASCII - string is greater than PcdUefiLibMaxPrintBufferSize, then only the first - PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. - If Format is NULL, then ASSERT(). - If gST->StdErr is NULL, then ASSERT(). - - @param Format A Null-terminated ASCII format string. - @param ... Variable argument list whose contents are accessed based - on the format string specified by Format. - - @return The number of ASCII characters printed to ConErr. - -**/ -UINTN -EFIAPI -AsciiErrorPrint ( - IN CONST CHAR8 *Format, - ... - ) -{ - VA_LIST Marker; - UINTN Return; - - ASSERT (Format != NULL); - - VA_START (Marker, Format); - - Return = AsciiInternalPrint( Format, gST->StdErr, Marker); - - VA_END (Marker); - - return Return; -} - -/** - Internal function to print a formatted Unicode string to a graphics console device specified by - ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates. - - This function prints a formatted Unicode string to the graphics console device - specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of - Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the - string to a bitmap using the glyphs registered with the - HII database. No wrapping is performed, so any portions of the string the fall - outside the active display region will not be displayed. - - If a graphics console device is not associated with the ConsoleOutputHandle - defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. - If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no - string is printed, and 0 is returned. - - @param PointX An X coordinate to print the string. - @param PointY A Y coordinate to print the string. - @param Foreground The foreground color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the foreground color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param Background The background color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the background color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param Buffer A Null-terminated Unicode formatted string. - @param PrintNum The number of Unicode formatted string to be printed. - - @return The number of Unicode Characters printed. Zero means no any character - displayed successfully. - -**/ -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 - ) -{ - 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); - - Status = gBS->HandleProtocol ( - ConsoleHandle, - &gEfiGraphicsOutputProtocolGuid, - (VOID **) &GraphicsOutput - ); - - UgaDraw = NULL; - if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { - // - // If no GOP available, try to open UGA Draw protocol if supported. - // - GraphicsOutput = NULL; - - Status = gBS->HandleProtocol ( - ConsoleHandle, - &gEfiUgaDrawProtocolGuid, - (VOID **) &UgaDraw - ); - } - if (EFI_ERROR (Status)) { - goto Error; - } - - Status = gBS->HandleProtocol ( - ConsoleHandle, - &gEfiSimpleTextOutProtocolGuid, - (VOID **) &Sto - ); - - if (EFI_ERROR (Status)) { - goto Error; - } - - if (GraphicsOutput != NULL) { - HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; - 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)); - - Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont); - if (EFI_ERROR (Status)) { - goto Error; - } - - Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT)); - ASSERT (Blt != NULL); - - Blt->Width = (UINT16) (HorizontalResolution); - Blt->Height = (UINT16) (VerticalResolution); - - ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO)); - - if (Foreground != NULL) { - CopyMem (&FontInfo.ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - } else { - CopyMem ( - &FontInfo.ForegroundColor, - &mEfiColors[Sto->Mode->Attribute & 0x0f], - sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - ); - } - if (Background != NULL) { - CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - } else { - CopyMem ( - &FontInfo.BackgroundColor, - &mEfiColors[Sto->Mode->Attribute >> 4], - sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - ); - } - - if (GraphicsOutput != NULL) { - 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 - ); - if (EFI_ERROR (Status)) { - goto Error; - } - - } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { - ASSERT (UgaDraw!= NULL); - - // - // Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow. - // - if (Blt->Width > DivU64x32 (MAX_UINTN, Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) { - goto Error; - } - - Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - ASSERT (Blt->Image.Bitmap != NULL); - - // - // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform, - // 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 - ); - - if (!EFI_ERROR (Status)) { - ASSERT (RowInfoArray != NULL); - // - // Explicit Line break characters are ignored, so the updated parameter RowInfoArraySize by StringToImage will - // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure. - // - ASSERT (RowInfoArraySize <= 1); - - if (RowInfoArraySize != 0) { - Width = RowInfoArray[0].LineWidth; - Height = RowInfoArray[0].LineHeight; - Delta = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL); - } else { - Width = 0; - Height = 0; - Delta = 0; - } - Status = UgaDraw->Blt ( - UgaDraw, - (EFI_UGA_PIXEL *) Blt->Image.Bitmap, - EfiUgaBltBufferToVideo, - PointX, - PointY, - PointX, - PointY, - Width, - Height, - Delta - ); - } else { - goto Error; - } - FreePool (Blt->Image.Bitmap); - } else { - goto Error; - } - // - // Calculate the number of actual printed characters - // - if (RowInfoArraySize != 0) { - PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1; - } else { - PrintNum = 0; - } - - FreePool (RowInfoArray); - FreePool (Blt); - return PrintNum; - -Error: - if (Blt != NULL) { - FreePool (Blt); - } - return 0; -} - -/** - Prints a formatted Unicode string to a graphics console device specified by - ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates. - - This function prints a formatted Unicode string to the graphics console device - specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of - Unicode characters displayed, not including partial characters that may be clipped - by the right edge of the display. If the length of the formatted Unicode string is - greater than PcdUefiLibMaxPrintBufferSize, then at most the first - PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL - StringToImage() service is used to convert the string to a bitmap using the glyphs - registered with the HII database. No wrapping is performed, so any portions of the - string the fall outside the active display region will not be displayed. Please see - Section 27.2.6 of the UEFI Specification for a description of the supported string - format including the set of control codes supported by the StringToImage() service. - - If a graphics console device is not associated with the ConsoleOutputHandle - defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. - If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no - string is printed, and 0 is returned. - If Format is NULL, then ASSERT(). - If Format is not aligned on a 16-bit boundary, then ASSERT(). - If gST->ConsoleOutputHandle is NULL, then ASSERT(). - - @param PointX An X coordinate to print the string. - @param PointY A Y coordinate to print the string. - @param ForeGround The foreground color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the foreground color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param BackGround The background color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the background color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param Format A Null-terminated Unicode format string. See Print Library - for the supported format string syntax. - @param ... A Variable argument list whose contents are accessed based on - the format string specified by Format. - - @return The number of Unicode characters printed. - -**/ -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, - ... - ) -{ - VA_LIST Marker; - CHAR16 *Buffer; - UINTN BufferSize; - UINTN PrintNum; - UINTN ReturnNum; - - ASSERT (Format != NULL); - ASSERT (((UINTN) Format & BIT0) == 0); - - VA_START (Marker, Format); - - BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16); - - Buffer = (CHAR16 *) AllocatePool (BufferSize); - ASSERT (Buffer != NULL); - - PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker); - - VA_END (Marker); - - ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); - - FreePool (Buffer); - - return ReturnNum; -} - -/** - Prints a formatted ASCII string to a graphics console device specified by - ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates. - - This function prints a formatted ASCII string to the graphics console device - specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of - ASCII characters displayed, not including partial characters that may be clipped - by the right edge of the display. If the length of the formatted ASCII string is - greater than PcdUefiLibMaxPrintBufferSize, then at most the first - PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL - StringToImage() service is used to convert the string to a bitmap using the glyphs - registered with the HII database. No wrapping is performed, so any portions of the - string the fall outside the active display region will not be displayed. Please see - Section 27.2.6 of the UEFI Specification for a description of the supported string - format including the set of control codes supported by the StringToImage() service. - - If a graphics console device is not associated with the ConsoleOutputHandle - defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. - If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no - string is printed, and 0 is returned. - If Format is NULL, then ASSERT(). - If gST->ConsoleOutputHandle is NULL, then ASSERT(). - - @param PointX An X coordinate to print the string. - @param PointY A Y coordinate to print the string. - @param ForeGround The foreground color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the foreground color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param BackGround The background color of the string being printed. This is - an optional parameter that may be NULL. If it is NULL, - then the background color of the current ConOut device - in the EFI_SYSTEM_TABLE is used. - @param Format A Null-terminated ASCII format string. See Print Library - for the supported format string syntax. - @param ... Variable argument list whose contents are accessed based on - the format string specified by Format. - - @return The number of ASCII characters printed. - -**/ -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, - ... - ) -{ - VA_LIST Marker; - CHAR16 *Buffer; - UINTN BufferSize; - UINTN PrintNum; - UINTN ReturnNum; - - ASSERT (Format != NULL); - - VA_START (Marker, Format); - - BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16); - - Buffer = (CHAR16 *) AllocatePool (BufferSize); - ASSERT (Buffer != NULL); - - PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker); - - VA_END (Marker); - - ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); - - FreePool (Buffer); - - return ReturnNum; -} - -/** - Appends a formatted Unicode string to a Null-terminated Unicode string - - This function appends a formatted Unicode string to the Null-terminated - Unicode string specified by String. String is optional and may be NULL. - Storage for the formatted Unicode string returned is allocated using - AllocatePool(). The pointer to the appended string is returned. The caller - is responsible for freeing the returned string. - - If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). - If FormatString is NULL, then ASSERT(). - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - @param[in] String A Null-terminated Unicode string. - @param[in] FormatString A Null-terminated Unicode format string. - @param[in] Marker VA_LIST marker for the variable argument list. - - @retval NULL There was not enough available memory. - @return Null-terminated Unicode string is that is the formatted - string appended to String. -**/ -CHAR16* -EFIAPI -CatVSPrint ( - IN CHAR16 *String, OPTIONAL - IN CONST CHAR16 *FormatString, - IN VA_LIST Marker - ) -{ - UINTN CharactersRequired; - UINTN SizeRequired; - CHAR16 *BufferToReturn; - VA_LIST ExtraMarker; - - VA_COPY (ExtraMarker, Marker); - CharactersRequired = SPrintLength(FormatString, ExtraMarker); - VA_END (ExtraMarker); - - if (String != NULL) { - SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16)); - } else { - SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16)); - } - - BufferToReturn = AllocatePool(SizeRequired); - - if (BufferToReturn == NULL) { - return NULL; - } else { - BufferToReturn[0] = L'\0'; - } - - if (String != NULL) { - StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String); - } - - UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker); - - ASSERT(StrSize(BufferToReturn)==SizeRequired); - - return (BufferToReturn); -} - -/** - Appends a formatted Unicode string to a Null-terminated Unicode string - - This function appends a formatted Unicode string to the Null-terminated - Unicode string specified by String. String is optional and may be NULL. - Storage for the formatted Unicode string returned is allocated using - AllocatePool(). The pointer to the appended string is returned. The caller - is responsible for freeing the returned string. - - If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). - If FormatString is NULL, then ASSERT(). - If FormatString is not aligned on a 16-bit boundary, then ASSERT(). - - @param[in] String A Null-terminated Unicode string. - @param[in] FormatString A Null-terminated Unicode format string. - @param[in] ... The variable argument list whose contents are - accessed based on the format string specified by - FormatString. - - @retval NULL There was not enough available memory. - @return Null-terminated Unicode string is that is the formatted - string appended to String. -**/ -CHAR16 * -EFIAPI -CatSPrint ( - IN CHAR16 *String, OPTIONAL - IN CONST CHAR16 *FormatString, - ... - ) -{ - VA_LIST Marker; - CHAR16 *NewString; - - VA_START (Marker, FormatString); - NewString = CatVSPrint(String, FormatString, Marker); - VA_END (Marker); - return NewString; -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiNotTiano.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiNotTiano.c deleted file mode 100644 index f992739..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiLib/UefiNotTiano.c +++ /dev/null @@ -1,336 +0,0 @@ -/** @file - Library functions that abstract areas of conflict between framework and UEFI 2.0. - - Help Port Framework code that has conflicts with UEFI 2.0 by hiding the - old conflicts with library functions and supporting implementations of the old - (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as - it contains DXE enum extensions for EFI event services. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - - -#include "UefiLibInternal.h" - -/** - Creates an EFI event in the Legacy Boot Event Group. - - Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library - abstracts the implementation mechanism of this event from the caller. This function - abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary - to UEFI 2.0 based mechanism. This library abstracts the caller from how this event - is created to prevent to code form having to change with the version of the - specification supported. - If LegacyBootEvent is NULL, then ASSERT(). - - @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). - - @retval EFI_SUCCESS Event was created. - @retval Other Event was not created. - -**/ -EFI_STATUS -EFIAPI -EfiCreateEventLegacyBoot ( - OUT EFI_EVENT *LegacyBootEvent - ) -{ - return EfiCreateEventLegacyBootEx ( - TPL_CALLBACK, - EfiEventEmptyFunction, - NULL, - LegacyBootEvent - ); -} - -/** - Create an EFI event in the Legacy Boot Event Group and allows - the caller to specify a notification function. - - This function abstracts the creation of the Legacy Boot Event. - The Framework moved from a proprietary to UEFI 2.0 based mechanism. - This library abstracts the caller from how this event is created to prevent - to code form having to change with the version of the specification supported. - If LegacyBootEvent is NULL, then ASSERT(). - - @param NotifyTpl The task priority level of the event. - @param NotifyFunction The notification function to call when the event is signaled. - @param NotifyContext The content to pass to NotifyFunction when the event is signaled. - @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). - - @retval EFI_SUCCESS Event was created. - @retval Other Event was not created. - -**/ -EFI_STATUS -EFIAPI -EfiCreateEventLegacyBootEx ( - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL - IN VOID *NotifyContext, OPTIONAL - OUT EFI_EVENT *LegacyBootEvent - ) -{ - EFI_STATUS Status; - EFI_EVENT_NOTIFY WorkerNotifyFunction; - - ASSERT (LegacyBootEvent != NULL); - - if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) { - DEBUG ((EFI_D_ERROR, "EFI1.1 can't support LegacyBootEvent!")); - ASSERT (FALSE); - - return EFI_UNSUPPORTED; - } else { - // - // For UEFI 2.0 and the future use an Event Group - // - if (NotifyFunction == NULL) { - // - // CreateEventEx will check NotifyFunction is NULL or not and return error. - // Use dummy routine for the case NotifyFunction is NULL. - // - WorkerNotifyFunction = EfiEventEmptyFunction; - } else { - WorkerNotifyFunction = NotifyFunction; - } - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - NotifyTpl, - WorkerNotifyFunction, - NotifyContext, - &gEfiEventLegacyBootGuid, - LegacyBootEvent - ); - } - - return Status; -} - -/** - Create an EFI event in the Ready To Boot Event Group. - - Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library - abstracts the implementation mechanism of this event from the caller. - This function abstracts the creation of the Ready to Boot Event. The Framework - moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts - the caller from how this event is created to prevent the code form having to - change with the version of the specification supported. - If ReadyToBootEvent is NULL, then ASSERT(). - - @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). - - @retval EFI_SUCCESS Event was created. - @retval Other Event was not created. - -**/ -EFI_STATUS -EFIAPI -EfiCreateEventReadyToBoot ( - OUT EFI_EVENT *ReadyToBootEvent - ) -{ - return EfiCreateEventReadyToBootEx ( - TPL_CALLBACK, - EfiEventEmptyFunction, - NULL, - ReadyToBootEvent - ); -} - -/** - Create an EFI event in the Ready To Boot Event Group and allows - the caller to specify a notification function. - - This function abstracts the creation of the Ready to Boot Event. - The Framework moved from a proprietary to UEFI 2.0 based mechanism. - This library abstracts the caller from how this event is created to prevent - to code form having to change with the version of the specification supported. - If ReadyToBootEvent is NULL, then ASSERT(). - - @param NotifyTpl The task priority level of the event. - @param NotifyFunction The notification function to call when the event is signaled. - @param NotifyContext The content to pass to NotifyFunction when the event is signaled. - @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). - - @retval EFI_SUCCESS Event was created. - @retval Other Event was not created. - -**/ -EFI_STATUS -EFIAPI -EfiCreateEventReadyToBootEx ( - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL - IN VOID *NotifyContext, OPTIONAL - OUT EFI_EVENT *ReadyToBootEvent - ) -{ - EFI_STATUS Status; - EFI_EVENT_NOTIFY WorkerNotifyFunction; - - ASSERT (ReadyToBootEvent != NULL); - - if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) { - DEBUG ((EFI_D_ERROR, "EFI1.1 can't support ReadyToBootEvent!")); - ASSERT (FALSE); - - return EFI_UNSUPPORTED; - } else { - // - // For UEFI 2.0 and the future use an Event Group - // - if (NotifyFunction == NULL) { - // - // CreateEventEx will check NotifyFunction is NULL or not and return error. - // Use dummy routine for the case NotifyFunction is NULL. - // - WorkerNotifyFunction = EfiEventEmptyFunction; - } else { - WorkerNotifyFunction = NotifyFunction; - } - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - NotifyTpl, - WorkerNotifyFunction, - NotifyContext, - &gEfiEventReadyToBootGuid, - ReadyToBootEvent - ); - } - - return Status; -} - - -/** - Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot(). - - This function abstracts the signaling of the Ready to Boot Event. The Framework moved - from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller - from how this event is created to prevent to code form having to change with the - version of the specification supported. - -**/ -VOID -EFIAPI -EfiSignalEventReadyToBoot ( - VOID - ) -{ - EFI_STATUS Status; - EFI_EVENT ReadyToBootEvent; - - Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent); - if (!EFI_ERROR (Status)) { - gBS->SignalEvent (ReadyToBootEvent); - gBS->CloseEvent (ReadyToBootEvent); - } -} - -/** - Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot(). - - This function abstracts the signaling of the Legacy Boot Event. The Framework moved from - a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how - this event is created to prevent to code form having to change with the version of the - specification supported. - -**/ -VOID -EFIAPI -EfiSignalEventLegacyBoot ( - VOID - ) -{ - EFI_STATUS Status; - EFI_EVENT LegacyBootEvent; - - Status = EfiCreateEventLegacyBoot (&LegacyBootEvent); - if (!EFI_ERROR (Status)) { - gBS->SignalEvent (LegacyBootEvent); - gBS->CloseEvent (LegacyBootEvent); - } -} - - -/** - Check to see if the Firmware Volume (FV) Media Device Path is valid - - The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. - This library function abstracts validating a device path node. - Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid. - If it is valid, then return the GUID file name from the device path node. Otherwise, - return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward - compatible way to not conflict with the UEFI 2.0 specification. This function abstracts - the differences from the caller. - If FvDevicePathNode is NULL, then ASSERT(). - - @param FvDevicePathNode The pointer to FV device path to check. - - @retval NULL FvDevicePathNode is not valid. - @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned. - -**/ -EFI_GUID * -EFIAPI -EfiGetNameGuidFromFwVolDevicePathNode ( - IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode - ) -{ - ASSERT (FvDevicePathNode != NULL); - - 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. - - The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. - This library function abstracts initializing a device path node. - Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device - path changed in the DXE CIS version 0.92 in a non back ward compatible way to - not conflict with the UEFI 2.0 specification. This function abstracts the - differences from the caller. - If FvDevicePathNode is NULL, then ASSERT(). - If NameGuid is NULL, then ASSERT(). - - @param FvDevicePathNode The pointer to a FV device path node to initialize - @param NameGuid FV file name to use in FvDevicePathNode - -**/ -VOID -EFIAPI -EfiInitializeFwVolDevicepathNode ( - IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, - IN CONST EFI_GUID *NameGuid - ) -{ - ASSERT (FvDevicePathNode != NULL); - ASSERT (NameGuid != NULL); - - // - // 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; - SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)); - - CopyGuid (&FvDevicePathNode->FvFileName, NameGuid); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c deleted file mode 100644 index c2621c5..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c +++ /dev/null @@ -1,821 +0,0 @@ -/** @file - Support routines for memory allocation routines based - on boot services for Dxe phase drivers. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - - -#include -#include -#include -#include - -/** - Allocates one or more 4KB pages of a certain memory type. - - Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated - buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. - If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - - if (Pages == 0) { - return NULL; - } - - Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - return (VOID *) (UINTN) Memory; -} - -/** - Allocates one or more 4KB pages of type EfiBootServicesData. - - Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiBootServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData. - - Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiRuntimeServicesData, Pages); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType. - - Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL - is returned. If there is not enough memory remaining to satisfy the request, then NULL is - returned. - - @param Pages The number of 4 KB pages to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPages ( - IN UINTN Pages - ) -{ - return InternalAllocatePages (EfiReservedMemoryType, Pages); -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the page allocation - functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer - must have been allocated on a previous call to the page allocation services of the Memory - Allocation Library. If it is not possible to free allocated pages, then this function will - perform no actions. - - If Buffer was not allocated with a page allocation function in the Memory Allocation Library, - then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreePages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages); - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates one or more 4KB pages of a certain memory type at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment - specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned. - If there is not enough memory at the specified alignment remaining to satisfy the request, then - NULL is returned. - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param MemoryType The type of memory to allocate. - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateAlignedPages ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - IN UINTN Alignment - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS Memory; - UINTN AlignedMemory; - UINTN AlignmentMask; - UINTN UnalignedPages; - UINTN RealPages; - - // - // Alignment must be a power of two or zero. - // - ASSERT ((Alignment & (Alignment - 1)) == 0); - - 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); - // - // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow. - // - ASSERT (RealPages > Pages); - - 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); - if (UnalignedPages > 0) { - // - // Free first unaligned page(s). - // - Status = gBS->FreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages); - UnalignedPages = RealPages - Pages - UnalignedPages; - if (UnalignedPages > 0) { - // - // Free last unaligned page(s). - // - Status = gBS->FreePages (Memory, UnalignedPages); - ASSERT_EFI_ERROR (Status); - } - } else { - // - // Do not over-allocate pages in this case. - // - Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); - if (EFI_ERROR (Status)) { - return NULL; - } - AlignedMemory = (UINTN) Memory; - } - return (VOID *) AlignedMemory; -} - -/** - Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedRuntimePages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment); -} - -/** - Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment. - - Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an - alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is - returned. If there is not enough memory at the specified alignment remaining to satisfy the - request, then NULL is returned. - - If Alignment is not a power of two and Alignment is not zero, then ASSERT(). - If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). - - @param Pages The number of 4 KB pages to allocate. - @param Alignment The requested alignment of the allocation. Must be a power of two. - If Alignment is zero, then byte alignment is used. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateAlignedReservedPages ( - IN UINTN Pages, - IN UINTN Alignment - ) -{ - return InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment); -} - -/** - Frees one or more 4KB pages that were previously allocated with one of the aligned page - allocation functions in the Memory Allocation Library. - - Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer - must have been allocated on a previous call to the aligned page allocation services of the Memory - Allocation Library. If it is not possible to free allocated pages, then this function will - perform no actions. - - If Buffer was not allocated with an aligned page allocation function in the Memory Allocation - Library, then ASSERT(). - If Pages is zero, then ASSERT(). - - @param Buffer The pointer to the buffer of pages to free. - @param Pages The number of 4 KB pages to free. - -**/ -VOID -EFIAPI -FreeAlignedPages ( - IN VOID *Buffer, - IN UINTN Pages - ) -{ - EFI_STATUS Status; - - ASSERT (Pages != 0); - Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages); - ASSERT_EFI_ERROR (Status); -} - -/** - Allocates a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type and returns a - pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param MemoryType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocatePool ( - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN AllocationSize - ) -{ - EFI_STATUS Status; - VOID *Memory; - - Status = gBS->AllocatePool (MemoryType, AllocationSize, &Memory); - if (EFI_ERROR (Status)) { - Memory = NULL; - } - return Memory; -} - -/** - Allocates a buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a - pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocatePool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiBootServicesData, AllocationSize); -} - -/** - Allocates a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimePool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns - a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is - returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocatePool (EfiReservedMemoryType, AllocationSize); -} - -/** - Allocates and zeros a buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer - with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid - buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, - then NULL is returned. - - @param PoolType The type of memory to allocate. - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateZeroPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = ZeroMem (Memory, AllocationSize); - } - return Memory; -} - -/** - Allocates and zeros a buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiBootServicesData, AllocationSize); -} - -/** - Allocates and zeros a buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize); -} - -/** - Allocates and zeros a buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the - buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a - valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the - request, then NULL is returned. - - @param AllocationSize The number of bytes to allocate and zero. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedZeroPool ( - IN UINTN AllocationSize - ) -{ - return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize); -} - -/** - Copies a buffer to an allocated buffer of a certain pool type. - - Allocates the number bytes specified by AllocationSize of a certain pool type, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalAllocateCopyPool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - VOID *Memory; - - ASSERT (Buffer != NULL); - ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1)); - - Memory = InternalAllocatePool (PoolType, AllocationSize); - if (Memory != NULL) { - Memory = CopyMem (Memory, Buffer, AllocationSize); - } - return Memory; -} - -/** - Copies a buffer to an allocated buffer of type EfiBootServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer); -} - -/** - Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. - - Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateRuntimeCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer); -} - -/** - Copies a buffer to an allocated buffer of type EfiReservedMemoryType. - - Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies - AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the - allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there - is not enough memory remaining to satisfy the request, then NULL is returned. - - If Buffer is NULL, then ASSERT(). - If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param AllocationSize The number of bytes to allocate and zero. - @param Buffer The buffer to copy to the allocated buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -AllocateReservedCopyPool ( - IN UINTN AllocationSize, - IN CONST VOID *Buffer - ) -{ - return InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer); -} - -/** - Reallocates a buffer of a specified memory type. - - Allocates and zeros the number bytes specified by NewSize from memory of the type - specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param PoolType The type of pool to allocate. - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -InternalReallocatePool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - VOID *NewBuffer; - - NewBuffer = InternalAllocateZeroPool (PoolType, NewSize); - if (NewBuffer != NULL && OldBuffer != NULL) { - CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); - FreePool (OldBuffer); - } - return NewBuffer; -} - -/** - Reallocates a buffer of type EfiBootServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocatePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiRuntimeServicesData. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateRuntimePool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer); -} - -/** - Reallocates a buffer of type EfiReservedMemoryType. - - Allocates and zeros the number bytes specified by NewSize from memory of type - EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and - NewSize bytes are copied from OldBuffer to the newly allocated buffer, and - OldBuffer is freed. A pointer to the newly allocated buffer is returned. - If NewSize is 0, then a valid buffer of 0 size is returned. If there is not - enough memory remaining to satisfy the request, then NULL is returned. - - If the allocation of the new buffer is successful and the smaller of NewSize and OldSize - is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). - - @param OldSize The size, in bytes, of OldBuffer. - @param NewSize The size, in bytes, of the buffer to reallocate. - @param OldBuffer The buffer to copy to the allocated buffer. This is an optional - parameter that may be NULL. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID * -EFIAPI -ReallocateReservedPool ( - IN UINTN OldSize, - IN UINTN NewSize, - IN VOID *OldBuffer OPTIONAL - ) -{ - return InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer); -} - -/** - Frees a buffer that was previously allocated with one of the pool allocation functions in the - Memory Allocation Library. - - Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the - pool allocation services of the Memory Allocation Library. If it is not possible to free pool - resources, then this function will perform no actions. - - If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, - then ASSERT(). - - @param Buffer The pointer to the buffer to free. - -**/ -VOID -EFIAPI -FreePool ( - IN VOID *Buffer - ) -{ - EFI_STATUS Status; - - Status = gBS->FreePool (Buffer); - ASSERT_EFI_ERROR (Status); -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf deleted file mode 100644 index a8c283b..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# Instance of Memory Allocation Library using EFI Boot Services. -# -# Memory Allocation Library that uses EFI Boot Services to allocate -# and free memory. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiMemoryAllocationLib - MODULE_UNI_FILE = UefiMemoryAllocationLib.uni - FILE_GUID = 4674739d-3195-4fb2-8094-ac1d22d00194 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MemoryAllocationLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - MemoryAllocationLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - UefiBootServicesTableLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.uni deleted file mode 100644 index b97ef82..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Memory Allocation Library using EFI Boot Services. -// -// Memory Allocation Library that uses EFI Boot Services to allocate -// and free memory. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Memory Allocation Library using EFI Boot Services" - -#string STR_MODULE_DESCRIPTION #language en-US "This Memory Allocation Library uses EFI Boot Services to allocate and free memory." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c deleted file mode 100644 index a80ea43..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - CompareMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Compares the contents of two buffers. - - This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer to compare. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -CompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - if (Length == 0 || DestinationBuffer == SourceBuffer) { - return 0; - } - ASSERT (DestinationBuffer != NULL); - ASSERT (SourceBuffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer)); - - return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c deleted file mode 100644 index 1a01fbe..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/CopyMemWrapper.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - CopyMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns - DestinationBuffer. The implementation must be reentrant, and it must handle the case - where SourceBuffer overlaps DestinationBuffer. - - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -CopyMem ( - OUT VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - 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/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/IsZeroBufferWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/IsZeroBufferWrapper.c deleted file mode 100644 index 078c924..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/IsZeroBufferWrapper.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Implementation of IsZeroBuffer function. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Checks if the contents of a buffer are all zeros. - - This function checks whether the contents of a buffer are all zeros. If the - contents are all zeros, return TRUE. Otherwise, return FALSE. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -IsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - ASSERT (!(Buffer == NULL && Length > 0)); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - return InternalMemIsZeroBuffer (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLib.c deleted file mode 100644 index 84b853e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLib.c +++ /dev/null @@ -1,63 +0,0 @@ -/** @file - Base Memory Library functions implementation bases on Uefi Boot Service. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function wraps the gBS->CopyMem(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *Destination, - IN CONST VOID *Source, - IN UINTN Length - ) -{ - gBS->CopyMem (Destination, (VOID*)Source, Length); - return Destination; -} - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function wraps the gBS->SetMem(). - - @param Buffer Memory to set. - @param Size The number of bytes to set. - @param Value Value of the set operation. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ) -{ - gBS->SetMem (Buffer, Size, Value); - return Buffer; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c deleted file mode 100644 index e493046..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c +++ /dev/null @@ -1,289 +0,0 @@ -/** @file - Architecture Independent Base Memory Library Implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT16*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT32*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - for (; Length != 0; Length--) { - ((UINT64*)Buffer)[Length - 1] = Value; - } - return Buffer; -} - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer Memory to set. - @param Length The number of bytes to set - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - return InternalMemSetMem (Buffer, Length, 0); -} - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer - @param SourceBuffer The second memory buffer - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - 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; - } - return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer; -} - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - CONST UINT8 *Pointer; - - Pointer = (CONST UINT8*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - CONST UINT16 *Pointer; - - Pointer = (CONST UINT16*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - CONST UINT32 *Pointer; - - Pointer = (CONST UINT32*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - CONST UINT64 *Pointer; - - Pointer = (CONST UINT64*)Buffer; - do { - if (*(Pointer++) == Value) { - return --Pointer; - } - } while (--Length != 0); - return NULL; -} - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ) -{ - CONST UINT8 *BufferData; - UINTN Index; - - BufferData = Buffer; - for (Index = 0; Index < Length; Index++) { - if (BufferData[Index] != 0) { - return FALSE; - } - } - return TRUE; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGuid.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGuid.c deleted file mode 100644 index 28b08c9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibGuid.c +++ /dev/null @@ -1,171 +0,0 @@ -/** @file - Implementation of GUID functions. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Copies a source GUID to a destination GUID. - - This function copies the contents of the 128-bit GUID specified by SourceGuid to - DestinationGuid, and returns DestinationGuid. - - If DestinationGuid is NULL, then ASSERT(). - If SourceGuid is NULL, then ASSERT(). - - @param DestinationGuid The pointer to the destination GUID. - @param SourceGuid The pointer to the source GUID. - - @return DestinationGuid. - -**/ -GUID * -EFIAPI -CopyGuid ( - OUT GUID *DestinationGuid, - IN CONST GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -/** - Compares two GUIDs. - - This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. - If there are any bit differences in the two GUIDs, then FALSE is returned. - - If Guid1 is NULL, then ASSERT(). - If Guid2 is NULL, then ASSERT(). - - @param Guid1 A pointer to a 128 bit GUID. - @param Guid2 A pointer to a 128 bit GUID. - - @retval TRUE Guid1 and Guid2 are identical. - @retval FALSE Guid1 and Guid2 are not identical. - -**/ -BOOLEAN -EFIAPI -CompareGuid ( - IN CONST GUID *Guid1, - IN CONST GUID *Guid2 - ) -{ - UINT64 LowPartOfGuid1; - UINT64 LowPartOfGuid2; - 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); - - return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2); -} - -/** - Scans a target buffer for a GUID, and returns a pointer to the matching GUID - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from - the lowest address to the highest address at 128-bit increments for the 128-bit - GUID value that matches Guid. If a match is found, then a pointer to the matching - GUID in the target buffer is returned. If no match is found, then NULL is returned. - If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Guid The value to search for in the target buffer. - - @return A pointer to the matching Guid in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanGuid ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN CONST GUID *Guid - ) -{ - 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; - Buffer = GuidPtr + Length / sizeof (*GuidPtr); - while (GuidPtr < (CONST GUID*)Buffer) { - if (CompareGuid (GuidPtr, Guid)) { - return (VOID*)GuidPtr; - } - GuidPtr++; - } - return NULL; -} - -/** - Checks if the given GUID is a zero GUID. - - This function checks whether the given GUID is a zero GUID. If the GUID is - identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned. - - If Guid is NULL, then ASSERT(). - - @param Guid The pointer to a 128 bit GUID. - - @retval TRUE Guid is a zero GUID. - @retval FALSE Guid is not a zero GUID. - -**/ -BOOLEAN -EFIAPI -IsZeroGuid ( - IN CONST GUID *Guid - ) -{ - UINT64 LowPartOfGuid; - UINT64 HighPartOfGuid; - - LowPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid); - HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1); - - return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibInternals.h b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibInternals.h deleted file mode 100644 index 9aab2c1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/MemLibInternals.h +++ /dev/null @@ -1,249 +0,0 @@ -/** @file - Declaration of internal functions for Base Memory Library. - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEM_LIB_INTERNALS__ -#define __MEM_LIB_INTERNALS__ - -#include - -#include -#include -#include -#include - -/** - Copies a source buffer to a destination buffer, and returns the destination buffer. - - This function wraps the gBS->CopyMem(). - - @param DestinationBuffer The pointer to the destination buffer of the memory copy. - @param SourceBuffer The pointer to the source buffer of the memory copy. - @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. - - @return DestinationBuffer. - -**/ -VOID * -EFIAPI -InternalMemCopyMem ( - OUT VOID *Destination, - IN CONST VOID *Source, - IN UINTN Length - ); - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function wraps the gBS->SetMem(). - - @param Buffer Memory to set. - @param Size The number of bytes to set. - @param Value Value of the set operation. - - @return Buffer. - -**/ -VOID * -EFIAPI -InternalMemSetMem ( - OUT VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ); - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 16-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 32-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - @param Buffer The pointer to the target buffer to fill. - @param Length The count of 64-bit value to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemSetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Set Buffer to 0 for Size bytes. - - @param Buffer The memory to set. - @param Length The number of bytes to set - - @return Buffer - -**/ -VOID * -EFIAPI -InternalMemZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ); - -/** - Compares two memory buffers of a given length. - - @param DestinationBuffer The first memory buffer - @param SourceBuffer The second memory buffer - @param Length The length of DestinationBuffer and SourceBuffer memory - regions to compare. Must be non-zero. - - @return 0 All Length bytes of the two buffers are identical. - @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first - mismatched byte in DestinationBuffer. - -**/ -INTN -EFIAPI -InternalMemCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the - matching 8-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 8-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ); - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the - matching 16-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 16-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ); - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the - matching 32-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 32-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ); - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the - matching 64-bit value in the target buffer. - - @param Buffer The pointer to the target buffer to scan. - @param Length The count of 64-bit value to scan. Must be non-zero. - @param Value The value to search for in the target buffer. - - @return The pointer to the first occurrence or NULL if not found. - -**/ -CONST VOID * -EFIAPI -InternalMemScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ); - -/** - Checks whether the contents of a buffer are all zeros. - - @param Buffer The pointer to the buffer to be checked. - @param Length The size of the buffer (in bytes) to be checked. - - @retval TRUE Contents of the buffer are all zeros. - @retval FALSE Contents of the buffer are not all zeros. - -**/ -BOOLEAN -EFIAPI -InternalMemIsZeroBuffer ( - IN CONST VOID *Buffer, - IN UINTN Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c deleted file mode 100644 index 7b37607..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem16Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 16-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem16 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c deleted file mode 100644 index 654306a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c +++ /dev/null @@ -1,66 +0,0 @@ -/** @file - ScanMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 32-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem32 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c deleted file mode 100644 index 9606caa..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem64Wrapper.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - ScanMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a 64-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem64 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return NULL; - } - - ASSERT (Buffer != NULL); - ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return (VOID*)InternalMemScanMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c deleted file mode 100644 index 6d974d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ScanMem8Wrapper.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - ScanMem8() and ScanMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value - in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for an 8-bit value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMem8 ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return NULL; - } - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return (VOID*)InternalMemScanMem8 (Buffer, Length, Value); -} - -/** - Scans a target buffer for a UINTN sized value, and returns a pointer to the matching - UINTN sized value in the target buffer. - - This function searches the target buffer specified by Buffer and Length from the lowest - address to the highest address for a UINTN sized value that matches Value. If a match is found, - then a pointer to the matching byte in the target buffer is returned. If no match is found, - then NULL is returned. If Length is 0, then NULL is returned. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to scan. - @param Length The number of bytes in Buffer to scan. - @param Value The value to search for in the target buffer. - - @return A pointer to the matching byte in the target buffer or NULL otherwise. - -**/ -VOID * -EFIAPI -ScanMemN ( - IN CONST VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return ScanMem64 (Buffer, Length, (UINT64)Value); - } else { - return ScanMem32 (Buffer, Length, (UINT32)Value); - } -} - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c deleted file mode 100644 index 7001f29..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem16Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem16() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 16-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 16-bit value specified by - Value, and returns Buffer. Value is repeated every 16-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 16-bit boundary, then ASSERT(). - If Length is not aligned on a 16-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem16 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT16 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c deleted file mode 100644 index c51b846..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem32Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem32() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 32-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 32-bit value specified by - Value, and returns Buffer. Value is repeated every 32-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 32-bit boundary, then ASSERT(). - If Length is not aligned on a 32-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem32 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT32 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c deleted file mode 100644 index f412897..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMem64Wrapper.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - SetMem64() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a 64-bit value, and returns the target buffer. - - This function fills Length bytes of Buffer with the 64-bit value specified by - Value, and returns Buffer. Value is repeated every 64-bits in for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a 64-bit boundary, then ASSERT(). - If Length is not aligned on a 64-bit boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem64 ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT64 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); - ASSERT ((Length & (sizeof (Value) - 1)) == 0); - - return InternalMemSetMem64 (Buffer, Length / sizeof (Value), Value); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c deleted file mode 100644 index 65b8606..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/SetMemWrapper.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - SetMem() and SetMemN() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with a byte value, and returns the target buffer. - - This function fills Length bytes of Buffer with Value, and returns Buffer. - - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer Memory to set. - @param Length The number of bytes to set. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMem ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINT8 Value - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); - - return InternalMemSetMem (Buffer, Length, Value); -} - -/** - Fills a target buffer with a value that is size UINTN, and returns the target buffer. - - This function fills Length bytes of Buffer with the UINTN sized value specified by - Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length - bytes of Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Buffer is not aligned on a UINTN boundary, then ASSERT(). - If Length is not aligned on a UINTN boundary, then ASSERT(). - - @param Buffer The pointer to the target buffer to fill. - @param Length The number of bytes in Buffer to fill. - @param Value The value with which to fill Length bytes of Buffer. - - @return Buffer. - -**/ -VOID * -EFIAPI -SetMemN ( - OUT VOID *Buffer, - IN UINTN Length, - IN UINTN Value - ) -{ - if (sizeof (UINTN) == sizeof (UINT64)) { - return SetMem64 (Buffer, Length, (UINT64)Value); - } else { - return SetMem32 (Buffer, Length, (UINT32)Value); - } -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf deleted file mode 100644 index 58a484c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf +++ /dev/null @@ -1,60 +0,0 @@ -## @file -# Instance of Base Memory Library using EFI Boot Services. -# -# Base Memory Library implementation that uses EFI Boot Services -# where possible for size reduction. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiMemoryLib - MODULE_UNI_FILE = UefiMemoryLib.uni - FILE_GUID = f1bbe03d-2f28-4dee-bec7-d98d7a30c36a - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseMemoryLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - ScanMem64Wrapper.c - ScanMem32Wrapper.c - ScanMem16Wrapper.c - ScanMem8Wrapper.c - ZeroMemWrapper.c - CompareMemWrapper.c - SetMem64Wrapper.c - SetMem32Wrapper.c - SetMem16Wrapper.c - SetMemWrapper.c - CopyMemWrapper.c - IsZeroBufferWrapper.c - MemLibGeneric.c - MemLibGuid.c - MemLib.c - MemLibInternals.h - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - UefiBootServicesTableLib - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.uni deleted file mode 100644 index 8eb667a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Instance of Base Memory Library using EFI Boot Services. -// -// Base Memory Library implementation that uses EFI Boot Services -// where possible for size reduction. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of Base Memory Library using EFI Boot Services" - -#string STR_MODULE_DESCRIPTION #language en-US "Base Memory Library implementation that uses EFI Boot Services where possible, for size reduction." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c deleted file mode 100644 index d768dd1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - ZeroMem() implementation. - - The following BaseMemoryLib instances contain the same copy of this file: - - BaseMemoryLib - BaseMemoryLibMmx - BaseMemoryLibSse2 - BaseMemoryLibRepStr - BaseMemoryLibOptDxe - BaseMemoryLibOptPei - PeiMemoryLib - UefiMemoryLib - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "MemLibInternals.h" - -/** - Fills a target buffer with zeros, and returns the target buffer. - - This function fills Length bytes of Buffer with zeros, and returns Buffer. - - If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - - @param Buffer The pointer to the target buffer to fill with zeros. - @param Length The number of bytes in Buffer to fill with zeros. - - @return Buffer. - -**/ -VOID * -EFIAPI -ZeroMem ( - OUT VOID *Buffer, - IN UINTN Length - ) -{ - if (Length == 0) { - return Buffer; - } - - ASSERT (Buffer != NULL); - ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); - return InternalMemZeroMem (Buffer, Length); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c deleted file mode 100644 index a97b4b9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c +++ /dev/null @@ -1,1434 +0,0 @@ -/** @file - PCI Library using PCI Root Bridge I/O Protocol. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -/** - Assert the validity of a PCI address. A valid PCI address should contain 1's - only in the low 28 bits. - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_ADDRESS(A,M) \ - ASSERT (((A) & (~0xfffffff | (M))) == 0) - -/** - Translate PCI Lib address into format of PCI Root Bridge I/O Protocol. - - @param A The address that encodes the PCI Bus, Device, Function and - Register. - -**/ -#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \ - ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) - -// -// Global varible to cache pointer to PCI Root Bridge I/O protocol. -// -EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL; - -/** - The constructor function caches the pointer to PCI Root Bridge I/O protocol. - - The constructor function locates PCI Root Bridge I/O protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -PciLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**) &mPciRootBridgeIo); - ASSERT_EFI_ERROR (Status); - ASSERT (mPciRootBridgeIo != NULL); - - return EFI_SUCCESS; -} - -/** - Internal worker function to read a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service. - It reads and returns the PCI configuration register specified by Address, - the width of data is specified by Width. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to read - - @return The value read from the PCI configuration register. - -**/ -UINT32 -DxePciLibPciRootBridgeIoReadWorker ( - IN UINTN Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width - ) -{ - UINT32 Data; - - mPciRootBridgeIo->Pci.Read ( - mPciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - - return Data; -} - -/** - Internal worker function to writes a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service. - It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specified by Width. - Data is returned. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width The width of data to write - @param Data The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -DxePciLibPciRootBridgeIoWriteWorker ( - IN UINTN Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, - IN UINT32 Data - ) -{ - mPciRootBridgeIo->Pci.Write ( - mPciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - return Data; -} - -/** - Registers a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - Registers the PCI device specified by Address so all the PCI configuration registers - associated with that PCI device may be accessed after SetVirtualAddressMap() is called. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - return RETURN_UNSUPPORTED; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciRead8 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 0); - - return (UINT8) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with - an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciOr8 ( - IN UINTN Address, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAnd8 ( - IN UINTN Address, - IN UINT8 AndData - ) -{ - return PciWrite8 (Address, (UINT8) (PciRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciAndThenOr8 ( - IN UINTN Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 (Address, (UINT8) ((PciRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldRead8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldWrite8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciWrite8 ( - Address, - BitFieldWrite8 (PciRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldOr8 (PciRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAnd8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciWrite8 ( - Address, - BitFieldAnd8 (PciRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciBitFieldAndThenOr8 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciWrite8 ( - Address, - BitFieldAndThenOr8 (PciRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciRead16 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 1); - - return (UINT16) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciOr16 ( - IN UINTN Address, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAnd16 ( - IN UINTN Address, - IN UINT16 AndData - ) -{ - return PciWrite16 (Address, (UINT16) (PciRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciAndThenOr16 ( - IN UINTN Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 (Address, (UINT16) ((PciRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldRead16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldWrite16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciWrite16 ( - Address, - BitFieldWrite16 (PciRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldOr16 (PciRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAnd16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciWrite16 ( - Address, - BitFieldAnd16 (PciRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciBitFieldAndThenOr16 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciWrite16 ( - Address, - BitFieldAndThenOr16 (PciRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - - @return The read value from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciRead32 ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the - value specified by Value. Value is returned. This function must guarantee - that all PCI read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_ADDRESS (Address, 3); - - return DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with - a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciOr32 ( - IN UINTN Address, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAnd32 ( - IN UINTN Address, - IN UINT32 AndData - ) -{ - return PciWrite32 (Address, PciRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and - the value specified by OrData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciAndThenOr32 ( - IN UINTN Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 (Address, (PciRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address The PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldRead32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value The new value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldWrite32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciWrite32 ( - Address, - BitFieldWrite32 (PciRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldOr32 (PciRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 32-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAnd32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciWrite32 ( - Address, - BitFieldAnd32 (PciRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If Address > 0x0FFFFFFF, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address The PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciBitFieldAndThenOr32 ( - IN UINTN Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciWrite32 ( - Address, - BitFieldAndThenOr32 (PciRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciReadBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciRead16 (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 = PciRead8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If StartAddress > 0x0FFFFFFF, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress The starting address that encodes the PCI Bus, Device, - Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. - - @return Size written to StartAddress. - -**/ -UINTN -EFIAPI -PciWriteBuffer ( - IN UINTN StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciWrite8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf deleted file mode 100644 index 4d13837..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf +++ /dev/null @@ -1,57 +0,0 @@ -## @file -# PCI Library that layers on top of the PCI Root Bridge I/O Protocol. -# -# This library produces the APIs from the PCI Library and implements these APIs -# by calling into the PCI Root Bridge I/O Protocol. The PCI Root Bridge I/O Protocol is -# typically produced by a chipset specific DXE driver. -# This library binds to the first PCI Root Bridge I/O Protocol in the platform. As a result, -# it should only be used on platforms that contain a single PCI root bridge. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiPciLibPciRootBridgeIo - MODULE_UNI_FILE = UefiPciLibPciRootBridgeIo.uni - FILE_GUID = 90EC42CB-B780-4eb8-8E99-C8E3E5F37530 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION - - CONSTRUCTOR = PciLibConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseLib - UefiBootServicesTableLib - DebugLib - -[Protocols] - gEfiPciRootBridgeIoProtocolGuid ## CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiPciRootBridgeIoProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.uni deleted file mode 100644 index b5498a8..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// PCI Library that layers on top of the PCI Root Bridge I/O Protocol. -// -// This library produces the APIs from the PCI Library and implements these APIs -// by calling into the PCI Root Bridge I/O Protocol. The PCI Root Bridge I/O Protocol is -// typically produced by a chipset specific DXE driver. -// This library binds to the first PCI Root Bridge I/O Protocol in the platform. As a result, -// it should only be used on platforms that contain a single PCI root bridge. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "PCI Library that layers on top of the PCI Root Bridge I/O Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "This library produces the APIs from the PCI Library and implements these APIs by calling into the PCI Root Bridge I/O Protocol. The PCI Root Bridge I/O Protocol is typically produced by a chipset-specific DXE driver. This library binds to the first PCI Root Bridge I/O Protocol in the platform. As a result, it should only be used on platforms that contain a single PCI root bridge." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c deleted file mode 100644 index 1bd4589..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c +++ /dev/null @@ -1,1491 +0,0 @@ -/** @file - PCI Segment Library implementation using PCI Root Bridge I/O Protocol. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "PciSegmentLib.h" - -// -// Global variable to record data of PCI Root Bridge I/O Protocol instances -// -PCI_ROOT_BRIDGE_DATA *mPciRootBridgeData = NULL; -UINTN mNumberOfPciRootBridges = 0; - -/** - The constructor function caches data of PCI Root Bridge I/O Protocol instances. - - The constructor function locates PCI Root Bridge I/O protocol instances, - and caches the protocol instances, together with their segment numbers and bus ranges. - It will ASSERT() if that related operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -PciSegmentLibConstructor ( - 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; - - HandleCount = 0; - HandleBuffer = NULL; - PciRootBridgeIo = NULL; - Descriptors = NULL; - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciRootBridgeIoProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - ASSERT_EFI_ERROR (Status); - - mNumberOfPciRootBridges = HandleCount; - - mPciRootBridgeData = AllocatePool (HandleCount * sizeof (PCI_ROOT_BRIDGE_DATA)); - ASSERT (mPciRootBridgeData != NULL); - - // - // Traverse all PCI Root Bridge I/O Protocol instances, and record the protocol - // instances, together with their segment numbers and bus ranges. - // - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiPciRootBridgeIoProtocolGuid, - (VOID **) &PciRootBridgeIo - ); - ASSERT_EFI_ERROR (Status); - - mPciRootBridgeData[Index].PciRootBridgeIo = PciRootBridgeIo; - mPciRootBridgeData[Index].SegmentNumber = PciRootBridgeIo->SegmentNumber; - - Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors); - ASSERT_EFI_ERROR (Status); - - while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) { - if (Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) { - mPciRootBridgeData[Index].MinBusNumber = Descriptors->AddrRangeMin; - mPciRootBridgeData[Index].MaxBusNumber = Descriptors->AddrRangeMax; - break; - } - Descriptors++; - } - ASSERT (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR); - } - - FreePool(HandleBuffer); - - return EFI_SUCCESS; -} - -/** - The destructor function frees memory allocated by constructor. - - The destructor function frees memory for data of protocol instances allocated by constructor. - It will ASSERT() if that related operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -PciSegmentLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - FreePool (mPciRootBridgeData); - - return EFI_SUCCESS; -} - -/** - According to address, search for the corresponding PCI Root Bridge I/O Protocol instance. - - This internal function extracts segment number and bus number data from address, and - retrieves the corresponding PCI Root Bridge I/O Protocol instance. - - @param Address The address that encodes the Segment, PCI Bus, Device, Function and - Register. - - @return The address for PCI Root Bridge I/O Protocol. - -**/ -EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * -PciSegmentLibSearchForRootBridge ( - IN UINT64 Address - ) -{ - UINTN Index; - UINT64 SegmentNumber; - UINT64 BusNumber; - - for (Index = 0; Index < mNumberOfPciRootBridges; Index++) { - // - // Matches segment number of address with the segment number of protocol instance. - // - SegmentNumber = BitFieldRead64 (Address, 32, 63); - if (SegmentNumber == mPciRootBridgeData[Index].SegmentNumber) { - // - // 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) { - return mPciRootBridgeData[Index].PciRootBridgeIo; - } - } - } - return NULL; -} - -/** - Internal worker function to read a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() service. - It reads and returns the PCI configuration register specified by Address, - the width of data is specified by Width. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width Width of data to read - - @return The value read from the PCI configuration register. - -**/ -UINT32 -DxePciSegmentLibPciRootBridgeIoReadWorker ( - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width - ) -{ - UINT32 Data; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; - - PciRootBridgeIo = PciSegmentLibSearchForRootBridge (Address); - ASSERT (PciRootBridgeIo != NULL); - - PciRootBridgeIo->Pci.Read ( - PciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - - return Data; -} - -/** - Internal worker function to writes a PCI configuration register. - - This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service. - It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specifed by Width. - Data is returned. - - @param Address The address that encodes the PCI Bus, Device, Function and - Register. - @param Width Width of data to write - @param Data The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -DxePciSegmentLibPciRootBridgeIoWriteWorker ( - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, - IN UINT32 Data - ) -{ - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; - - PciRootBridgeIo = PciSegmentLibSearchForRootBridge (Address); - ASSERT (PciRootBridgeIo != NULL); - - PciRootBridgeIo->Pci.Write ( - PciRootBridgeIo, - Width, - PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address), - 1, - &Data - ); - - return Data; -} - -/** - Register a PCI device so PCI configuration registers may be accessed after - SetVirtualAddressMap(). - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Bus, Device, Function and - Register. - - @retval RETURN_SUCCESS The PCI device was registered for runtime access. - @retval RETURN_UNSUPPORTED An attempt was made to call this function - after ExitBootServices(). - @retval RETURN_UNSUPPORTED The resources required to access the PCI device - at runtime could not be mapped. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - complete the registration. - -**/ -RETURN_STATUS -EFIAPI -PciSegmentRegisterForRuntimeAccess ( - IN UINTN Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - return RETURN_UNSUPPORTED; -} - -/** - Reads an 8-bit PCI configuration register. - - Reads and returns the 8-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 8-bit PCI configuration register specified by Address. - -**/ -UINT8 -EFIAPI -PciSegmentRead8 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return (UINT8) DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8); -} - -/** - Writes an 8-bit PCI configuration register. - - Writes the 8-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentWrite8 ( - IN UINT64 Address, - IN UINT8 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); - - return (UINT8) DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value); -} - -/** - Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentOr8 ( - IN UINT64 Address, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) | OrData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAnd8 ( - IN UINT64 Address, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData)); -} - -/** - Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, - followed a bitwise OR with another 8-bit value. - - Reads the 8-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 8-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentAndThenOr8 ( - IN UINT64 Address, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in an 8-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldRead8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 8-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldWrite8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 Value - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldWrite8 (PciSegmentRead8 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 8-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldOr8 (PciSegmentRead8 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in an 8-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 8-bit register. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 8-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAnd8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAnd8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the 8-bit port. - - Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 8-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..7. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..7. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT8 -EFIAPI -PciSegmentBitFieldAndThenOr8 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT8 AndData, - IN UINT8 OrData - ) -{ - return PciSegmentWrite8 ( - Address, - BitFieldAndThenOr8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 16-bit PCI configuration register. - - Reads and returns the 16-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 16-bit PCI configuration register specified by Address. - -**/ -UINT16 -EFIAPI -PciSegmentRead16 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return (UINT16) DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16); -} - -/** - Writes a 16-bit PCI configuration register. - - Writes the 16-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT16 -EFIAPI -PciSegmentWrite16 ( - IN UINT64 Address, - IN UINT16 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); - - return (UINT16) DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value); -} - -/** - Performs a bitwise OR of a 16-bit PCI configuration register with - a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by OrData, and - writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. This function - must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function and - Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentOr16 ( - IN UINT64 Address, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAnd16 ( - IN UINT64 Address, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData)); -} - -/** - Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, - followed a bitwise OR with another 16-bit value. - - Reads the 16-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 16-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentAndThenOr16 ( - IN UINT64 Address, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData)); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 16-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldRead16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 16-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldWrite16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 Value - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldWrite16 (PciSegmentRead16 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes - the result back to the bit field in the 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 16-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldOr16 (PciSegmentRead16 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 16-bit PCI configuration register, performs a bitwise - AND, writes the result back to the bit field in the 16-bit register. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND between the read result and the value specified by AndData, and - writes the result to the 16-bit PCI configuration register specified by - Address. The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are - serialized. Extra left bits in AndData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAnd16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAnd16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 16-bit port. - - Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 16-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 15, then ASSERT(). - If EndBit is greater than 15, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..15. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..15. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT16 -EFIAPI -PciSegmentBitFieldAndThenOr16 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT16 AndData, - IN UINT16 OrData - ) -{ - return PciSegmentWrite16 ( - Address, - BitFieldAndThenOr16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a 32-bit PCI configuration register. - - Reads and returns the 32-bit PCI configuration register specified by Address. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - - @return The 32-bit PCI configuration register specified by Address. - -**/ -UINT32 -EFIAPI -PciSegmentRead32 ( - IN UINT64 Address - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32); -} - -/** - Writes a 32-bit PCI configuration register. - - Writes the 32-bit PCI configuration register specified by Address with the value specified by Value. - Value is returned. This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param Value The value to write. - - @return The parameter of Value. - -**/ -UINT32 -EFIAPI -PciSegmentWrite32 ( - IN UINT64 Address, - IN UINT32 Value - ) -{ - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); - - return DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value); -} - -/** - Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise OR between the read result and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentOr32 ( - IN UINT64 Address, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAnd32 ( - IN UINT64 Address, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData); -} - -/** - Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, - followed a bitwise OR with another 32-bit value. - - Reads the 32-bit PCI configuration register specified by Address, - performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise OR between the result of the AND operation and the value specified by OrData, - and writes the result to the 32-bit PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the PCI configuration register. - - @return The value written to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentAndThenOr32 ( - IN UINT64 Address, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData); -} - -/** - Reads a bit field of a PCI configuration register. - - Reads the bit field in a 32-bit PCI configuration register. The bit field is - specified by the StartBit and the EndBit. The value of the bit field is - returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - - @param Address PCI configuration register to read. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - - @return The value of the bit field read from the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldRead32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit - ) -{ - return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit); -} - -/** - Writes a bit field to a PCI configuration register. - - Writes Value to the bit field of the PCI configuration register. The bit - field is specified by the StartBit and the EndBit. All other bits in the - destination PCI configuration register are preserved. The new value of the - 32-bit register is returned. - - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param Value New value of the bit field. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldWrite32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 Value - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldWrite32 (PciSegmentRead32 (Address), StartBit, EndBit, Value) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and - writes the result back to the bit field in the 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise OR between the read result and the value specified by - OrData, and writes the result to the 32-bit PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. Extra left bits in OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param OrData The value to OR with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldOr32 (PciSegmentRead32 (Address), StartBit, EndBit, OrData) - ); -} - -/** - Reads a bit field in a 32-bit PCI configuration register, performs a bitwise - AND, and writes the result back to the bit field in the 32-bit register. - - - Reads the 32-bit PCI configuration register specified by Address, performs a bitwise - AND between the read result and the value specified by AndData, and writes the result - to the 32-bit PCI configuration register specified by Address. The value written to - the PCI configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in AndData are stripped. - If any reserved bits in Address are set, then ASSERT(). - If Address is not aligned on a 32-bit boundary, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAnd32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAnd32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData) - ); -} - -/** - Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 32-bit port. - - Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise OR between the read result and - the value specified by AndData, and writes the result to the 32-bit PCI - configuration register specified by Address. The value written to the PCI - configuration register is returned. This function must guarantee that all PCI - read and write operations are serialized. Extra left bits in both AndData and - OrData are stripped. - - If any reserved bits in Address are set, then ASSERT(). - If StartBit is greater than 31, then ASSERT(). - If EndBit is greater than 31, then ASSERT(). - If EndBit is less than StartBit, then ASSERT(). - If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - - @param Address PCI configuration register to write. - @param StartBit The ordinal of the least significant bit in the bit field. - Range 0..31. - @param EndBit The ordinal of the most significant bit in the bit field. - Range 0..31. - @param AndData The value to AND with the PCI configuration register. - @param OrData The value to OR with the result of the AND operation. - - @return The value written back to the PCI configuration register. - -**/ -UINT32 -EFIAPI -PciSegmentBitFieldAndThenOr32 ( - IN UINT64 Address, - IN UINTN StartBit, - IN UINTN EndBit, - IN UINT32 AndData, - IN UINT32 OrData - ) -{ - return PciSegmentWrite32 ( - Address, - BitFieldAndThenOr32 (PciSegmentRead32 (Address), StartBit, EndBit, AndData, OrData) - ); -} - -/** - Reads a range of PCI configuration registers into a caller supplied buffer. - - Reads the range of PCI configuration registers specified by StartAddress and - Size into the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be read. Size is - returned. When possible 32-bit PCI configuration read cycles are used to read - from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit - and 16-bit PCI configuration read cycles may be used at the beginning and the - end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. - - @return Size - -**/ -UINTN -EFIAPI -PciSegmentReadBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - OUT VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return Size; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Read a byte if StartAddress is byte aligned - // - *(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Read as many double words as possible - // - WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Read the last remaining word if exist - // - WriteUnaligned16 (Buffer, PciSegmentRead16 (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 = PciSegmentRead8 (StartAddress); - } - - return ReturnValue; -} - -/** - Copies the data in a caller supplied buffer to a specified range of PCI - configuration space. - - Writes the range of PCI configuration registers specified by StartAddress and - Size from the buffer specified by Buffer. This function only allows the PCI - configuration registers from a single PCI function to be written. Size is - returned. When possible 32-bit PCI configuration write cycles are used to - write from StartAdress to StartAddress + Size. Due to alignment restrictions, - 8-bit and 16-bit PCI configuration write cycles may be used at the beginning - and the end of the range. - - If any reserved bits in StartAddress are set, then ASSERT(). - If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). - If Size > 0 and Buffer is NULL, then ASSERT(). - - @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, - Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. - - @return The parameter of Size. - -**/ -UINTN -EFIAPI -PciSegmentWriteBuffer ( - IN UINT64 StartAddress, - IN UINTN Size, - IN VOID *Buffer - ) -{ - UINTN ReturnValue; - - ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); - ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); - - if (Size == 0) { - return 0; - } - - ASSERT (Buffer != NULL); - - // - // Save Size for return - // - ReturnValue = Size; - - if ((StartAddress & BIT0) != 0) { - // - // Write a byte if StartAddress is byte aligned - // - PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer); - StartAddress += sizeof (UINT8); - Size -= sizeof (UINT8); - Buffer = (UINT8*)Buffer + 1; - } - - 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; - } - - while (Size >= sizeof (UINT32)) { - // - // Write as many double words as possible - // - PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer)); - StartAddress += sizeof (UINT32); - Size -= sizeof (UINT32); - Buffer = (UINT32*)Buffer + 1; - } - - if (Size >= sizeof (UINT16)) { - // - // Write the last remaining word if exist - // - PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); - StartAddress += sizeof (UINT16); - Size -= sizeof (UINT16); - Buffer = (UINT16*)Buffer + 1; - } - - if (Size >= sizeof (UINT8)) { - // - // Write the last remaining byte if exist - // - PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer); - } - - return ReturnValue; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h deleted file mode 100644 index 2ed4e79..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - Include file of PciSegmentPciRootBridgeIo Library. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __DXE_PCI_SEGMENT_LIB__ -#define __DXE_PCI_SEGMENT_LIB__ - - -#include - -#include -#include -#include -#include -#include - -#include - -typedef struct { - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; - UINT32 SegmentNumber; - UINT64 MinBusNumber; - UINT64 MaxBusNumber; -} PCI_ROOT_BRIDGE_DATA; - -/** - Assert the validity of a PCI Segment address. - A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 - - @param A The address to validate. - @param M Additional bits to assert to be zero. - -**/ -#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ - ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0) - -/** - Translate PCI Lib address into format of PCI Root Bridge I/O Protocol - - @param A The address that encodes the PCI Bus, Device, Function and - Register. - -**/ -#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \ - ((((UINT32)(A) << 4) & 0xff000000) | (((UINT32)(A) >> 4) & 0x00000700) | (((UINT32)(A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf deleted file mode 100644 index 733f2dc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf +++ /dev/null @@ -1,60 +0,0 @@ -## @file -# PCI Segment Library that layers on top of the PCI Root Bridge I/O Protocol. -# -# This library produces the APIs from the PCI Library and implements these APIs -# by calling into the PCI Root Bridge I/O Protocols that are present in the platform. -# The PCI Root Bridge I/O Protocols are typically produced by a chipset specific DXE driver. -# This library binds to all of the PCI Root Bridge I/O Protocols in the platform and handles -# the translation from a PCI segment number into a specific PCI Root Bridge I/O Protocol. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiPciSegmentLibPciRootBridgeIo - MODULE_UNI_FILE = UefiPciSegmentLibPciRootBridgeIo.uni - FILE_GUID = C6068612-B6E0-48a3-BB92-60E4A4F89EDF - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PciSegmentLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION - - CONSTRUCTOR = PciSegmentLibConstructor - DESTRUCTOR = PciSegmentLibDestructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - PciSegmentLib.h - PciSegmentLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - MemoryAllocationLib - BaseLib - UefiBootServicesTableLib - DebugLib - -[Protocols] - gEfiPciRootBridgeIoProtocolGuid ## CONSUMES - -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiPciRootBridgeIoProtocolGuid - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.uni deleted file mode 100644 index dc4a06a..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.uni +++ /dev/null @@ -1,25 +0,0 @@ -// /** @file -// PCI Segment Library that layers on top of the PCI Root Bridge I/O Protocol. -// -// This library produces the APIs from the PCI Library and implements these APIs -// by calling into the PCI Root Bridge I/O Protocols that are present in the platform. -// The PCI Root Bridge I/O Protocols are typically produced by a chipset specific DXE driver. -// This library binds to all of the PCI Root Bridge I/O Protocols in the platform and handles -// the translation from a PCI segment number into a specific PCI Root Bridge I/O Protocol. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Layers on top of the PCI Root Bridge I/O Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "This library produces the APIs from the PCI Library and implements these APIs by calling into the PCI Root Bridge I/O Protocols that are present in the platform. The PCI Root Bridge I/O Protocols are typically produced by a chipset-specific DXE driver. This library binds to all of the PCI Root Bridge I/O Protocols in the platform and handles the translation from a PCI segment number into a specific PCI Root Bridge I/O Protocol." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c deleted file mode 100644 index c840e46..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/RuntimeLib.c +++ /dev/null @@ -1,843 +0,0 @@ -/** @file - UEFI Runtime Library implementation for non IPF processor types. - - This library hides the global variable for the EFI Runtime Services so the - caller does not need to deal with the possibility of being called from an - OS virtual address space. All pointer values are different for a virtual - mapping than from the normal physical mapping at boot services time. - -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include -#include - -/// -/// Driver Lib Module Globals -/// -EFI_EVENT mEfiVirtualNotifyEvent; -EFI_EVENT mEfiExitBootServicesEvent; -BOOLEAN mEfiGoneVirtual = FALSE; -BOOLEAN mEfiAtRuntime = FALSE; -EFI_RUNTIME_SERVICES *mInternalRT; - -/** - Set AtRuntime flag as TRUE after ExitBootServices. - - @param[in] Event The Event that is being processed. - @param[in] Context The Event Context. - -**/ -VOID -EFIAPI -RuntimeLibExitBootServicesEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - mEfiAtRuntime = TRUE; -} - -/** - Fixup internal data so that EFI can be call in virtual mode. - Call the passed in Child Notify event and convert any pointers in - lib to virtual mode. - - @param[in] Event The Event that is being processed. - @param[in] Context The Event Context. -**/ -VOID -EFIAPI -RuntimeLibVirtualNotifyEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Update global for Runtime Services Table and IO - // - EfiConvertPointer (0, (VOID **) &mInternalRT); - - mEfiGoneVirtual = TRUE; -} - -/** - Initialize runtime Driver Lib if it has not yet been initialized. - It will ASSERT() if gRT is NULL or gBS is NULL. - It will ASSERT() if that operation fails. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started. -**/ -EFI_STATUS -EFIAPI -RuntimeDriverLibConstruct ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - ASSERT (gRT != NULL); - ASSERT (gBS != NULL); - - mInternalRT = gRT; - // - // Register SetVirtualAddressMap () notify function - // - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - RuntimeLibVirtualNotifyEvent, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mEfiVirtualNotifyEvent - ); - - ASSERT_EFI_ERROR (Status); - - Status = gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - RuntimeLibExitBootServicesEvent, - NULL, - &gEfiEventExitBootServicesGuid, - &mEfiExitBootServicesEvent - ); - - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - If a runtime driver exits with an error, it must call this routine - to free the allocated resource before the exiting. - It will ASSERT() if gBS is NULL. - It will ASSERT() if that operation fails. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The Runtime Driver Lib shutdown successfully. - @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized. -**/ -EFI_STATUS -EFIAPI -RuntimeDriverLibDeconstruct ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Close SetVirtualAddressMap () notify function - // - ASSERT (gBS != NULL); - Status = gBS->CloseEvent (mEfiVirtualNotifyEvent); - ASSERT_EFI_ERROR (Status); - - Status = gBS->CloseEvent (mEfiExitBootServicesEvent); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - This function allows the caller to determine if UEFI ExitBootServices() has been called. - - This function returns TRUE after all the EVT_SIGNAL_EXIT_BOOT_SERVICES functions have - executed as a result of the OS calling ExitBootServices(). Prior to this time FALSE - is returned. This function is used by runtime code to decide it is legal to access - services that go away after ExitBootServices(). - - @retval TRUE The system has finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event. - @retval FALSE The system has not finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event. - -**/ -BOOLEAN -EFIAPI -EfiAtRuntime ( - VOID - ) -{ - return mEfiAtRuntime; -} - -/** - This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called. - - This function returns TRUE after all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE functions have - executed as a result of the OS calling SetVirtualAddressMap(). Prior to this time FALSE - is returned. This function is used by runtime code to decide it is legal to access services - that go away after SetVirtualAddressMap(). - - @retval TRUE The system has finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. - @retval FALSE The system has not finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. - -**/ -BOOLEAN -EFIAPI -EfiGoneVirtual ( - VOID - ) -{ - return mEfiGoneVirtual; -} - - -/** - This service is a wrapper for the UEFI Runtime Service ResetSystem(). - - The ResetSystem()function resets the entire platform, including all processors and devices,and reboots the system. - Calling this interface with ResetType of EfiResetCold causes a system-wide reset. This sets all circuitry within - the system to its initial state. This type of reset is asynchronous to system operation and operates without regard - to cycle boundaries. EfiResetCold is tantamount to a system power cycle. - Calling this interface with ResetType of EfiResetWarm causes a system-wide initialization. The processors are set to - their initial state, and pending cycles are not corrupted. If the system does not support this reset type, then an - EfiResetCold must be performed. - Calling this interface with ResetType of EfiResetShutdown causes the system to enter a power state equivalent to the - ACPI G2/S5 or G3 states. If the system does not support this reset type, then when the system is rebooted, it should - exhibit the EfiResetCold attributes. - The platform may optionally log the parameters from any non-normal reset that occurs. - The ResetSystem() function does not return. - - @param ResetType The type of reset to perform. - @param ResetStatus The status code for the reset. If the system reset is part of a normal operation, the status code - would be EFI_SUCCESS. If the system reset is due to some type of failure the most appropriate EFI - Status code would be used. - @param DataSizeThe size, in bytes, of ResetData. - @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown the data buffer starts with a - Null-terminated Unicode string, optionally followed by additional binary data. The string is a - description that the caller may use to further indicate the reason for the system reset. ResetData - is only valid if ResetStatus is something other then EFI_SUCCESS. This pointer must be a physical - address. For a ResetType of EfiRestUpdate the data buffer also starts with a Null-terminated string - that is followed by a physical VOID * to an EFI_CAPSULE_HEADER. - -**/ -VOID -EFIAPI -EfiResetSystem ( - 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(). - - The GetTime() function returns a time that was valid sometime during the call to the function. - While the returned EFI_TIME structure contains TimeZone and Daylight savings time information, - the actual clock does not maintain these values. The current time zone and daylight saving time - information returned by GetTime() are the values that were last set via SetTime(). - The GetTime() function should take approximately the same amount of time to read the time each - time it is called. All reported device capabilities are to be rounded up. - During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize - access to the device before calling GetTime(). - - @param Time A pointer to storage to receive a snapshot of the current time. - @param Capabilities An optional pointer to a buffer to receive the real time clock device's - capabilities. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER Time is NULL. - @retval EFI_DEVICE_ERROR The time could not be retrieved due to a hardware error. - -**/ -EFI_STATUS -EFIAPI -EfiGetTime ( - 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(). - - The SetTime() function sets the real time clock device to the supplied time, and records the - current time zone and daylight savings time information. The SetTime() function is not allowed - to loop based on the current time. For example, if the device does not support a hardware reset - for the sub-resolution time, the code is not to implement the feature by waiting for the time to - wrap. - During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize - access to the device before calling SetTime(). - - @param Time A pointer to the current time. Type EFI_TIME is defined in the GetTime() - function description. Full error checking is performed on the different - fields of the EFI_TIME structure (refer to the EFI_TIME definition in the - GetTime() function description for full details), and EFI_INVALID_PARAMETER - is returned if any field is out of range. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The time could not be set due to a hardware error. - -**/ -EFI_STATUS -EFIAPI -EfiSetTime ( - IN EFI_TIME *Time - ) -{ - return mInternalRT->SetTime (Time); -} - - -/** - This service is a wrapper for the UEFI Runtime Service GetWakeupTime(). - - The alarm clock time may be rounded from the set alarm clock time to be within the resolution - of the alarm clock device. The resolution of the alarm clock device is defined to be one second. - During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize - access to the device before calling GetWakeupTime(). - - @param Enabled Indicates if the alarm is currently enabled or disabled. - @param Pending Indicates if the alarm signal is pending and requires acknowledgement. - @param Time The current alarm setting. Type EFI_TIME is defined in the GetTime() - function description. - - @retval EFI_SUCCESS The alarm settings were returned. - @retval EFI_INVALID_PARAMETER Enabled is NULL. - @retval EFI_INVALID_PARAMETER Pending is NULL. - @retval EFI_INVALID_PARAMETER Time is NULL. - @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. - @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. - -**/ -EFI_STATUS -EFIAPI -EfiGetWakeupTime ( - 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() - - Setting a system wakeup alarm causes the system to wake up or power on at the set time. - When the alarm fires, the alarm signal is latched until it is acknowledged by calling SetWakeupTime() - to disable the alarm. If the alarm fires before the system is put into a sleeping or off state, - since the alarm signal is latched the system will immediately wake up. If the alarm fires while - the system is off and there is insufficient power to power on the system, the system is powered - on when power is restored. - - @param Enable Enable or disable the wakeup alarm. - @param Time If Enable is TRUE, the time to set the wakeup alarm for. Type EFI_TIME - is defined in the GetTime() function description. If Enable is FALSE, - then this parameter is optional, and may be NULL. - - @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. - If Enable is FALSE, then the wakeup alarm was disabled. - @retval EFI_INVALID_PARAMETER A time field is out of range. - @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. - @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. - -**/ -EFI_STATUS -EFIAPI -EfiSetWakeupTime ( - IN BOOLEAN Enable, - IN EFI_TIME *Time OPTIONAL - ) -{ - return mInternalRT->SetWakeupTime (Enable, Time); -} - - -/** - This service is a wrapper for the UEFI Runtime Service GetVariable(). - - Each vendor may create and manage its own variables without the risk of name conflicts by - using a unique VendorGuid. When a variable is set its Attributes are supplied to indicate - how the data variable should be stored and maintained by the system. The attributes affect - when the variable may be accessed and volatility of the data. Any attempts to access a variable - that does not have the attribute set for runtime access will yield the EFI_NOT_FOUND error. - If the Data buffer is too small to hold the contents of the variable, the error EFI_BUFFER_TOO_SMALL - is returned and DataSize is set to the required buffer size to obtain the data. - - @param VariableName the name of the vendor's variable, it's a Null-Terminated Unicode String - @param VendorGuid Unify identifier for vendor. - @param Attributes Point to memory location to return the attributes of variable. If the point - is NULL, the parameter would be ignored. - @param DataSize As input, point to the maximum size of return Data-Buffer. - As output, point to the actual size of the returned Data-Buffer. - @param Data Point to return Data-Buffer. - - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_FOUND The variable was not found. - @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has - been updated with the size needed to complete the request. - @retval EFI_INVALID_PARAMETER VariableName is NULL. - @retval EFI_INVALID_PARAMETER VendorGuid is NULL. - @retval EFI_INVALID_PARAMETER DataSize is NULL. - @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL. - @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. - @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. -**/ -EFI_STATUS -EFIAPI -EfiGetVariable ( - 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(). - - GetNextVariableName() is called multiple times to retrieve the VariableName and VendorGuid of - all variables currently available in the system. On each call to GetNextVariableName() the - previous results are passed into the interface, and on output the interface returns the next - variable name data. When the entire variable list has been returned, the error EFI_NOT_FOUND - is returned. - - @param VariableNameSize As input, point to maximum size of variable name. - As output, point to actual size of variable name. - @param VariableName As input, supplies the last VariableName that was returned by - GetNextVariableName(). - As output, returns the name of variable. The name - string is Null-Terminated Unicode string. - @param VendorGuid As input, supplies the last VendorGuid that was returned by - GetNextVriableName(). - As output, returns the VendorGuid of the current variable. - - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_FOUND The next variable was not found. - @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. - VariableNameSize has been updated with the size needed - to complete the request. - @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. - @retval EFI_INVALID_PARAMETER VariableName is NULL. - @retval EFI_INVALID_PARAMETER VendorGuid is NULL. - @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to a hardware error. - -**/ -EFI_STATUS -EFIAPI -EfiGetNextVariableName ( - 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() - - Variables are stored by the firmware and may maintain their values across power cycles. Each vendor - may create and manage its own variables without the risk of name conflicts by using a unique VendorGuid. - - @param VariableName The name of the vendor's variable; it's a Null-Terminated - Unicode String - @param VendorGuid Unify identifier for vendor. - @param Attributes Points to a memory location to return the attributes of variable. If the point - is NULL, the parameter would be ignored. - @param DataSize The size in bytes of Data-Buffer. - @param Data Points to the content of the variable. - - @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as - defined by the Attributes. - @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the - DataSize exceeds the maximum allowed. - @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. - @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure. - @retval EFI_WRITE_PROTECTED The variable in question is read-only. - @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. - @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS - set but the AuthInfo does NOT pass the validation check carried - out by the firmware. - @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. - -**/ -EFI_STATUS -EFIAPI -EfiSetVariable ( - 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(). - - The platform's monotonic counter is comprised of two 32-bit quantities: the high 32 bits and - the low 32 bits. During boot service time the low 32-bit value is volatile: it is reset to zero - on every system reset and is increased by 1 on every call to GetNextMonotonicCount(). The high - 32-bit value is nonvolatile and is increased by 1 whenever the system resets or whenever the low - 32-bit count (returned by GetNextMonoticCount()) overflows. - - @param HighCount The pointer to returned value. - - @retval EFI_SUCCESS The next high monotonic count was returned. - @retval EFI_DEVICE_ERROR The device is not functioning properly. - @retval EFI_INVALID_PARAMETER HighCount is NULL. - -**/ -EFI_STATUS -EFIAPI -EfiGetNextHighMonotonicCount ( - OUT UINT32 *HighCount - ) -{ - return mInternalRT->GetNextHighMonotonicCount (HighCount); -} - - -/** - This service is a wrapper for the UEFI Runtime Service ConvertPointer(). - - The ConvertPointer() function is used by an EFI component during the SetVirtualAddressMap() operation. - ConvertPointer()must be called using physical address pointers during the execution of SetVirtualAddressMap(). - - @param DebugDisposition Supplies type information for the pointer being converted. - @param Address The pointer to a pointer that is to be fixed to be the - value needed for the new virtual address mapping being - applied. - - @retval EFI_SUCCESS The pointer pointed to by Address was modified. - @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part of - the current memory map. This is normally fatal. - @retval EFI_INVALID_PARAMETER Address is NULL. - @retval EFI_INVALID_PARAMETER *Address is NULL and DebugDispositio - -**/ -EFI_STATUS -EFIAPI -EfiConvertPointer ( - 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. - - For IA32, x64, and EBC, this service is a wrapper for the UEFI Runtime Service - ConvertPointer(). See the UEFI Specification for details. - For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure - and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical - to virtiual addressing. Since IPF allows the GP to point to an address outside - a PE/COFF image, the physical to virtual offset for the EntryPoint field is used - to adjust the GP field. The UEFI Runtime Service ConvertPointer() is used to convert - EntryPoint and the status code for this conversion is always returned. If the convertion - of EntryPoint fails, then neither EntryPoint nor GP are modified. See the UEFI - Specification for details on the UEFI Runtime Service ConvertPointer(). - - @param DebugDisposition Supplies type information for the pointer being converted. - @param Address The pointer to a pointer that is to be fixed to be the - value needed for the new virtual address mapping being - applied. - - @return EFI_STATUS value from EfiConvertPointer(). - -**/ -EFI_STATUS -EFIAPI -EfiConvertFunctionPointer ( - IN UINTN DebugDisposition, - IN OUT VOID **Address - ) -{ - return EfiConvertPointer (DebugDisposition, Address); -} - - -/** - Convert the standard Lib double linked list to a virtual mapping. - - This service uses EfiConvertPointer() to walk a double linked list and convert all the link - pointers to their virtual mappings. This function is only guaranteed to work during the - EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event and calling it at other times has undefined results. - - @param DebugDisposition Supplies type information for the pointer being converted. - @param ListHead Head of linked list to convert. - - @retval EFI_SUCCESS Success to execute the function. - @retval !EFI_SUCCESS Failed to e3xecute the function. - -**/ -EFI_STATUS -EFIAPI -EfiConvertList ( - IN UINTN DebugDisposition, - IN OUT LIST_ENTRY *ListHead - ) -{ - LIST_ENTRY *Link; - LIST_ENTRY *NextLink; - - // - // For NULL List, return EFI_SUCCESS - // - if (ListHead == NULL) { - return EFI_SUCCESS; - } - - // - // Convert all the ForwardLink & BackLink pointers in the list - // - Link = ListHead; - do { - NextLink = Link->ForwardLink; - - EfiConvertPointer ( - Link->ForwardLink == ListHead ? DebugDisposition : 0, - (VOID **) &Link->ForwardLink - ); - - EfiConvertPointer ( - Link->BackLink == ListHead ? DebugDisposition : 0, - (VOID **) &Link->BackLink - ); - - Link = NextLink; - } while (Link != ListHead); - return EFI_SUCCESS; -} - - -/** - This service is a wrapper for the UEFI Runtime Service SetVirtualAddressMap(). - - The SetVirtualAddressMap() function is used by the OS loader. The function can only be called - at runtime, and is called by the owner of the system's memory map. I.e., the component which - called ExitBootServices(). All events of type EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE must be signaled - before SetVirtualAddressMap() returns. - - @param MemoryMapSize The size in bytes of VirtualMap. - @param DescriptorSize The size in bytes of an entry in the VirtualMap. - @param DescriptorVersion The version of the structure entries in VirtualMap. - @param VirtualMap An array of memory descriptors which contain new virtual - address mapping information for all runtime ranges. Type - EFI_MEMORY_DESCRIPTOR is defined in the - GetMemoryMap() function description. - - @retval EFI_SUCCESS The virtual address map has been applied. - @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in - virtual address mapped mode. - @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is - invalid. - @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory - map that requires a mapping. - @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found - in the memory map. -**/ -EFI_STATUS -EFIAPI -EfiSetVirtualAddressMap ( - 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 - ); -} - - -/** - This service is a wrapper for the UEFI Runtime Service UpdateCapsule(). - - Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended - consumption, the firmware may process the capsule immediately. If the payload should persist across a - system reset, the reset value returned from EFI_QueryCapsuleCapabilities must be passed into ResetSystem() - and will cause the capsule to be processed by the firmware as part of the reset process. - - @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules - being passed into update capsule. Each capsules is assumed to - stored in contiguous virtual memory. The capsules in the - CapsuleHeaderArray must be the same capsules as the - ScatterGatherList. The CapsuleHeaderArray must - have the capsules in the same order as the ScatterGatherList. - @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in - CaspuleHeaderArray. - @param ScatterGatherList Physical pointer to a set of - EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the - location in physical memory of a set of capsules. See Related - Definitions for an explanation of how more than one capsule is - passed via this interface. The capsules in the - ScatterGatherList must be in the same order as the - CapsuleHeaderArray. This parameter is only referenced if - the capsules are defined to persist across system reset. - - @retval EFI_SUCCESS Valid capsule was passed. If CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, - the capsule has been successfully processed by the firmware. - @retval EFI_INVALID_PARAMETER CapsuleSize or HeaderSize is NULL. - @retval EFI_INVALID_PARAMETER CapsuleCount is 0 - @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error. - @retval EFI_UNSUPPORTED The capsule type is not supported on this platform. - @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the capsule. - -**/ -EFI_STATUS -EFIAPI -EfiUpdateCapsule ( - IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, - IN UINTN CapsuleCount, - IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL - ) -{ - return mInternalRT->UpdateCapsule ( - CapsuleHeaderArray, - CapsuleCount, - ScatterGatherList - ); -} - - -/** - This service is a wrapper for the UEFI Runtime Service QueryCapsuleCapabilities(). - - The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or - capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and - size of the entire capsule is checked. - If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be - constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof - (EFI_CAPSULE_HEADER). To determine reset requirements, - CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the - EFI_CAPSULE_HEADER. - The firmware must support any capsule that has the - CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The - firmware sets the policy for what capsules are supported that do not have the - CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set. - - @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules - being passed into update capsule. The capsules are assumed to - stored in contiguous virtual memory. - @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in - CaspuleHeaderArray. - @param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can - support as an argument to UpdateCapsule() via - CapsuleHeaderArray and ScatterGatherList. - Undefined on input. - @param ResetType Returns the type of reset required for the capsule update. - - @retval EFI_SUCCESS A valid answer was returned. - @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL. - @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and - MaximumCapsuleSize and ResetType are undefined. - @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the query request. - -**/ -EFI_STATUS -EFIAPI -EfiQueryCapsuleCapabilities ( - IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, - IN UINTN CapsuleCount, - OUT UINT64 *MaximumCapsuleSize, - OUT EFI_RESET_TYPE *ResetType - ) -{ - return mInternalRT->QueryCapsuleCapabilities ( - CapsuleHeaderArray, - CapsuleCount, - MaximumCapsuleSize, - ResetType - ); -} - - -/** - This service is a wrapper for the UEFI Runtime Service QueryVariableInfo(). - - The QueryVariableInfo() function allows a caller to obtain the information about the - maximum size of the storage space available for the EFI variables, the remaining size of the storage - space available for the EFI variables and the maximum size of each individual EFI variable, - associated with the attributes specified. - The returned MaximumVariableStorageSize, RemainingVariableStorageSize, - MaximumVariableSize information may change immediately after the call based on other - runtime activities including asynchronous error events. Also, these values associated with different - attributes are not additive in nature. - - @param Attributes Attributes bitmask to specify the type of variables on - which to return information. Refer to the - GetVariable() function description. - @param MaximumVariableStorageSize - On output the maximum size of the storage space - available for the EFI variables associated with the - attributes specified. - @param RemainingVariableStorageSize - Returns the remaining size of the storage space - available for the EFI variables associated with the - attributes specified.. - @param MaximumVariableSize Returns the maximum size of the individual EFI - variables associated with the attributes specified. - - @retval EFI_SUCCESS A valid answer was returned. - @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied. - @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the - MaximumVariableStorageSize, - RemainingVariableStorageSize, MaximumVariableSize - are undefined. - -**/ -EFI_STATUS -EFIAPI -EfiQueryVariableInfo ( - IN UINT32 Attributes, - OUT UINT64 *MaximumVariableStorageSize, - OUT UINT64 *RemainingVariableStorageSize, - OUT UINT64 *MaximumVariableSize - ) -{ - return mInternalRT->QueryVariableInfo ( - Attributes, - MaximumVariableStorageSize, - RemainingVariableStorageSize, - MaximumVariableSize - ); -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf deleted file mode 100644 index b89e1cc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf +++ /dev/null @@ -1,51 +0,0 @@ -## @file -# Instance of UEFI Runtime Library. -# -# Instance of UEFI Runtime Library, with hooked EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE and -# EVT_SIGNAL_EXIT_BOOT_SERVICES event, to provide runtime services. -# This instance also supports SAL drivers for better performance. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiRuntimeLib - MODULE_UNI_FILE = UefiRuntimeLib.uni - FILE_GUID = b1ee6c28-54aa-4d17-b705-3e28ccb27b2e - MODULE_TYPE = DXE_RUNTIME_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiRuntimeLib|DXE_RUNTIME_DRIVER - - CONSTRUCTOR = RuntimeDriverLibConstruct - DESTRUCTOR = RuntimeDriverLibDeconstruct - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - - -[Sources] - RuntimeLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - DebugLib - -[Guids] - gEfiEventExitBootServicesGuid ## CONSUMES ## Event - gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.uni deleted file mode 100644 index 7220ae6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file -// Instance of UEFI Runtime Library. -// -// Instance of UEFI Runtime Library, with hooked EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE and -// EVT_SIGNAL_EXIT_BOOT_SERVICES event, to provide runtime services. -// This instance also supports SAL drivers for better performance. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Instance of UEFI Runtime Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Instance of UEFI Runtime Library, with hooked EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE and EVT_SIGNAL_EXIT_BOOT_SERVICES event, to provide runtime services. This instance also supports SAL drivers for better performance." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.c deleted file mode 100644 index 72b631d..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.c +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - UEFI Runtime Services Table Library. - - This library instance retrieve EFI_RUNTIME_SERVICES pointer from EFI system table - in library's constructor. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include - -EFI_RUNTIME_SERVICES *gRT = NULL; - -/** - The constructor function caches the pointer of Runtime Services Table. - - The constructor function caches the pointer of Runtime Services Table. - It will ASSERT() if the pointer of Runtime Services Table is NULL. - It will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -UefiRuntimeServicesTableLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // Cache pointer to the EFI Runtime Services Table - // - gRT = SystemTable->RuntimeServices; - ASSERT (gRT != NULL); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf deleted file mode 100644 index a8a7db0..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# UEFI Runtime Services Table Library implementation. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiRuntimeServicesTableLib - MODULE_UNI_FILE = UefiRuntimeServicesTableLib.uni - FILE_GUID = 19cbbb97-ff61-45ff-8c3f-dfa66dd118c8 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiRuntimeServicesTableLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - - CONSTRUCTOR = UefiRuntimeServicesTableLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiRuntimeServicesTableLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - DebugLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.uni deleted file mode 100644 index 9f045be..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file -// UEFI Runtime Services Table Library implementation. -// -// UEFI Runtime Services Table Library implementation. -// -// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "UEFI Runtime Services Table Library implementation" - -#string STR_MODULE_DESCRIPTION #language en-US "UEFI Runtime Services Table Library implementation." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.c deleted file mode 100644 index cf9d94c..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.c +++ /dev/null @@ -1,2067 +0,0 @@ -/** @file - UEFI SCSI Library implementation - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include -#include -#include -#include -#include -#include -#include - -#include - - - // - // Scsi Command Length - // -#define EFI_SCSI_OP_LENGTH_SIX 0x6 -#define EFI_SCSI_OP_LENGTH_TEN 0xa -#define EFI_SCSI_OP_LENGTH_SIXTEEN 0x10 - -// -// The context structure used when non-blocking SCSI read/write operation -// completes. -// -typedef struct { - /// - /// The SCSI request packet to send to the SCSI controller specified by - /// the device handle. - /// - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - /// - /// The length of the output sense data. - /// - UINT8 *SenseDataLength; - /// - /// The status of the SCSI host adapter. - /// - UINT8 *HostAdapterStatus; - /// - /// The status of the target SCSI device. - /// - UINT8 *TargetStatus; - /// - /// The length of the data buffer for the SCSI read/write command. - /// - UINT32 *DataLength; - /// - /// The caller event to be signaled when the SCSI read/write command - /// completes. - /// - EFI_EVENT CallerEvent; -} EFI_SCSI_LIB_ASYNC_CONTEXT; - - - -/** - Execute Test Unit Ready SCSI command on a specific SCSI target. - - Executes the Test Unit Ready command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance - for the specific SCSI target. - @param[in] Timeout The timeout in 100 ns units to use for the execution - of this SCSI Request Packet. A Timeout value of - zero means that this function will wait indefinitely - for the SCSI Request Packet to execute. If Timeout - is greater than zero, then this function will return - EFI_TIMEOUT if the time required to execute the SCSI - Request Packet is greater than Timeout. - @param[in, out] SenseData A pointer to sense data that was generated by - the execution of the SCSI Request Packet. This - buffer must be allocated by the caller. - If SenseDataLength is 0, then this parameter is - optional and may be NULL. - @param[in, out] SenseDataLength On input, a pointer to the length in bytes of - the SenseData buffer. On output, a pointer to - the number of bytes written to the SenseData buffer. - @param[out] HostAdapterStatus The status of the SCSI Host Controller that produces - the SCSI bus containing the SCSI target specified by - ScsiIo when the SCSI Request Packet was executed. - See the EFI SCSI I/O Protocol in the UEFI Specification - for details on the possible return values. - @param[out] TargetStatus The status returned by the SCSI target specified - by ScsiIo when the SCSI Request Packet was executed - on the SCSI Host Controller. See the EFI SCSI I/O - Protocol in the UEFI Specification for details on - the possible return values. - - @retval EFI_SUCCESS The command was executed successfully. - See HostAdapterStatus, TargetStatus, SenseDataLength, - and SenseData in that order for additional status - information. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already - queued. The SCSI Request Packet was not sent, so - no additional status information is available. - The caller may retry again later. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send - SCSI Request Packet. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in that - order for additional status information. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI - Host Controller). The SCSI Request Packet was not - sent, so no additional status information is available. - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request - Packet to execute. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for - additional status information. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiTestUnitReadyCommand ( - IN EFI_SCSI_IO_PROTOCOL *ScsiIo, - IN UINT64 Timeout, - IN OUT VOID *SenseData, OPTIONAL - IN OUT UINT8 *SenseDataLength, - OUT UINT8 *HostAdapterStatus, - OUT UINT8 *TargetStatus - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Test Unit Ready Command - // - Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY; - CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX; - CommandPacket.SenseDataLength = *SenseDataLength; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - - return Status; -} - - -/** - Execute Inquiry SCSI command on a specific SCSI target. - - Executes the Inquiry command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If InquiryDataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, InquiryDataBuffer - must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance - for the specific SCSI target. - @param[in] Timeout The timeout in 100 ns units to use for the - execution of this SCSI Request Packet. A Timeout - value of zero means that this function will wait - indefinitely for the SCSI Request Packet to execute. - If Timeout is greater than zero, then this function - will return EFI_TIMEOUT if the time required to - execute the SCSI Request Packet is greater than Timeout. - @param[in, out] SenseData A pointer to sense data that was generated - by the execution of the SCSI Request Packet. - This buffer must be allocated by the caller. - If SenseDataLength is 0, then this parameter - is optional and may be NULL. - @param[in, out] SenseDataLength On input, the length in bytes of the SenseData buffer. - On output, the number of bytes written to the SenseData buffer. - @param[out] HostAdapterStatus The status of the SCSI Host Controller that - produces the SCSI bus containing the SCSI - target specified by ScsiIo when the SCSI - Request Packet was executed. See the EFI - SCSI I/O Protocol in the UEFI Specification - for details on the possible return values. - @param[out] TargetStatus The status returned by the SCSI target specified - by ScsiIo when the SCSI Request Packet was - executed on the SCSI Host Controller. - See the EFI SCSI I/O Protocol in the UEFI - Specification for details on the possible - return values. - @param[in, out] InquiryDataBuffer A pointer to inquiry data that was generated - by the execution of the SCSI Request Packet. - This buffer must be allocated by the caller. - If InquiryDataLength is 0, then this parameter - is optional and may be NULL. - @param[in, out] InquiryDataLength On input, a pointer to the length in bytes - of the InquiryDataBuffer buffer. - On output, a pointer to the number of bytes - written to the InquiryDataBuffer buffer. - @param[in] EnableVitalProductData If TRUE, then the supported vital product - data for the PageCode is returned in InquiryDataBuffer. - If FALSE, then the standard inquiry data is - returned in InquiryDataBuffer and PageCode is ignored. - @param[in] PageCode The page code of the vital product data. - It's ignored if EnableVitalProductData is FALSE. - - @retval EFI_SUCCESS The command executed successfully. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in that order - for additional status information. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire - InquiryDataBuffer could not be transferred. The actual - number of bytes transferred is returned in InquiryDataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there - are too many SCSI Command Packets already queued. - The SCSI Request Packet was not sent, so no additional - status information is available. The caller may retry again later. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI - Request Packet. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for additional - status information. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not - supported by the SCSI initiator(i.e., SCSI Host Controller). - The SCSI Request Packet was not sent, so no additional - status information is available. - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request - Packet to execute. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for - additional status information. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiInquiryCommandEx ( - 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 *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]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (InquiryDataLength != NULL); - ASSERT (ScsiIo != NULL); - - 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; - - Cdb[0] = EFI_SCSI_OP_INQUIRY; - if (EnableVitalProductData) { - Cdb[1] |= 0x01; - Cdb[2] = PageCode; - } - - if (*InquiryDataLength > 0xff) { - *InquiryDataLength = 0xff; - } - - Cdb[4] = (UINT8) (*InquiryDataLength); - CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX; - CommandPacket.DataDirection = EFI_SCSI_DATA_IN; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *InquiryDataLength = CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Inquiry SCSI command on a specific SCSI target. - - Executes the Inquiry command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If InquiryDataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, InquiryDataBuffer - must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance - for the specific SCSI target. - @param[in] Timeout The timeout in 100 ns units to use for the - execution of this SCSI Request Packet. A Timeout - value of zero means that this function will wait - indefinitely for the SCSI Request Packet to execute. - If Timeout is greater than zero, then this function - will return EFI_TIMEOUT if the time required to - execute the SCSI Request Packet is greater than Timeout. - @param[in, out] SenseData A pointer to sense data that was generated - by the execution of the SCSI Request Packet. - This buffer must be allocated by the caller. - If SenseDataLength is 0, then this parameter - is optional and may be NULL. - @param[in, out] SenseDataLength On input, the length in bytes of the SenseData buffer. - On output, the number of bytes written to the SenseData buffer. - @param[out] HostAdapterStatus The status of the SCSI Host Controller that - produces the SCSI bus containing the SCSI - target specified by ScsiIo when the SCSI - Request Packet was executed. See the EFI - SCSI I/O Protocol in the UEFI Specification - for details on the possible return values. - @param[out] TargetStatus The status returned by the SCSI target specified - by ScsiIo when the SCSI Request Packet was - executed on the SCSI Host Controller. - See the EFI SCSI I/O Protocol in the UEFI - Specification for details on the possible - return values. - @param[in, out] InquiryDataBuffer A pointer to inquiry data that was generated - by the execution of the SCSI Request Packet. - This buffer must be allocated by the caller. - If InquiryDataLength is 0, then this parameter - is optional and may be NULL. - @param[in, out] InquiryDataLength On input, a pointer to the length in bytes - of the InquiryDataBuffer buffer. - On output, a pointer to the number of bytes - written to the InquiryDataBuffer buffer. - @param[in] EnableVitalProductData If TRUE, then the supported vital product - data is returned in InquiryDataBuffer. - If FALSE, then the standard inquiry data is - returned in InquiryDataBuffer. - - @retval EFI_SUCCESS The command was executed successfully. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in that order - for additional status information. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire - InquiryDataBuffer could not be transferred. The actual - number of bytes transferred is returned in InquiryDataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there - are too many SCSI Command Packets already queued. - The SCSI Request Packet was not sent, so no additional - status information is available. The caller may retry again later. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI - Request Packet. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for additional - status information. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not - supported by the SCSI initiator(i.e., SCSI Host Controller). - The SCSI Request Packet was not sent, so no additional - status information is available. - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request - Packet to execute. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for - additional status information. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiInquiryCommand ( - 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 *InquiryDataBuffer, OPTIONAL - IN OUT UINT32 *InquiryDataLength, - IN BOOLEAN EnableVitalProductData - ) -{ - return ScsiInquiryCommandEx ( - ScsiIo, - Timeout, - SenseData, - SenseDataLength, - HostAdapterStatus, - TargetStatus, - InquiryDataBuffer, - InquiryDataLength, - EnableVitalProductData, - 0 - ); -} - -/** - Execute Mode Sense(10) SCSI command on a specific SCSI target. - - Executes the SCSI Mode Sense(10) command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout - after Timeout 100 ns units. The DBDField, PageControl, and PageCode parameters - are used to construct the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance - for the specific SCSI target. - @param[in] Timeout The timeout in 100 ns units to use for the - execution of this SCSI Request Packet. A Timeout - value of zero means that this function will wait - indefinitely for the SCSI Request Packet to execute. - If Timeout is greater than zero, then this function - will return EFI_TIMEOUT if the time required to - execute the SCSI Request Packet is greater than Timeout. - @param[in, out] SenseData A pointer to sense data that was generated - by the execution of the SCSI Request Packet. - This buffer must be allocated by the caller. - If SenseDataLength is 0, then this parameter - is optional and may be NULL. - @param[in, out] SenseDataLength On input, the length in bytes of the SenseData buffer. - On output, the number of bytes written to the SenseData buffer. - @param[out] HostAdapterStatus The status of the SCSI Host Controller that - produces the SCSI bus containing the SCSI target - specified by ScsiIo when the SCSI Request Packet - was executed. See the EFI SCSI I/O Protocol in the - UEFI Specification for details on the possible - return values. - @param[out] TargetStatus The status returned by the SCSI target specified - by ScsiIo when the SCSI Request Packet was executed - on the SCSI Host Controller. See the EFI SCSI - I/O Protocol in the UEFI Specification for details - on the possible return values. - @param[in, out] DataBuffer A pointer to data that was generated by the - execution of the SCSI Request Packet. This - buffer must be allocated by the caller. If - DataLength is 0, then this parameter is optional - and may be NULL. - @param[in, out] DataLength On input, a pointer to the length in bytes of - the DataBuffer buffer. On output, a pointer - to the number of bytes written to the DataBuffer - buffer. - @param[in] DBDField Specifies the DBD field of the CDB for this SCSI Command. - @param[in] PageControl Specifies the PC field of the CDB for this SCSI Command. - @param[in] PageCode Specifies the Page Control field of the CDB for this SCSI Command. - - @retval EFI_SUCCESS The command was executed successfully. - See HostAdapterStatus, TargetStatus, SenseDataLength, - and SenseData in that order for additional status information. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the - entire DataBuffer could not be transferred. - The actual number of bytes transferred is returned - in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already queued. - The SCSI Request Packet was not sent, so no additional - status information is available. The caller may retry - again later. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send - SCSI Request Packet. See HostAdapterStatus, TargetStatus, - SenseDataLength, and SenseData in that order for - additional status information. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI - Host Controller). The SCSI Request Packet was not - sent, so no additional status information is available. - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI - Request Packet to execute. See HostAdapterStatus, - TargetStatus, SenseDataLength, and SenseData in that - order for additional status information. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -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 - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Mode Sense (10) Command - // - Cdb[0] = EFI_SCSI_OP_MODE_SEN10; - // - // DBDField is in Cdb[1] bit3 of (bit7..0) - // - 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); - - CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN; - CommandPacket.DataDirection = EFI_SCSI_DATA_IN; - CommandPacket.SenseDataLength = *SenseDataLength; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Request Sense SCSI command on a specific SCSI target. - - Executes the Request Sense command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are - too many SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by - the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiRequestSenseCommand ( - IN EFI_SCSI_IO_PROTOCOL *ScsiIo, - IN UINT64 Timeout, - IN OUT VOID *SenseData, OPTIONAL - IN OUT UINT8 *SenseDataLength, - OUT UINT8 *HostAdapterStatus, - OUT UINT8 *TargetStatus - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Request Sense Command - // - Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE; - Cdb[4] = (UINT8) (*SenseDataLength); - - CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX; - CommandPacket.DataDirection = EFI_SCSI_DATA_IN; - CommandPacket.SenseDataLength = 0; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = (UINT8) CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Read Capacity SCSI command on a specific SCSI target. - - Executes the SCSI Read Capacity command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after - Timeout 100 ns units. The Pmi parameter is used to construct the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] Pmi Partial medium indicator. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire - DataBuffer could not be transferred. The actual - number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiReadCapacityCommand ( - 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 BOOLEAN Pmi - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Read Capacity Command - // - Cdb[0] = EFI_SCSI_OP_READ_CAPACITY; - if (!Pmi) { - // - // Partial medium indicator,if Pmi is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO. - // - ZeroMem ((Cdb + 2), 4); - } else { - Cdb[8] |= 0x01; - } - - CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN; - CommandPacket.DataDirection = EFI_SCSI_DATA_IN; - CommandPacket.SenseDataLength = *SenseDataLength; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *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. - - Executes the SCSI Read Capacity 16 command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after - Timeout 100 ns units. The Pmi parameter is used to construct the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] Pmi Partial medium indicator. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire - DataBuffer could not be transferred. The actual - number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because - there are too many SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet - is not supported by the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiReadCapacity16Command ( - 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 BOOLEAN Pmi - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[16]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Read Capacity Command - // - 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. - // - ZeroMem ((Cdb + 2), 8); - } else { - Cdb[14] |= 0x01; - } - - Cdb[13] = 0x20; - CommandPacket.CdbLength = 16; - CommandPacket.DataDirection = EFI_SCSI_DATA_IN; - CommandPacket.SenseDataLength = *SenseDataLength; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Read(10) SCSI command on a specific SCSI target. - - Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout - after Timeout 100 ns units. The StartLba and SectorSize parameters are used to - construct the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer Read 10 command data. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks of data that shall be transferred. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could - not be transferred. The actual number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many - SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by - the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiRead10Command ( - 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 UINT32 StartLba, - IN UINT32 SectorSize - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - 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; - // - // Fill Cdb for Read (10) Command - // - Cdb[0] = EFI_SCSI_OP_READ10; - WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba)); - 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); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Write(10) SCSI command on a specific SCSI target. - - Executes the SCSI Write(10) command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after - Timeout 100 ns units. The StartLba and SectorSize parameters are used to construct - the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo SCSI IO Protocol to use - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks of data that shall be transferred. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could - not be transferred. The actual number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many - SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by - the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiWrite10Command ( - 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 UINT32 StartLba, - IN UINT32 SectorSize - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); - ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN); - - CommandPacket.Timeout = Timeout; - CommandPacket.OutDataBuffer = DataBuffer; - CommandPacket.SenseData = SenseData; - CommandPacket.OutTransferLength= *DataLength; - CommandPacket.Cdb = Cdb; - // - // Fill Cdb for Write (10) Command - // - Cdb[0] = EFI_SCSI_OP_WRITE10; - WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba)); - 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); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.OutTransferLength; - - return Status; -} - -/** - Execute Read(16) SCSI command on a specific SCSI target. - - Executes the SCSI Read(16) command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout - after Timeout 100 ns units. The StartLba and SectorSize parameters are used to - construct the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer Read 16 command data. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks of data that shall be transferred. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could - not be transferred. The actual number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many - SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by - the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiRead16Command ( - 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 UINT64 StartLba, - IN UINT32 SectorSize - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); - ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIXTEEN); - - CommandPacket.Timeout = Timeout; - CommandPacket.InDataBuffer = DataBuffer; - CommandPacket.SenseData = SenseData; - CommandPacket.InTransferLength = *DataLength; - CommandPacket.Cdb = Cdb; - // - // Fill Cdb for Read (16) Command - // - 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; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.InTransferLength; - - return Status; -} - - -/** - Execute Write(16) SCSI command on a specific SCSI target. - - Executes the SCSI Write(16) command on the SCSI target specified by ScsiIo. - If Timeout is zero, then this function waits indefinitely for the command to complete. - If Timeout is greater than zero, then the command is executed and will timeout after - Timeout 100 ns units. The StartLba and SectorSize parameters are used to construct - the CDB for this SCSI command. - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet buffer - alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise EFI_INVALID_PARAMETER - gets returned. - - @param[in] ScsiIo SCSI IO Protocol to use - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks of data that shall be transferred. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could - not be transferred. The actual number of bytes transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many - SCSI Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by - the SCSI initiator(i.e., SCSI Host Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet are invalid. - -**/ -EFI_STATUS -EFIAPI -ScsiWrite16Command ( - 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 UINT64 StartLba, - IN UINT32 SectorSize - ) -{ - EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket; - EFI_STATUS Status; - UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIXTEEN]; - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); - ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIXTEEN); - - CommandPacket.Timeout = Timeout; - CommandPacket.OutDataBuffer = DataBuffer; - CommandPacket.SenseData = SenseData; - CommandPacket.OutTransferLength = *DataLength; - CommandPacket.Cdb = Cdb; - // - // Fill Cdb for Write (16) Command - // - 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; - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL); - - *HostAdapterStatus = CommandPacket.HostAdapterStatus; - *TargetStatus = CommandPacket.TargetStatus; - *SenseDataLength = CommandPacket.SenseDataLength; - *DataLength = CommandPacket.OutTransferLength; - - return Status; -} - - -/** - Internal helper notify function in which update the result of the - non-blocking SCSI Read/Write commands and signal caller event. - - @param Event The instance of EFI_EVENT. - @param Context The parameter passed in. - -**/ -VOID -EFIAPI -ScsiLibNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_SCSI_LIB_ASYNC_CONTEXT *LibContext; - EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket; - EFI_EVENT CallerEvent; - - LibContext = (EFI_SCSI_LIB_ASYNC_CONTEXT *) Context; - CommandPacket = &LibContext->CommandPacket; - CallerEvent = LibContext->CallerEvent; - - // - // Update SCSI Read/Write operation results - // - *LibContext->SenseDataLength = CommandPacket->SenseDataLength; - *LibContext->HostAdapterStatus = CommandPacket->HostAdapterStatus; - *LibContext->TargetStatus = CommandPacket->TargetStatus; - if (CommandPacket->InDataBuffer != NULL) { - *LibContext->DataLength = CommandPacket->InTransferLength; - } else { - *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. - - Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo. - When Event is NULL, blocking command will be executed. Otherwise non-blocking - command will be executed. - For blocking I/O, if Timeout is zero, this function will wait indefinitely - for the command to complete. If Timeout is greater than zero, then the - command is executed and will timeout after Timeout 100 ns units. - For non-blocking I/O, if Timeout is zero, Event will be signaled only after - the command to completes. If Timeout is greater than zero, Event will also be - signaled after Timeout 100 ns units. - The StartLba and SectorSize parameters are used to construct the CDB for this - SCSI command. - - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer Read 16 command data. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks - of data that shall be transferred. - @param[in] Event If the SCSI target does not support - non-blocking I/O, then Event is ignored, - and blocking I/O is performed. If Event - is NULL, then blocking I/O is performed. - If Event is not NULL and non-blocking - I/O is supported, then non-blocking I/O - is performed, and Event will be signaled - when the SCSI Read(10) command - completes. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, - but the entire DataBuffer could not be - transferred. The actual number of bytes - transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be - sent because there are too many SCSI - Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting - to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI - Request Packet is not supported by the - SCSI initiator(i.e., SCSI Host - Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the - SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet - are invalid. - @retval EFI_OUT_OF_RESOURCES The request could not be completed due - to a lack of resources. - -**/ -EFI_STATUS -EFIAPI -ScsiRead10CommandEx ( - 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 UINT32 StartLba, - IN UINT32 SectorSize, - 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; - - if (Event == NULL) { - return ScsiRead10Command ( - ScsiIo, - Timeout, - SenseData, - SenseDataLength, - HostAdapterStatus, - TargetStatus, - DataBuffer, - DataLength, - StartLba, - SectorSize - ); - } - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - Context = AllocateZeroPool (sizeof (EFI_SCSI_LIB_ASYNC_CONTEXT)); - if (Context == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Cdb = AllocateZeroPool (EFI_SCSI_OP_LENGTH_TEN); - if (Cdb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - Context->SenseDataLength = SenseDataLength; - Context->HostAdapterStatus = HostAdapterStatus; - Context->TargetStatus = TargetStatus; - Context->CallerEvent = Event; - - CommandPacket = &Context->CommandPacket; - 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; - WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba)); - WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize)); - - CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN; - CommandPacket->DataDirection = EFI_SCSI_DATA_IN; - CommandPacket->SenseDataLength = *SenseDataLength; - - // - // Create Event - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - ScsiLibNotify, - Context, - &SelfEvent - ); - if (EFI_ERROR(Status)) { - goto ErrorExit; - } - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent); - if (EFI_ERROR(Status)) { - // - // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand() - // returns with error, close the event here. - // - gBS->CloseEvent (SelfEvent); - goto ErrorExit; - } else { - return EFI_SUCCESS; - } - -ErrorExit: - if (Context != NULL) { - FreePool (Context); - } - - return Status; -} - - -/** - Execute blocking/non-blocking Write(10) SCSI command on a specific SCSI - target. - - Executes the SCSI Write(10) command on the SCSI target specified by ScsiIo. - When Event is NULL, blocking command will be executed. Otherwise non-blocking - command will be executed. - For blocking I/O, if Timeout is zero, this function will wait indefinitely - for the command to complete. If Timeout is greater than zero, then the - command is executed and will timeout after Timeout 100 ns units. - For non-blocking I/O, if Timeout is zero, Event will be signaled only after - the command to completes. If Timeout is greater than zero, Event will also be - signaled after Timeout 100 ns units. - The StartLba and SectorSize parameters are used to construct the CDB for this - SCSI command. - - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo SCSI IO Protocol to use - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks - of data that shall be transferred. - @param[in] Event If the SCSI target does not support - non-blocking I/O, then Event is ignored, - and blocking I/O is performed. If Event - is NULL, then blocking I/O is performed. - If Event is not NULL and non-blocking - I/O is supported, then non-blocking I/O - is performed, and Event will be signaled - when the SCSI Write(10) command - completes. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, - but the entire DataBuffer could not be - transferred. The actual number of bytes - transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be - sent because there are too many SCSI - Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting - to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI - Request Packet is not supported by the - SCSI initiator(i.e., SCSI Host - Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the - SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet - are invalid. - @retval EFI_OUT_OF_RESOURCES The request could not be completed due - to a lack of resources. - -**/ -EFI_STATUS -EFIAPI -ScsiWrite10CommandEx ( - 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 UINT32 StartLba, - IN UINT32 SectorSize, - 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; - - if (Event == NULL) { - return ScsiWrite10Command ( - ScsiIo, - Timeout, - SenseData, - SenseDataLength, - HostAdapterStatus, - TargetStatus, - DataBuffer, - DataLength, - StartLba, - SectorSize - ); - } - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - Context = AllocateZeroPool (sizeof (EFI_SCSI_LIB_ASYNC_CONTEXT)); - if (Context == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Cdb = AllocateZeroPool (EFI_SCSI_OP_LENGTH_TEN); - if (Cdb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - Context->SenseDataLength = SenseDataLength; - Context->HostAdapterStatus = HostAdapterStatus; - Context->TargetStatus = TargetStatus; - Context->CallerEvent = Event; - - CommandPacket = &Context->CommandPacket; - CommandPacket->Timeout = Timeout; - CommandPacket->OutDataBuffer = DataBuffer; - CommandPacket->SenseData = SenseData; - CommandPacket->OutTransferLength = *DataLength; - CommandPacket->Cdb = Cdb; - // - // Fill Cdb for Write (10) Command - // - Cdb[0] = EFI_SCSI_OP_WRITE10; - WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba)); - WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize)); - - CommandPacket->CdbLength = EFI_SCSI_OP_LENGTH_TEN; - CommandPacket->DataDirection = EFI_SCSI_DATA_OUT; - CommandPacket->SenseDataLength = *SenseDataLength; - - // - // Create Event - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - ScsiLibNotify, - Context, - &SelfEvent - ); - if (EFI_ERROR(Status)) { - goto ErrorExit; - } - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent); - if (EFI_ERROR(Status)) { - // - // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand() - // returns with error, close the event here. - // - gBS->CloseEvent (SelfEvent); - goto ErrorExit; - } else { - return EFI_SUCCESS; - } - -ErrorExit: - if (Context != NULL) { - FreePool (Context); - } - - return Status; -} - - -/** - Execute blocking/non-blocking Read(16) SCSI command on a specific SCSI - target. - - Executes the SCSI Read(16) command on the SCSI target specified by ScsiIo. - When Event is NULL, blocking command will be executed. Otherwise non-blocking - command will be executed. - For blocking I/O, if Timeout is zero, this function will wait indefinitely - for the command to complete. If Timeout is greater than zero, then the - command is executed and will timeout after Timeout 100 ns units. - For non-blocking I/O, if Timeout is zero, Event will be signaled only after - the command to completes. If Timeout is greater than zero, Event will also be - signaled after Timeout 100 ns units. - The StartLba and SectorSize parameters are used to construct the CDB for this - SCSI command. - - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo A pointer to SCSI IO protocol. - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer Read 16 command data. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks - of data that shall be transferred. - @param[in] Event If the SCSI target does not support - non-blocking I/O, then Event is ignored, - and blocking I/O is performed. If Event - is NULL, then blocking I/O is performed. - If Event is not NULL and non-blocking - I/O is supported, then non-blocking I/O - is performed, and Event will be signaled - when the SCSI Read(16) command - completes. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, - but the entire DataBuffer could not be - transferred. The actual number of bytes - transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be - sent because there are too many SCSI - Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting - to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI - Request Packet is not supported by the - SCSI initiator(i.e., SCSI Host - Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the - SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet - are invalid. - @retval EFI_OUT_OF_RESOURCES The request could not be completed due - to a lack of resources. - -**/ -EFI_STATUS -EFIAPI -ScsiRead16CommandEx ( - 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 UINT64 StartLba, - IN UINT32 SectorSize, - 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; - - if (Event == NULL) { - return ScsiRead16Command ( - ScsiIo, - Timeout, - SenseData, - SenseDataLength, - HostAdapterStatus, - TargetStatus, - DataBuffer, - DataLength, - StartLba, - SectorSize - ); - } - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - Context = AllocateZeroPool (sizeof (EFI_SCSI_LIB_ASYNC_CONTEXT)); - if (Context == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Cdb = AllocateZeroPool (EFI_SCSI_OP_LENGTH_SIXTEEN); - if (Cdb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - Context->SenseDataLength = SenseDataLength; - Context->HostAdapterStatus = HostAdapterStatus; - Context->TargetStatus = TargetStatus; - Context->CallerEvent = Event; - - CommandPacket = &Context->CommandPacket; - CommandPacket->Timeout = Timeout; - CommandPacket->InDataBuffer = DataBuffer; - CommandPacket->SenseData = SenseData; - CommandPacket->InTransferLength = *DataLength; - CommandPacket->Cdb = Cdb; - // - // Fill Cdb for Read (16) Command - // - 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; - - // - // Create Event - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - ScsiLibNotify, - Context, - &SelfEvent - ); - if (EFI_ERROR(Status)) { - goto ErrorExit; - } - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent); - if (EFI_ERROR(Status)) { - // - // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand() - // returns with error, close the event here. - // - gBS->CloseEvent (SelfEvent); - goto ErrorExit; - } else { - return EFI_SUCCESS; - } - -ErrorExit: - if (Context != NULL) { - FreePool (Context); - } - - return Status; -} - - -/** - Execute blocking/non-blocking Write(16) SCSI command on a specific SCSI - target. - - Executes the SCSI Write(16) command on the SCSI target specified by ScsiIo. - When Event is NULL, blocking command will be executed. Otherwise non-blocking - command will be executed. - For blocking I/O, if Timeout is zero, this function will wait indefinitely - for the command to complete. If Timeout is greater than zero, then the - command is executed and will timeout after Timeout 100 ns units. - For non-blocking I/O, if Timeout is zero, Event will be signaled only after - the command to completes. If Timeout is greater than zero, Event will also be - signaled after Timeout 100 ns units. - The StartLba and SectorSize parameters are used to construct the CDB for this - SCSI command. - - If ScsiIo is NULL, then ASSERT(). - If SenseDataLength is NULL, then ASSERT(). - If HostAdapterStatus is NULL, then ASSERT(). - If TargetStatus is NULL, then ASSERT(). - If DataLength is NULL, then ASSERT(). - - If SenseDataLength is non-zero and SenseData is not NULL, SenseData must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet - buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise - EFI_INVALID_PARAMETER gets returned. - - @param[in] ScsiIo SCSI IO Protocol to use - @param[in] Timeout The length of timeout period. - @param[in, out] SenseData A pointer to output sense data. - @param[in, out] SenseDataLength The length of output sense data. - @param[out] HostAdapterStatus The status of Host Adapter. - @param[out] TargetStatus The status of the target. - @param[in, out] DataBuffer A pointer to a data buffer. - @param[in, out] DataLength The length of data buffer. - @param[in] StartLba The start address of LBA. - @param[in] SectorSize The number of contiguous logical blocks - of data that shall be transferred. - @param[in] Event If the SCSI target does not support - non-blocking I/O, then Event is ignored, - and blocking I/O is performed. If Event - is NULL, then blocking I/O is performed. - If Event is not NULL and non-blocking - I/O is supported, then non-blocking I/O - is performed, and Event will be signaled - when the SCSI Write(16) command - completes. - - @retval EFI_SUCCESS Command is executed successfully. - @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, - but the entire DataBuffer could not be - transferred. The actual number of bytes - transferred is returned in DataLength. - @retval EFI_NOT_READY The SCSI Request Packet could not be - sent because there are too many SCSI - Command Packets already queued. - @retval EFI_DEVICE_ERROR A device error occurred while attempting - to send SCSI Request Packet. - @retval EFI_UNSUPPORTED The command described by the SCSI - Request Packet is not supported by the - SCSI initiator(i.e., SCSI Host - Controller) - @retval EFI_TIMEOUT A timeout occurred while waiting for the - SCSI Request Packet to execute. - @retval EFI_INVALID_PARAMETER The contents of the SCSI Request Packet - are invalid. - @retval EFI_OUT_OF_RESOURCES The request could not be completed due - to a lack of resources. - -**/ -EFI_STATUS -EFIAPI -ScsiWrite16CommandEx ( - 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 UINT64 StartLba, - IN UINT32 SectorSize, - 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; - - if (Event == NULL) { - return ScsiWrite16Command ( - ScsiIo, - Timeout, - SenseData, - SenseDataLength, - HostAdapterStatus, - TargetStatus, - DataBuffer, - DataLength, - StartLba, - SectorSize - ); - } - - ASSERT (SenseDataLength != NULL); - ASSERT (HostAdapterStatus != NULL); - ASSERT (TargetStatus != NULL); - ASSERT (DataLength != NULL); - ASSERT (ScsiIo != NULL); - - Context = AllocateZeroPool (sizeof (EFI_SCSI_LIB_ASYNC_CONTEXT)); - if (Context == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Cdb = AllocateZeroPool (EFI_SCSI_OP_LENGTH_SIXTEEN); - if (Cdb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - Context->SenseDataLength = SenseDataLength; - Context->HostAdapterStatus = HostAdapterStatus; - Context->TargetStatus = TargetStatus; - Context->CallerEvent = Event; - - CommandPacket = &Context->CommandPacket; - CommandPacket->Timeout = Timeout; - CommandPacket->OutDataBuffer = DataBuffer; - CommandPacket->SenseData = SenseData; - CommandPacket->OutTransferLength = *DataLength; - CommandPacket->Cdb = Cdb; - // - // Fill Cdb for Write (16) Command - // - 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; - - // - // Create Event - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - ScsiLibNotify, - Context, - &SelfEvent - ); - if (EFI_ERROR(Status)) { - goto ErrorExit; - } - - Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent); - if (EFI_ERROR(Status)) { - // - // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand() - // returns with error, close the event here. - // - gBS->CloseEvent (SelfEvent); - goto ErrorExit; - } else { - return EFI_SUCCESS; - } - -ErrorExit: - if (Context != NULL) { - FreePool (Context); - } - - return Status; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf deleted file mode 100644 index 7ae36c1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -## @file -# Uefi Scsi Library Instance. -# -# This libarary provides the functions to submit Scsi commands defined -# in SCSI-2 specification for scsi device. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiScsiLib - MODULE_UNI_FILE = UefiScsiLib.uni - FILE_GUID = 280E42C3-826E-4573-9772-B74EF1086D95 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiScsiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiScsiLib.c - - -[Packages] - MdePkg/MdePkg.dec - - -[LibraryClasses] - BaseMemoryLib - DebugLib - BaseLib - MemoryAllocationLib - UefiBootServicesTableLib - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.uni deleted file mode 100644 index 67644ce..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiScsiLib/UefiScsiLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Uefi Scsi Library Instance. -// -// This libarary provides the functions to submit Scsi commands defined -// in SCSI-2 specification for scsi device. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "UEFI SCSI Library Instance" - -#string STR_MODULE_DESCRIPTION #language en-US "This library provides the functions to submit SCSI commands defined in SCSI-2 specification for SCSI devices." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/Hid.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/Hid.c deleted file mode 100644 index 1e2658e..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/Hid.c +++ /dev/null @@ -1,488 +0,0 @@ -/** @file - - The library provides USB HID Class standard and specific requests defined - in USB HID Firmware Specification 7 section : Requests. - - Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiUsbLibInternal.h" - -// -// Hid RequestType Bits specifying characteristics of request. -// Valid values are 10100001b (0xa1) or 00100001b (0x21). -// The following description: -// 7 Data transfer direction -// 0 = Host to device -// 1 = Device to host -// 6..5 Type -// 1 = Class -// 4..0 Recipient -// 1 = Interface -// - -/** - Get the descriptor of the specified USB HID interface. - - Submit a USB get HID descriptor request for the USB device specified by UsbIo - and Interface and return the HID descriptor in HidDescriptor. - If UsbIo is NULL, then ASSERT(). - If HidDescriptor is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the HID interface on the USB target. - @param HidDescriptor The pointer to the USB HID descriptor that was retrieved from - the specified USB target and interface. Type EFI_USB_HID_DESCRIPTOR - is defined in the MDE Package Industry Standard include file Usb.h. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbGetHidDescriptor ( - 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); - - Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE; - Request.Request = USB_REQ_GET_DESCRIPTOR; - Request.Value = (UINT16) (USB_DESC_TYPE_HID << 8); - Request.Index = Interface; - Request.Length = (UINT16) sizeof (EFI_USB_HID_DESCRIPTOR); - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - HidDescriptor, - sizeof (EFI_USB_HID_DESCRIPTOR), - &Status - ); - - return Result; - -} - -/** - Get the report descriptor of the specified USB HID interface. - - Submit a USB get HID report descriptor request for the USB device specified by - UsbIo and Interface and return the report descriptor in DescriptorBuffer. - If UsbIo is NULL, then ASSERT(). - If DescriptorBuffer is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param DescriptorLength The size, in bytes, of DescriptorBuffer. - @param DescriptorBuffer A pointer to the buffer to store the report class descriptor. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_OUT_OF_RESOURCES The request could not be completed because the - buffer specified by DescriptorLength and DescriptorBuffer - is not large enough to hold the result of the request. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbGetReportDescriptor ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Interface, - IN UINT16 DescriptorLength, - OUT UINT8 *DescriptorBuffer - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - ASSERT (DescriptorBuffer != NULL); - - // - // Fill Device request packet - // - Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE; - Request.Request = USB_REQ_GET_DESCRIPTOR; - Request.Value = (UINT16) (USB_DESC_TYPE_REPORT << 8); - Request.Index = Interface; - Request.Length = DescriptorLength; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - DescriptorBuffer, - DescriptorLength, - &Status - ); - - return Result; - -} - -/** - Get the HID protocol of the specified USB HID interface. - - Submit a USB get HID protocol request for the USB device specified by UsbIo - and Interface and return the protocol retrieved in Protocol. - If UsbIo is NULL, then ASSERT(). - If Protocol is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param Protocol A pointer to the protocol for the specified USB target. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbGetProtocolRequest ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Interface, - OUT UINT8 *Protocol - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - ASSERT (Protocol != NULL); - - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - Protocol, - sizeof (UINT8), - &Status - ); - - return Result; -} - - - -/** - Set the HID protocol of the specified USB HID interface. - - Submit a USB set HID protocol request for the USB device specified by UsbIo - and Interface and set the protocol to the value specified by Protocol. - If UsbIo is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param Protocol The protocol value to set for the specified USB target. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbSetProtocolRequest ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Interface, - IN UINT8 Protocol - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - &Status - ); - return Result; -} - - -/** - Set the idle rate of the specified USB HID report. - - Submit a USB set HID report idle request for the USB device specified by UsbIo, - Interface, and ReportId, and set the idle rate to the value specified by Duration. - If UsbIo is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param ReportId The identifier of the report to retrieve. - @param Duration The idle rate to set for the specified USB target. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbSetIdleRequest ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Interface, - IN UINT8 ReportId, - IN UINT8 Duration - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - &Status - ); - return Result; -} - - -/** - Get the idle rate of the specified USB HID report. - - Submit a USB get HID report idle request for the USB device specified by UsbIo, - Interface, and ReportId, and return the ide rate in Duration. - If UsbIo is NULL, then ASSERT(). - If Duration is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param ReportId The identifier of the report to retrieve. - @param Duration A pointer to the idle rate retrieved from the specified USB target. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -EFI_STATUS -EFIAPI -UsbGetIdleRequest ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Interface, - IN UINT8 ReportId, - OUT UINT8 *Duration - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - ASSERT (Duration != NULL); - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - Duration, - 1, - &Status - ); - - return Result; -} - - - -/** - Set the report descriptor of the specified USB HID interface. - - Submit a USB set HID report request for the USB device specified by UsbIo, - Interface, ReportId, and ReportType, and set the report descriptor using the - buffer specified by ReportLength and Report. - If UsbIo is NULL, then ASSERT(). - If Report is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param ReportId The identifier of the report to retrieve. - @param ReportType The type of report to retrieve. - @param ReportLength The size, in bytes, of Report. - @param Report A pointer to the report descriptor buffer to set. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -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 - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - ASSERT (Report != NULL); - - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataOut, - PcdGet32 (PcdUsbTransferTimeoutValue), - Report, - ReportLen, - &Status - ); - - return Result; -} - - -/** - Get the report descriptor of the specified USB HID interface. - - Submit a USB get HID report request for the USB device specified by UsbIo, - Interface, ReportId, and ReportType, and return the report in the buffer - specified by Report. - If UsbIo is NULL, then ASSERT(). - If Report is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The index of the report interface on the USB target. - @param ReportId The identifier of the report to retrieve. - @param ReportType The type of report to retrieve. - @param ReportLength The size, in bytes, of Report. - @param Report A pointer to the buffer to store the report descriptor. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_OUT_OF_RESOURCES The request could not be completed because the - buffer specified by ReportLength and Report is not - large enough to hold the result of the request. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - -**/ -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 - ) -{ - UINT32 Status; - EFI_STATUS Result; - EFI_USB_DEVICE_REQUEST Request; - - ASSERT (UsbIo != NULL); - ASSERT (Report != NULL); - - // - // 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; - - Result = UsbIo->UsbControlTransfer ( - UsbIo, - &Request, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - Report, - ReportLen, - &Status - ); - - return Result; -} diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf b/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf deleted file mode 100644 index 2a615d2..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Uefi Usb Library instance. -# -# This library instance provides most usb APIs to support the Hid requests defined in -# Usb Hid 1.1 spec and the standard requests defined in Usb 1.1 spec. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php. -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiUsbLib - MODULE_UNI_FILE = UefiUsbLib.uni - FILE_GUID = 87eb5df9-722a-4241-ad7f-370d0b3a56d7 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiUsbLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - UefiUsbLibInternal.h - Hid.c - UsbDxeLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - PcdLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue ## CONSUMES - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.uni b/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.uni deleted file mode 100644 index 1a86975..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLib.uni +++ /dev/null @@ -1,22 +0,0 @@ -// /** @file -// Uefi Usb Library instance. -// -// This library instance provides most usb APIs to support the Hid requests defined in -// Usb Hid 1.1 spec and the standard requests defined in Usb 1.1 spec. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "UEFI USB Library instance" - -#string STR_MODULE_DESCRIPTION #language en-US "This library instance provides most USB APIs to support the HID requests defined in the USB HID 1.1 specification and the standard requests defined in the USB 1.1 specification." - diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h b/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h deleted file mode 100644 index 3857fb6..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h +++ /dev/null @@ -1,29 +0,0 @@ -/** @file - - Common header file shared by all source files. - - This file includes package header files, library classes and protocol, PPI & GUID definitions. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef _UEFI_USB_LIB_INTERNAL_H_ -#define _UEFI_USB_LIB_INTERNAL_H_ - -#include - -#include -#include -#include -#include - -#include - - -#endif diff --git a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UsbDxeLib.c deleted file mode 100644 index 93f6ecc..0000000 --- a/Voyager/Voyager/edk2/MdePkg/Library/UefiUsbLib/UsbDxeLib.c +++ /dev/null @@ -1,672 +0,0 @@ -/** @file - - The library provides the USB Standard Device Requests defined - in Usb specification 9.4 section. - - Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials are - licensed and made available under the terms and conditions of - the BSD License which accompanies this distribution. The full - text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiUsbLibInternal.h" - - -/** - Get the descriptor of the specified USB device. - - Submit a USB get descriptor request for the USB device specified by UsbIo, Value, - and Index, and return the descriptor in the buffer specified by Descriptor. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Descriptor is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Value The device request value. - @param Index The device request index. - @param DescriptorLength The size, in bytes, of Descriptor. - @param Descriptor A pointer to the descriptor buffer to get. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_OUT_OF_RESOURCES The request could not be completed because the - buffer specified by DescriptorLength and Descriptor - is not large enough to hold the result of the request. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. The transfer - status is returned in Status. - -**/ -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 - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (Descriptor != NULL); - ASSERT (Status != NULL); - - 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; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - Descriptor, - DescriptorLength, - Status - ); -} - - -/** - Set the descriptor of the specified USB device. - - Submit a USB set descriptor request for the USB device specified by UsbIo, - Value, and Index, and set the descriptor using the buffer specified by DesriptorLength - and Descriptor. The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Descriptor is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Value The device request value. - @param Index The device request index. - @param DescriptorLength The size, in bytes, of Descriptor. - @param Descriptor A pointer to the descriptor buffer to set. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -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 - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (Descriptor != NULL); - ASSERT (Status != NULL); - - 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; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbDataOut, - PcdGet32 (PcdUsbTransferTimeoutValue), - Descriptor, - DescriptorLength, - Status - ); -} - - -/** - Get the interface setting of the specified USB device. - - Submit a USB get interface request for the USB device specified by UsbIo, - and Interface, and place the result in the buffer specified by AlternateSetting. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If AlternateSetting is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The interface index value. - @param AlternateSetting A pointer to the alternate setting to be retrieved. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbGetInterface ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT16 Interface, - OUT UINT16 *AlternateSetting, - OUT UINT32 *Status - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (AlternateSetting != NULL); - ASSERT (Status != NULL); - - *AlternateSetting = 0; - - 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; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - AlternateSetting, - 1, - Status - ); -} - - -/** - Set the interface setting of the specified USB device. - - Submit a USB set interface request for the USB device specified by UsbIo, and - Interface, and set the alternate setting to the value specified by AlternateSetting. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Interface The interface index value. - @param AlternateSetting The alternate setting to be set. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_SUCCESS The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbSetInterface ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT16 Interface, - IN UINT16 AlternateSetting, - OUT UINT32 *Status - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (Status != NULL); - - 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; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - Status - ); -} - - -/** - Get the device configuration. - - Submit a USB get configuration request for the USB device specified by UsbIo - and place the result in the buffer specified by ConfigurationValue. The status - of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If ConfigurationValue is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param ConfigurationValue A pointer to the device configuration to be retrieved. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbGetConfiguration ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - OUT UINT16 *ConfigurationValue, - OUT UINT32 *Status - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (ConfigurationValue != NULL); - ASSERT (Status != NULL); - - *ConfigurationValue = 0; - - ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); - - DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE; - DevReq.Request = USB_REQ_GET_CONFIG; - DevReq.Length = 1; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - ConfigurationValue, - 1, - Status - ); -} - - -/** - Set the device configuration. - - Submit a USB set configuration request for the USB device specified by UsbIo - and set the device configuration to the value specified by ConfigurationValue. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param ConfigurationValue The device configuration value to be set. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbSetConfiguration ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT16 ConfigurationValue, - OUT UINT32 *Status - ) -{ - EFI_USB_DEVICE_REQUEST DevReq; - - ASSERT (UsbIo != NULL); - ASSERT (Status != NULL); - - ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); - - DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE; - DevReq.Request = USB_REQ_SET_CONFIG; - DevReq.Value = ConfigurationValue; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - Status - ); -} - - -/** - Set the specified feature of the specified device. - - Submit a USB set device feature request for the USB device specified by UsbIo, - Recipient, and Target to the value specified by Value. The status of the - transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Recipient The USB data recipient type (i.e. Device, Interface, Endpoint). - Type USB_TYPES_DEFINITION is defined in the MDE Package Industry - Standard include file Usb.h. - @param Value The value of the feature to be set. - @param Target The index of the device to be set. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbSetFeature ( - 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; - - ASSERT (UsbIo != NULL); - ASSERT (Status != NULL); - - 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_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; - - default: - break; - } - // - // Fill device request, see USB1.1 spec - // - DevReq.Request = USB_REQ_SET_FEATURE; - DevReq.Value = Value; - DevReq.Index = Target; - - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - Status - ); -} - - -/** - Clear the specified feature of the specified device. - - Submit a USB clear device feature request for the USB device specified by UsbIo, - Recipient, and Target to the value specified by Value. The status of the transfer - is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Recipient The USB data recipient type (i.e. Device, Interface, Endpoint). - Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard - include file Usb.h. - @param Value The value of the feature to be cleared. - @param Target The index of the device to be cleared. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbClearFeature ( - 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; - - 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_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; - - default: - break; - } - // - // Fill device request, see USB1.1 spec - // - DevReq.Request = USB_REQ_CLEAR_FEATURE; - DevReq.Value = Value; - DevReq.Index = Target; - - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbNoData, - PcdGet32 (PcdUsbTransferTimeoutValue), - NULL, - 0, - Status - ); -} - - -/** - Get the status of the specified device. - - Submit a USB device get status request for the USB device specified by UsbIo, - Recipient, and Target and place the result in the buffer specified by DeviceStatus. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If DeviceStatus is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Recipient The USB data recipient type (i.e. Device, Interface, Endpoint). - Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard - include file Usb.h. - @param Target The index of the device to be get the status of. - @param DeviceStatus A pointer to the device status to be retrieved. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - -**/ -EFI_STATUS -EFIAPI -UsbGetStatus ( - 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; - - ASSERT (UsbIo != NULL); - ASSERT (DeviceStatus != NULL); - ASSERT (Status != NULL); - - 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_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; - - default: - break; - } - // - // Fill device request, see USB1.1 spec - // - DevReq.Request = USB_REQ_GET_STATUS; - DevReq.Value = 0; - DevReq.Index = Target; - DevReq.Length = 2; - - return UsbIo->UsbControlTransfer ( - UsbIo, - &DevReq, - EfiUsbDataIn, - PcdGet32 (PcdUsbTransferTimeoutValue), - DeviceStatus, - 2, - Status - ); -} - - -/** - Clear halt feature of the specified usb endpoint. - - Retrieve the USB endpoint descriptor specified by UsbIo and EndPoint. - If the USB endpoint descriptor can not be retrieved, then return EFI_NOT_FOUND. - If the endpoint descriptor is found, then clear the halt feature of this USB endpoint. - The status of the transfer is returned in Status. - If UsbIo is NULL, then ASSERT(). - If Status is NULL, then ASSERT(). - - @param UsbIo A pointer to the USB I/O Protocol instance for the specific USB target. - @param Endpoint The endpoint address. - @param Status A pointer to the status of the transfer. - - @retval EFI_SUCCESS The request executed successfully. - @retval EFI_TIMEOUT A timeout occurred executing the request. - @retval EFI_DEVICE_ERROR The request failed due to a device error. - The transfer status is returned in Status. - @retval EFI_NOT_FOUND The specified USB endpoint descriptor can not be found - -**/ -EFI_STATUS -EFIAPI -UsbClearEndpointHalt ( - IN EFI_USB_IO_PROTOCOL *UsbIo, - IN UINT8 Endpoint, - OUT UINT32 *Status - ) -{ - EFI_STATUS Result; - EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor; - EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; - UINT8 Index; - - ASSERT (UsbIo != NULL); - ASSERT (Status != NULL); - - ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)); - // - // First search the endpoint descriptor for that endpoint addr - // - Result = UsbIo->UsbGetInterfaceDescriptor ( - UsbIo, - &InterfaceDescriptor - ); - if (EFI_ERROR (Result)) { - return Result; - } - - for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) { - Result = UsbIo->UsbGetEndpointDescriptor ( - UsbIo, - Index, - &EndpointDescriptor - ); - if (EFI_ERROR (Result)) { - continue; - } - - if (EndpointDescriptor.EndpointAddress == Endpoint) { - break; - } - } - - if (Index == InterfaceDescriptor.NumEndpoints) { - // - // No such endpoint - // - return EFI_NOT_FOUND; - } - - Result = UsbClearFeature ( - UsbIo, - USB_TARGET_ENDPOINT, - USB_FEATURE_ENDPOINT_HALT, - EndpointDescriptor.EndpointAddress, - Status - ); - - return Result; -} diff --git a/Voyager/Voyager/edk2/MdePkg/MdePkg.dec b/Voyager/Voyager/edk2/MdePkg/MdePkg.dec deleted file mode 100644 index d5fd2f1..0000000 --- a/Voyager/Voyager/edk2/MdePkg/MdePkg.dec +++ /dev/null @@ -1,2307 +0,0 @@ -## @file MdePkg.dec -# This Package provides all definitions, library classes and libraries instances. -# -# It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of -# EFI1.10/UEFI2.7/PI1.7 and some Industry Standards. -# -# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-# -# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License which accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = MdePkg - PACKAGE_UNI_FILE = MdePkg.uni - PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766 - PACKAGE_VERSION = 1.08 - - -[Includes] - Include - -[Includes.IA32] - Include/Ia32 - -[Includes.X64] - Include/X64 - -[Includes.EBC] - Include/Ebc - -[Includes.ARM] - Include/Arm - -[Includes.AARCH64] - Include/AArch64 - -[LibraryClasses] - ## @libraryclass Provides most usb APIs to support the Hid requests defined in Usb Hid 1.1 spec - # and the standard requests defined in Usb 1.1 spec. - ## - UefiUsbLib|Include/Library/UefiUsbLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the EFI Runtime Services Table. - # Only available to DXE and UEFI module types. - UefiRuntimeServicesTableLib|Include/Library/UefiRuntimeServicesTableLib.h - - ## @libraryclass Provides library functions for each of the UEFI Runtime Services. - # Only available to DXE and UEFI module types. - UefiRuntimeLib|Include/Library/UefiRuntimeLib.h - - ## @libraryclass Provides library functions for common UEFI operations. - # Only available to DXE and UEFI module types. - ## - UefiLib|Include/Library/UefiLib.h - - ## @libraryclass Module entry point library for UEFI drivers, DXE Drivers, DXE SMM Driver and DXE Runtime Drivers - UefiDriverEntryPoint|Include/Library/UefiDriverEntryPoint.h - - ## @libraryclass UEFI Decompress Library Functions defintion for UEFI compress algorithm. - UefiDecompressLib|Include/Library/UefiDecompressLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the EFI Boot Services Table. - # Only available to DXE and UEFI module types. - UefiBootServicesTableLib|Include/Library/UefiBootServicesTableLib.h - - ## @libraryclass Module entry point library for UEFI Applications. - UefiApplicationEntryPoint|Include/Library/UefiApplicationEntryPoint.h - - ## @libraryclass Provides calibrated delay and performance counter services. - TimerLib|Include/Library/TimerLib.h - - ## @libraryclass Provides library functions to access SMBUS devices. - # Libraries of this class must be ported to a specific SMBUS controller. - SmbusLib|Include/Library/SmbusLib.h - - ## @libraryclass Provides the functions to submit Scsi commands defined in SCSI-2 specification for scsi device. - UefiScsiLib|Include/Library/UefiScsiLib.h - - ## @libraryclass Provides a service to publish discovered system resources. - ResourcePublicationLib|Include/Library/ResourcePublicationLib.h - - ## @libraryclass Provides services to log status code records. - ReportStatusCodeLib|Include/Library/ReportStatusCodeLib.h - - ## @libraryclass Provides services to print a formatted string to a buffer. - # All combinations of Unicode and ASCII strings are supported. - ## - PrintLib|Include/Library/PrintLib.h - - ## @libraryclass Provides an ordered collection data structure. - OrderedCollectionLib|Include/Library/OrderedCollectionLib.h - - ## @libraryclass Provides services to send progress/error codes to a POST card. - PostCodeLib|Include/Library/PostCodeLib.h - - ## @libraryclass Provides services to log the execution times and retrieve them later. - PerformanceLib|Include/Library/PerformanceLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the PEI Services Table. - PeiServicesTablePointerLib|Include/Library/PeiServicesTablePointerLib.h - - ## @libraryclass Provides library functions for all PEI Services. - PeiServicesLib|Include/Library/PeiServicesLib.h - - ## @libraryclass Module entry point library for PEIM. - PeimEntryPoint|Include/Library/PeimEntryPoint.h - - ## @libraryclass Module entry point library for PEI core. - PeiCoreEntryPoint|Include/Library/PeiCoreEntryPoint.h - - ## @libraryclass Provides services to load and relocate a PE/COFF image. - PeCoffLib|Include/Library/PeCoffLib.h - ## @libraryclass Provides extra action services for unloading and relocating a PE/COFF image on some specific platform such - ## as NT32 emulator. - PeCoffExtraActionLib|Include/Library/PeCoffExtraActionLib.h - - ## @libraryclass Provides a service to retrieve the PE/COFF entry point from a PE/COFF image. - PeCoffGetEntryPointLib|Include/Library/PeCoffGetEntryPointLib.h - - ## @libraryclass Provides services to return the PCI segment information. - PciSegmentInfoLib|Include/Library/PciSegmentInfoLib.h - - ## @libraryclass Provides services to access PCI Configuration Space on a platform with multiple PCI segments. - PciSegmentLib|Include/Library/PciSegmentLib.h - - ## @libraryclass The multiple segments PCI configuration Library Services that carry out - ## PCI configuration and enable the PCI operations to be replayed during an - ## S3 resume. This library class maps directly on top of the PciSegmentLib class. - S3PciSegmentLib|Include/Library/PciSegmentLib.h - - ## @libraryclass Provides services to access PCI Configuration Space. - PciLib|Include/Library/PciLib.h - - ## @libraryclass Provides services to access PCI Configuration Space using the MMIO PCI Express window. - PciExpressLib|Include/Library/PciExpressLib.h - - ## @libraryclass Provides services to access PCI Configuration Space using the I/O ports 0xCF8 and 0xCFC. - PciCf8Lib|Include/Library/PciCf8Lib.h - - ## @libraryclass Provides library services to get and set Platform Configuration Database entries. - PcdLib|Include/Library/PcdLib.h - - ## @libraryclass Provides services to allocate and free memory buffers of various memory types and alignments. - MemoryAllocationLib|Include/Library/MemoryAllocationLib.h - - ## @libraryclass Provide services to access I/O Ports and MMIO registers. - IoLib|Include/Library/IoLib.h - - ## @libraryclass Provide services to create, get and update HSTI table in AIP protocol. - HstiLib|Include/Library/HstiLib.h - - ## @libraryclass Provides services to create and parse HOBs. Only available for PEI and DXE module types. - HobLib|Include/Library/HobLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the DXE Services Table. - # Only available to DXE module types. - ## - DxeServicesTableLib|Include/Library/DxeServicesTableLib.h - - ## @libraryclass Module entry point library for DXE core. - DxeCoreEntryPoint|Include/Library/DxeCoreEntryPoint.h - - ## @libraryclass Provides library functions to construct and parse UEFI Device Paths. - DevicePathLib|Include/Library/DevicePathLib.h - - ## @libraryclass Provides services to print debug and assert messages to a debug output device. - DebugLib|Include/Library/DebugLib.h - - ## @libraryclass Provides CPU architecture specific functions that can not be defined in the Base Library - # due to dependencies on the PAL Library - ## - CpuLib|Include/Library/CpuLib.h - - ## @libraryclass Provides services to maintain instruction and data caches. - CacheMaintenanceLib|Include/Library/CacheMaintenanceLib.h - - ## @libraryclass Provides copy memory, fill memory, zero memory, and GUID functions. - BaseMemoryLib|Include/Library/BaseMemoryLib.h - - ## @libraryclass Provides string functions, linked list functions, math functions, synchronization functions - # and CPU architecture specific functions. - ## - BaseLib|Include/Library/BaseLib.h - - ## @libraryclass This library provides common functions to process the different guided section data. - ExtractGuidedSectionLib|Include/Library/ExtractGuidedSectionLib.h - - ## @libraryclass Provides three common serial I/O port functions. - SerialPortLib|Include/Library/SerialPortLib.h - - ## @libraryclass Provides a set of PI library functions and macros for DXE phase. - DxeServicesLib|Include/Library/DxeServicesLib.h - - ## @libraryclass Provides synchronization functions. - ## - SynchronizationLib|Include/Library/SynchronizationLib.h - - ## @libraryclass Defines library APIs used by modules to save S3 Boot - # Script Opcodes. These OpCode will be restored by S3 - # related modules. - S3BootScriptLib|Include/Library/S3BootScriptLib.h - - ## @libraryclass I/O and MMIO Library Services that do I/O and also enable - # the I/O operatation to be replayed during an S3 resume. - # This library class maps directly on top of the IoLib class. - S3IoLib|Include/Library/S3IoLib.h - - ## @libraryclass PCI configuration Library Services that do PCI configuration - # and also enable the PCI operations to be replayed during an - # S3 resume. This library class maps directly on top of the - # PciLib class. - S3PciLib|Include/Library/S3PciLib.h - - ## @libraryclass Smbus Library Services that do SMBus transactions and also - # enable the operatation to be replayed during an S3 resume. - # This library class maps directly on top of the SmbusLib class. - S3SmbusLib|Include/Library/S3SmbusLib.h - - ## @libraryclass Stall Services that do stall and also enable the Stall - # operatation to be replayed during an S3 resume. This - # library class maps directly on top of the Timer class. - S3StallLib|Include/Library/S3StallLib.h - - ## @libraryclass Defines library APIs used by modules to get/set print error level. - DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h - - ## @libraryclass provides EFI_FILE_HANDLE services - FileHandleLib|Include/Library/FileHandleLib.h - - ## @libraryclass provides helper functions to prevent integer overflow during - # type conversion, addition, subtraction, and multiplication. - ## - SafeIntLib|Include/Library/SafeIntLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the Standalone MM Services Table. - # Only available to MM_STANDALONE, SMM/DXE Combined and SMM module types. - MmServicesTableLib|Include/Library/MmServicesTableLib.h - - ## @libraryclass Module entry point library for standalone MM drivers. - StandaloneMmDriverEntryPoint|Include/Library/StandaloneMmDriverEntryPoint.h - -[LibraryClasses.IA32, LibraryClasses.X64] - ## @libraryclass Abstracts both S/W SMI generation and detection. - ## - SmmLib|Include/Library/SmmLib.h - - ## @libraryclass Provides a service to retrieve a pointer to the SMM Services Table. - # Only available to SMM/DXE Combined and SMM module types. - SmmServicesTableLib|Include/Library/SmmServicesTableLib.h - - ## @libraryclass Provides services for Smm Memory Operation. - # - SmmMemLib|Include/Library/SmmMemLib.h - - ## @libraryclass Provides services for Smm IO Operation. - # - SmmIoLib|Include/Library/SmmIoLib.h - - ## @libraryclass Provides services to enable/disable periodic SMI handlers. - # - SmmPeriodicSmiLib|Include/Library/SmmPeriodicSmiLib.h - - ## @libraryclass Provides services to generate random number. - # - RngLib|Include/Library/RngLib.h - - ## @libraryclass Provides services to log the SMI handler registration. - SmiHandlerProfileLib|Include/Library/SmiHandlerProfileLib.h - -[Guids] - # - # GUID defined in UEFI2.1/UEFI2.0/EFI1.1 - # - ## Include/Guid/GlobalVariable.h - gEfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }} - - ## Include/Guid/PcAnsi.h - gEfiVT100PlusGuid = { 0x7BAEC70B, 0x57E0, 0x4C76, { 0x8E, 0x87, 0x2F, 0x9E, 0x28, 0x08, 0x83, 0x43 }} - - ## Include/Guid/PcAnsi.h - gEfiVT100Guid = { 0xDFA66065, 0xB419, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/PcAnsi.h - gEfiPcAnsiGuid = { 0xE0C14753, 0xF9BE, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/PcAnsi.h - gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }} - - ## Include/Guid/PcAnsi.h - gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }} - - ## Include/Guid/PcAnsi.h - gEfiSasDevicePathGuid = { 0xd487ddb4, 0x008b, 0x11d9, { 0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d }} - - ## Include/Guid/Gpt.h - gEfiPartTypeLegacyMbrGuid = { 0x024DEE41, 0x33E7, 0x11D3, { 0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F }} - - ## Include/Guid/Gpt.h - gEfiPartTypeSystemPartGuid = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B }} - - ## Include/Guid/Gpt.h - gEfiPartTypeUnusedGuid = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }} - - ## Include/Guid/DebugImageInfoTable.h - gEfiDebugImageInfoTableGuid = { 0x49152E77, 0x1ADA, 0x4764, { 0xB7, 0xA2, 0x7A, 0xFE, 0xFE, 0xD9, 0x5E, 0x8B }} - - ## Include/Guid/Acpi.h - gEfiAcpiTableGuid = { 0x8868E871, 0xE4F1, 0x11D3, { 0xBC, 0x22, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Guid/Acpi.h - gEfiAcpi20TableGuid = { 0x8868E871, 0xE4F1, 0x11D3, { 0xBC, 0x22, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Guid/Acpi.h - gEfiAcpi10TableGuid = { 0xEB9D2D30, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/SmBios.h - gEfiSmbiosTableGuid = { 0xEB9D2D31, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/Mps.h - gEfiMpsTableGuid = { 0xEB9D2D2F, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/SalSystemTable.h - gEfiSalSystemTableGuid = { 0xEB9D2D32, 0x2D88, 0x11D3, { 0x9A, 0x16, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/AuthenticationInfo.h - gEfiAuthenticationChapLocalGuid = { 0xC280C73E, 0x15CA, 0x11DA, { 0xB0, 0xCA, 0x00, 0x10, 0x83, 0xFF, 0xCA, 0x4D }} - - ## Include/Protocol/AuthenticationInfo.h - gEfiAuthenticationChapRadiusGuid = { 0xD6062B50, 0x15CA, 0x11DA, { 0x92, 0x19, 0x00, 0x10, 0x83, 0xFF, 0xCA, 0x4D }} - - ## Include/Guid/FileSystemVolumeLabelInfo.h - gEfiFileSystemVolumeLabelInfoIdGuid = { 0xDB47D7D3, 0xFE81, 0x11D3, { 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/FileSystemInfo.h - gEfiFileSystemInfoGuid = { 0x09576E93, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Guid/FileInfo.h - gEfiFileInfoGuid = { 0x09576E92, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/Bis.h - gBootObjectAuthorizationParmsetGuid = { 0xEDD35E31, 0x07B9, 0x11D2, { 0x83, 0xA3, 0x00, 0xA0, 0xC9, 0x1F, 0xAD, 0xCF }} - - ## Include/Protocol/PlatformToDriverConfiguration.h - gEfiPlatformToDriverConfigurationClpGuid = { 0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e }} - - ## Include/Guid/HiiKeyBoardLayout.h - gEfiHiiKeyBoardLayoutGuid = { 0x14982a4f, 0xb0ed, 0x45b8, { 0xa8, 0x11, 0x5a, 0x7a, 0x9b, 0xc2, 0x32, 0xdf }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmMD5Guid = { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha512Guid = { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha384Guid = { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha256Guid = { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha224Guid = { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha1Guid = { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 }} - - ## Include/Guid/EventGroup.h - gEfiEventReadyToBootGuid = { 0x7CE88FB3, 0x4BD7, 0x4679, { 0x87, 0xA8, 0xA8, 0xD8, 0xDE, 0xE5, 0x0D, 0x2B }} - - ## Include/Guid/EventGroup.h - gEfiEventMemoryMapChangeGuid = { 0x78BEE926, 0x692F, 0x48FD, { 0x9E, 0xDB, 0x01, 0x42, 0x2E, 0xF0, 0xD7, 0xAB }} - - ## Include/Guid/EventGroup.h - gEfiEventVirtualAddressChangeGuid = { 0x13FA7698, 0xC831, 0x49C7, { 0x87, 0xEA, 0x8F, 0x43, 0xFC, 0xC2, 0x51, 0x96 }} - - ## Include/Guid/EventGroup.h - gEfiEventExitBootServicesGuid = { 0x27ABF055, 0xB1B8, 0x4C26, { 0x80, 0x48, 0x74, 0x8F, 0x37, 0xBA, 0xA2, 0xDF }} - - ## Include/Protocol/DebugPort.h - gEfiDebugPortVariableGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }} - - ## Include/Protocol/DebugPort.h - gEfiDebugPortDevicePathGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }} - - ## Include/Guid/HiiPlatformSetupFormset.h - gEfiHiiPlatformSetupFormsetGuid = { 0x93039971, 0x8545, 0x4b04, { 0xb4, 0x5e, 0x32, 0xeb, 0x83, 0x26, 0x04, 0x0e }} - - ## Include/Guid/HiiPlatformSetupFormset.h - gEfiHiiDriverHealthFormsetGuid = { 0xf22fc20c, 0x8cf4, 0x45eb, { 0x8e, 0x6, 0xad, 0x4e, 0x50, 0xb9, 0x5d, 0xd3 }} - - ## Include/Guid/HiiPlatformSetupFormset.h - gEfiHiiUserCredentialFormsetGuid = { 0x337f4407, 0x5aee, 0x4b83, { 0xb2, 0xa7, 0x4e, 0xad, 0xca, 0x30, 0x88, 0xcd }} - - ## Include/Guid/HiiFormMapMethodGuid.h - gEfiHiiStandardFormGuid = { 0x3bd2f4ec, 0xe524, 0x46e4, { 0xa9, 0xd8, 0x51, 0x1, 0x17, 0x42, 0x55, 0x62 }} - - ## Include/Guid/MemoryOverwriteControl.h - gEfiMemoryOverwriteControlDataGuid = { 0xe20939be, 0x32d4, 0x41be, {0xa1, 0x50, 0x89, 0x7f, 0x85, 0xd4, 0x98, 0x29 }} - - ## Include/IndustryStandard/MemoryOverwriteRequestControlLock.h - gEfiMemoryOverwriteRequestControlLockGuid = { 0xBB983CCF, 0x151D, 0x40E1, {0xA0, 0x7B, 0x4A, 0x17, 0xBE, 0x16, 0x82, 0x92}} - - ## Include/Guid/WinCertificate.h - gEfiCertTypeRsa2048Sha256Guid = { 0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeCmcGuid = { 0x2DCE8BB1, 0xBDD7, 0x450e, { 0xB9, 0xAD, 0x9C, 0xF4, 0xEB, 0xD4, 0xF8, 0x90 }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeCpeGuid = { 0x4E292F96, 0xD843, 0x4a55, { 0xA8, 0xC2, 0xD4, 0x81, 0xF2, 0x7E, 0xBE, 0xEE }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeMceGuid = { 0xE8F56FFE, 0x919C, 0x4cc5, { 0xBA, 0x88, 0x65, 0xAB, 0xE1, 0x49, 0x13, 0xBB }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypePcieGuid = { 0xCF93C01F, 0x1A16, 0x4dfc, { 0xB8, 0xBC, 0x9C, 0x4D, 0xAF, 0x67, 0xC1, 0x04 }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeInitGuid = { 0xCC5263E8, 0x9308, 0x454a, { 0x89, 0xD0, 0x34, 0x0B, 0xD3, 0x9B, 0xC9, 0x8E }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeNmiGuid = { 0x5BAD89FF, 0xB7E6, 0x42c9, { 0x81, 0x4A, 0xCF, 0x24, 0x85, 0xD6, 0xE9, 0x8A }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeBootGuid = { 0x3D61A466, 0xAB40, 0x409a, { 0xA6, 0x98, 0xF3, 0x62, 0xD4, 0x64, 0xB3, 0x8F }} - - ## Include/Guid/Cper.h - gEfiEventNotificationTypeDmarGuid = { 0x667DD791, 0xC6B3, 0x4c27, { 0x8A, 0x6B, 0x0F, 0x8E, 0x72, 0x2D, 0xEB, 0x41 }} - - ## Include/Guid/Cper.h - gEfiProcessorGenericErrorSectionGuid = { 0x9876ccad, 0x47b4, 0x4bdb, { 0xb6, 0x5e, 0x16, 0xf1, 0x93, 0xc4, 0xf3, 0xdb }} - - ## Include/Guid/Cper.h - gEfiProcessorSpecificErrorSectionGuid = { 0xdc3ea0b0, 0xa144, 0x4797, { 0xb9, 0x5b, 0x53, 0xfa, 0x24, 0x2b, 0x6e, 0x1d }} - - ## Include/Guid/Cper.h - gEfiIa32X64ProcessorErrorSectionGuid = { 0xdc3ea0b0, 0xa144, 0x4797, { 0xb9, 0x5b, 0x53, 0xfa, 0x24, 0x2b, 0x6e, 0x1d }} - - ## Include/Guid/Cper.h - gEfiPlatformMemoryErrorSectionGuid = { 0xa5bc1114, 0x6f64, 0x4ede, { 0xb8, 0x63, 0x3e, 0x83, 0xed, 0x7c, 0x83, 0xb1 }} - - ## Include/Guid/Cper.h - gEfiPcieErrorSectionGuid = { 0xd995e954, 0xbbc1, 0x430f, { 0xad, 0x91, 0xb4, 0x4d, 0xcb, 0x3c, 0x6f, 0x35 }} - - ## Include/Guid/Cper.h - gEfiFirmwareErrorSectionGuid = { 0x81212a96, 0x09ed, 0x4996, { 0x94, 0x71, 0x8d, 0x72, 0x9c, 0x8e, 0x69, 0xed }} - - ## Include/Guid/Cper.h - gEfiPciBusErrorSectionGuid = { 0xc5753963, 0x3b84, 0x4095, { 0xbf, 0x78, 0xed, 0xda, 0xd3, 0xf9, 0xc9, 0xdd }} - - ## Include/Guid/Cper.h - gEfiPciDevErrorSectionGuid = { 0xeb5e4685, 0xca66, 0x4769, { 0xb6, 0xa2, 0x26, 0x06, 0x8b, 0x00, 0x13, 0x26 }} - - ## Include/Guid/Cper.h - gEfiDMArGenericErrorSectionGuid = { 0x5b51fef7, 0xc79d, 0x4434, { 0x8f, 0x1b, 0xaa, 0x62, 0xde, 0x3e, 0x2c, 0x64 }} - - ## Include/Guid/Cper.h - gEfiDirectedIoDMArErrorSectionGuid = { 0x71761d37, 0x32b2, 0x45cd, { 0xa7, 0xd0, 0xb0, 0xfe, 0xdd, 0x93, 0xe8, 0xcf }} - - ## Include/Guid/Cper.h - gEfiIommuDMArErrorSectionGuid = { 0x036f84e1, 0x7f37, 0x428c, { 0xa7, 0x9e, 0x57, 0x5f, 0xdf, 0xaa, 0x84, 0xec }} - - # - # GUID defined in UEFI2.2 - # - ## Include/Protocol/UserManager.h - gEfiEventUserProfileChangedGuid = { 0xbaf1e6de, 0x209e, 0x4adb, {0x8d, 0x96, 0xfd, 0x8b, 0x71, 0xf3, 0xf6, 0x83 }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassUnknownGuid = { 0x5cf32e68, 0x7660, 0x449b, { 0x80, 0xe6, 0x7e, 0xa3, 0x6e, 0x3, 0xf6, 0xa8 }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassPasswordGuid = { 0xf8e5058c, 0xccb6, 0x4714, { 0xb2, 0x20, 0x3f, 0x7e, 0x3a, 0x64, 0xb, 0xd1 }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassSmartCardGuid = { 0x5f03ba33, 0x8c6b, 0x4c24, { 0xaa, 0x2e, 0x14, 0xa2, 0x65, 0x7b, 0xd4, 0x54 }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassFingerprintGuid = { 0x32cba21f, 0xf308, 0x4cbc, { 0x9a, 0xb5, 0xf5, 0xa3, 0x69, 0x9f, 0x4, 0x4a }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassHandprintGuid = { 0x5917ef16, 0xf723, 0x4bb9, { 0xa6, 0x4b, 0xd8, 0xc5, 0x32, 0xf4, 0xd8, 0xb5 }} - - ## Include/Protocol/UserManager.h - gEfiUserCredentialClassSecureCardGuid = { 0x8a6b4a83, 0x42fe, 0x45d2, { 0xa2, 0xef, 0x46, 0xf0, 0x6c, 0x7d, 0x98, 0x52 }} - - ## Include/Protocol/UserManager.h - gEfiUserInfoAccessSetupAdminGuid = { 0x85b75607, 0xf7ce, 0x471e, { 0xb7, 0xe4, 0x2a, 0xea, 0x5f, 0x72, 0x32, 0xee }} - - ## Include/Protocol/UserManager.h - gEfiUserInfoAccessSetupNormalGuid = { 0x1db29ae0, 0x9dcb, 0x43bc, { 0x8d, 0x87, 0x5d, 0xa1, 0x49, 0x64, 0xdd, 0xe2 }} - - ## Include/Protocol/UserManager.h - gEfiUserInfoAccessSetupRestrictedGuid = { 0xbdb38125, 0x4d63, 0x49f4, { 0x82, 0x12, 0x61, 0xcf, 0x5a, 0x19, 0xa, 0xf8 }} - - ## Include/Guid/ImageAuthentication.h - gEfiImageSecurityDatabaseGuid = { 0xd719b2cb, 0x3d3a, 0x4596, {0xa3, 0xbc, 0xda, 0xd0, 0xe, 0x67, 0x65, 0x6f }} - gEfiCertSha256Guid = { 0xc1c41626, 0x504c, 0x4092, {0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 }} - gEfiCertRsa2048Guid = { 0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 0xb3, 0xb6 }} - gEfiCertRsa2048Sha256Guid = { 0xe2b36190, 0x879b, 0x4a3d, {0xad, 0x8d, 0xf2, 0xe7, 0xbb, 0xa3, 0x27, 0x84 }} - gEfiCertSha1Guid = { 0x826ca512, 0xcf10, 0x4ac9, {0xb1, 0x87, 0xbe, 0x1, 0x49, 0x66, 0x31, 0xbd }} - gEfiCertRsa2048Sha1Guid = { 0x67f8444f, 0x8743, 0x48f1, {0xa3, 0x28, 0x1e, 0xaa, 0xb8, 0x73, 0x60, 0x80 }} - gEfiCertX509Guid = { 0xa5c059a1, 0x94e4, 0x4aa7, {0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72 }} - - # - # GUIDs defined in UEFI2.3.1 - # - ## Include/Protocol/Kms.h - gEfiKmsFormatGeneric128Guid = { 0xec8a3d69, 0x6ddf, 0x4108, {0x94, 0x76, 0x73, 0x37, 0xfc, 0x52, 0x21, 0x36 }} - gEfiKmsFormatGeneric160Guid = { 0xa3b3e6f8, 0xefca, 0x4bc1, {0x88, 0xfb, 0xcb, 0x87, 0x33, 0x9b, 0x25, 0x79 }} - gEfiKmsFormatGeneric256Guid = { 0x70f64793, 0xc323, 0x4261, {0xac, 0x2c, 0xd8, 0x76, 0xf2, 0x7c, 0x53, 0x45 }} - gEfiKmsFormatGeneric512Guid = { 0x978fe043, 0xd7af, 0x422e, {0x8a, 0x92, 0x2b, 0x48, 0xe4, 0x63, 0xbd, 0xe6 }} - gEfiKmsFormatGeneric1024Guid = { 0x43be0b44, 0x874b, 0x4ead, {0xb0, 0x9c, 0x24, 0x1a, 0x4f, 0xbd, 0x7e, 0xb3 }} - gEfiKmsFormatGeneric2048Guid = { 0x40093f23, 0x630c, 0x4626, {0x9c, 0x48, 0x40, 0x37, 0x3b, 0x19, 0xcb, 0xbe }} - gEfiKmsFormatGeneric3072Guid = { 0xb9237513, 0x6c44, 0x4411, {0xa9, 0x90, 0x21, 0xe5, 0x56, 0xe0, 0x5a, 0xde }} - gEfiKmsFormatMd2128Guid = { 0x78be11c4, 0xee44, 0x4a22, {0x9f, 0x05, 0x03, 0x85, 0x2e, 0xc5, 0xc9, 0x78 }} - gEfiKmsFormatMdc2128Guid = { 0xf7ad60f8, 0xefa8, 0x44a3, {0x91, 0x13, 0x23, 0x1f, 0x39, 0x9e, 0xb4, 0xc7 }} - gEfiKmsFormatMd4128Guid = { 0xd1c17aa1, 0xcac5, 0x400f, {0xbe, 0x17, 0xe2, 0xa2, 0xae, 0x06, 0x67, 0x7c }} - gEfiKmsFormatMdc4128Guid = { 0x3fa4f847, 0xd8eb, 0x4df4, {0xbd, 0x49, 0x10, 0x3a, 0x0a, 0x84, 0x7b, 0xbc }} - gEfiKmsFormatMd5128Guid = { 0xdcbc3662, 0x9cda, 0x4b52, {0xa0, 0x4c, 0x82, 0xeb, 0x1d, 0x23, 0x48, 0xc7 }} - gEfiKmsFormatMd5sha128Guid = { 0x1c178237, 0x6897, 0x459e, {0x9d, 0x36, 0x67, 0xce, 0x8e, 0xf9, 0x4f, 0x76 }} - gEfiKmsFormatSha1160Guid = { 0x453c5e5a, 0x482d, 0x43f0, {0x87, 0xc9, 0x59, 0x41, 0xf3, 0xa3, 0x8a, 0xc2 }} - gEfiKmsFormatSha256256Guid = { 0x6bb4f5cd, 0x8022, 0x448d, {0xbc, 0x6d, 0x77, 0x1b, 0xae, 0x93, 0x5f, 0xc6 }} - gEfiKmsFormatSha512512Guid = { 0x2f240e12, 0xe14d, 0x475c, {0x83, 0xb0, 0xef, 0xff, 0x22, 0xd7, 0x7b, 0xe7 }} - gEfiKmsFormatAesxts128Guid = { 0x4776e33f, 0xdb47, 0x479a, {0xa2, 0x5f, 0xa1, 0xcd, 0x0a, 0xfa, 0xb3, 0x8b }} - gEfiKmsFormatAesxts256Guid = { 0xdc7e8613, 0xc4bb, 0x4db0, {0x84, 0x62, 0x13, 0x51, 0x13, 0x57, 0xab, 0xe2 }} - gEfiKmsFormatAescbc128Guid = { 0xa0e8ee6a, 0x0e92, 0x44d4, {0x86, 0x1b, 0x0e, 0xaa, 0x4a, 0xca, 0x44, 0xa2 }} - gEfiKmsFormatAescbc256Guid = { 0xd7e69789, 0x1f68, 0x45e8, {0x96, 0xef, 0x3b, 0x64, 0x07, 0xa5, 0xb2, 0xdc }} - gEfiKmsFormatRsasha11024Guid = { 0x56417bed, 0x6bbe, 0x4882, {0x86, 0xa0, 0x3a, 0xe8, 0xbb, 0x17, 0xf8, 0xf9 }} - gEfiKmsFormatRsasha12048Guid = { 0xf66447d4, 0x75a6, 0x463e, {0xa8, 0x19, 0x07, 0x7f, 0x2d, 0xda, 0x05, 0xe9 }} - gEfiKmsFormatRsasha2562048Guid = { 0xa477af13, 0x877d, 0x4060, {0xba, 0xa1, 0x25, 0xd1, 0xbe, 0xa0, 0x8a, 0xd3 }} - gEfiKmsFormatRsasha2563072Guid = { 0x4e1356c2, 0xeed, 0x463f, {0x81, 0x47, 0x99, 0x33, 0xab, 0xdb, 0xc7, 0xd5 }} - - ## Include/Guid/ImageAuthentication.h - gEfiCertSha224Guid = { 0xb6e5233, 0xa65c, 0x44c9, {0x94, 0x7, 0xd9, 0xab, 0x83, 0xbf, 0xc8, 0xbd }} - gEfiCertSha384Guid = { 0xff3e5307, 0x9fd0, 0x48c9, {0x85, 0xf1, 0x8a, 0xd5, 0x6c, 0x70, 0x1e, 0x1 }} - gEfiCertSha512Guid = { 0x93e0fae, 0xa6c4, 0x4f50, {0x9f, 0x1b, 0xd4, 0x1e, 0x2b, 0x89, 0xc1, 0x9a }} - gEfiCertPkcs7Guid = { 0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7 }} - - ## Include/Protocol/Hash.h - gEfiHashAlgorithmSha1NoPadGuid = { 0x24c5dc2f, 0x53e2, 0x40ca, { 0x9e, 0xd6, 0xa5, 0xd9, 0xa4, 0x9f, 0x46, 0x3b }} - gEfiHashAlgorithmSha256NoPadGuid = { 0x8628752a, 0x6cb7, 0x4814, { 0x96, 0xfc, 0x24, 0xa8, 0x15, 0xac, 0x22, 0x26 }} - - # - # GUIDs defined in UEFI2.4 - # - ## Include/Guid/FmpCapsule.h - gEfiFmpCapsuleGuid = { 0x6dcbd5ed, 0xe82d, 0x4c44, {0xbd, 0xa1, 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a }} - - ## Include/Guid/ImageAuthentication.h - gEfiCertX509Sha256Guid = { 0x3bd2a492, 0x96c0, 0x4079, {0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed }} - gEfiCertX509Sha384Guid = { 0x7076876e, 0x80c2, 0x4ee6, {0xaa, 0xd2, 0x28, 0xb3, 0x49, 0xa6, 0x86, 0x5b }} - gEfiCertX509Sha512Guid = { 0x446dbf63, 0x2502, 0x4cda, {0xbc, 0xfa, 0x24, 0x65, 0xd2, 0xb0, 0xfe, 0x9d }} - - ## Include/Protocol/Rng.h - gEfiRngAlgorithmSp80090Hash256Guid = { 0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }} - gEfiRngAlgorithmSp80090Hmac256Guid = { 0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }} - gEfiRngAlgorithmSp80090Ctr256Guid = { 0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e }} - gEfiRngAlgorithmX9313DesGuid = { 0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }} - gEfiRngAlgorithmX931AesGuid = { 0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }} - gEfiRngAlgorithmRaw = { 0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }} - - ## Include/Protocol/AdapterInformation.h - gEfiAdapterInfoMediaStateGuid = { 0xD7C74207, 0xA831, 0x4A26, {0xB1, 0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 }} - gEfiAdapterInfoNetworkBootGuid = { 0x1FBD2960, 0x4130, 0x41E5, {0x94, 0xAC, 0xD2, 0xCF, 0x03, 0x7F, 0xB3, 0x7C }} - gEfiAdapterInfoSanMacAddressGuid = { 0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 }} - - ## Include/Guid/CapsuleReport.h - gEfiCapsuleReportGuid = { 0x39b68c46, 0xf7fb, 0x441b, {0xb6, 0xec, 0x16, 0xb0, 0xf6, 0x98, 0x21, 0xf3 }} - - # - # GUIDs defined in UEFI2.5 - # - - ## Include/Guid/PropertiesTable.h - gEfiPropertiesTableGuid = { 0x880aaca3, 0x4adc, 0x4a04, {0x90, 0x79, 0xb7, 0x47, 0x34, 0x8, 0x25, 0xe5 }} - - ## Include/Guid/SystemResourceTable.h - gEfiSystemResourceTableGuid = { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 }} - - ## Include/Protocol/AdapterInformation.h - gEfiAdapterInfoUndiIpv6SupportGuid = { 0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d }} - - ## Include/Protocol/RegularExpressionProtocol.h - gEfiRegexSyntaxTypePosixExtendedGuid = {0x5F05B20F, 0x4A56, 0xC231, {0xFA, 0x0B, 0xA7, 0xB1, 0xF1, 0x10, 0x04, 0x1D }} - - ## Include/Protocol/RegularExpressionProtocol.h - gEfiRegexSyntaxTypeEcma262Guid = { 0x9A473A4A, 0x4CEB, 0xB95A, {0x41, 0x5E, 0x5B, 0xA0, 0xBC, 0x63, 0x9B, 0x2E }} - - ## Include/Protocol/RegularExpressionProtocol.h - gEfiRegexSyntaxTypePerlGuid = {0x63E60A51, 0x497D, 0xD427, {0xC4, 0xA5, 0xB8, 0xAB, 0xDC, 0x3A, 0xAE, 0xB6 }} - - ## Include/Guid/Cper.h - gEfiPlatformMemory2ErrorSectionGuid = { 0x61EC04FC, 0x48E6, 0xD813, { 0x25, 0xC9, 0x8D, 0xAA, 0x44, 0x75, 0x0B, 0x12 }} - - ## Include/Protocol/BlockIoCrypto.h - gEfiBlockIoCryptoAlgoAesXtsGuid = { 0x2f87ba6a, 0x5c04, 0x4385, {0xa7, 0x80, 0xf3, 0xbf, 0x78, 0xa9, 0x7b, 0xec }} - gEfiBlockIoCryptoAlgoAesCbcMsBitlockerGuid = { 0x689e4c62, 0x70bf, 0x4cf3, {0x88, 0xbb, 0x33, 0xb3, 0x18, 0x26, 0x86, 0x70 }} - - ## Include/Protocol/SmartCardEdge.h - gEfiPaddingRsassaPkcs1V1P5Guid = { 0x9317ec24, 0x7cb0, 0x4d0e, {0x8b, 0x32, 0x2e, 0xd9, 0x20, 0x9c, 0xd8, 0xaf }} - gEfiPaddingRsassaPssGuid = { 0x7b2349e0, 0x522d, 0x4f8e, {0xb9, 0x27, 0x69, 0xd9, 0x7c, 0x9e, 0x79, 0x5f }} - gEfiPaddingNoneGuid = { 0x3629ddb1, 0x228c, 0x452e, {0xb6, 0x16, 0x09, 0xed, 0x31, 0x6a, 0x97, 0x00 }} - gEfiPaddingRsaesPkcs1V1P5Guid = { 0xe1c1d0a9, 0x40b1, 0x4632, {0xbd, 0xcc, 0xd9, 0xd6, 0xe5, 0x29, 0x56, 0x31 }} - gEfiPaddingRsaesOaepGuid = { 0xc1e63ac4, 0xd0cf, 0x4ce6, {0x83, 0x5b, 0xee, 0xd0, 0xe6, 0xa8, 0xa4, 0x5b }} - - ## Include/Guid/SmBios.h - gEfiSmbios3TableGuid = { 0xF2FD1544, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }} - - ## Include/Protocol/BootManagerPolicy.h - gEfiBootManagerPolicyConsoleGuid = { 0xCAB0E94C, 0xE15F, 0x11E3, { 0x91, 0x8D, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }} - gEfiBootManagerPolicyNetworkGuid = { 0xD04159DC, 0xE15F, 0x11E3, { 0xB2, 0x61, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }} - gEfiBootManagerPolicyConnectAllGuid = { 0x113B2126, 0xFC8A, 0x11E3, { 0xBD, 0x6C, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA }} - - ## Include/Protocol/DevicePath.h - gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }} - gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }} - gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }} - gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }} - - # - # GUIDs defined in UEFI2.6 - # - - ## Include/Guid/MemoryAttributesTable.h - gEfiMemoryAttributesTableGuid = { 0xdcfa911d, 0x26eb, 0x469f, {0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20}} - - ## Include/Guid/Cper.h - gEfiArmProcessorErrorSectionGuid = { 0xe19e3d16, 0xbc11, 0x11e4, { 0x9c, 0xaa, 0xc2, 0x05, 0x1d, 0x5d, 0x46, 0xb0 }} - - ## Guid for Image decoder - ## Include/Protocol/ImageDecoder.h - gEfiHiiImageDecoderNameJpegGuid = { 0xefefd093, 0x0d9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x07, 0x00, 0xc9, 0x08 }} - gEfiHiiImageDecoderNamePngGuid = { 0xaf060190, 0x5e3a, 0x4025, { 0xaf, 0xbd, 0xe1, 0xf9, 0x05, 0xbf, 0xaa, 0x4c }} - - # - # GUIDs defined in UEFI2.7 - # - ## Include/Guid/Btt.h - gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} - - # - # GUID defined in PI1.0 - # - ## Include/Guid/AprioriFileName.h - gPeiAprioriFileNameGuid = { 0x1b45cc0a, 0x156a, 0x428a, { 0XAF, 0x62, 0x49, 0x86, 0x4d, 0xa0, 0xe6, 0xe6 }} - - ## Include/Guid/Apriori.h - gAprioriGuid = { 0xFC510EE7, 0xFFDC, 0x11D4, { 0xBD, 0x41, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Guid/FirmwareFileSystem2.h - gEfiFirmwareFileSystem2Guid = { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 }} - - ## Include/Guid/FirmwareFileSystem2.h - gEfiFirmwareVolumeTopFileGuid = { 0x1BA0062E, 0xC779, 0x4582, { 0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x09 }} - - ## Include/Guid/MemoryAllocationHob.h - gEfiHobMemoryAllocModuleGuid = { 0xF8E21975, 0x0899, 0x4F58, { 0xA4, 0xBE, 0x55, 0x25, 0xA9, 0xC6, 0xD7, 0x7A }} - - ## Include/Guid/MemoryAllocationHob.h - gEfiHobMemoryAllocStackGuid = { 0x4ED4BF27, 0x4092, 0x42E9, { 0x80, 0x7D, 0x52, 0x7B, 0x1D, 0x00, 0xC9, 0xBD }} - - ## Include/Guid/MemoryAllocationHob.h - gEfiHobMemoryAllocBspStoreGuid = { 0x564B33CD, 0xC92A, 0x4593, { 0x90, 0xBF, 0x24, 0x73, 0xE4, 0x3C, 0x63, 0x22 }} - - ## Include/Guid/EventLegacyBios.h - gEfiEventLegacyBootGuid = { 0x2A571201, 0x4966, 0x47F6, { 0x8B, 0x86, 0xF3, 0x1E, 0x41, 0xF3, 0x2F, 0x10 }} - - ## Include/Guid/HobList.h - gEfiHobListGuid = { 0x7739F24C, 0x93D7, 0x11D4, { 0x9A, 0x3A, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Guid/DxeServices.h - gEfiDxeServicesTableGuid = { 0x05AD34BA, 0x6F02, 0x4214, { 0x95, 0x2E, 0x4D, 0xA0, 0x39, 0x8E, 0x2B, 0xB9 }} - - ## Include/Guid/MdePkgTokenSpace.h - gEfiMdePkgTokenSpaceGuid = { 0x914AEBE7, 0x4635, 0x459b, { 0xAA, 0x1C, 0x11, 0xE2, 0x19, 0xB0, 0x3A, 0x10 }} - - ## Include/Guid/HardwareErrorVariable.h - gEfiHardwareErrorVariableGuid = { 0x414E6BDD, 0xE47B, 0x47cc, { 0xB2, 0x44, 0xBB, 0x61, 0x02, 0x0C, 0xF5, 0x16 }} - - # - # GUID defined in PI1.2 - # - ## Include/Guid/EventGroup.h - gEfiEventDxeDispatchGuid = { 0x7081E22F, 0xCAC6, 0x4053, { 0x94, 0x68, 0x67, 0x57, 0x82, 0xCF, 0x88, 0xE5 }} - - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Ide interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoIdeInterfaceGuid = { 0x5E948FE3, 0x26D3, 0x42B5, { 0xAF, 0x17, 0x61, 0x02, 0x87, 0x18, 0x8D, 0xEC }} - - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Scsi interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoScsiInterfaceGuid = { 0x08F74BAA, 0xEA36, 0x41D9, { 0x95, 0x21, 0x21, 0xA7, 0x0F, 0x87, 0x80, 0xBC }} - - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Usb interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoUsbInterfaceGuid = { 0xCB871572, 0xC11A, 0x47B5, { 0xB4, 0x92, 0x67, 0x5E, 0xAF, 0xA7, 0x77, 0x27 }} - - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Ahci interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoAhciInterfaceGuid = { 0x9e498932, 0x4abc, 0x45af, { 0xa3, 0x4d, 0x02, 0x47, 0x78, 0x7b, 0xe7, 0xc6 }} - - ## Include/Guid/StatusCodeDataTypeId.h - gEfiStatusCodeDataTypeStringGuid = { 0x92D11080, 0x496F, 0x4D95, { 0xBE, 0x7E, 0x03, 0x74, 0x88, 0x38, 0x2B, 0x0A }} - - ## Include/Guid/StatusCodeDataTypeId.h - gEfiStatusCodeSpecificDataGuid = { 0x335984BD, 0xE805, 0x409A, { 0xB8, 0xF8, 0xD2, 0x7E, 0xCE, 0x5F, 0xF7, 0xA6 }} - - ## Include/Guid/FirmwareFileSystem3.h - gEfiFirmwareFileSystem3Guid = { 0x5473c07a, 0x3dcb, 0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a }} - - # - # GUID defined in PI1.2.1 - # - ## Include/Guid/EventGroup.h - gEfiEndOfDxeEventGroupGuid = { 0x2ce967a, 0xdd7e, 0x4ffc, { 0x9e, 0xe7, 0x81, 0xc, 0xf0, 0x47, 0x8, 0x80 }} - - ## Include/Guid/FirmwareContentsSigned.h - gEfiFirmwareContentsSignedGuid = { 0xf9d89e8, 0x9259, 0x4f76, { 0xa5, 0xaf, 0xc, 0x89, 0xe3, 0x40, 0x23, 0xdf }} - - ## Include/Guid/VectorHandoffTable.h - gEfiVectorHandoffTableGuid = { 0x996ec11c, 0x5397, 0x4e73, { 0xb5, 0x8f, 0x82, 0x7e, 0x52, 0x90, 0x6d, 0xef }} - - ## Include/IndustryStandard/Hsti.h - gAdapterInfoPlatformSecurityGuid = {0x6be272c7, 0x1320, 0x4ccd, { 0x90, 0x17, 0xd4, 0x61, 0x2c, 0x01, 0x2b, 0x25 }} - - # - # GUID defined in PI1.3 - # - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Nvme interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoNvmeInterfaceGuid = { 0x3ab14680, 0x5d3f, 0x4a4d, { 0xbc, 0xdc, 0xcc, 0x38, 0x0, 0x18, 0xc7, 0xf7 }} - - # - # GUID defined in PI1.4 - # - ## Include/Guid/GraphicsInfoHob.h - gEfiGraphicsInfoHobGuid = { 0x39f62cce, 0x6825, 0x4669, { 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07 }} - - ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify UFS interface. - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoUfsInterfaceGuid = { 0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 }} - - # - # GUID defined in PI1.5 - # - ## Include/Guid/GraphicsInfoHob.h - gEfiGraphicsDeviceInfoHobGuid = { 0xe5cb2ac9, 0xd35d, 0x4430, { 0x93, 0x6e, 0x1d, 0xe3, 0x32, 0x47, 0x8d, 0xe7 }} - - # - # GUID defined in PI1.6 - # - ## Include/Protocol/DiskInfo.h - gEfiDiskInfoSdMmcInterfaceGuid = { 0x8deec992, 0xd39c, 0x4a5c, { 0xab, 0x6b, 0x98, 0x6e, 0x14, 0x24, 0x2b, 0x9d }} - - # - # GUID defined in Windows UEFI Firmware Update Platform doc - # - ## Include/IndustryStandard/WindowsUxCapsule.h - gWindowsUxCapsuleGuid = { 0x3b8c8162, 0x188c, 0x46a4, { 0xae, 0xc9, 0xbe, 0x43, 0xf1, 0xd6, 0x56, 0x97}} - -[Guids.IA32, Guids.X64] - ## Include/Guid/Cper.h - gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }} - - ## Include/Guid/Cper.h - gEfiIa32X64ErrorTypeTlbCheckGuid = { 0xFC06B535, 0x5E1F, 0x4562, { 0x9F, 0x25, 0x0A, 0x3B, 0x9A, 0xDB, 0x63, 0xC3 }} - - ## Include/Guid/Cper.h - gEfiIa32X64ErrorTypeBusCheckGuid = { 0x1CF3F8B3, 0xC5B1, 0x49a2, { 0xAA, 0x59, 0x5E, 0xEF, 0x92, 0xFF, 0xA6, 0x3C }} - - ## Include/Guid/Cper.h - gEfiIa32X64ErrorTypeMsCheckGuid = { 0x48AB7F57, 0xDC34, 0x4f6c, { 0xA7, 0xD3, 0xB0, 0xB5, 0xB0, 0xA7, 0x43, 0x14 }} - -[Ppis] - ## Include/Ppi/MasterBootMode.h - gEfiPeiMasterBootModePpiGuid = { 0x7408d748, 0xfc8c, 0x4ee6, {0x92, 0x88, 0xc4, 0xbe, 0xc0, 0x92, 0xa4, 0x10 } } - - ## Include/Ppi/DxeIpl.h - gEfiDxeIplPpiGuid = {0xae8ce5d, 0xe448, 0x4437, {0xa8, 0xd7, 0xeb, 0xf5, 0xf1, 0x94, 0xf7, 0x31 }} - - ## Include/Ppi/MemoryDiscovered.h - gEfiPeiMemoryDiscoveredPpiGuid = {0xf894643d, 0xc449, 0x42d1, {0x8e, 0xa8, 0x85, 0xbd, 0xd8, 0xc6, 0x5b, 0xde } } - - ## Include/Ppi/BootInRecoveryMode.h - gEfiPeiBootInRecoveryModePpiGuid = { 0x17ee496a, 0xd8e4, 0x4b9a, {0x94, 0xd1, 0xce, 0x82, 0x72, 0x30, 0x8, 0x50 } } - - ## Include/Ppi/EndOfPeiPhase.h - gEfiEndOfPeiSignalPpiGuid = {0x605EA650, 0xC65C, 0x42e1, {0xBA, 0x80, 0x91, 0xA5, 0x2A, 0xB6, 0x18, 0xC6 } } - - ## Include/Ppi/Reset.h - gEfiPeiResetPpiGuid = { 0xef398d58, 0x9dfd, 0x4103, {0xbf, 0x94, 0x78, 0xc6, 0xf4, 0xfe, 0x71, 0x2f } } - - ## Include/Ppi/StatusCode.h - gEfiPeiStatusCodePpiGuid = { 0x229832d3, 0x7a30, 0x4b36, {0xb8, 0x27, 0xf4, 0xc, 0xb7, 0xd4, 0x54, 0x36 } } - - ## Include/Ppi/Security2.h - gEfiPeiSecurity2PpiGuid = { 0xdcd0be23, 0x9586, 0x40f4, { 0xb6, 0x43, 0x6, 0x52, 0x2c, 0xed, 0x4e, 0xde } } - - ## Include/Ppi/TemporaryRamSupport.h - gEfiTemporaryRamSupportPpiGuid = { 0xdbe23aa9, 0xa345, 0x4b97, {0x85, 0xb6, 0xb2, 0x26, 0xf1, 0x61, 0x73, 0x89} } - - ## Include/Ppi/CpuIo.h - gEfiPeiCpuIoPpiInstalledGuid = { 0xe6af1f7b, 0xfc3f, 0x46da, {0xa8, 0x28, 0xa3, 0xb4, 0x57, 0xa4, 0x42, 0x82 } } - - ## Include/Ppi/PciCfg2.h - gEfiPciCfg2PpiGuid = { 0x57a449a, 0x1fdc, 0x4c06, { 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 } } - - ## Include/Ppi/Stall.h - gEfiPeiStallPpiGuid = { 0x1f4c6f90, 0xb06b, 0x48d8, {0xa2, 0x01, 0xba, 0xe5, 0xf1, 0xcd, 0x7d, 0x56 } } - - ## Include/Ppi/ReadOnlyVariable2.h - gEfiPeiReadOnlyVariable2PpiGuid = { 0x2ab86ef5, 0xecb5, 0x4134, { 0xb5, 0x56, 0x38, 0x54, 0xca, 0x1f, 0xe1, 0xb4 } } - - ## Include/Ppi/SecPlatformInformation.h - gEfiSecPlatformInformationPpiGuid = { 0x6f8c2b35, 0xfef4, 0x448d, {0x82, 0x56, 0xe1, 0x1b, 0x19, 0xd6, 0x10, 0x77 } } - - ## Include/Ppi/LoadImage.h - gEfiPeiLoadedImagePpiGuid = { 0xc1fcd448, 0x6300, 0x4458, { 0xb8, 0x64, 0x28, 0xdf, 0x1, 0x53, 0x64, 0xbc } } - - ## Include/Ppi/Smbus2.h - gEfiPeiSmbus2PpiGuid = { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } } - - ## Include/Ppi/FirmwareVolumeInfo.h - gEfiPeiFirmwareVolumeInfoPpiGuid = { 0x49edb1c1, 0xbf21, 0x4761, { 0xbb, 0x12, 0xeb, 0x0, 0x31, 0xaa, 0xbb, 0x39 } } - - ## Include/Ppi/LoadFile.h - gEfiPeiLoadFilePpiGuid = { 0xb9e0abfe, 0x5979, 0x4914, { 0x97, 0x7f, 0x6d, 0xee, 0x78, 0xc2, 0x78, 0xa6 } } - - ## Include/Ppi/Decompress.h - gEfiPeiDecompressPpiGuid = { 0x1a36e4e7, 0xfab6, 0x476a, { 0x8e, 0x75, 0x69, 0x5a, 0x5, 0x76, 0xfd, 0xd7 } } - - ## Include/Ppi/Pcd.h - gPcdPpiGuid = { 0x6e81c58, 0x4ad7, 0x44bc, { 0x83, 0x90, 0xf1, 0x2, 0x65, 0xf7, 0x24, 0x80 } } - - ## Include/Ppi/PcdInfo.h - gGetPcdInfoPpiGuid = { 0x4d8b155b, 0xc059, 0x4c8f, { 0x89, 0x26, 0x6, 0xfd, 0x43, 0x31, 0xdb, 0x8a } } - - # - # PPIs defined in PI 1.2. - # - - ## Include/Ppi/RecoveryModule.h - gEfiPeiRecoveryModulePpiGuid = { 0xFB6D9542, 0x612D, 0x4f45, { 0x87, 0x2f, 0x5c, 0xff, 0x52, 0xe9, 0x3d, 0xcf }} - - ## Include/Ppi/DeviceRecoveryModule.h - gEfiPeiDeviceRecoveryModulePpiGuid = { 0x0DE2CE25, 0x446A, 0x45a7, { 0xBF, 0xC9, 0x37, 0xDA, 0x26, 0x34, 0x4B, 0x37 }} - - ## Include/Ppi/BlockIo.h - gEfiPeiVirtualBlockIoPpiGuid = { 0x695d8aa1, 0x42ee, 0x4c46, { 0x80, 0x5c, 0x6e, 0xa6, 0xbc, 0xe7, 0x99, 0xe3 }} - - ## Include/Ppi/S3Resume2.h - gEfiPeiS3Resume2PpiGuid = { 0x6D582DBC, 0xDB85, 0x4514, {0x8F, 0xCC, 0x5A, 0xDF, 0x62, 0x27, 0xB1, 0x47 }} - - ## Include/Ppi/ReportStatusCodeHandler.h - gEfiPeiRscHandlerPpiGuid = { 0x65d394, 0x9951, 0x4144, {0x82, 0xa3, 0xa, 0xfc, 0x85, 0x79, 0xc2, 0x51 }} - - ## Include/Ppi/PiPcd.h - gEfiPeiPcdPpiGuid = { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } } - - # - # PPIs defined in PI 1.2.1. - # - - ## Include/Ppi/PiPcdInfo.h - gEfiGetPcdInfoPpiGuid = { 0xa60c6b59, 0xe459, 0x425d, { 0x9c, 0x69, 0xb, 0xcc, 0x9c, 0xb2, 0x7d, 0x81 } } - - ## Include/Ppi/TemporaryRamDone.h - gEfiTemporaryRamDonePpiGuid = { 0xceab683c, 0xec56, 0x4a2d, { 0xa9, 0x6, 0x40, 0x53, 0xfa, 0x4e, 0x9c, 0x16 } } - - ## Include/Ppi/VectorHandoffInfo.h - gEfiVectorHandoffInfoPpiGuid = { 0x3cd652b4, 0x6d33, 0x4dce, { 0x89, 0xdb, 0x83, 0xdf, 0x97, 0x66, 0xfc, 0xca }} - - ## Include/Ppi/IsaHc.h - gEfiIsaHcPpiGuid = { 0x8d48bd70, 0xc8a3, 0x4c06, {0x90, 0x1b, 0x74, 0x79, 0x46, 0xaa, 0xc3, 0x58 } } - - ## Include/Ppi/SuperIo.h - gEfiSioPpiGuid = { 0x23a464ad, 0xcb83, 0x48b8, {0x94, 0xab, 0x1a, 0x6f, 0xef, 0xcf, 0xe5, 0x22 } } - - # - # PPIs defined in PI 1.3. - # - - ## Include/Ppi/I2cMaster.h - gEfiPeiI2cMasterPpiGuid = { 0xb3bfab9b, 0x9f9c, 0x4e8b, { 0xad, 0x37, 0x7f, 0x8c, 0x51, 0xfc, 0x62, 0x80 }} - - ## Include/Ppi/FirmwareVolumeInfo2.h - gEfiPeiFirmwareVolumeInfo2PpiGuid = { 0xea7ca24b, 0xded5, 0x4dad, { 0xa3, 0x89, 0xbf, 0x82, 0x7e, 0x8f, 0x9b, 0x38 } } - - # - # PPIs defined in PI 1.4. - # - - ## Include/Ppi/Graphics.h - gEfiPeiGraphicsPpiGuid = { 0x6ecd1463, 0x4a4a, 0x461b, { 0xaf, 0x5f, 0x5a, 0x33, 0xe3, 0xb2, 0x16, 0x2b } } - - ## Include/Ppi/MpServices.h - gEfiPeiMpServicesPpiGuid = { 0xee16160a, 0xe8be, 0x47a6, { 0x82, 0xa, 0xc6, 0x90, 0xd, 0xb0, 0x25, 0xa } } - - ## Include/Ppi/Capsule.h - gEfiPeiCapsulePpiGuid = { 0x3acf33ee, 0xd892, 0x40f4, { 0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d }} - ## Keep name backwards compatible before PI Version 1.4 - gPeiCapsulePpiGuid = { 0x3acf33ee, 0xd892, 0x40f4, { 0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d }} - - ## Include/Ppi/Reset2.h - gEfiPeiReset2PpiGuid = { 0x6cc45765, 0xcce4, 0x42fd, {0xbc, 0x56, 0x1, 0x1a, 0xaa, 0xc6, 0xc9, 0xa8 } } - - ## Include/Ppi/BlockIo2.h - gEfiPeiVirtualBlockIo2PpiGuid = { 0x26cc0fad, 0xbeb3, 0x478a, { 0x91, 0xb2, 0xc, 0x18, 0x8f, 0x72, 0x61, 0x98 }} - - ## Include/Ppi/SecPlatformInformation.h - gEfiSecPlatformInformation2PpiGuid = { 0x9e9f374b, 0x8f16, 0x4230, {0x98, 0x24, 0x58, 0x46, 0xee, 0x76, 0x6a, 0x97 } } - - # - # PPIs defined in PI 1.5. - # - - ## Include/Ppi/SecHobData.h - gEfiSecHobDataPpiGuid = { 0x3ebdaf20, 0x6667, 0x40d8, {0xb4, 0xee, 0xf5, 0x99, 0x9a, 0xc1, 0xb7, 0x1f } } - - # - # PPIs defined in PI 1.7. - # - - ## Include/Ppi/PeiCoreFvLocation.h - gEfiPeiCoreFvLocationPpiGuid = { 0x52888eae, 0x5b10, 0x47d0, { 0xa8, 0x7f, 0xb8, 0x22, 0xab, 0xa0, 0xca, 0xf4 }} - -[Protocols] - ## Include/Protocol/Pcd.h - gPcdProtocolGuid = { 0x11B34006, 0xD85B, 0x4D0A, { 0xA2, 0x90, 0xD5, 0xA5, 0x71, 0x31, 0x0E, 0xF7 }} - - ## Include/Protocol/PcdInfo.h - gGetPcdInfoProtocolGuid = { 0x5be40f57, 0xfa68, 0x4610, { 0xbb, 0xbf, 0xe9, 0xc5, 0xfc, 0xda, 0xd3, 0x65 } } - - # - # Protocols defined in PI1.0. - # - - ## Include/Protocol/Bds.h - gEfiBdsArchProtocolGuid = { 0x665E3FF6, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/Cpu.h - gEfiCpuArchProtocolGuid = { 0x26BACCB1, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Protocol/Metronome.h - gEfiMetronomeArchProtocolGuid = { 0x26BACCB2, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Protocol/MonotonicCounter.h - gEfiMonotonicCounterArchProtocolGuid = { 0x1DA97072, 0xBDDC, 0x4B30, { 0x99, 0xF1, 0x72, 0xA0, 0xB5, 0x6F, 0xFF, 0x2A }} - - ## Include/Protocol/RealTimeClock.h - gEfiRealTimeClockArchProtocolGuid = { 0x27CFAC87, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/Reset.h - gEfiResetArchProtocolGuid = { 0x27CFAC88, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/Runtime.h - gEfiRuntimeArchProtocolGuid = { 0xb7dfb4e1, 0x052f, 0x449f, { 0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 }} - - ## Include/Protocol/Security.h - gEfiSecurityArchProtocolGuid = { 0xA46423E3, 0x4617, 0x49F1, { 0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 }} - - ## Include/Protocol/SecurityPolicy.h - gEfiSecurityPolicyProtocolGuid = { 0x78E4D245, 0xCD4D, 0x4A05, { 0xA2, 0xBA, 0x47, 0x43, 0xE8, 0x6C, 0xFC, 0xAB }} - - ## Include/Protocol/Timer.h - gEfiTimerArchProtocolGuid = { 0x26BACCB3, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Protocol/VariableWrite.h - gEfiVariableWriteArchProtocolGuid = { 0x6441F818, 0x6362, 0x4E44, { 0xB5, 0x70, 0x7D, 0xBA, 0x31, 0xDD, 0x24, 0x53 }} - - ## Include/Protocol/Variable.h - gEfiVariableArchProtocolGuid = { 0x1E5668E2, 0x8481, 0x11D4, { 0xBC, 0xF1, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} - - ## Include/Protocol/WatchdogTimer.h - gEfiWatchdogTimerArchProtocolGuid = { 0x665E3FF5, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/StatusCode.h - gEfiStatusCodeRuntimeProtocolGuid = { 0xD2B2B828, 0x0826, 0x48A7, { 0xB3, 0xDF, 0x98, 0x3C, 0x00, 0x60, 0x24, 0xF0 }} - - ## Include/Protocol/SmbusHc.h - gEfiSmbusHcProtocolGuid = {0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} } - - ## Include/Protocol/FirmwareVolume2.h - gEfiFirmwareVolume2ProtocolGuid = { 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } } - - ## Include/Protocol/FirmwareVolumeBlock.h - gEfiFirmwareVolumeBlockProtocolGuid = { 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } } - - ## Include/Protocol/Capsule.h - gEfiCapsuleArchProtocolGuid = { 0x5053697E, 0x2CBC, 0x4819, { 0x90, 0xD9, 0x05, 0x80, 0xDE, 0xEE, 0x57, 0x54 }} - - # - # Protocols defined in PI 1.2. - # - - ## Include/Protocol/MpService.h - gEfiMpServiceProtocolGuid = { 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 }} - - ## Include/Protocol/PciHostBridgeResourceAllocation.h - gEfiPciHostBridgeResourceAllocationProtocolGuid = { 0xCF8034BE, 0x6768, 0x4d8b, { 0xb7, 0x39, 0x7c, 0xce, 0x68, 0x3a, 0x9f, 0xbe }} - - ## Include/Protocol/PciPlatform.h - gEfiPciPlatformProtocolGuid = { 0x07d75280, 0x27d4, 0x4d69, { 0x90, 0xd0, 0x56, 0x43, 0xe2, 0x38, 0xb3, 0x41 }} - - ## Include/Protocol/PciOverride.h - gEfiPciOverrideProtocolGuid = { 0xb5b35764, 0x460c, 0x4a06, {0x99, 0xfc, 0x77, 0xa1, 0x7c, 0x1b, 0x5c, 0xeb }} - - ## Include/Protocol/PciEnumerationComplete.h - gEfiPciEnumerationCompleteProtocolGuid = { 0x30cfe3e7, 0x3de1, 0x4586, {0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93}} - - - ## Include/Protocol/IncompatiblePciDeviceSupport.h - gEfiIncompatiblePciDeviceSupportProtocolGuid = { 0xeb23f55a, 0x7863, 0x4ac2, { 0x8d, 0x3d, 0x95, 0x65, 0x35, 0xde, 0x03, 0x75 }} - - ## Include/Protocol/PciHotPlugInit.h - gEfiPciHotPlugInitProtocolGuid = { 0xaa0e8bc1, 0xdabc, 0x46b0, { 0xa8, 0x44, 0x37, 0xb8, 0x16, 0x9b, 0x2b, 0xea }} - - ## This protocol is used to add or remove all PCI child devices on the PCI root bridge. - # Include/Protocol/PciHotPlugRequest.h - gEfiPciHotPlugRequestProtocolGuid = { 0x19CB87AB, 0x2CB9, 0x4665, { 0x83, 0x60, 0xDD, 0xCF, 0x60, 0x54, 0xF7, 0x9D }} - - ## Include/Protocol/IdeControllerInit.h - gEfiIdeControllerInitProtocolGuid = { 0xa1e37052, 0x80d9, 0x4e65, { 0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 }} - - ## Disk Info protocol is used to export Inquiry Data for a drive. - # Include/Protocol/DiskInfo.h - gEfiDiskInfoProtocolGuid = { 0xD432A67F, 0x14DC, 0x484B, { 0xB3, 0xBB, 0x3F, 0x02, 0x91, 0x84, 0x93, 0x27 }} - - ## Include/Protocol/Smbios.h - gEfiSmbiosProtocolGuid = {0x3583ff6, 0xcb36, 0x4940, { 0x94, 0x7e, 0xb9, 0xb3, 0x9f, 0x4a, 0xfa, 0xf7}} - - ## Include/Protocol/S3SaveState.h - gEfiS3SaveStateProtocolGuid = {0xe857caf6, 0xc046, 0x45dc, { 0xbe, 0x3f, 0xee, 0x7, 0x65, 0xfb, 0xa8, 0x87}} - - ## Include/Protocol/S3SmmSaveState.h - gEfiS3SmmSaveStateProtocolGuid = {0x320afe62, 0xe593, 0x49cb, { 0xa9, 0xf1, 0xd4, 0xc2, 0xf4, 0xaf, 0x1, 0x4c}} - - ## Include/Protocol/ReportStatusCodeHandler.h - gEfiRscHandlerProtocolGuid = { 0x86212936, 0xe76, 0x41c8, { 0xa0, 0x3a, 0x2a, 0xf2, 0xfc, 0x1c, 0x39, 0xe2 }} - - ## Include/Protocol/SmmReportStatusCodeHandler.h - gEfiSmmRscHandlerProtocolGuid = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }} - - ## Include/Protocol/AcpiSystemDescriptionTable.h - gEfiAcpiSdtProtocolGuid = { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }} - - ## Include/Protocol/SuperIo.h - gEfiSioProtocolGuid = { 0x215fdd18, 0xbd50, 0x4feb, { 0x89, 0xb, 0x58, 0xca, 0xb, 0x47, 0x39, 0xe9 }} - - ## Include/Protocol/SmmCpuIo2.h - gEfiSmmCpuIo2ProtocolGuid = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d, 0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }} - - ## Include/Protocol/SmmBase2.h - gEfiSmmBase2ProtocolGuid = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }} - - ## Include/Protocol/SmmAccess2.h - gEfiSmmAccess2ProtocolGuid = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }} - - ## Include/Protocol/SmmControl2.h - gEfiSmmControl2ProtocolGuid = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}} - - ## Include/Protocol/SmmConfiguration.h - gEfiSmmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }} - - ## Include/Protocol/SmmReadyToLock.h - gEfiSmmReadyToLockProtocolGuid = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }} - - ## Include/Protocol/DxeSmmReadyToLock.h - gEfiDxeSmmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }} - - ## Include/Protocol/SmmCommunication.h - gEfiSmmCommunicationProtocolGuid = { 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }} - - ## Include/Protocol/SmmStatusCode.h - gEfiSmmStatusCodeProtocolGuid = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}} - - ## Include/Protocol/SmmCpu.h - gEfiSmmCpuProtocolGuid = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }} - - ## Include/Protocol/SmmPciRootBridgeIo.h - gEfiSmmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }} - - ## Include/Protocol/SmmSwDispatch2.h - gEfiSmmSwDispatch2ProtocolGuid = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }} - - ## Include/Protocol/SmmSxDispatch2.h - gEfiSmmSxDispatch2ProtocolGuid = { 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }} - - ## Include/Protocol/SmmPeriodicTimerDispatch2.h - gEfiSmmPeriodicTimerDispatch2ProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }} - - ## Include/Protocol/SmmUsbDispatch2.h - gEfiSmmUsbDispatch2ProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }} - - ## Include/Protocol/SmmGpiDispatch2.h - gEfiSmmGpiDispatch2ProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }} - - ## Include/Protocol/SmmStandbyButtonDispatch2.h - gEfiSmmStandbyButtonDispatch2ProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }} - - ## Include/Protocol/SmmPowerButtonDispatch2.h - gEfiSmmPowerButtonDispatch2ProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }} - - ## Include/Protocol/SmmIoTrapDispatch2.h - gEfiSmmIoTrapDispatch2ProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }} - - ## Include/Protocol/PiPcd.h - gEfiPcdProtocolGuid = { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } } - - ## Include/Protocol/FirmwareVolumeBlock.h - gEfiFirmwareVolumeBlock2ProtocolGuid = { 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } } - - ## Include/Protocol/CpuIo2.h - gEfiCpuIo2ProtocolGuid = {0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f } } - - ## Include/Protocol/LegacyRegion2.h - gEfiLegacyRegion2ProtocolGuid = {0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } } - - ## Include/Protocol/McaInitPmi.h - gEfiSalMcaInitPmiProtocolGuid = { 0xb60dc6e8, 0x3b6f, 0x11d5, {0xaf, 0x9, 0x0, 0xa0, 0xc9, 0x44, 0xa0, 0x5b } } - - ## Include/Protocol/ExtendedSalBootService.h - gEfiExtendedSalBootServiceProtocolGuid = { 0xde0ee9a4, 0x3c7a, 0x44f2, {0xb7, 0x8b, 0xe3, 0xcc, 0xd6, 0x9c, 0x3a, 0xf7 } } - - ## Include/Protocol/ExtendedSalServiceClasses.h - gEfiExtendedSalBaseIoServicesProtocolGuid = { 0x5aea42b5, 0x31e1, 0x4515, {0xbc, 0x31, 0xb8, 0xd5, 0x25, 0x75, 0x65, 0xa6 } } - gEfiExtendedSalStallServicesProtocolGuid = { 0x53a58d06, 0xac27, 0x4d8c, {0xb5, 0xe9, 0xf0, 0x8a, 0x80, 0x65, 0x41, 0x70 } } - gEfiExtendedSalRtcServicesProtocolGuid = { 0x7e97a470, 0xefdb, 0x4d02, {0x8f, 0xce, 0x61, 0x90, 0xd2, 0x7b, 0xa2, 0x96 } } - gEfiExtendedSalVariableServicesProtocolGuid = { 0x4ecb6c53, 0xc641, 0x4370, {0x8c, 0xb2, 0x3b, 0x0e, 0x49, 0x6e, 0x83, 0x78 } } - gEfiExtendedSalMtcServicesProtocolGuid = { 0x899afd18, 0x75e8, 0x408b, {0xa4, 0x1a, 0x6e, 0x2e, 0x7e, 0xcd, 0xf4, 0x54 } } - gEfiExtendedSalResetServicesProtocolGuid = { 0x7d019990, 0x8ce1, 0x46f5, {0xa7, 0x76, 0x3c, 0x51, 0x98, 0x67, 0x6a, 0xa0 } } - gEfiExtendedSalStatusCodeServicesProtocolGuid = { 0xdbd91d, 0x55e9, 0x420f, {0x96, 0x39, 0x5e, 0x9f, 0x84, 0x37, 0xb4, 0x4f } } - gEfiExtendedSalFvBlockServicesProtocolGuid = { 0xa2271df1, 0xbcbb, 0x4f1d, {0x98, 0xa9, 0x06, 0xbc, 0x17, 0x2f, 0x07, 0x1a } } - gEfiExtendedSalMpServicesProtocolGuid = { 0x697d81a2, 0xcf18, 0x4dc0, {0x9e, 0x0d, 0x06, 0x11, 0x3b, 0x61, 0x8a, 0x3f } } - gEfiExtendedSalPalServicesProtocolGuid = { 0xe1cd9d21, 0x0fc2, 0x438d, {0x97, 0x03, 0x04, 0xe6, 0x6d, 0x96, 0x1e, 0x57 } } - gEfiExtendedSalBaseServicesProtocolGuid = { 0xd9e9fa06, 0x0fe0, 0x41c3, {0x96, 0xfb, 0x83, 0x42, 0x5a, 0x33, 0x94, 0xf8 } } - gEfiExtendedSalMcaServicesProtocolGuid = { 0x2a591128, 0x6cc7, 0x42b1, {0x8a, 0xf0, 0x58, 0x93, 0x3b, 0x68, 0x2d, 0xbb } } - gEfiExtendedSalPciServicesProtocolGuid = { 0xa46b1a31, 0xad66, 0x4905, {0x92, 0xf6, 0x2b, 0x46, 0x59, 0xdc, 0x30, 0x63 } } - gEfiExtendedSalCacheServicesProtocolGuid = { 0xedc9494, 0x2743, 0x4ba5, { 0x88, 0x18, 0x0a, 0xef, 0x52, 0x13, 0xf1, 0x88 } } - gEfiExtendedSalMcaLogServicesProtocolGuid = { 0xcb3fd86e, 0x38a3, 0x4c03, {0x9a, 0x5c, 0x90, 0xcf, 0xa3, 0xa2, 0xab, 0x7a } } - - # - # Protocols defined in PI 1.2.1 - # - - ## Include/Protocol/Security2.h - gEfiSecurity2ArchProtocolGuid = { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } } - - ## Include/Protocol/SmmEndOfDxe.h - gEfiSmmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }} - - ## Include/Protocol/IsaHc.h - gEfiIsaHcProtocolGuid = { 0xbcdaf080, 0x1bde, 0x4e22, {0xae, 0x6a, 0x43, 0x54, 0x1e, 0x12, 0x8e, 0xc4 } } - gEfiIsaHcServiceBindingProtocolGuid = { 0xfad7933a, 0x6c21, 0x4234, {0xa4, 0x34, 0x0a, 0x8a, 0x0d, 0x2b, 0x07, 0x81 } } - - ## Include/Protocol/SuperIoControl.h - gEfiSioControlProtocolGuid = { 0xb91978df, 0x9fc1, 0x427d, { 0xbb, 0x5, 0x4c, 0x82, 0x84, 0x55, 0xca, 0x27 } } - - ## Include/Protocol/PiPcdInfo.h - gEfiGetPcdInfoProtocolGuid = { 0xfd0f4478, 0xefd, 0x461d, { 0xba, 0x2d, 0xe5, 0x8c, 0x45, 0xfd, 0x5f, 0x5e } } - - # - # Protocols defined in PI 1.3. - # - - ## Include/Protocol/I2cMaster.h - gEfiI2cMasterProtocolGuid = { 0xcd72881f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }} - - ## Include/Protocol/I2cIo.h - gEfiI2cIoProtocolGuid = { 0xb60a3e6b, 0x18c4, 0x46e5, { 0xa2, 0x9a, 0xc9, 0xa1, 0x06, 0x65, 0xa2, 0x8e }} - - ## Include/Protocol/I2cEnumerate.h - gEfiI2cEnumerateProtocolGuid = { 0xda8cd7c4, 0x1c00, 0x49e2, { 0x80, 0x3e, 0x52, 0x14, 0xe7, 0x01, 0x89, 0x4c }} - - ## Include/Protocol/I2cHost.h - gEfiI2cHostProtocolGuid = { 0xa5aab9e3, 0xc727, 0x48cd, { 0x8b, 0xbf, 0x42, 0x72, 0x33, 0x85, 0x49, 0x48 }} - - ## Include/Protocol/I2cBusConfigurationManagement.h - gEfiI2cBusConfigurationManagementProtocolGuid = { 0x55b71fb5, 0x17c6, 0x410e, { 0xb5, 0xbd, 0x5f, 0xa2, 0xe3, 0xd4, 0x46, 0x6b }} - - # - # Protocols defined in PI 1.5. - # - - ## Include/Protocol/MmEndOfDxe.h - gEfiMmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }} - - ## Include/Protocol/MmIoTrapDispatch.h - gEfiMmIoTrapDispatchProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }} - - ## Include/Protocol/MmPowerButtonDispatch.h - gEfiMmPowerButtonDispatchProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }} - - ## Include/Protocol/MmStandbyButtonDispatch.h - gEfiMmStandbyButtonDispatchProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }} - - ## Include/Protocol/MmGpiDispatch.h - gEfiMmGpiDispatchProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }} - - ## Include/Protocol/MmUsbDispatch.h - gEfiMmUsbDispatchProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }} - - ## Include/Protocol/MmPeriodicTimerDispatch.h - gEfiMmPeriodicTimerDispatchProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }} - - ## Include/Protocol/MmSxDispatch.h - gEfiMmSxDispatchProtocolGuid = { 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }} - - ## Include/Protocol/MmSwDispatch.h - gEfiMmSwDispatchProtocolGuid = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }} - - ## Include/Protocol/MmPciRootBridgeIo.h - gEfiMmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }} - - ## Include/Protocol/MmCpu.h - gEfiMmCpuProtocolGuid = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }} - - ## Include/Protocol/MmStatusCode.h - gEfiMmStatusCodeProtocolGuid = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}} - - ## Include/Protocol/DxeMmReadyToLock.h - gEfiDxeMmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }} - - ## Include/Protocol/MmConfiguration.h - gEfiMmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }} - - ## Include/Protocol/MmReadyToLock.h - gEfiMmReadyToLockProtocolGuid = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }} - - ## Include/Protocol/MmControl.h - gEfiMmControlProtocolGuid = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}} - - ## Include/Protocol/MmAccess.h - gEfiMmAccessProtocolGuid = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }} - - ## Include/Protocol/MmBase.h - gEfiMmBaseProtocolGuid = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }} - - ## Include/Protocol/MmCpuIo.h - gEfiMmCpuIoProtocolGuid = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d, 0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }} - - ## Include/Protocol/MmReportStatusCodeHandler.h - gEfiMmRscHandlerProtocolGuid = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }} - - ## Include/Protocol/MmCommunication.h - gEfiMmCommunicationProtocolGuid = { 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }} - - # - # Protocols defined in PI 1.6. - # - - ## Include/Protocol/LegacySpiController.h - gEfiLegacySpiControllerProtocolGuid = { 0x39136fc7, 0x1a11, 0x49de, { 0xbf, 0x35, 0x0e, 0x78, 0xdd, 0xb5, 0x24, 0xfc }} - - ## Include/Protocol/LegacySpiFlash.h - gEfiLegacySpiFlashProtocolGuid = { 0xf01bed57, 0x04bc, 0x4f3f, { 0x96, 0x60, 0xd6, 0xf2, 0xea, 0x22, 0x82, 0x59 }} - - ## Include/Protocol/LegacySpiSmmController.h - gEfiLegacySpiSmmControllerProtocolGuid = { 0x62331b78, 0xd8d0, 0x4c8c, { 0x8c, 0xcb, 0xd2, 0x7d, 0xfe, 0x32, 0xdb, 0x9b }} - - ## Include/Protocol/LegacySpiSmmFlash.h - gEfiLegacySpiSmmFlashProtocolGuid = { 0x5e3848d4, 0x0db5, 0x4fc0, { 0x97, 0x29, 0x3f, 0x35, 0x3d, 0x4f, 0x87, 0x9f }} - - ## Include/Protocol/SpiConfiguration.h - gEfiSpiConfigurationProtocolGuid = { 0x85a6d3e6, 0xb65b, 0x4afc, { 0xb3, 0x8f, 0xc6, 0xd5, 0x4a, 0xf6, 0xdd, 0xc8 }} - - ## Include/Protocol/SpiHc.h - gEfiSpiHcProtocolGuid = { 0xc74e5db2, 0xfa96, 0x4ae2, { 0xb3, 0x99, 0x15, 0x97, 0x7f, 0xe3, 0x0, 0x2d }} - - ## Include/Protocol/SpiNorFlash.h - gEfiSpiNorFlashProtocolGuid = { 0xb57ec3fe, 0xf833, 0x4ba6, { 0x85, 0x78, 0x2a, 0x7d, 0x6a, 0x87, 0x44, 0x4b }} - - ## Include/Protocol/SpiSmmConfiguration.h - gEfiSpiSmmConfigurationProtocolGuid = { 0x995c6eca, 0x171b, 0x45fd, { 0xa3, 0xaa, 0xfd, 0x4c, 0x9c, 0x9d, 0xef, 0x59 }} - - ## Include/Protocol/SpiSmmHc.h - gEfiSpiSmmHcProtocolGuid = { 0xe9f02217, 0x2093, 0x4470, { 0x8a, 0x54, 0x5c, 0x2c, 0xff, 0xe7, 0x3e, 0xcb }} - - ## Include/Protocol/SpiSmmNorFlash.h - gEfiSpiSmmNorFlashProtocolGuid = { 0xaab18f19, 0xfe14, 0x4666, { 0x86, 0x04, 0x87, 0xff, 0x6d, 0x66, 0x2c, 0x9a }} - - # - # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1 - # - - ## Include/Protocol/DebugPort.h - gEfiDebugPortProtocolGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }} - - ## Include/Protocol/DebugSupport.h - gEfiDebugSupportProtocolGuid = { 0x2755590C, 0x6F3C, 0x42FA, { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 }} - - ## Include/Protocol/Decompress.h - gEfiDecompressProtocolGuid = { 0xD8117CFE, 0x94A6, 0x11D4, { 0x9A, 0x3A, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/DeviceIo.h - gEfiDeviceIoProtocolGuid = { 0xAF6AC311, 0x84C3, 0x11D2, { 0x8E, 0x3C, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/DevicePath.h - gEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/DevicePathFromText.h - gEfiDevicePathFromTextProtocolGuid = { 0x05C99A21, 0xC70F, 0x4AD2, { 0x8A, 0x5F, 0x35, 0xDF, 0x33, 0x43, 0xF5, 0x1E }} - - ## Include/Protocol/DevicePathToText.h - gEfiDevicePathToTextProtocolGuid = { 0x8B843E20, 0x8132, 0x4852, { 0x90, 0xCC, 0x55, 0x1A, 0x4E, 0x4A, 0x7F, 0x1C }} - - ## Include/Protocol/DevicePathUtilities.h - gEfiDevicePathUtilitiesProtocolGuid = { 0x0379BE4E, 0xD706, 0x437D, { 0xB0, 0x37, 0xED, 0xB8, 0x2F, 0xB7, 0x72, 0xA4 }} - - ## Include/Protocol/DriverBinding.h - gEfiDriverBindingProtocolGuid = { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 }} - - ## Include/Protocol/PlatformDriverOverride.h - gEfiPlatformDriverOverrideProtocolGuid = { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } - - ## Include/Protocol/DriverFamilyOverride.h - gEfiDriverFamilyOverrideProtocolGuid = { 0xb1ee129e, 0xda36, 0x4181, { 0x91, 0xf8, 0x4, 0xa4, 0x92, 0x37, 0x66, 0xa7 }} - - ## Include/Protocol/BusSpecificDriverOverride.h - gEfiBusSpecificDriverOverrideProtocolGuid = { 0x3BC1B285, 0x8A15, 0x4A82, { 0xAA, 0xBF, 0x4D, 0x7D, 0x13, 0xFB, 0x32, 0x65 }} - - ## Include/Protocol/DriverDiagnostics2.h - gEfiDriverDiagnostics2ProtocolGuid = { 0x4D330321, 0x025F, 0x4AAC, { 0x90, 0xD8, 0x5E, 0xD9, 0x00, 0x17, 0x3B, 0x63 }} - - ## Include/Protocol/DriverDiagnostics.h - gEfiDriverDiagnosticsProtocolGuid = { 0x0784924F, 0xE296, 0x11D4, { 0x9A, 0x49, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/ComponentName2.h - gEfiComponentName2ProtocolGuid = { 0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14 }} - - ## Include/Protocol/ComponentName.h - gEfiComponentNameProtocolGuid = { 0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/DriverConfiguration2.h - gEfiDriverConfiguration2ProtocolGuid = { 0xBFD7DC1D, 0x24F1, 0x40D9, { 0x82, 0xE7, 0x2E, 0x09, 0xBB, 0x6B, 0x4E, 0xBE }} - - ## Include/Protocol/DriverConfiguration.h - gEfiDriverConfigurationProtocolGuid = { 0x107A772B, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/PlatformToDriverConfiguration.h - gEfiPlatformToDriverConfigurationProtocolGuid = { 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } } - - ## Include/Protocol/DriverSupportedEfiVersion.h - gEfiDriverSupportedEfiVersionProtocolGuid = { 0x5c198761, 0x16a8, 0x4e69, { 0x97, 0x2c, 0x89, 0xd6, 0x79, 0x54, 0xf8, 0x1d } } - - ## Include/Protocol/SimpleTextIn.h - gEfiSimpleTextInProtocolGuid = { 0x387477C1, 0x69C7, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/SimpleTextInEx.h - gEfiSimpleTextInputExProtocolGuid = {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } } - - ## Include/Protocol/SimpleTextOut.h - gEfiSimpleTextOutProtocolGuid = { 0x387477C2, 0x69C7, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/SimplePointer.h - gEfiSimplePointerProtocolGuid = { 0x31878C87, 0x0B75, 0x11D5, { 0x9A, 0x4F, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/AbsolutePointer.h - gEfiAbsolutePointerProtocolGuid = { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } } - - ## Include/Protocol/SerialIo.h - gEfiSerialIoProtocolGuid = { 0xBB25CF6F, 0xF1D4, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }} - - ## Include/Protocol/GraphicsOutput.h - gEfiGraphicsOutputProtocolGuid = { 0x9042A9DE, 0x23DC, 0x4A38, { 0x96, 0xFB, 0x7A, 0xDE, 0xD0, 0x80, 0x51, 0x6A }} - - ## Include/Protocol/EdidDiscovered.h - gEfiEdidDiscoveredProtocolGuid = { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8A, 0xD0, 0x6C, 0x1A, 0x66, 0xAA }} - - ## Include/Protocol/EdidActive.h - gEfiEdidActiveProtocolGuid = { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86 }} - - ## Include/Protocol/EdidOverride.h - gEfiEdidOverrideProtocolGuid = { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5 }} - - ## Include/Protocol/UgaIo.h - gEfiUgaIoProtocolGuid = { 0x61A4D49E, 0x6F68, 0x4F1B, { 0xB9, 0x22, 0xA8, 0x6E, 0xED, 0x0B, 0x07, 0xA2 }} - - ## Include/Protocol/UgaDraw.h - gEfiUgaDrawProtocolGuid = { 0x982C298B, 0xF4FA, 0x41CB, { 0xB8, 0x38, 0x77, 0xAA, 0x68, 0x8F, 0xB8, 0x39 }} - - ## Include/Protocol/LoadedImage.h - gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/LoadedImage.h - gEfiLoadedImageDevicePathProtocolGuid = { 0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }} - - ## Include/Protocol/LoadFile.h - gEfiLoadFileProtocolGuid = { 0x56EC3091, 0x954C, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/LoadFile2.h - gEfiLoadFile2ProtocolGuid = { 0x4006c0c1, 0xfcb3, 0x403e, {0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d }} - - ## Include/Protocol/SimpleFileSystem.h - gEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/TapeIo.h - gEfiTapeIoProtocolGuid = { 0x1E93E633, 0xD65A, 0x459E, { 0xAB, 0x84, 0x93, 0xD9, 0xEC, 0x26, 0x6D, 0x18 }} - - ## Include/Protocol/DiskIo.h - gEfiDiskIoProtocolGuid = { 0xCE345171, 0xBA0B, 0x11D2, { 0x8E, 0x4F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/BlockIo.h - gEfiBlockIoProtocolGuid = { 0x964E5B21, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/UnicodeCollation.h - gEfiUnicodeCollationProtocolGuid = { 0x1D85CD7F, 0xF43D, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/UnicodeCollation.h - gEfiUnicodeCollation2ProtocolGuid = {0xa4c751fc, 0x23ae, 0x4c3e, { 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49 }} - - ## Include/Protocol/PciRootBridgeIo.h - gEfiPciRootBridgeIoProtocolGuid = { 0x2F707EBB, 0x4A1A, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/PciIo.h - gEfiPciIoProtocolGuid = { 0x4CF5B200, 0x68B8, 0x4CA5, { 0x9E, 0xEC, 0xB2, 0x3E, 0x3F, 0x50, 0x02, 0x9A }} - - ## Include/Protocol/ScsiIo.h - gEfiScsiIoProtocolGuid = { 0x932F47e6, 0x2362, 0x4002, { 0x80, 0x3E, 0x3C, 0xD5, 0x4B, 0x13, 0x8F, 0x85 }} - - ## Include/Protocol/ScsiPassThruExt.h - gEfiExtScsiPassThruProtocolGuid = { 0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe }} - - ## Include/Protocol/ScsiPassThru.h - gEfiScsiPassThruProtocolGuid = { 0xA59E8FCF, 0xBDA0, 0x43BB, { 0x90, 0xB1, 0xD3, 0x73, 0x2E, 0xCA, 0xA8, 0x77 }} - - ## Include/Protocol/IScsiInitiatorName.h - gEfiIScsiInitiatorNameProtocolGuid = { 0x59324945, 0xEC44, 0x4C0D, { 0xB1, 0xCD, 0x9D, 0xB1, 0x39, 0xDF, 0x07, 0x0C }} - - ## Include/Protocol/Usb2HostController.h - gEfiUsb2HcProtocolGuid = { 0x3E745226, 0x9818, 0x45B6, { 0xA2, 0xAC, 0xD7, 0xCD, 0x0E, 0x8B, 0xA2, 0xBC }} - - ## Include/Protocol/UsbHostController.h - gEfiUsbHcProtocolGuid = { 0xF5089266, 0x1AA0, 0x4953, { 0x97, 0xD8, 0x56, 0x2F, 0x8A, 0x73, 0xB5, 0x19 }} - - ## Include/Protocol/UsbIo.h - gEfiUsbIoProtocolGuid = { 0x2B2F68D6, 0x0CD2, 0x44CF, { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 }} - - ## Include/Protocol/AcpiTable.h - gEfiAcpiTableProtocolGuid = { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C, 0x7E, 0xC5, 0x27, 0x5C }} - - ## Include/Protocol/Ebc.h - gEfiEbcProtocolGuid = { 0x13AC6DD1, 0x73D0, 0x11D4, { 0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 }} - - ## Include/Protocol/SimpleNetwork.h - gEfiSimpleNetworkProtocolGuid = { 0xA19832B9, 0xAC25, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/NetworkInterfaceIdentifier.h - gEfiNetworkInterfaceIdentifierProtocolGuid_31 = { 0x1ACED566, 0x76ED, 0x4218, { 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 }} - - ## Include/Protocol/NetworkInterfaceIdentifier.h - gEfiNetworkInterfaceIdentifierProtocolGuid = { 0xE18541CD, 0xF755, 0x4F73, { 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 }} - - ## Include/Protocol/PxeBaseCodeCallBack.h - gEfiPxeBaseCodeCallbackProtocolGuid = { 0x245DCA21, 0xFB7B, 0x11D3, { 0x8F, 0x01, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }} - - ## Include/Protocol/PxeBaseCode.h - gEfiPxeBaseCodeProtocolGuid = { 0x03C4E603, 0xAC28, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} - - ## Include/Protocol/Bis.h - gEfiBisProtocolGuid = { 0x0B64AAB0, 0x5429, 0x11D4, { 0x98, 0x16, 0x00, 0xA0, 0xC9, 0x1F, 0xAD, 0xCF }} - - ## Include/Protocol/ManagedNetwork.h - gEfiManagedNetworkServiceBindingProtocolGuid = { 0xF36FF770, 0xA7E1, 0x42CF, { 0x9E, 0xD2, 0x56, 0xF0, 0xF2, 0x71, 0xF4, 0x4C }} - - ## Include/Protocol/ManagedNetwork.h - gEfiManagedNetworkProtocolGuid = { 0x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 }} - - ## Include/Protocol/Arp.h - gEfiArpServiceBindingProtocolGuid = { 0xF44C00EE, 0x1F2C, 0x4A00, { 0xAA, 0x09, 0x1C, 0x9F, 0x3E, 0x08, 0x00, 0xA3 }} - - ## Include/Protocol/Arp.h - gEfiArpProtocolGuid = { 0xF4B427BB, 0xBA21, 0x4F16, { 0xBC, 0x4E, 0x43, 0xE4, 0x16, 0xAB, 0x61, 0x9C }} - - ## Include/Protocol/Dhcp4.h - gEfiDhcp4ServiceBindingProtocolGuid = { 0x9D9A39D8, 0xBD42, 0x4A73, { 0xA4, 0xD5, 0x8E, 0xE9, 0x4B, 0xE1, 0x13, 0x80 }} - - ## Include/Protocol/Dhcp4.h - gEfiDhcp4ProtocolGuid = { 0x8A219718, 0x4EF5, 0x4761, { 0x91, 0xC8, 0xC0, 0xF0, 0x4B, 0xDA, 0x9E, 0x56 }} - - ## Include/Protocol/Tcp4.h - gEfiTcp4ServiceBindingProtocolGuid = { 0x00720665, 0x67EB, 0x4A99, { 0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 }} - - ## Include/Protocol/Tcp4.h - gEfiTcp4ProtocolGuid = { 0x65530BC7, 0xA359, 0x410F, { 0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 }} - - ## Include/Protocol/Ip4.h - gEfiIp4ServiceBindingProtocolGuid = { 0xC51711E7, 0xB4BF, 0x404A, { 0xBF, 0xB8, 0x0A, 0x04, 0x8E, 0xF1, 0xFF, 0xE4 }} - - ## Include/Protocol/Ip4.h - gEfiIp4ProtocolGuid = { 0x41D94CD2, 0x35B6, 0x455A, { 0x82, 0x58, 0xD4, 0xE5, 0x13, 0x34, 0xAA, 0xDD }} - - ## Include/Protocol/Ip4Config.h - gEfiIp4ConfigProtocolGuid = { 0x3B95AA31, 0x3793, 0x434B, { 0x86, 0x67, 0xC8, 0x07, 0x08, 0x92, 0xE0, 0x5E }} - - ## Include/Protocol/Udp4.h - gEfiUdp4ServiceBindingProtocolGuid = { 0x83F01464, 0x99BD, 0x45E5, { 0xB3, 0x83, 0xAF, 0x63, 0x05, 0xD8, 0xE9, 0xE6 }} - - ## Include/Protocol/Udp4.h - gEfiUdp4ProtocolGuid = { 0x3AD9DF29, 0x4501, 0x478D, { 0xB1, 0xF8, 0x7F, 0x7F, 0xE7, 0x0E, 0x50, 0xF3 }} - - ## Include/Protocol/Mtftp4.h - gEfiMtftp4ServiceBindingProtocolGuid = { 0x2FE800BE, 0x8F01, 0x4AA6, { 0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F }} - - ## Include/Protocol/Mtftp4.h - gEfiMtftp4ProtocolGuid = { 0x78247C57, 0x63DB, 0x4708, { 0x99, 0xC2, 0xA8, 0xB4, 0xA9, 0xA6, 0x1F, 0x6B }} - - ## Include/Protocol/AuthenticationInfo.h - gEfiAuthenticationInfoProtocolGuid = { 0x7671D9D0, 0x53DB, 0x4173, { 0xAA, 0x69, 0x23, 0x27, 0xF2, 0x1F, 0x0B, 0xC7 }} - - ## Include/Protocol/Hash.h - gEfiHashServiceBindingProtocolGuid = { 0x42881c98, 0xa4f3, 0x44b0, { 0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd }} - - ## Include/Protocol/Hash.h - gEfiHashProtocolGuid = { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 }} - - ## Include/Protocol/TcgService.h - gEfiTcgProtocolGuid = { 0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }} - - ## Include/Protocol/TrEEProtocol.h - gEfiTrEEProtocolGuid = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }} - - ## Include/Protocol/Tcg2Protocol.h - gEfiTcg2ProtocolGuid = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }} - gEfiTcg2FinalEventsTableGuid = {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }} - - ## Include/Protocol/FormBrowser2.h - gEfiFormBrowser2ProtocolGuid = {0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58}} - - ## Include/Protocol/HiiString.h - gEfiHiiStringProtocolGuid = {0x0fd96974, 0x23aa, 0x4cdc, {0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a}} - - ## Include/Protocol/HiiImage.h - gEfiHiiImageProtocolGuid = {0x31a6406a, 0x6bdf, 0x4e46, {0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x09, 0x20}} - - ## Include/Protocol/HiiConfigRouting.h - gEfiHiiConfigRoutingProtocolGuid = {0x587e72d7, 0xcc50, 0x4f79, {0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f}} - - ## Include/Protocol/HiiDatabase.h - gEfiHiiDatabaseProtocolGuid = {0xef9fc172, 0xa1b2, 0x4693, {0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42}} - - ## Include/Protocol/HiiFont.h - gEfiHiiFontProtocolGuid = {0xe9ca4775, 0x8657, 0x47fc, {0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x08, 0x43, 0x24}} - - ## Include/Protocol/HiiConfigAccess.h - gEfiHiiConfigAccessProtocolGuid = {0x330d4706, 0xf2a0, 0x4e4f, {0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85}} - - ## Include/Protocol/HiiPackageList.h - gEfiHiiPackageListProtocolGuid = { 0x6a1ee763, 0xd47a, 0x43b4, {0xaa, 0xbe, 0xef, 0x1d, 0xe2, 0xab, 0x56, 0xfc}} - - # - # Protocols defined in UEFI2.2 - # - ## Include/Protocol/Ip6.h - gEfiIp6ServiceBindingProtocolGuid = { 0xec835dd3, 0xfe0f, 0x617b, {0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 }} - - ## Include/Protocol/Ip6.h - gEfiIp6ProtocolGuid = { 0x2c8759d5, 0x5c2d, 0x66ef, {0x92, 0x5f, 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 }} - - ## Include/Protocol/Ip6Config.h - gEfiIp6ConfigProtocolGuid = { 0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a }} - - ## Include/Protocol/Mtftp6.h - gEfiMtftp6ServiceBindingProtocolGuid = { 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 }} - - ## Include/Protocol/Mtftp6.h - gEfiMtftp6ProtocolGuid = { 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 }} - - ## Include/Protocol/Dhcp6.h - gEfiDhcp6ServiceBindingProtocolGuid = { 0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5 }} - - ## Include/Protocol/Dhcp6.h - gEfiDhcp6ProtocolGuid = { 0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b }} - - ## Include/Protocol/Udp6.h - gEfiUdp6ServiceBindingProtocolGuid = { 0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 }} - - ## Include/Protocol/Udp6.h - gEfiUdp6ProtocolGuid = { 0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 }} - - ## Include/Protocol/Tcp6.h - gEfiTcp6ServiceBindingProtocolGuid = { 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0x0d, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64 }} - - ## Include/Protocol/Tcp6.h - gEfiTcp6ProtocolGuid = { 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0x0d, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77 }} - - ## Include/Protocol/VlanConfig.h - gEfiVlanConfigProtocolGuid = { 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74 }} - - ## Include/Protocol/Eap.h - gEfiEapProtocolGuid = { 0x5d9f96db, 0xe731, 0x4caa, {0xa0, 0xd, 0x72, 0xe1, 0x87, 0xcd, 0x77, 0x62 }} - - ## Include/Protocol/EapManagement.h - gEfiEapManagementProtocolGuid = { 0xbb62e663, 0x625d, 0x40b2, {0xa0, 0x88, 0xbb, 0xe8, 0x36, 0x23, 0xa2, 0x45 }} - - ## Include/Protocol/Ftp4.h - gEfiFtp4ServiceBindingProtocolGuid = { 0xfaaecb1, 0x226e, 0x4782, {0xaa, 0xce, 0x7d, 0xb9, 0xbc, 0xbf, 0x4d, 0xaf }} - - ## Include/Protocol/Ftp4.h - gEfiFtp4ProtocolGuid = { 0xeb338826, 0x681b, 0x4295, {0xb3, 0x56, 0x2b, 0x36, 0x4c, 0x75, 0x7b, 0x9 }} - - ## Include/Protocol/IpSecConfig.h - gEfiIpSecConfigProtocolGuid = { 0xce5e5929, 0xc7a3, 0x4602, {0xad, 0x9e, 0xc9, 0xda, 0xf9, 0x4e, 0xbf, 0xcf }} - - ## Include/Protocol/DriverHealth.h - gEfiDriverHealthProtocolGuid = { 0x2a534210, 0x9280, 0x41d8, {0xae, 0x79, 0xca, 0xda, 0x1, 0xa2, 0xb1, 0x27 }} - - ## Include/Protocol/DeferredImageLoad.h - gEfiDeferredImageLoadProtocolGuid = { 0x15853d7c, 0x3ddf, 0x43e0, {0xa1, 0xcb, 0xeb, 0xf8, 0x5b, 0x8f, 0x87, 0x2c }} - - ## Include/Protocol/UserCredential.h - gEfiUserCredentialProtocolGuid = { 0x71ee5e94, 0x65b9, 0x45d5, {0x82, 0x1a, 0x3a, 0x4d, 0x86, 0xcf, 0xe6, 0xbe }} - - ## Include/Protocol/UserManager.h - gEfiUserManagerProtocolGuid = { 0x6fd5b00c, 0xd426, 0x4283, {0x98, 0x87, 0x6c, 0xf5, 0xcf, 0x1c, 0xb1, 0xfe }} - - ## Include/Protocol/AtaPassThru.h - gEfiAtaPassThruProtocolGuid = { 0x1d3de7f0, 0x807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f }} - - # - # Protocols defined in UEFI2.3 - # - ## Include/Protocol/FirmwareManagement.h - gEfiFirmwareManagementProtocolGuid = { 0x86c77a67, 0xb97, 0x4633, {0xa1, 0x87, 0x49, 0x10, 0x4d, 0x6, 0x85, 0xc7 }} - - ## Include/Protocol/IpSec.h - gEfiIpSecProtocolGuid = { 0xdfb386f7, 0xe100, 0x43ad, {0x9c, 0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }} - - ## Include/Protocol/IpSec.h - gEfiIpSec2ProtocolGuid = { 0xa3979e64, 0xace8, 0x4ddc, {0xbc, 0x7, 0x4d, 0x66, 0xb8, 0xfd, 0x9, 0x77 }} - - # - # Protocols defined in UEFI2.3.1 - # - ## Include/Protocol/Kms.h - gEfiKmsProtocolGuid = { 0xEC3A978D, 0x7C4E, 0x48FA, {0x9A, 0xBE, 0x6A, 0xD9, 0x1C, 0xC8, 0xF8, 0x11 }} - - ## Include/Protocol/BlockIo2.h - gEfiBlockIo2ProtocolGuid = { 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1 }} - - ## Include/Protocol/StorageSecurityCommand.h - gEfiStorageSecurityCommandProtocolGuid = { 0xc88b0b6d, 0x0dfc, 0x49a7, {0x9c, 0xb4, 0x49, 0x7, 0x4b, 0x4c, 0x3a, 0x78 }} - - ## Include/Protocol/UserCredential2.h - gEfiUserCredential2ProtocolGuid = { 0xe98adb03, 0xb8b9, 0x4af8, {0xba, 0x20, 0x26, 0xe9, 0x11, 0x4c, 0xbc, 0xe5 }} - - # - # Protocols defined in UEFI2.4 - # - ## Include/Protocol/DiskIo2.h - gEfiDiskIo2ProtocolGuid = { 0x151c8eae, 0x7f2c, 0x472c, { 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88 }} - - ## Include/Protocol/Timestamp.h - gEfiTimestampProtocolGuid = { 0xafbfde41, 0x2e6e, 0x4262, {0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 }} - - ## Include/Protocol/Rng.h - gEfiRngProtocolGuid = { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }} - - ## Include/Protocol/AdapterInformation.h - gEfiAdapterInformationProtocolGuid = { 0xE5DD1403, 0xD622, 0xC24E, {0x84, 0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 }} - - # - # Protocols defined in UEFI2.5 - # - ## Include/Protocol/NvmExpressPassthru.h - gEfiNvmExpressPassThruProtocolGuid = { 0x52c78312, 0x8edc, 0x4233, { 0x98, 0xf2, 0x1a, 0x1a, 0xa5, 0xe3, 0x88, 0xa5 }} - - ## Include/Protocol/Hash2.h - gEfiHash2ServiceBindingProtocolGuid = { 0xda836f8d, 0x217f, 0x4ca0, { 0x99, 0xc2, 0x1c, 0xa4, 0xe1, 0x60, 0x77, 0xea }} - - ## Include/Protocol/Hash2.h - gEfiHash2ProtocolGuid = { 0x55b1d734, 0xc5e1, 0x49db, { 0x96, 0x47, 0xb1, 0x6a, 0xfb, 0xe, 0x30, 0x5b }} - - ## Include/Protocol/BlockIoCrypto.h - gEfiBlockIoCryptoProtocolGuid = { 0xa00490ba, 0x3f1a, 0x4b4c, { 0xab, 0x90, 0x4f, 0xa9, 0x97, 0x26, 0xa1, 0xe8 }} - - ## Include/Protocol/SmartCardReader.h - gEfiSmartCardReaderProtocolGuid = { 0x2a4d1adf, 0x21dc, 0x4b81, {0xa4, 0x2f, 0x8b, 0x8e, 0xe2, 0x38, 0x00, 0x60 }} - - ## Include/Protocol/SmartCardEdge.h - gEfiSmartCardEdgeProtocolGuid = { 0xd317f29b, 0xa325, 0x4712, {0x9b, 0xf1, 0xc6, 0x19, 0x54, 0xdc, 0x19, 0x8c }} - - ## Include/Protocol/UsbFunctionIo.h - gEfiUsbFunctionIoProtocolGuid = { 0x32d2963a, 0xfe5d, 0x4f30, {0xb6, 0x33, 0x6e, 0x5d, 0xc5, 0x58, 0x3, 0xcc }} - - ## Include/Protocol/BluetoothHc.h - gEfiBluetoothHcProtocolGuid = { 0xb3930571, 0xbeba, 0x4fc5, { 0x92, 0x3, 0x94, 0x27, 0x24, 0x2e, 0x6a, 0x43 }} - - ## Include/Protocol/BluetoothIo.h - gEfiBluetoothIoServiceBindingProtocolGuid = { 0x388278d3, 0x7b85, 0x42f0, { 0xab, 0xa9, 0xfb, 0x4b, 0xfd, 0x69, 0xf5, 0xab }} - gEfiBluetoothIoProtocolGuid = { 0x467313de, 0x4e30, 0x43f1, { 0x94, 0x3e, 0x32, 0x3f, 0x89, 0x84, 0x5d, 0xb5 }} - - ## Include/Protocol/BluetoothConfig.h - gEfiBluetoothConfigProtocolGuid = { 0x62960cf3, 0x40ff, 0x4263, { 0xa7, 0x7c, 0xdf, 0xde, 0xbd, 0x19, 0x1b, 0x4b }} - - ## Include/Protocol/RegularExpressionProtocol.h - gEfiRegularExpressionProtocolGuid = { 0xB3F79D9A, 0x436C, 0xDC11, {0xB0, 0x52, 0xCD, 0x85, 0xDF, 0x52, 0x4C, 0xE6 }} - - ## Include/Protocol/BootManagerPolicy.h - gEfiBootManagerPolicyProtocolGuid = { 0xfedf8e0c, 0xe147, 0x11e3, { 0x99, 0x03, 0xb8, 0xe8, 0x56, 0x2c, 0xba, 0xfa }} - - ## Include/Protocol/HiiConfigKeyword.h - gEfiConfigKeywordHandlerProtocolGuid = {0x0a8badd5, 0x03b8, 0x4d19, {0xb1, 0x28, 0x7b, 0x8f, 0x0e, 0xda, 0xa5, 0x96}} - - ## Include/Protocol/WiFi.h - gEfiWiFiProtocolGuid = { 0xda55bc9, 0x45f8, 0x4bb4, {0x87, 0x19, 0x52, 0x24, 0xf1, 0x8a, 0x4d, 0x45 }} - - ## Include/Protocol/EapManagement2.h - gEfiEapManagement2ProtocolGuid = { 0x5e93c847, 0x456d, 0x40b3, {0xa6, 0xb4, 0x78, 0xb0, 0xc9, 0xcf, 0x7f, 0x20 }} - - ## Include/Protocol/EapConfiguration.h - gEfiEapConfigurationProtocolGuid = { 0xe5b58dbb, 0x7688, 0x44b4, {0x97, 0xbf, 0x5f, 0x1d, 0x4b, 0x7c, 0xc8, 0xdb }} - - ## Include/Protocol/Pkcs7Verify.h - gEfiPkcs7VerifyProtocolGuid = { 0x47889fb2, 0xd671, 0x4fab, { 0xa0, 0xca, 0xdf, 0x0e, 0x44, 0xdf, 0x70, 0xd6 }} - - ## Include/Protocol/Ip4Config2.h - gEfiIp4Config2ProtocolGuid = { 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 }} - - ## Include/Protocol/Dns4.h - gEfiDns4ServiceBindingProtocolGuid = { 0xb625b186, 0xe063, 0x44f7, { 0x89, 0x5, 0x6a, 0x74, 0xdc, 0x6f, 0x52, 0xb4 }} - - ## Include/Protocol/Dns4.h - gEfiDns4ProtocolGuid = { 0xae3d28cc, 0xe05b, 0x4fa1, { 0xa0, 0x11, 0x7e, 0xb5, 0x5a, 0x3f, 0x14, 0x1 }} - - ## Include/Protocol/Dns6.h - gEfiDns6ServiceBindingProtocolGuid = { 0x7f1647c8, 0xb76e, 0x44b2, { 0xa5, 0x65, 0xf7, 0xf, 0xf1, 0x9c, 0xd1, 0x9e }} - - ## Include/Protocol/Dns6.h - gEfiDns6ProtocolGuid = { 0xca37bc1f, 0xa327, 0x4ae9, { 0x82, 0x8a, 0x8c, 0x40, 0xd8, 0x50, 0x6a, 0x17 }} - - ## Include/Protocol/Http.h - gEfiHttpServiceBindingProtocolGuid = { 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c }} - - ## Include/Protocol/Http.h - gEfiHttpProtocolGuid = { 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b }} - - ## Include/Protocol/HttpUtilities.h - gEfiHttpUtilitiesProtocolGuid = { 0x3e35c163, 0x4074, 0x45dd, {0x43, 0x1e, 0x23, 0x98, 0x9d, 0xd8, 0x6b, 0x32 }} - - ## Include/Protocol/Tls.h - gEfiTlsServiceBindingProtocolGuid = { 0x952cb795, 0xff36, 0x48cf, {0xa2, 0x49, 0x4d, 0xf4, 0x86, 0xd6, 0xab, 0x8d }} - - ## Include/Protocol/Tls.h - gEfiTlsProtocolGuid = { 0xca959f, 0x6cfa, 0x4db1, {0x95, 0xbc, 0xe4, 0x6c, 0x47, 0x51, 0x43, 0x90 }} - - ## Include/Protocol/TlsConfig.h - gEfiTlsConfigurationProtocolGuid = { 0x1682fe44, 0xbd7a, 0x4407, { 0xb7, 0xc7, 0xdc, 0xa3, 0x7c, 0xa3, 0x92, 0x2d }} - - ## Include/Protocol/Rest.h - gEfiRestProtocolGuid = { 0x0db48a36, 0x4e54, 0xea9c, {0x9b, 0x09, 0x1e, 0xa5, 0xbe, 0x3a, 0x66, 0x0b }} - - ## Include/Protocol/Supplicant.h - gEfiSupplicantServiceBindingProtocolGuid = { 0x45bcd98e, 0x59ad, 0x4174, { 0x95, 0x46, 0x34, 0x4a, 0x7, 0x48, 0x58, 0x98 }} - gEfiSupplicantProtocolGuid = { 0x54fcc43e, 0xaa89, 0x4333, { 0x9a, 0x85, 0xcd, 0xea, 0x24, 0x5, 0x1e, 0x9e }} - - # - # Protocols defined in UEFI2.6 - # - ## Include/Protocol/WiFi2.h - gEfiWiFi2ProtocolGuid = { 0x1b0fb9bf, 0x699d, 0x4fdd, {0xa7, 0xc3, 0x25, 0x46, 0x68, 0x1b, 0xf6, 0x3b }} - - ## Include/Protocol/RamDisk.h - gEfiRamDiskProtocolGuid = { 0xab38a0df, 0x6873, 0x44a9, { 0x87, 0xe6, 0xd4, 0xeb, 0x56, 0x14, 0x84, 0x49 }} - - ## Include/Protocol/ImageDecoder.h - gEfiHiiImageDecoderProtocolGuid = { 0x9e66f251, 0x727c, 0x418c, { 0xbf, 0xd6, 0xc2, 0xb4, 0x25, 0x28, 0x18, 0xea }} - - ## Include/Protocol/HiiImageEx.h - gEfiHiiImageExProtocolGuid = { 0x1a1241e6, 0x8f19, 0x41a9, { 0xbc, 0xe, 0xe8, 0xef, 0x39, 0xe0, 0x65, 0x46 }} - - ## Include/Protocol/SdMmcPassThru.h - gEfiSdMmcPassThruProtocolGuid = { 0x716ef0d9, 0xff83, 0x4f69, {0x81, 0xe9, 0x51, 0x8b, 0xd3, 0x9a, 0x8e, 0x70 }} - - ## Include/Protocol/EraseBlock.h - gEfiEraseBlockProtocolGuid = { 0x95a9a93e, 0xa86e, 0x4926, {0xaa, 0xef, 0x99, 0x18, 0xe7, 0x72, 0xd9, 0x87 }} - - # - # Protocols defined in UEFI2.7 - # - ## Include/Protocol/BluetoothAttribute.h - gEfiBluetoothAttributeProtocolGuid = { 0x898890e9, 0x84b2, 0x4f3a, { 0x8c, 0x58, 0xd8, 0x57, 0x78, 0x13, 0xe0, 0xac } } - gEfiBluetoothAttributeServiceBindingProtocolGuid = { 0x5639867a, 0x8c8e, 0x408d, {0xac, 0x2f, 0x4b, 0x61, 0xbd, 0xc0, 0xbb, 0xbb }} - - ## Include/Protocol/BluetoothLeConfig.h - gEfiBluetoothLeConfigProtocolGuid = { 0x8f76da58, 0x1f99, 0x4275, { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } } - - ## Include/Protocol/UfsDeviceConfig.h - gEfiUfsDeviceConfigProtocolGuid = { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }} - - ## Include/Protocol/HttpBootCallback.h - gEfiHttpBootCallbackProtocolGuid = {0xba23b311, 0x343d, 0x11e6, {0x91, 0x85, 0x58, 0x20, 0xb1, 0xd6, 0x52, 0x99}} - - ## Include/Protocol/ResetNotification.h - gEfiResetNotificationProtocolGuid = { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } } - - ## Include/Protocol/PartitionInfo.h - gEfiPartitionInfoProtocolGuid = { 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }} - - ## Include/Protocol/HiiPopup.h - gEfiHiiPopupProtocolGuid = { 0x4311edc0, 0x6054, 0x46d4, { 0x9e, 0x40, 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc }} - - ## Include/Protocol/NvdimmLabel.h - gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80, 0x97d5, 0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }} - - # - # Protocols defined in Shell2.0 - # - ## Include/Protocol/Shell.h - gEfiShellProtocolGuid = { 0x6302d008, 0x7f9b, 0x4f30, {0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e }} - - ## Include/Protocol/ShellParameters.h - gEfiShellParametersProtocolGuid = { 0x752f3136, 0x4e16, 0x4fdc, {0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca }} - - # - # Protocols defined in Shell2.1 - # - ## Include/Protocol/ShellDynamicCommand.h - gEfiShellDynamicCommandProtocolGuid = { 0x3c7200e9, 0x005f, 0x4ea4, {0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }} - -# -# [Error.gEfiMdePkgTokenSpaceGuid] -# 0x80000001 | Invalid value provided. -# 0x80000002 | Reserved bits must be set to zero. -# 0x80000003 | Incorrect progress code provided. -# - -[PcdsFeatureFlag] - ## Indicates if the component name protocol will be installed.

- # TRUE - Does not install component name protocol.
- # FALSE - Install component name protocol.
- # @Prompt Disable Component Name Protocol. - gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d - - ## Indicates if the diagnostics name protocol will be installed.

- # TRUE - Does not install diagnostics name protocol.
- # FALSE - Install diagnostics name protocol.
- # @Prompt Disable Diagnostics Name protocol. - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|FALSE|BOOLEAN|0x0000000e - - ## Indicates if the component name2 protocol will be installed.

- # TRUE - Does not install component name2 protocol.
- # FALSE - Install component name2 protocol.
- # @Prompt Disable Component Name2 Protocol. - gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE|BOOLEAN|0x00000010 - - ## Indicates if the diagnostics2 name protocol will be installed.

- # TRUE - Does not install diagnostics2 name protocol.
- # FALSE - Install diagnostics2 name protocol.
- # @Prompt Disable Diagnostics2 Name Protocol. - gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|FALSE|BOOLEAN|0x00000011 - - ## Indicates if EFI 1.1 ISO 639-2 language supports are obsolete

- # TRUE - Deprecate global variable LangCodes.
- # FALSE - Does not deprecate global variable LangCodes.
- # @Prompt Deprecate Global Variable LangCodes. - gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012 - - ## Indicates if UGA Draw Protocol is still consumed.

- # TRUE - Consume UGA Draw protocol.
- # FALSE - Does not consume UGA Draw protocol.
- # @Prompt Consume UGA Draw Protocol. - gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000027 - - ## Indicates if a check will be made to see if a specified node is a member of linked list - # in the following BaseLib functions: GetNextNode(), IsNull(), IsNodeAtEnd(), SwapListEntries().

- # TRUE - Verify a specified node is a member of linked list.
- # FALSE - Does not verify a specified node is a member of linked list.
- # @Prompt Verify Node In List. - gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList|FALSE|BOOLEAN|0x00000028 - - ## If TRUE, OrderedCollectionLib is instructed to validate the - # ORDERED_COLLECTION structure at the end of such operations (typically - # structure modifications) that justify validation of the structure for unit - # testing purposes. - # @Prompt Validate ORDERED_COLLECTION structure - gEfiMdePkgTokenSpaceGuid.PcdValidateOrderedCollection|FALSE|BOOLEAN|0x0000002a - -[PcdsFixedAtBuild] - ## Status code value for indicating a watchdog timer has expired. - # EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_TIMER_EXPIRED - # @Prompt Progress Code for WatchDog Timer Expired. - # @ValidList 0x80000003 | 0x00011003 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueEfiWatchDogTimerExpired|0x00011003|UINT32|0x00000013 - - ## Status code value for indicating the invocation of SetVirtualAddressMap() - # EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP - # @Prompt Progress Code for Invocation of SetVirtualAddressMap. - # @ValidList 0x80000003 | 0x03111004 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueSetVirtualAddressMap|0x03111004|UINT32|0x00000014 - - ## Status code value for indicating the start of memory test - # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST - # @Prompt Progress Code for Memory Test Start. - # @ValidList 0x80000003 | 0x00051006 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMemoryTestStarted|0x00051006|UINT32|0x00000015 - - ## Status code value for indicating memory error in memory test - # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE - # @Prompt Progress Code for Memory Error. - # @ValidList 0x80000003 | 0x00051003 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueUncorrectableMemoryError|0x00051003|UINT32|0x00000016 - - ## Status code value for console operation failure. - # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR - # @Prompt Progress Code for Console Error. - # @ValidList 0x80000003 | 0x01040006 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError|0x01040006|UINT32|0x00000017 - - ## Status code value for console reset operation failure. - # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET - # @Prompt Progress Code for Console Reset. - # @ValidList 0x80000003 | 0x01040001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleReset|0x01040001|UINT32|0x00000018 - - ## Status code value for console input operation failure. - # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR - # @Prompt Progress Code for Console Input Error. - # @ValidList 0x80000003 | 0x01040007 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleInputError|0x01040007|UINT32|0x00000019 - - ## Status code value for console output operation failure. - # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR - # @Prompt Progress Code for Console Output Error. - # @ValidList 0x80000003 | 0x01040008 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleOutputError|0x01040008|UINT32|0x0000001a - - ## Status code value for mouse operation failure. - # EFI_PERIPHERAL_MOUSE | EFI_P_EC_INTERFACE_ERROR - # @Prompt Progress Code for Module Device Failure. - # @ValidList 0x80000003 | 0x01020005 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInterfaceError|0x01020005|UINT32|0x30001000 - - ## Status code value for indicating mouse device has been enabled. - # EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE - # @Prompt Progress Code for Enable Mouse Device. - # @ValidList 0x80000003 | 0x01020004 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseEnable|0x01020004|UINT32|0x30001001 - - ## Status code value for indicating mouse device has been disabled. - # EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE - # @Prompt Progress Code for Disable Mouse Device. - # @ValidList 0x80000003 | 0x01020002 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseDisable|0x01020002|UINT32|0x30001002 - - ## Status code value for enabling keyboard device. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE - # @Prompt Progress Code for Enable Keyboard Device. - # @ValidList 0x80000003 | 0x01010004 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardEnable|0x01010004|UINT32|0x30001003 - - ## Status code value for disabling keyboard device. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE - # @Prompt Progress Code for Disable Keyboard Device. - # @ValidList 0x80000003 | 0x01010002 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardDisable|0x01010002|UINT32|0x30001004 - - ## Status code value for indicating presence of keyboard. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT - # @Prompt Progress Code for Detect Keyboard Device. - # @ValidList 0x80000003 | 0x01010003 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardPresenceDetect|0x01010003|UINT32|0x30001005 - - ## Status code value for keyboard operation reset operation. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET - # @Prompt Progress Code for Keyboard Device Reset. - # @ValidList 0x80000003 | 0x01010001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardReset|0x01010001|UINT32|0x30001006 - - ## Status code value for keyboard clear buffer operation. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER - # @Prompt Progress Code for Keyboard Device Clear Buffer. - # @ValidList 0x80000003 | 0x01011000 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardClearBuffer|0x01011000|UINT32|0x30001007 - - ## Status code value for keyboard device self-test. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST - # @Prompt Progress Code for Keyboard Device SelfTest. - # @ValidList 0x80000003 | 0x01011001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardSelfTest|0x01011001|UINT32|0x30001008 - - ## Status code value for indicating keyboard device failure. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR - # @Prompt Progress Code for Keyboard Device Failure. - # @ValidList 0x80000003 | 0x01010005 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardInterfaceError|0x01010005|UINT32|0x30001009 - - ## Status code value for indicating keyboard input handler failure. - # EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR - # @Prompt Progress Code for Keyboard Input Failure. - # @ValidList 0x80000003 | 0x01010007 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardInputError|0x01010007|UINT32|0x3000100a - - ## Status code value for mouse input handler failure. - # EFI_PERIPHERAL_MOUSE | EFI_P_EC_INPUT_ERROR - # @Prompt Progress Code for Mouse Input Failure. - # @ValidList 0x80000003 | 0x01020007 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError|0x01020007|UINT32|0x3000100b - - ## Status code value for mouse device reset operation. - # EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET - # @Prompt Progress Code for Mouse Device Reset. - # @ValidList 0x80000003 | 0x01020001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset|0x01020001|UINT32|0x3000100c - - ## Status code value for indicating the handoff from PEI phase to DXE phase. - # EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT - # @Prompt Progress Code for Handoff from Pei phase to Dxe phase. - # @ValidList 0x80000003 | 0x3021001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiHandoffToDxe|0x3021001|UINT32|0x3000100d - - ## Status code value for indicating one PEIM is dispatched. - # EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN - # @Prompt Progress Code for Dispatching One PEIM. - # @ValidList 0x80000003 | 0x3020002 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch|0x3020002|UINT32|0x3000100e - - ## Status code value for PeiCore entry. - # EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT - # @Prompt Progress Code for PeiCore Entry. - # @ValidList 0x80000003 | 0x3020000 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiCoreEntry|0x3020000|UINT32|0x3000100f - - ## Status code value for DxeCore entry. - # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT - # @Prompt Progress Code for DxeCore Entry. - # @ValidList 0x80000003 | 0x3041000 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreEntry|0x3041000|UINT32|0x30001010 - - ## Status code value for handoff from DxeCore to BDS. - # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT - # @Prompt Progress Code for Handoff from DxeCore to BDS. - # @ValidList 0x80000003 | 0x3041001 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreHandoffToBds|0x3041001|UINT32|0x30001011 - - ## Status code value for indicating boot service exit. - # EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES - # @Prompt Progress Code for Exit of Boot Service. - # @ValidList 0x80000003 | 0x3101019 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueBootServiceExit|0x3101019|UINT32|0x30001012 - - ## Status code value for indicating the beginning of DXE driver. - # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN - # @Prompt Progress Code for Begin of DXE Driver. - # @ValidList 0x80000003 | 0x3040002 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverBegin|0x3040002|UINT32|0x30001013 - - ## Status code value for indicating the end of DXE drive. - # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END - # @Prompt Progress Code for End of DXE Driver. - # @ValidList 0x80000003 | 0x3040003 - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverEnd|0x3040003|UINT32|0x30001014 - - ## This flag is used to control build time optimization based on debug print level. - # Its default value is 0xFFFFFFFF to expose all debug print level. - # BIT0 - Initialization message.
- # BIT1 - Warning message.
- # BIT2 - Load Event message.
- # BIT3 - File System message.
- # BIT4 - Allocate or Free Pool message.
- # BIT5 - Allocate or Free Page message.
- # BIT6 - Information message.
- # BIT7 - Dispatcher message.
- # BIT8 - Variable message.
- # BIT10 - Boot Manager message.
- # BIT12 - BlockIo Driver message.
- # BIT14 - Network Driver message.
- # BIT16 - UNDI Driver message.
- # BIT17 - LoadFile message.
- # BIT19 - Event message.
- # BIT20 - Global Coherency Database changes message.
- # BIT21 - Memory range cachability changes message.
- # BIT22 - Detailed debug message.
- # BIT31 - Error message.
- # @Prompt Fixed Debug Message Print Level. - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0xFFFFFFFF|UINT32|0x30001016 - - ## Indicates the control flow enforcement enabling state. - # If enabled, it uses control flow enforcement technology to prevent ROP or JOP.

- # BIT0 - SMM CET Shadow Stack is enabled.
- # Other - reserved - # @Prompt Enable control flow enforcement. - gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask|0x0|UINT32|0x30001017 - -[PcdsFixedAtBuild,PcdsPatchableInModule] - ## Indicates the maximum length of unicode string used in the following - # BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()

- # 0 - No length check for unicode string.
- # >0 - Maximum length of unicode string.
- # @Prompt Maximum Length of Unicode String. - gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001 - - ## Indicates the maximum length of ascii string used in the following - # BaseLib functions: AsciiStrLen(), AsciiStrSize(), AsciiStrCmp(), AsciiStrnCmp(), - # AsciiStrCpy(), AsciiStrnCpy().

- # 0 - No length check for ascii string.
- # >0 - Maximum length of ascii string.
- # @Prompt Maximum Length of Ascii String. - gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000|UINT32|0x00000002 - - ## Indicates the maximum node number of linked list.

- # 0 - No node number check for linked list.
- # >0 - Maximum node number of linked list.
- # @Prompt Maximum Length of Linked List. - gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000|UINT32|0x00000003 - - ## Indicates the maximum node number of device path.

- # 0 - No node number check for device path.
- # >0 - Maximum node number of device path.
- # @Prompt Maximum node number of device path. - gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount|0|UINT32|0x00000029 - - ## Indicates the timeout tick of holding spin lock.

- # 0 - No timeout.
- # >0 - Timeout tick of holding spin lock.
- # @Prompt Spin Lock Timeout (us). - gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004 - - ## The mask is used to control DebugLib behavior.

- # BIT0 - Enable Debug Assert.
- # BIT1 - Enable Debug Print.
- # BIT2 - Enable Debug Code.
- # BIT3 - Enable Clear Memory.
- # BIT4 - Enable BreakPoint as ASSERT.
- # BIT5 - Enable DeadLoop as ASSERT.
- # @Prompt Debug Property. - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0 - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005 - - ## This flag is used to control the print out Debug message.

- # BIT0 - Initialization message.
- # BIT1 - Warning message.
- # BIT2 - Load Event message.
- # BIT3 - File System message.
- # BIT4 - Allocate or Free Pool message.
- # BIT5 - Allocate or Free Page message.
- # BIT6 - Information message.
- # BIT7 - Dispatcher message.
- # BIT8 - Variable message.
- # BIT10 - Boot Manager message.
- # BIT12 - BlockIo Driver message.
- # BIT14 - Network Driver message.
- # BIT16 - UNDI Driver message.
- # BIT17 - LoadFile message.
- # BIT19 - Event message.
- # BIT20 - Global Coherency Database changes message.
- # BIT21 - Memory range cachability changes message.
- # BIT22 - Detailed debug message.
- # BIT31 - Error message.
- # @Prompt Debug Message Print Level. - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel & 0x7F84AA00) == 0 - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000|UINT32|0x00000006 - - ## The mask is used to control ReportStatusCodeLib behavior.

- # BIT0 - Enable Progress Code.
- # BIT1 - Enable Error Code.
- # BIT2 - Enable Debug Code.
- # @Prompt Report Status Code Property. - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask & 0xF8) == 0 - gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0|UINT8|0x00000007 - - ## This value is used to fill a segment of memory when PcdDebugPropertyMask Clear Memory is enabled. - # @Prompt Value to Clear Memory. - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF|UINT8|0x00000008 - - ## The mask is used to control PerformanceLib behavior.

- # BIT0 - Enable Performance Measurement.
- # BIT1 - Disable Start Image Logging.
- # BIT2 - Disable Load Image logging.
- # BIT3 - Disable Binding Support logging.
- # BIT4 - Disable Binding Start logging.
- # BIT5 - Disable Binding Stop logging.
- # BIT6 - Disable all other general Perfs.
- # BIT1-BIT6 are evaluated when BIT0 is set.
- # @Prompt Performance Measurement Property. - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask & 0x80) == 0 - gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0|UINT8|0x00000009 - - ## The mask is used to control PostCodeLib behavior.

- # BIT0 - Enable Post Code.
- # BIT1 - Enable Post Code with Description.
- # @Prompt Post Code Property. - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask & 0xFC) == 0 - gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0|UINT8|0x0000000b - - ## The bit width of data to be written to Port80. The default value is 8. - # @Prompt Port80 Data Width - # @ValidList 0x80000001 | 8, 16, 32 - gEfiMdePkgTokenSpaceGuid.PcdPort80DataWidth|8|UINT8|0x0000002d - - ## This value is used to configure X86 Processor FSB clock. - # @Prompt FSB Clock. - gEfiMdePkgTokenSpaceGuid.PcdFSBClock|200000000|UINT32|0x0000000c - - ## The maximum printable number of characters. UefLib functions: AsciiPrint(), AsciiErrorPrint(), - # PrintXY(), AsciiPrintXY(), Print(), ErrorPrint() base on this PCD value to print characters. - # @Prompt Maximum Printable Number of Characters. - gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320|UINT32|0x101 - - ## This is the print buffer length for FileHandleLib. - # FileHandlePrintLine() sizes buffers based on this PCD value for printing. - # @Prompt Number of Printable Characters. - gEfiMdePkgTokenSpaceGuid.PcdUefiFileHandleLibPrintBufferSize|1536|UINT16|0x201 - - ## Indicates the allowable maximum number in extract handler table. - # @Prompt Maximum Number of GuidedExtractHandler. - gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10|UINT32|0x00000025 - - ## Indicates the default timeouts for USB transfers in milliseconds. - # @Prompt USB Transfer Timeout (ms). - gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue|3000|UINT32|0x00000026 - - ## This value is used to set the available memory address to store Guided Extract Handlers. - # The required memory space is decided by the value of PcdMaximumGuidedExtractHandler. - # @Prompt Memory Address of GuidedExtractHandler Table. - gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015 - -[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] - ## This value is used to set the base address of PCI express hierarchy. - # @Prompt PCI Express Base Address. - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000|UINT64|0x0000000a - - ## Default current ISO 639-2 language: English & French. - # @Prompt Default Value of LangCodes Variable. - gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes|"engfraengfra"|VOID*|0x0000001c - - ## Default current ISO 639-2 language: English. - # @Prompt Default Value of Lang Variable. - gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang|"eng"|VOID*|0x0000001d - - ## Default platform supported RFC 4646 languages: (American) English & French. - # @Prompt Default Value of PlatformLangCodes Variable. - gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en;fr;en-US;fr-FR"|VOID*|0x0000001e - - ## Default current RFC 4646 language: (American) English. - # @Prompt Default Value of PlatformLang Variable. - gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"|VOID*|0x0000001f - - ## Indicates the default baud rate of UART. - # @Prompt Default UART Baud Rate. - # @ValidList 0x80000001 | 115200, 57600, 38400, 19200, 9600, 7200, 4800, 3600, 2400, 2000, 1800, 1200, 600, 300, 150, 134, 110, 75, 50 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020 - - ## Indicates the number of efficient data bit in UART transaction. - # @Prompt Default UART Data Bit. - # @ValidRange 0x80000001 | 5 - 8 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021 - - ## Indicates the setting of data parity in UART transaction.

- # 0 - Default Parity.
- # 1 - No Parity.
- # 2 - Even Parity.
- # 3 - Odd Parity.
- # 4 - Mark Parity.
- # 5 - Space Parity.
- # @Prompt Default UART Parity. - # @ValidRange 0x80000001 | 0 - 5 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022 - - ## Indicates the setting of stop bit in UART transaction.

- # 0 - Default Stop Bits.
- # 1 - One Stop Bit.
- # 2 - One Five Stop Bits.
- # 3 - Two Stop Bits.
- # @Prompt Default UART Stop Bits. - # @ValidRange 0x80000001 | 0 - 3 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1|UINT8|0x00000023 - - ## Indicates the usable type of terminal.

- # 0 - PCANSI
- # 1 - VT100
- # 2 - VT100+
- # 3 - UTF8
- # 4 - TTYTERM, NOT defined in UEFI SPEC
- # @Prompt Default Terminal Type. - # @ValidRange 0x80000001 | 0 - 4 - gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0|UINT8|0x00000024 - - ## Indicates the receive FIFO depth of UART controller.

- # @Prompt Default UART Receive FIFO Depth. - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|1|UINT16|0x00000030 - - ## Error level for hardware recorder. - # If value 0, platform does not support feature of hardware error record. - # @Prompt Error Level For Hardware Recorder - gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|0|UINT16|0x0000002b - - ## The number of seconds that the firmware will wait before initiating the original default boot selection. - # A value of 0 indicates that the default boot selection is to be initiated immediately on boot. - # The value of 0xFFFF then firmware will wait for user input before booting. - # @Prompt Boot Timeout (s) - gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x0000002c - -[UserExtensions.TianoCore."ExtraFiles"] - MdePkgExtra.uni diff --git a/Voyager/Voyager/edk2/MdePkg/MdePkg.dsc b/Voyager/Voyager/edk2/MdePkg/MdePkg.dsc deleted file mode 100644 index 48a4a74..0000000 --- a/Voyager/Voyager/edk2/MdePkg/MdePkg.dsc +++ /dev/null @@ -1,158 +0,0 @@ -## @file -# EFI/PI MdePkg Package -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - PLATFORM_NAME = Mde - PLATFORM_GUID = 082F8BFC-0455-4859-AE3C-ECD64FB81642 - PLATFORM_VERSION = 1.08 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/Mde - SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64 - BUILD_TARGETS = DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER = DEFAULT - -[PcdsFeatureFlag] - gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE - -[PcdsFixedAtBuild] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000 - -[Components] - MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf - MdePkg/Library/BaseCpuLib/BaseCpuLib.inf - MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf - MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - MdePkg/Library/BaseLib/BaseLib.inf - MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf - MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf - MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf - MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf - MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf - MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf - MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf - MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf - MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLibSegmentInfo.inf - MdePkg/Library/BaseS3PciSegmentLib/BaseS3PciSegmentLib.inf - MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf - MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf - MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf - MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf - MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf - MdePkg/Library/BasePrintLib/BasePrintLib.inf - MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf - MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf - MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf - MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf - MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf - MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf - - MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf - MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf - MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf - MdePkg/Library/DxeHobLib/DxeHobLib.inf - MdePkg/Library/DxePcdLib/DxePcdLib.inf - MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf - MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf - MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf - MdePkg/Library/DxeHstiLib/DxeHstiLib.inf - MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf - MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf - - MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf - MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf - MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf - MdePkg/Library/PeiHobLib/PeiHobLib.inf - MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf - MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf - MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf - MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf - MdePkg/Library/PeiPcdLib/PeiPcdLib.inf - MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf - MdePkg/Library/PeiServicesLib/PeiServicesLib.inf - MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf - MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf - MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf - MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf - - MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf - MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf - MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf - MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf - MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf - MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf - MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - MdePkg/Library/UefiLib/UefiLib.inf - MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf - MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - MdePkg/Library/UefiScsiLib/UefiScsiLib.inf - MdePkg/Library/UefiUsbLib/UefiUsbLib.inf - MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf - MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf - MdePkg/Library/SmmLibNull/SmmLibNull.inf - MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf - - MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf - MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf - -[Components.IA32, Components.X64] - MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf - MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf - MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf - MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf - MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf - MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf - MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf - MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf - MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf - MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf - MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf - MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf - MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf - MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf - MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf - MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf - MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf - MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf - MdePkg/Library/SmmMemLib/SmmMemLib.inf - MdePkg/Library/SmmIoLib/SmmIoLib.inf - MdePkg/Library/BaseRngLib/BaseRngLib.inf - MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf - MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf - MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf - -[Components.EBC] - MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - -[Components.ARM, Components.AARCH64] - MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf - MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf - -[BuildOptions] - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Voyager/Voyager/edk2/MdePkg/MdePkg.uni b/Voyager/Voyager/edk2/MdePkg/MdePkg.uni deleted file mode 100644 index 2238e24..0000000 --- a/Voyager/Voyager/edk2/MdePkg/MdePkg.uni +++ /dev/null @@ -1,413 +0,0 @@ -// /** @file -// This Package provides all definitions, library classes and libraries instances. -// -// It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of -// EFI1.10/UEFI2.4/PI1.3 and some Industry Standards. -// -// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials are licensed and made available under -// the terms and conditions of the BSD License which accompanies this distribution. -// The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - - -#string STR_PACKAGE_ABSTRACT #language en-US "This Package provides all definitions, library classes and libraries instances." - -#string STR_PACKAGE_DESCRIPTION #language en-US "It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of EFI1.10/UEFI2.4/PI1.3 and some Industry Standards." - - - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueEfiWatchDogTimerExpired_PROMPT #language en-US "Progress Code for WatchDog Timer Expired" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueEfiWatchDogTimerExpired_HELP #language en-US "Status code value for indicating a watchdog timer has expired. EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_TIMER_EXPIRED" - -#string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000003 #language en-US "Incorrect progress code provided." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueSetVirtualAddressMap_PROMPT #language en-US "Progress Code for Invocation of SetVirtualAddressMap" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueSetVirtualAddressMap_HELP #language en-US "Status code value for indicating the invocation of SetVirtualAddressMap() EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMemoryTestStarted_PROMPT #language en-US "Progress Code for Memory Test Start" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMemoryTestStarted_HELP #language en-US "Status code value for indicating the start of memory test EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueUncorrectableMemoryError_PROMPT #language en-US "Progress Code for Memory Error" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueUncorrectableMemoryError_HELP #language en-US "Status code value for indicating memory error in memory test EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleError_PROMPT #language en-US "Progress Code for Console Error" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleError_HELP #language en-US "Status code value for console operation failure. EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleReset_PROMPT #language en-US "Progress Code for Console Reset" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleReset_HELP #language en-US "Status code value for console reset operation failure. EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleInputError_PROMPT #language en-US "Progress Code for Console Input Error" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleInputError_HELP #language en-US "Status code value for console input operation failure. EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleOutputError_PROMPT #language en-US "Progress Code for Console Output Error" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueRemoteConsoleOutputError_HELP #language en-US "Status code value for console output operation failure. EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseInterfaceError_PROMPT #language en-US "Progress Code for Module Device Failure" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseInterfaceError_HELP #language en-US "Status code value for mouse operation failure. EFI_PERIPHERAL_MOUSE | EFI_P_EC_INTERFACE_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseEnable_PROMPT #language en-US "Progress Code for Enable Mouse Device" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseEnable_HELP #language en-US "Status code value for indicating mouse device has been enabled. EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseDisable_PROMPT #language en-US "Progress Code for Disable Mouse Device" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseDisable_HELP #language en-US "Status code value for indicating mouse device has been disabled. EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardEnable_PROMPT #language en-US "Progress Code for Enable Keyboard Device" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardEnable_HELP #language en-US "Status code value for enabling keyboard device. EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardDisable_PROMPT #language en-US "Progress Code for Disable Keyboard Device" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardDisable_HELP #language en-US "Status code value for disabling keyboard device. EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardPresenceDetect_PROMPT #language en-US "Progress Code for Detect Keyboard Device" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardPresenceDetect_HELP #language en-US "Status code value for indicating presence of keyboard. EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardReset_PROMPT #language en-US "Progress Code for Keyboard Device Reset" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardReset_HELP #language en-US "Status code value for keyboard operation reset operation. EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardClearBuffer_PROMPT #language en-US "Progress Code for Keyboard Device Clear Buffer" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardClearBuffer_HELP #language en-US "Status code value for keyboard clear buffer operation. EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardSelfTest_PROMPT #language en-US "Progress Code for Keyboard Device SelfTest" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardSelfTest_HELP #language en-US "Status code value for keyboard device self-test. EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardInterfaceError_PROMPT #language en-US "Progress Code for Keyboard Device Failure" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardInterfaceError_HELP #language en-US "Status code value for indicating keyboard device failure. EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardInputError_PROMPT #language en-US "Progress Code for Keyboard Input Failure" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueKeyboardInputError_HELP #language en-US "Status code value for indicating keyboard input handler failure. EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseInputError_PROMPT #language en-US "Progress Code for Mouse Input Failure" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseInputError_HELP #language en-US "Status code value for mouse input handler failure. EFI_PERIPHERAL_MOUSE | EFI_P_EC_INPUT_ERROR" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseReset_PROMPT #language en-US "Progress Code for Mouse Device Reset" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueMouseReset_HELP #language en-US "Status code value for mouse device reset operation. EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeiHandoffToDxe_PROMPT #language en-US "Progress Code for Handoff from PEI phase to DXE phase" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeiHandoffToDxe_HELP #language en-US "Status code value for indicating the handoff from PEI phase to DXE phase. EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeimDispatch_PROMPT #language en-US "Progress Code for Dispatching One PEIM" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeimDispatch_HELP #language en-US "Status code value for indicating one PEIM is dispatched. EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeiCoreEntry_PROMPT #language en-US "Progress Code for PeiCore Entry" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValuePeiCoreEntry_HELP #language en-US "Status code value for PeiCore entry. EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeCoreEntry_PROMPT #language en-US "Progress Code for DxeCore Entry" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeCoreEntry_HELP #language en-US "Status code value for DxeCore entry. EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeCoreHandoffToBds_PROMPT #language en-US "Progress Code for Handoff from DxeCore to BDS" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeCoreHandoffToBds_HELP #language en-US "Status code value for handoff from DxeCore to BDS. EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueBootServiceExit_PROMPT #language en-US "Progress Code for Exit of Boot Service" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueBootServiceExit_HELP #language en-US "Status code value for indicating boot service exit. EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeDriverBegin_PROMPT #language en-US "Progress Code for Begin of DXE Driver" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeDriverBegin_HELP #language en-US "Status code value for indicating the beginning of DXE driver. EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeDriverEnd_PROMPT #language en-US "Progress Code for End of DXE Driver" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdStatusCodeValueDxeDriverEnd_HELP #language en-US "Status code value for indicating the end of DXE drive. EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumUnicodeStringLength_PROMPT #language en-US "Maximum Length of Unicode String" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumUnicodeStringLength_HELP #language en-US "Sets the maximum number of unicode characters used for string functions. This affects the following BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()

\n" - "0 - No length check for unicode string.
\n" - ">0 - Maximum length of unicode string.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdControlFlowEnforcementPropertyMask_PROMPT #language en-US "Enable control flow enforcement." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdControlFlowEnforcementPropertyMask_HELP #language en-US "Indicates the control flow enforcement enabling state.\n" - "If enabled, it uses control flow enforcement technology to prevent ROP or JOP.

\n" - " BIT0 - SMM CET Shadow Stack is enabled.
\n" - " Other - reserved" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_PROMPT #language en-US "Maximum Length of Ascii String" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_HELP #language en-US "Sets the maximum number of ASCII characters used for string functions. This affects the following BaseLib functions: AsciiStrLen(), AsciiStrSize(), AsciiStrCmp(), AsciiStrnCmp(), AsciiStrCpy(), AsciiStrnCpy().

\n" - "0 - No length check for ASCII string.
\n" - ">0 - Maximum length of ASCII string.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumLinkedListLength_PROMPT #language en-US "Maximum Length of Linked List" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumLinkedListLength_HELP #language en-US "Indicates the maximum node number of linked list.

\n" - "0 - No node number check for linked list.
\n" - ">0 - Maximum node number of linked list.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumDevicePathNodeCount_PROMPT #language en-US "Maximum node number of device path" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumDevicePathNodeCount_HELP #language en-US "Indicates the maximum node number of device path.

\n" - "0 - No node number check for device path.
\n" - ">0 - Maximum node number of device path.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpinLockTimeout_PROMPT #language en-US "Spin Lock Timeout (us)" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpinLockTimeout_HELP #language en-US "Indicates the timeout tick of holding spin lock.

\n" - "0 - No timeout.
\n" - ">0 - Timeout tick of holding spin lock.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugPropertyMask_PROMPT #language en-US "Debug Property" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugPropertyMask_HELP #language en-US "The mask is used to control DebugLib behavior.

\n" - "BIT0 - Enable Debug Assert.
\n" - "BIT1 - Enable Debug Print.
\n" - "BIT2 - Enable Debug Code.
\n" - "BIT3 - Enable Clear Memory.
\n" - "BIT4 - Enable BreakPoint as ASSERT.
\n" - "BIT5 - Enable DeadLoop as ASSERT.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugPrintErrorLevel_PROMPT #language en-US "Debug Message Print Level" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugPrintErrorLevel_HELP #language en-US "This flag is used to control the print out Debug message.

\n" - "BIT0 - Initialization message.
\n" - "BIT1 - Warning message.
\n" - "BIT2 - Load Event message.
\n" - "BIT3 - File System message.
\n" - "BIT4 - Allocate or Free Pool message.
\n" - "BIT5 - Allocate or Free Page message.
\n" - "BIT6 - Information message.
\n" - "BIT7 - Dispatcher message.
\n" - "BIT8 - Variable message.
\n" - "BIT10 - Boot Manager message.
\n" - "BIT12 - BlockIo Driver message.
\n" - "BIT14 - Network Driver message.
\n" - "BIT16 - UNDI Driver message.
\n" - "BIT17 - LoadFile message.
\n" - "BIT19 - Event message.
\n" - "BIT20 - Global Coherency Database changes message.
\n" - "BIT21 - Memory range cacheability changes message.
\n" - "BIT22 - Detailed debug message.
\n" - "BIT31 - Error message.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdFixedDebugPrintErrorLevel_PROMPT #language en-US "Fixed Debug Message Print Level" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdFixedDebugPrintErrorLevel_HELP #language en-US "This flag is used to control build time optimization based on debug print level.

\n" - "BIT0 - Initialization message.
\n" - "BIT1 - Warning message.
\n" - "BIT2 - Load Event message.
\n" - "BIT3 - File System message.
\n" - "BIT4 - Allocate or Free Pool message.
\n" - "BIT5 - Allocate or Free Page message.
\n" - "BIT6 - Information message.
\n" - "BIT7 - Dispatcher message.
\n" - "BIT8 - Variable message.
\n" - "BIT10 - Boot Manager message.
\n" - "BIT12 - BlockIo Driver message.
\n" - "BIT14 - Network Driver message.
\n" - "BIT16 - UNDI Driver message.
\n" - "BIT17 - LoadFile message.
\n" - "BIT19 - Event message.
\n" - "BIT20 - Global Coherency Database changes message.
\n" - "BIT21 - Memory range cacheability changes message.
\n" - "BIT22 - Detailed debug message.
\n" - "BIT31 - Error message.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdReportStatusCodePropertyMask_PROMPT #language en-US "Report Status Code Property" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdReportStatusCodePropertyMask_HELP #language en-US "The mask is used to control ReportStatusCodeLib behavior.

\n" - "BIT0 - Enable Progress Code.
\n" - "BIT1 - Enable Error Code.
\n" - "BIT2 - Enable Debug Code.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugClearMemoryValue_PROMPT #language en-US "Value to Clear Memory" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDebugClearMemoryValue_HELP #language en-US "This value is used to fill a segment of memory when PcdDebugPropertyMask Clear Memory is enabled." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPerformanceLibraryPropertyMask_PROMPT #language en-US "Performance Measurement Property" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPerformanceLibraryPropertyMask_HELP #language en-US "The mask is used to control PerformanceLib behavior.

\n" - "BIT0 - Enable Performance Measurement.
" - "BIT1 - Disable Start Image Logging.
" - "BIT2 - Disable Load Image logging.
" - "BIT3 - Disable Binding Support logging.
" - "BIT4 - Disable Binding Start logging.
" - "BIT5 - Disable Binding Stop logging.
" - "BIT6 - Disable all other general Perfs.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPostCodePropertyMask_PROMPT #language en-US "Post Code Property" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPostCodePropertyMask_HELP #language en-US "The mask is used to control PostCodeLib behavior.

\n" - "BIT0 - Enable Post Code.
\n" - "BIT1 - Enable Post Code with Description.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdFSBClock_PROMPT #language en-US "FSB Clock" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdFSBClock_HELP #language en-US "This value is used to configure X86 Processor FSB clock." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiLibMaxPrintBufferSize_PROMPT #language en-US "Maximum Printable Number of Characters" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiLibMaxPrintBufferSize_HELP #language en-US "The maximum printable number of characters. UefLib functions: AsciiPrint(), AsciiErrorPrint(), PrintXY(), AsciiPrintXY(), Print(), ErrorPrint() base on this PCD value to print characters." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumGuidedExtractHandler_PROMPT #language en-US "Maximum Number of GuidedExtractHandler" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumGuidedExtractHandler_HELP #language en-US "Indicates the allowable maximum number in extract handler table." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUsbTransferTimeoutValue_PROMPT #language en-US "USB Transfer Timeout (ms)" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUsbTransferTimeoutValue_HELP #language en-US "Indicates the default timeouts for USB transfers in milliseconds." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_PROMPT #language en-US "Memory Address of GuidedExtractHandler Table" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_HELP #language en-US "This value is used to set the available memory address to store Guided Extract Handlers. The required memory space is decided by the value of PcdMaximumGuidedExtractHandler." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_PROMPT #language en-US "PCI Express Base Address" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_HELP #language en-US "This value is used to set the base address of PCI express hierarchy." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLangCodes_PROMPT #language en-US "Default Value of LangCodes Variable" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLangCodes_HELP #language en-US "Default current ISO 639-2 language: English & French." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLang_PROMPT #language en-US "Default Value of Lang Variable" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLang_HELP #language en-US "Default current ISO 639-2 language: English." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultPlatformLangCodes_PROMPT #language en-US "Default Value of PlatformLangCodes Variable" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultPlatformLangCodes_HELP #language en-US "Default platform supported RFC 4646 languages: (American) English & French." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultPlatformLang_PROMPT #language en-US "Default Value of PlatformLang Variable" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultPlatformLang_HELP #language en-US "Default current RFC 4646 language: (American) English." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultBaudRate_PROMPT #language en-US "Default UART Baud Rate" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultBaudRate_HELP #language en-US "Indicates the default baud rate of UART." - -#string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000001 #language en-US "Invalid value provided." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultDataBits_PROMPT #language en-US "Default UART Data Bit" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultDataBits_HELP #language en-US "Indicates the number of efficient data bit in UART transaction." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultParity_PROMPT #language en-US "Default UART Parity" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultParity_HELP #language en-US "Indicates the setting of data parity in UART transaction.

\n" - "0 - Default Parity.
\n" - "1 - No Parity.
\n" - "2 - Even Parity.
\n" - "3 - Odd Parity.
\n" - "4 - Mark Parity.
\n" - "5 - Space Parity.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultStopBits_PROMPT #language en-US "Default UART Stop Bits" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultStopBits_HELP #language en-US "Indicates the setting of stop bit in UART transaction.

\n" - "0 - Default Stop Bits.
\n" - "1 - One Stop Bit.
\n" - "2 - One Five Stop Bits.
\n" - "3 - Two Stop Bits.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDefaultTerminalType_PROMPT #language en-US "Default Terminal Type" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDefaultTerminalType_HELP #language en-US "Selects default terminal type.

\n" - "0 - PCANSI
\n" - "1 - VT100
\n" - "2 - VT100+
\n" - "3 - UTF8
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdComponentNameDisable_PROMPT #language en-US "Disable Component Name Protocol" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdComponentNameDisable_HELP #language en-US "Indicates if the component name protocol will be installed.

\n" - "TRUE - Does not install component name protocol.
\n" - "FALSE - Install component name protocol.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDriverDiagnosticsDisable_PROMPT #language en-US "Disable Diagnostics Name protocol" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDriverDiagnosticsDisable_HELP #language en-US "Indicates if the diagnostics name protocol will be installed.

\n" - "TRUE - Does not install diagnostics name protocol.
\n" - "FALSE - Install diagnostics name protocol.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdComponentName2Disable_PROMPT #language en-US "Disable Component Name2 Protocol" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdComponentName2Disable_HELP #language en-US "Indicates if the component name2 protocol will be installed.

\n" - "TRUE - Does not install component name2 protocol.
\n" - "FALSE - Install component name2 protocol.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDriverDiagnostics2Disable_PROMPT #language en-US "Disable Diagnostics2 Name Protocol" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdDriverDiagnostics2Disable_HELP #language en-US "Indicates if the diagnostics2 name protocol will be installed.

\n" - "TRUE - Does not install diagnostics2 name protocol.
\n" - "FALSE - Install diagnostics2 name protocol.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLangDeprecate_PROMPT #language en-US "Deprecate Global Variable LangCodes" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiVariableDefaultLangDeprecate_HELP #language en-US "Indicates if EFI 1.1 ISO 639-2 language supports are obsolete

\n" - "TRUE - Deprecate global variable LangCodes.
\n" - "FALSE - Does not deprecate global variable LangCodes.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUgaConsumeSupport_PROMPT #language en-US "Consume UGA Draw Protocol" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUgaConsumeSupport_HELP #language en-US "Indicates if UGA Draw Protocol is still consumed.

\n" - "TRUE - Consume UGA Draw protocol.
\n" - "FALSE - Does not consume UGA Draw protocol.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdVerifyNodeInList_PROMPT #language en-US "Verify Node In List" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdVerifyNodeInList_HELP #language en-US "Indicates if a check will be made to see if a specified node is a member of linked list in the following BaseLib functions: GetNextNode(), IsNull(), IsNodeAtEnd(), SwapListEntries().

\n" - "TRUE - Verify a specified node is a member of linked list.
\n" - "FALSE - Does not verify a specified node is a member of linked list.
" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdValidateOrderedCollection_PROMPT #language en-US "Validate ORDERED_COLLECTION structure" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdValidateOrderedCollection_HELP #language en-US "If TRUE, OrderedCollectionLib is instructed to validate the ORDERED_COLLECTION structure at the end of such operations (typically structure modifications) that justify validation of the structure for unit testing purposes." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiFileHandleLibPrintBufferSize_PROMPT #language en-US "Number of Printable Characters." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUefiFileHandleLibPrintBufferSize_HELP #language en-US "This is the print buffer length for FileHandleLib.\n" - "FileHandlePrintLine() sizes buffers based on this PCD value for printing." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdHardwareErrorRecordLevel_PROMPT #language en-US "Error Level For Hardware Recorder" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdHardwareErrorRecordLevel_HELP #language en-US "Error level for hardware recorder.\n" - "If value 0, platform does not support feature of hardware error record." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPlatformBootTimeOut_PROMPT #language en-US "Boot Timeout (s)" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPlatformBootTimeOut_HELP #language en-US "The number of seconds that the firmware will wait before initiating the original default boot selection.\n" - "A value of 0 indicates that the default boot selection is to be initiated immediately on boot.\n" - "The value of 0xFFFF then firmware will wait for user input before booting." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPort80DataWidth_PROMPT #language en-US "Port80 Data Width" - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdPort80DataWidth_HELP #language en-US "The bit width of data to be written to Port80. The default value is 8. " - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultReceiveFifoDepth_PROMPT #language en-US "Default UART Receive FIFO Depth." - -#string STR_gEfiMdePkgTokenSpaceGuid_PcdUartDefaultReceiveFifoDepth_HELP #language en-US "Indicates the receive FIFO depth of UART controller.

" - diff --git a/Voyager/Voyager/edk2/MdePkg/MdePkgExtra.uni b/Voyager/Voyager/edk2/MdePkg/MdePkgExtra.uni deleted file mode 100644 index a66efe9..0000000 --- a/Voyager/Voyager/edk2/MdePkg/MdePkgExtra.uni +++ /dev/null @@ -1,20 +0,0 @@ -// /** @file -// Mde Package Localized Strings and Content. -// -// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-// -// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials are licensed and made available under -// the terms and conditions of the BSD License which accompanies this distribution. -// The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// **/ - -#string STR_PROPERTIES_PACKAGE_NAME -#language en-US -"Mde package" diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.c deleted file mode 100644 index 4f46eca..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.c +++ /dev/null @@ -1,1243 +0,0 @@ -/** @file - Provides interface to shell console logger. - - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2016 Hewlett-Packard Development Company, L.P.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Shell.h" - -/** - Install our intermediate ConOut into the system table to - keep a log of all the info that is displayed to the user. - - @param[in] ScreensToSave Sets how many screen-worths of data to save. - @param[out] ConsoleInfo The object to pass into later functions. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. - - @sa ConsoleLoggerResetBuffers - @sa InstallProtocolInterface -**/ -EFI_STATUS -ConsoleLoggerInstall( - IN CONST UINTN ScreensToSave, - OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo - ) -{ - EFI_STATUS Status; - ASSERT(ConsoleInfo != NULL); - - (*ConsoleInfo) = AllocateZeroPool(sizeof(CONSOLE_LOGGER_PRIVATE_DATA)); - if ((*ConsoleInfo) == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - (*ConsoleInfo)->Signature = CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE; - (*ConsoleInfo)->OldConOut = gST->ConOut; - (*ConsoleInfo)->OldConHandle = gST->ConsoleOutHandle; - (*ConsoleInfo)->Buffer = NULL; - (*ConsoleInfo)->BufferSize = 0; - (*ConsoleInfo)->OriginalStartRow = 0; - (*ConsoleInfo)->CurrentStartRow = 0; - (*ConsoleInfo)->RowsPerScreen = 0; - (*ConsoleInfo)->ColsPerScreen = 0; - (*ConsoleInfo)->Attributes = NULL; - (*ConsoleInfo)->AttribSize = 0; - (*ConsoleInfo)->ScreenCount = ScreensToSave; - (*ConsoleInfo)->HistoryMode.MaxMode = 1; - (*ConsoleInfo)->HistoryMode.Mode = 0; - (*ConsoleInfo)->HistoryMode.Attribute = 0; - (*ConsoleInfo)->HistoryMode.CursorColumn = 0; - (*ConsoleInfo)->HistoryMode.CursorRow = 0; - (*ConsoleInfo)->HistoryMode.CursorVisible = FALSE; - (*ConsoleInfo)->OurConOut.Reset = ConsoleLoggerReset; - (*ConsoleInfo)->OurConOut.OutputString = ConsoleLoggerOutputString; - (*ConsoleInfo)->OurConOut.TestString = ConsoleLoggerTestString; - (*ConsoleInfo)->OurConOut.QueryMode = ConsoleLoggerQueryMode; - (*ConsoleInfo)->OurConOut.SetMode = ConsoleLoggerSetMode; - (*ConsoleInfo)->OurConOut.SetAttribute = ConsoleLoggerSetAttribute; - (*ConsoleInfo)->OurConOut.ClearScreen = ConsoleLoggerClearScreen; - (*ConsoleInfo)->OurConOut.SetCursorPosition = ConsoleLoggerSetCursorPosition; - (*ConsoleInfo)->OurConOut.EnableCursor = ConsoleLoggerEnableCursor; - (*ConsoleInfo)->OurConOut.Mode = gST->ConOut->Mode; - (*ConsoleInfo)->Enabled = TRUE; - - Status = ConsoleLoggerResetBuffers(*ConsoleInfo); - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL((*ConsoleInfo)); - *ConsoleInfo = NULL; - return (Status); - } - - Status = gBS->InstallProtocolInterface(&gImageHandle, &gEfiSimpleTextOutProtocolGuid, EFI_NATIVE_INTERFACE, (VOID*)&((*ConsoleInfo)->OurConOut)); - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL((*ConsoleInfo)->Buffer); - SHELL_FREE_NON_NULL((*ConsoleInfo)->Attributes); - SHELL_FREE_NON_NULL((*ConsoleInfo)); - *ConsoleInfo = NULL; - return (Status); - } - - gST->ConsoleOutHandle = gImageHandle; - gST->ConOut = &(*ConsoleInfo)->OurConOut; - - // - // Update the CRC32 in the EFI System Table header - // - gST->Hdr.CRC32 = 0; - gBS->CalculateCrc32 ( - (UINT8 *)&gST->Hdr, - gST->Hdr.HeaderSize, - &gST->Hdr.CRC32 - ); - return (Status); -} - -/** - Return the system to the state it was before InstallConsoleLogger - was installed. - - @param[in] ConsoleInfo The object from the install function. - - @retval EFI_SUCCESS The operation was successful - @return other The operation failed. This was from UninstallProtocolInterface. -**/ -EFI_STATUS -ConsoleLoggerUninstall( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - ASSERT(ConsoleInfo != NULL); - ASSERT(ConsoleInfo->OldConOut != NULL); - - if (ConsoleInfo->Buffer != NULL) { - FreePool(ConsoleInfo->Buffer); - DEBUG_CODE(ConsoleInfo->Buffer = NULL;); - DEBUG_CODE(ConsoleInfo->BufferSize = 0;); - } - if (ConsoleInfo->Attributes != NULL) { - FreePool(ConsoleInfo->Attributes); - DEBUG_CODE(ConsoleInfo->Attributes = NULL;); - DEBUG_CODE(ConsoleInfo->AttribSize = 0;); - } - - gST->ConsoleOutHandle = ConsoleInfo->OldConHandle; - gST->ConOut = ConsoleInfo->OldConOut; - - // - // Update the CRC32 in the EFI System Table header - // - gST->Hdr.CRC32 = 0; - gBS->CalculateCrc32 ( - (UINT8 *)&gST->Hdr, - gST->Hdr.HeaderSize, - &gST->Hdr.CRC32 - ); - - return (gBS->UninstallProtocolInterface(gImageHandle, &gEfiSimpleTextOutProtocolGuid, (VOID*)&ConsoleInfo->OurConOut)); -} - -/** - Displays previously logged output back to the screen. - - This will scroll the screen forwards and backwards through the log of previous - output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows - is (UINTN)(-1) then the size of the screen will be scrolled. - - @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer). - If FALSE then the log will be displayed backwards (scroll to older). - @param[in] Rows Determines how many rows the log should scroll. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. -**/ -EFI_STATUS -ConsoleLoggerDisplayHistory( - IN CONST BOOLEAN Forward, - IN CONST UINTN Rows, - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - UINTN RowChange; - - ASSERT(ConsoleInfo != NULL); - - // - // Calculate the row number change - // - switch (Rows) { - case ((UINTN)(-1)): - RowChange = ConsoleInfo->RowsPerScreen; - break; - case (0): - RowChange = ConsoleInfo->RowsPerScreen / 2; - break; - default: - RowChange = Rows; - break; - } - - // - // Do the math for direction - // - if (Forward) { - if ((ConsoleInfo->OriginalStartRow - ConsoleInfo->CurrentStartRow) < RowChange) { - RowChange = ConsoleInfo->OriginalStartRow - ConsoleInfo->CurrentStartRow; - } - } else { - if (ConsoleInfo->CurrentStartRow < RowChange) { - RowChange = ConsoleInfo->CurrentStartRow; - } - } - - // - // If we are already at one end or the other - // - if (RowChange == 0) { - return (EFI_SUCCESS); - } - - // - // Clear the screen - // - ConsoleInfo->OldConOut->ClearScreen(ConsoleInfo->OldConOut); - - // - // Set the new start row - // - if (Forward) { - ConsoleInfo->CurrentStartRow += RowChange; - } else { - ConsoleInfo->CurrentStartRow -= RowChange; - } - - // - // Change the screen - // - return (UpdateDisplayFromHistory(ConsoleInfo)); -} - -/** - Function to return to normal output whent he scrolling is complete. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. See UpdateDisplayFromHistory. - - @sa UpdateDisplayFromHistory -**/ -EFI_STATUS -ConsoleLoggerStopHistory( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - ASSERT(ConsoleInfo != NULL); - if (ConsoleInfo->CurrentStartRow == ConsoleInfo->OriginalStartRow) { - return (EFI_SUCCESS); - } - - // - // Clear the screen - // - ConsoleInfo->OldConOut->ClearScreen(ConsoleInfo->OldConOut); - - ConsoleInfo->CurrentStartRow = ConsoleInfo->OriginalStartRow; - return (UpdateDisplayFromHistory(ConsoleInfo)); -} - -/** - Updates the hidden ConOut to be displaying the correct stuff. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. -**/ -EFI_STATUS -UpdateDisplayFromHistory( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - EFI_STATUS Status; - EFI_STATUS RetVal; - CHAR16 *Screen; - INT32 *Attributes; - UINTN CurrentRow; - CHAR16 TempCharHolder; - UINTN Column; - INT32 CurrentAttrib; - UINTN CurrentColumn; - CHAR16 *StringSegment; - CHAR16 *StringSegmentEnd; - CHAR16 StringSegmentEndChar; - INT32 OrigAttribute; - - ASSERT(ConsoleInfo != NULL); - TempCharHolder = CHAR_NULL; - RetVal = EFI_SUCCESS; - OrigAttribute = ConsoleInfo->OldConOut->Mode->Attribute; - - // - // Disable cursor visibility and move it to the top left corner - // - ConsoleInfo->OldConOut->EnableCursor (ConsoleInfo->OldConOut, FALSE); - ConsoleInfo->OldConOut->SetCursorPosition (ConsoleInfo->OldConOut, 0, 0); - - Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow]; - Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow]; - for ( CurrentRow = 0 - ; CurrentRow < ConsoleInfo->RowsPerScreen - ; CurrentRow++ - , Screen += (ConsoleInfo->ColsPerScreen + 2) - , Attributes += ConsoleInfo->ColsPerScreen - ){ - // - // dont use the last char - prevents screen scroll - // - if (CurrentRow == (ConsoleInfo->RowsPerScreen-1)){ - TempCharHolder = Screen[ConsoleInfo->ColsPerScreen - 1]; - Screen[ConsoleInfo->ColsPerScreen - 1] = CHAR_NULL; - } - - for ( Column = 0 - ; Column < ConsoleInfo->ColsPerScreen - ; Column++ - ){ - if (Screen[Column] != CHAR_NULL) { - CurrentAttrib = Attributes[Column]; - CurrentColumn = Column; - StringSegment = &Screen[Column]; - - // - // Find the first char with a different arrribute and make that temporarily NULL - // so we can do fewer printout statements. (later) restore that one and we will - // start at that collumn on the next loop. - // - StringSegmentEndChar = CHAR_NULL; - for ( StringSegmentEnd = StringSegment - ; *StringSegmentEnd != CHAR_NULL - ; StringSegmentEnd++ - , Column++ - ){ - if (Attributes[Column] != CurrentAttrib) { - StringSegmentEndChar = *StringSegmentEnd; - *StringSegmentEnd = CHAR_NULL; - break; - } - } // StringSegmentEnd loop - - // - // Now write out as much as had the same Attributes - // - - ConsoleInfo->OldConOut->SetAttribute(ConsoleInfo->OldConOut, CurrentAttrib); - ConsoleInfo->OldConOut->SetCursorPosition(ConsoleInfo->OldConOut, CurrentColumn, CurrentRow); - Status = ConsoleInfo->OldConOut->OutputString(ConsoleInfo->OldConOut, StringSegment); - - if (EFI_ERROR(Status)) { - ASSERT(FALSE); - RetVal = Status; - } - - // - // If we found a change in attribute put the character back and decrement the column - // so when it increments it will point at that character and we will start printing - // a segment with that new attribute - // - if (StringSegmentEndChar != CHAR_NULL) { - *StringSegmentEnd = StringSegmentEndChar; - StringSegmentEndChar = CHAR_NULL; - Column--; - } - } - } // column for loop - - // - // If we removed the last char and this was the last row put it back - // - if (TempCharHolder != CHAR_NULL) { - Screen[ConsoleInfo->ColsPerScreen - 1] = TempCharHolder; - TempCharHolder = CHAR_NULL; - } - } // row for loop - - // - // If we are setting the screen back to original turn on the cursor and make it visible - // and set the attributes back to what they were - // - if (ConsoleInfo->CurrentStartRow == ConsoleInfo->OriginalStartRow) { - ConsoleInfo->OldConOut->SetAttribute ( - ConsoleInfo->OldConOut, - ConsoleInfo->HistoryMode.Attribute - ); - ConsoleInfo->OldConOut->SetCursorPosition ( - ConsoleInfo->OldConOut, - ConsoleInfo->HistoryMode.CursorColumn, - ConsoleInfo->HistoryMode.CursorRow - ConsoleInfo->OriginalStartRow - ); - - Status = ConsoleInfo->OldConOut->EnableCursor ( - ConsoleInfo->OldConOut, - ConsoleInfo->HistoryMode.CursorVisible - ); - if (EFI_ERROR (Status)) { - RetVal = Status; - } - } else { - ConsoleInfo->OldConOut->SetAttribute ( - ConsoleInfo->OldConOut, - OrigAttribute - ); - } - - return (RetVal); -} - -/** - Reset the text output device hardware and optionaly run diagnostics - - @param This pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL - @param ExtendedVerification Indicates that a more extensive test may be performed - - @retval EFI_SUCCESS The text output device was reset. - @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and - could not be reset. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerReset ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ) -{ - EFI_STATUS Status; - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->Reset (ConsoleInfo->OldConOut, ExtendedVerification); - - // - // Check that the buffers are still correct for logging - // - if (!EFI_ERROR (Status)) { - ConsoleLoggerResetBuffers(ConsoleInfo); - if (ExtendedVerification) { - ConsoleInfo->OriginalStartRow = 0; - ConsoleInfo->CurrentStartRow = 0; - } - } - - return Status; -} - -/** - Appends a string to the history buffer. If the buffer is full then the oldest - information in the buffer will be dropped. Information is added in a line by - line manner such that an empty line takes up just as much space as a full line. - - @param[in] String String pointer to add. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. -**/ -EFI_STATUS -AppendStringToHistory( - IN CONST CHAR16 *String, - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - CONST CHAR16 *Walker; - UINTN CopySize; - UINTN PrintIndex; - UINTN Index; - - ASSERT(ConsoleInfo != NULL); - - for ( Walker = String - ; Walker != NULL && *Walker != CHAR_NULL - ; Walker++ - ){ - switch (*Walker) { - case (CHAR_BACKSPACE): - if (ConsoleInfo->HistoryMode.CursorColumn > 0) { - ConsoleInfo->HistoryMode.CursorColumn--; - } - break; - case (CHAR_LINEFEED): - if (ConsoleInfo->HistoryMode.CursorRow >= (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1)) { - // - // Should never be bigger - // - ASSERT(ConsoleInfo->HistoryMode.CursorRow == (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1)); - - // - // scroll history attributes 'up' 1 row and set the last row to default attribute - // - CopySize = ConsoleInfo->ColsPerScreen - * ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1) - * sizeof(ConsoleInfo->Attributes[0]); - ASSERT(CopySize < ConsoleInfo->AttribSize); - CopyMem( - ConsoleInfo->Attributes, - ConsoleInfo->Attributes + ConsoleInfo->ColsPerScreen, - CopySize - ); - - for ( Index = 0 - ; Index < ConsoleInfo->ColsPerScreen - ; Index++ - ){ - *(ConsoleInfo->Attributes + (CopySize/sizeof(ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute; - } - - // - // scroll history buffer 'up' 1 row and set the last row to spaces (L' ') - // - CopySize = (ConsoleInfo->ColsPerScreen + 2) - * ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1) - * sizeof(ConsoleInfo->Buffer[0]); - ASSERT(CopySize < ConsoleInfo->BufferSize); - CopyMem( - ConsoleInfo->Buffer, - ConsoleInfo->Buffer + (ConsoleInfo->ColsPerScreen + 2), - CopySize - ); - - // - // Set that last row of chars to spaces - // - SetMem16(((UINT8*)ConsoleInfo->Buffer)+CopySize, ConsoleInfo->ColsPerScreen*sizeof(CHAR16), L' '); - } else { - // - // we are not on the last row - // - - // - // We should not be scrolling history - // - ASSERT (ConsoleInfo->OriginalStartRow == ConsoleInfo->CurrentStartRow); - // - // are we at the end of a row? - // - if (ConsoleInfo->HistoryMode.CursorRow == (INT32) (ConsoleInfo->OriginalStartRow + ConsoleInfo->RowsPerScreen - 1)) { - ConsoleInfo->OriginalStartRow++; - ConsoleInfo->CurrentStartRow++; - } - ConsoleInfo->HistoryMode.CursorRow++; - } - break; - case (CHAR_CARRIAGE_RETURN): - // - // Move the cursor to the beginning of the current row. - // - ConsoleInfo->HistoryMode.CursorColumn = 0; - break; - default: - // - // Acrtually print characters into the history buffer - // - - PrintIndex = ConsoleInfo->HistoryMode.CursorRow * ConsoleInfo->ColsPerScreen + ConsoleInfo->HistoryMode.CursorColumn; - - for ( // no initializer needed - ; ConsoleInfo->HistoryMode.CursorColumn < (INT32) ConsoleInfo->ColsPerScreen - ; ConsoleInfo->HistoryMode.CursorColumn++ - , PrintIndex++ - , Walker++ - ){ - if (*Walker == CHAR_NULL - ||*Walker == CHAR_BACKSPACE - ||*Walker == CHAR_LINEFEED - ||*Walker == CHAR_CARRIAGE_RETURN - ){ - Walker--; - break; - } - // - // The buffer is 2*CursorRow more since it has that many \r\n characters at the end of each row. - // - - ASSERT(PrintIndex + ConsoleInfo->HistoryMode.CursorRow < ConsoleInfo->BufferSize); - ConsoleInfo->Buffer[PrintIndex + (2*ConsoleInfo->HistoryMode.CursorRow)] = *Walker; - ASSERT(PrintIndex < ConsoleInfo->AttribSize); - ConsoleInfo->Attributes[PrintIndex] = ConsoleInfo->HistoryMode.Attribute; - } // for loop - - // - // Add the carriage return and line feed at the end of the lines - // - if (ConsoleInfo->HistoryMode.CursorColumn >= (INT32)ConsoleInfo->ColsPerScreen) { - AppendStringToHistory(L"\r\n", ConsoleInfo); - Walker--; - } - - break; - } // switch for character - } // for loop - - return (EFI_SUCCESS); -} - -/** - Worker function to handle printing the output to the screen - and the history buffer - - @param[in] String The string to output - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The string was printed - @retval EFI_DEVICE_ERROR The device reported an error while attempting to output - the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. -**/ -EFI_STATUS -ConsoleLoggerOutputStringSplit( - IN CONST CHAR16 *String, - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - EFI_STATUS Status; - - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->OutputString (ConsoleInfo->OldConOut, (CHAR16*)String); - - if (EFI_ERROR(Status)) { - return (Status); - } - - return (AppendStringToHistory(String, ConsoleInfo)); -} - -/** - Function to handle page break mode. - - This function will prompt for continue or break. - - @retval EFI_SUCCESS Continue was choosen - @return other Break was choosen -**/ -EFI_STATUS -ConsoleLoggerDoPageBreak( - VOID - ) -{ - SHELL_PROMPT_RESPONSE *Resp; - EFI_STATUS Status; - - Resp = NULL; - ASSERT(ShellInfoObject.PageBreakEnabled); - ShellInfoObject.PageBreakEnabled = FALSE; - Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN(STR_SHELL_QUIT_CONT), ShellInfoObject.HiiHandle, (VOID**)&Resp); - ShellInfoObject.PageBreakEnabled = TRUE; - ASSERT(Resp != NULL); - if (Resp == NULL) { - return (EFI_NOT_FOUND); - } - if (EFI_ERROR(Status)) { - if (Resp != NULL) { - FreePool(Resp); - } - return (Status); - } - if (*Resp == ShellPromptResponseContinue) { - FreePool(Resp); - ShellInfoObject.ConsoleInfo->RowCounter = 0; -// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0; -// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0; - - return (EFI_SUCCESS); - } else if (*Resp == ShellPromptResponseQuit) { - FreePool(Resp); - ShellInfoObject.ConsoleInfo->Enabled = FALSE; - // - // When user wants to quit, the shell should stop running the command. - // - gBS->SignalEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak); - return (EFI_DEVICE_ERROR); - } else { - ASSERT(FALSE); - } - return (EFI_SUCCESS); -} -/** - Worker function to handle printing the output with page breaks. - - @param[in] String The string to output - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The string was printed - @retval EFI_DEVICE_ERROR The device reported an error while attempting to output - the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. -**/ -EFI_STATUS -ConsoleLoggerPrintWithPageBreak( - IN CONST CHAR16 *String, - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - CONST CHAR16 *Walker; - CONST CHAR16 *LineStart; - CHAR16 *StringCopy; - CHAR16 TempChar; - - StringCopy = NULL; - StringCopy = StrnCatGrow(&StringCopy, NULL, String, 0); - if (StringCopy == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - for ( Walker = StringCopy - , LineStart = StringCopy - ; Walker != NULL && *Walker != CHAR_NULL - ; Walker++ - ){ - switch (*Walker) { - case (CHAR_BACKSPACE): - if (ConsoleInfo->OurConOut.Mode->CursorColumn > 0) { - ConsoleInfo->OurConOut.Mode->CursorColumn--; - } - break; - case (CHAR_LINEFEED): - // - // add a temp NULL terminator - // - TempChar = *(Walker + 1); - *((CHAR16*)(Walker+1)) = CHAR_NULL; - - // - // output the string - // - ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo); - - // - // restore the temp NULL terminator to it's original character - // - *((CHAR16*)(Walker+1)) = TempChar; - - // - // Update LineStart Variable - // - LineStart = Walker + 1; - - // - // increment row count - // - ShellInfoObject.ConsoleInfo->RowCounter++; - ConsoleInfo->OurConOut.Mode->CursorRow++; - - break; - case (CHAR_CARRIAGE_RETURN): - // - // Move the cursor to the beginning of the current row. - // - ConsoleInfo->OurConOut.Mode->CursorColumn = 0; - break; - default: - // - // increment column count - // - ConsoleInfo->OurConOut.Mode->CursorColumn++; - // - // check if that is the last column - // - if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn + 1) { - // - // output a line similar to the linefeed character. - // - - // - // add a temp NULL terminator - // - TempChar = *(Walker + 1); - *((CHAR16*)(Walker+1)) = CHAR_NULL; - - // - // output the string - // - ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo); - - // - // restore the temp NULL terminator to it's original character - // - *((CHAR16*)(Walker+1)) = TempChar; - - // - // Update LineStart Variable - // - LineStart = Walker + 1; - - // - // increment row count and zero the column - // - ShellInfoObject.ConsoleInfo->RowCounter++; - ConsoleInfo->OurConOut.Mode->CursorRow++; - ConsoleInfo->OurConOut.Mode->CursorColumn = 0; - } // last column on line - break; - } // switch for character - - // - // check if that was the last printable row. If yes handle PageBreak mode - // - if ((ConsoleInfo->RowsPerScreen) -1 == ShellInfoObject.ConsoleInfo->RowCounter) { - if (EFI_ERROR(ConsoleLoggerDoPageBreak())) { - // - // We got an error which means 'break' and halt the printing - // - SHELL_FREE_NON_NULL(StringCopy); - return (EFI_DEVICE_ERROR); - } - } - } // for loop - - if (LineStart != NULL && *LineStart != CHAR_NULL) { - ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo); - } - - SHELL_FREE_NON_NULL(StringCopy); - return (EFI_SUCCESS); -} - -/** - Write a Unicode string to the output device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be displayed on the output - device(s). All output devices must also support the Unicode - drawing defined in this file. - @retval EFI_SUCCESS The string was output to the device. - @retval EFI_DEVICE_ERROR The device reported an error while attempting to output - the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerOutputString ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ) -{ - EFI_STATUS Status; - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx; - EFI_KEY_DATA KeyData; - UINTN EventIndex; - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) { - return (EFI_UNSUPPORTED); - } - ASSERT(ShellInfoObject.ConsoleInfo == ConsoleInfo); - - Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **) &TxtInEx); - if (!EFI_ERROR (Status)) { - while (ShellInfoObject.HaltOutput) { - - ShellInfoObject.HaltOutput = FALSE; - // - // just get some key - // - Status = gBS->WaitForEvent (1, &TxtInEx->WaitForKeyEx, &EventIndex); - ASSERT_EFI_ERROR (Status); - Status = TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData); - if (EFI_ERROR(Status)) { - break; - } - - if ((KeyData.Key.UnicodeChar == L's') && (KeyData.Key.ScanCode == SCAN_NULL) && - ((KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED)) || - (KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED)) - ) - ) { - ShellInfoObject.HaltOutput = TRUE; - } - } - } - - if (!ShellInfoObject.ConsoleInfo->Enabled) { - return (EFI_DEVICE_ERROR); - } else if (ShellInfoObject.PageBreakEnabled) { - return (ConsoleLoggerPrintWithPageBreak(WString, ConsoleInfo)); - } else { - return (ConsoleLoggerOutputStringSplit(WString, ConsoleInfo)); - } -} - -/** - Verifies that all characters in a Unicode string can be output to the - target device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be examined for the output - device(s). - - @retval EFI_SUCCESS The device(s) are capable of rendering the output string. - @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be - rendered by one or more of the output devices mapped - by the EFI handle. - -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerTestString ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ) -{ - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - // - // Forward the request to the original ConOut - // - return (ConsoleInfo->OldConOut->TestString (ConsoleInfo->OldConOut, WString)); -} - -/** - Returns information for an available text mode that the output device(s) - supports. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to return information on. - @param[out] Columns Upon return, the number of columns in the selected geometry - @param[out] Rows Upon return, the number of rows in the selected geometry - - @retval EFI_SUCCESS The requested mode information was returned. - @retval EFI_DEVICE_ERROR The device had an error and could not - complete the request. - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerQueryMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber, - OUT UINTN *Columns, - OUT UINTN *Rows - ) -{ - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - // - // Forward the request to the original ConOut - // - return (ConsoleInfo->OldConOut->QueryMode ( - ConsoleInfo->OldConOut, - ModeNumber, - Columns, - Rows - )); -} - -/** - Sets the output device(s) to a specified mode. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to set. - - - @retval EFI_SUCCESS The requested text mode was set. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber - ) -{ - EFI_STATUS Status; - - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->SetMode (ConsoleInfo->OldConOut, ModeNumber); - - // - // Check that the buffers are still correct for logging - // - if (!EFI_ERROR (Status)) { - ConsoleInfo->OurConOut.Mode = ConsoleInfo->OldConOut->Mode; - ConsoleLoggerResetBuffers(ConsoleInfo); - ConsoleInfo->OriginalStartRow = 0; - ConsoleInfo->CurrentStartRow = 0; - ConsoleInfo->OurConOut.ClearScreen (&ConsoleInfo->OurConOut); - } - - return Status; -} - -/** - Sets the background and foreground colors for the OutputString () and - ClearScreen () functions. - - @param[in] This Protocol instance pointer. - @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and - bits 4..6 are the background color. All other bits are undefined - and must be zero. The valid Attributes are defined in this file. - - @retval EFI_SUCCESS The attribute was set. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The attribute requested is not defined. - -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetAttribute ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Attribute - ) -{ - EFI_STATUS Status; - - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->SetAttribute (ConsoleInfo->OldConOut, Attribute); - - // - // Record console output history - // - if (!EFI_ERROR (Status)) { - ConsoleInfo->HistoryMode.Attribute = (INT32) Attribute; - } - - return Status; -} - -/** - Clears the output device(s) display to the currently selected background - color. - - @param[in] This Protocol instance pointer. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerClearScreen ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This - ) -{ - EFI_STATUS Status; - CHAR16 *Screen; - INT32 *Attributes; - UINTN Row; - UINTN Column; - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) { - return (EFI_UNSUPPORTED); - } - - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->ClearScreen (ConsoleInfo->OldConOut); - - // - // Record console output history - // - if (!EFI_ERROR (Status)) { - Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow]; - Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow]; - for ( Row = ConsoleInfo->OriginalStartRow - ; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - ; Row++ - ){ - for ( Column = 0 - ; Column < ConsoleInfo->ColsPerScreen - ; Column++ - , Screen++ - , Attributes++ - ){ - *Screen = L' '; - *Attributes = ConsoleInfo->OldConOut->Mode->Attribute; - } - // - // Skip the NULL on each column end in text buffer only - // - Screen += 2; - } - ConsoleInfo->HistoryMode.CursorColumn = 0; - ConsoleInfo->HistoryMode.CursorRow = 0; - } - - return Status; -} - -/** - Sets the current coordinates of the cursor position - - @param[in] This Protocol instance pointer. - @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode - @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the - cursor position is invalid for the current mode. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetCursorPosition ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Column, - IN UINTN Row - ) -{ - EFI_STATUS Status; - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) { - return (EFI_UNSUPPORTED); - } - - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->SetCursorPosition ( - ConsoleInfo->OldConOut, - Column, - Row - ); - - // - // Record console output history - // - if (!EFI_ERROR (Status)) { - ConsoleInfo->HistoryMode.CursorColumn = (INT32)Column; - ConsoleInfo->HistoryMode.CursorRow = (INT32)(ConsoleInfo->OriginalStartRow + Row); - } - - return Status; -} - -/** - Makes the cursor visible or invisible - - @param[in] This Protocol instance pointer. - @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is - set to be invisible. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and could not complete the - request, or the device does not support changing - the cursor mode. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerEnableCursor ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN Visible - ) -{ - EFI_STATUS Status; - - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; - ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This); - // - // Forward the request to the original ConOut - // - Status = ConsoleInfo->OldConOut->EnableCursor (ConsoleInfo->OldConOut, Visible); - - // - // Record console output history - // - if (!EFI_ERROR (Status)) { - ConsoleInfo->HistoryMode.CursorVisible = Visible; - } - - return Status; -} - -/** - Function to update and verify that the current buffers are correct. - - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - This will be used when a mode has changed or a reset ocurred to verify all - history buffers. -**/ -EFI_STATUS -ConsoleLoggerResetBuffers( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ) -{ - EFI_STATUS Status; - - if (ConsoleInfo->Buffer != NULL) { - FreePool(ConsoleInfo->Buffer); - ConsoleInfo->Buffer = NULL; - ConsoleInfo->BufferSize = 0; - } - if (ConsoleInfo->Attributes != NULL) { - FreePool(ConsoleInfo->Attributes); - ConsoleInfo->Attributes = NULL; - ConsoleInfo->AttribSize = 0; - } - - Status = gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &ConsoleInfo->ColsPerScreen, &ConsoleInfo->RowsPerScreen); - if (EFI_ERROR(Status)){ - return (Status); - } - - ConsoleInfo->BufferSize = (ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof(ConsoleInfo->Buffer[0]); - ConsoleInfo->AttribSize = ConsoleInfo->ColsPerScreen * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof(ConsoleInfo->Attributes[0]); - - ConsoleInfo->Buffer = (CHAR16*)AllocateZeroPool(ConsoleInfo->BufferSize); - - if (ConsoleInfo->Buffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - ConsoleInfo->Attributes = (INT32*)AllocateZeroPool(ConsoleInfo->AttribSize); - if (ConsoleInfo->Attributes == NULL) { - FreePool(ConsoleInfo->Buffer); - ConsoleInfo->Buffer = NULL; - return (EFI_OUT_OF_RESOURCES); - } - - CopyMem (&ConsoleInfo->HistoryMode, ConsoleInfo->OldConOut->Mode, sizeof (EFI_SIMPLE_TEXT_OUTPUT_MODE)); - - return (EFI_SUCCESS); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.h deleted file mode 100644 index b69fd99..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleLogger.h +++ /dev/null @@ -1,323 +0,0 @@ -/** @file - Provides interface to shell console logger. - - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef _CONSOLE_LOGGER_HEADER_ -#define _CONSOLE_LOGGER_HEADER_ - -#include "Shell.h" - -#define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D') - -typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{ - UINTN Signature; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut; ///< the protocol we installed onto the system table - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OldConOut; ///< old protocol to reinstall upon exiting - EFI_HANDLE OldConHandle; ///< old protocol handle - UINTN ScreenCount; ///< How many screens worth of data to save - CHAR16 *Buffer; ///< Buffer to save data - UINTN BufferSize; ///< size of buffer in bytes - - // start row is the top of the screen - UINTN OriginalStartRow; ///< What the originally visible start row was - UINTN CurrentStartRow; ///< what the currently visible start row is - - UINTN RowsPerScreen; ///< how many rows the screen can display - UINTN ColsPerScreen; ///< how many columns the screen can display - - INT32 *Attributes; ///< Buffer for Attribute to be saved for each character - UINTN AttribSize; ///< Size of Attributes in bytes - - EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode; ///< mode of the history log - BOOLEAN Enabled; ///< Set to FALSE when a break is requested. - UINTN RowCounter; ///< Initial row of each print job. -} CONSOLE_LOGGER_PRIVATE_DATA; - -#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE) - -/** - Install our intermediate ConOut into the system table to - keep a log of all the info that is displayed to the user. - - @param[in] ScreensToSave Sets how many screen-worths of data to save. - @param[out] ConsoleInfo The object to pass into later functions. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. - - @sa ConsoleLoggerResetBuffers - @sa InstallProtocolInterface -**/ -EFI_STATUS -ConsoleLoggerInstall( - IN CONST UINTN ScreensToSave, - OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo - ); - -/** - Return the system to the state it was before InstallConsoleLogger - was installed. - - @param[in, out] ConsoleInfo The object from the install function. - - @retval EFI_SUCCESS The operation was successful - @return other The operation failed. This was from UninstallProtocolInterface. -**/ -EFI_STATUS -ConsoleLoggerUninstall( - IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ); - -/** - Displays previously logged output back to the screen. - - This will scroll the screen forwards and backwards through the log of previous - output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows - is (UINTN)(-1) then the size of the screen will be scrolled. - - @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer). - If FALSE then the log will be displayed backwards (scroll to older). - @param[in] Rows Determines how many rows the log should scroll. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. -**/ -EFI_STATUS -ConsoleLoggerDisplayHistory( - IN CONST BOOLEAN Forward, - IN CONST UINTN Rows, - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ); - -/** - Function to return to normal output whent he scrolling is complete. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. See UpdateDisplayFromHistory. - - @sa UpdateDisplayFromHistory -**/ -EFI_STATUS -ConsoleLoggerStopHistory( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ); - -/** - Updates the hidden ConOut to be displaying the correct stuff. - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - @retval EFI_SUCCESS The operation was successful. - @return other The operation failed. -**/ -EFI_STATUS -UpdateDisplayFromHistory( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ); - -/** - Reset the text output device hardware and optionaly run diagnostics - - @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL - @param ExtendedVerification Indicates that a more extensive test may be performed - - @retval EFI_SUCCESS The text output device was reset. - @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and - could not be reset. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerReset ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ); - -/** - Write a Unicode string to the output device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be displayed on the output - device(s). All output devices must also support the Unicode - drawing defined in this file. - @retval EFI_SUCCESS The string was output to the device. - @retval EFI_DEVICE_ERROR The device reported an error while attempting to output - the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerOutputString( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ); - -/** - Verifies that all characters in a Unicode string can be output to the - target device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be examined for the output - device(s). - - @retval EFI_SUCCESS The device(s) are capable of rendering the output string. - @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be - rendered by one or more of the output devices mapped - by the EFI handle. - -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerTestString ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ); - -/** - Returns information for an available text mode that the output device(s) - supports. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to return information on. - @param[out] Columns Upon return, the number of columns in the selected geometry - @param[out] Rows Upon return, the number of rows in the selected geometry - - @retval EFI_SUCCESS The requested mode information was returned. - @retval EFI_DEVICE_ERROR The device had an error and could not - complete the request. - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerQueryMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber, - OUT UINTN *Columns, - OUT UINTN *Rows - ); - -/** - Sets the output device(s) to a specified mode. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to set. - - - @retval EFI_SUCCESS The requested text mode was set. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber - ); - -/** - Sets the background and foreground colors for the OutputString () and - ClearScreen () functions. - - @param[in] This Protocol instance pointer. - @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and - bits 4..6 are the background color. All other bits are undefined - and must be zero. The valid Attributes are defined in this file. - - @retval EFI_SUCCESS The attribute was set. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The attribute requested is not defined. - -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetAttribute ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Attribute - ); - -/** - Clears the output device(s) display to the currently selected background - color. - - @param[in] This Protocol instance pointer. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerClearScreen ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This - ); - -/** - Sets the current coordinates of the cursor position. - - @param[in] This Protocol instance pointer. - @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode - @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and - could not complete the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the - cursor position is invalid for the current mode. -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerSetCursorPosition ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Column, - IN UINTN Row - ); - -/** - Makes the cursor visible or invisible - - @param[in] This Protocol instance pointer. - @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is - set to be invisible. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and could not complete the - request, or the device does not support changing - the cursor mode. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. - -**/ -EFI_STATUS -EFIAPI -ConsoleLoggerEnableCursor ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN Visible - ); - -/** - Function to update and verify that the current buffers are correct. - - @param[in] ConsoleInfo The pointer to the instance of the console logger information. - - This will be used when a mode has changed or a reset ocurred to verify all - history buffers. -**/ -EFI_STATUS -ConsoleLoggerResetBuffers( - IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo - ); - -#endif //_CONSOLE_LOGGER_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c deleted file mode 100644 index 4f0e535..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c +++ /dev/null @@ -1,514 +0,0 @@ -/** @file - Function definitions for shell simple text in and out on top of file handles. - - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -extern BOOLEAN AsciiRedirection; - -typedef struct { - EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn; - SHELL_FILE_HANDLE FileHandle; - EFI_HANDLE TheHandle; - UINT64 RemainingBytesOfInputFile; -} SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL; - -typedef struct { - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut; - SHELL_FILE_HANDLE FileHandle; - EFI_HANDLE TheHandle; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalSimpleTextOut; -} SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL; - -/** - Event notification function for EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey event - Signal the event if there is key available - - @param Event Indicates the event that invoke this function. - @param Context Indicates the calling context. - -**/ -VOID -EFIAPI -ConInWaitForKey ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - gBS->SignalEvent (Event); -} - -/** - Reset function for the fake simple text input. - - @param[in] This A pointer to the SimpleTextIn structure. - @param[in] ExtendedVerification TRUE for extra validation, FALSE otherwise. - - @retval EFI_SUCCESS The reset was successful. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextInReset( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ) -{ - return (EFI_SUCCESS); -} - -/** - ReadKeyStroke function for the fake simple text input. - - @param[in] This A pointer to the SimpleTextIn structure. - @param[in, out] Key A pointer to the Key structure to fill. - - @retval EFI_SUCCESS The read was successful. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextInReadKeyStroke( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, - IN OUT EFI_INPUT_KEY *Key - ) -{ - UINTN Size; - UINTN CharSize; - - // - // Verify the parameters - // - if (Key == NULL || This == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Check if we have any characters left in the stream. - // - if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile == 0) { - return (EFI_NOT_READY); - } - - Size = sizeof(CHAR16); - - if(!AsciiRedirection) { - CharSize = sizeof(CHAR16); - } else { - CharSize = sizeof(CHAR8); - } - // - // Decrement the amount of free space by Size or set to zero (for odd length files) - // - if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile > CharSize) { - ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile -= CharSize; - } else { - ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile = 0; - } - - Key->ScanCode = 0; - return (ShellInfoObject.NewEfiShellProtocol->ReadFile( - ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle, - &Size, - &Key->UnicodeChar)); -} - -/** - Function to create a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting input from a file. - - @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. - @param[in] HandleLocation The pointer of a location to copy handle with protocol to. - - @retval NULL There was insufficient memory available. - @return A pointer to the allocated protocol structure; -**/ -EFI_SIMPLE_TEXT_INPUT_PROTOCOL* -CreateSimpleTextInOnFile( - IN SHELL_FILE_HANDLE FileHandleToUse, - IN EFI_HANDLE *HandleLocation - ) -{ - SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ProtocolToReturn; - EFI_STATUS Status; - UINT64 CurrentPosition; - UINT64 FileSize; - - if (HandleLocation == NULL || FileHandleToUse == NULL) { - return (NULL); - } - - ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL)); - if (ProtocolToReturn == NULL) { - return (NULL); - } - - ShellGetFileSize (FileHandleToUse, &FileSize); - ShellGetFilePosition(FileHandleToUse, &CurrentPosition); - - // - // Initialize the protocol members - // - ProtocolToReturn->RemainingBytesOfInputFile = FileSize - CurrentPosition; - ProtocolToReturn->FileHandle = FileHandleToUse; - ProtocolToReturn->SimpleTextIn.Reset = FileBasedSimpleTextInReset; - ProtocolToReturn->SimpleTextIn.ReadKeyStroke = FileBasedSimpleTextInReadKeyStroke; - - Status = gBS->CreateEvent ( - EVT_NOTIFY_WAIT, - TPL_NOTIFY, - ConInWaitForKey, - &ProtocolToReturn->SimpleTextIn, - &ProtocolToReturn->SimpleTextIn.WaitForKey - ); - - if (EFI_ERROR(Status)) { - FreePool(ProtocolToReturn); - return (NULL); - } - ///@todo possibly also install SimpleTextInputEx on the handle at this point. - Status = gBS->InstallProtocolInterface( - &(ProtocolToReturn->TheHandle), - &gEfiSimpleTextInProtocolGuid, - EFI_NATIVE_INTERFACE, - &(ProtocolToReturn->SimpleTextIn)); - if (!EFI_ERROR(Status)) { - *HandleLocation = ProtocolToReturn->TheHandle; - return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)ProtocolToReturn); - } else { - FreePool(ProtocolToReturn); - return (NULL); - } -} - -/** - Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting input from a file. - - @param[in] SimpleTextIn The pointer to the SimpleTextIn to close. - - @retval EFI_SUCCESS The object was closed. -**/ -EFI_STATUS -CloseSimpleTextInOnFile( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn - ) -{ - EFI_STATUS Status; - EFI_STATUS Status1; - - if (SimpleTextIn == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Status = gBS->CloseEvent(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey); - - Status1 = gBS->UninstallProtocolInterface( - ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle, - &gEfiSimpleTextInProtocolGuid, - &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn)); - - FreePool(SimpleTextIn); - if (!EFI_ERROR(Status)) { - return (Status1); - } else { - return (Status); - } -} - -/** - Reset the text output device hardware and optionaly run diagnostics. - - @param This pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL - @param ExtendedVerification Indicates that a more extensive test may be performed - - @retval EFI_SUCCESS The text output device was reset. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutReset ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ) -{ - return (EFI_SUCCESS); -} - -/** - Verifies that all characters in a Unicode string can be output to the - target device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be examined. - - @retval EFI_SUCCESS The device(s) are capable of rendering the output string. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutTestString ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ) -{ - return (EFI_SUCCESS); -} - -/** - Returns information for an available text mode that the output device(s) - supports. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to return information on. - @param[out] Columns Upon return, the number of columns in the selected geometry - @param[out] Rows Upon return, the number of rows in the selected geometry - - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutQueryMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber, - OUT UINTN *Columns, - OUT UINTN *Rows - ) -{ - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol; - - PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut; - - // Pass the QueryMode call thru to the original SimpleTextOutProtocol - return (PassThruProtocol->QueryMode( - PassThruProtocol, - ModeNumber, - Columns, - Rows)); -} - -/** - Sets the output device(s) to a specified mode. - - @param[in] This Protocol instance pointer. - @param[in] ModeNumber The mode number to set. - - @retval EFI_UNSUPPORTED The mode number was not valid. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutSetMode ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN ModeNumber - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - Sets the background and foreground colors for the OutputString () and - ClearScreen () functions. - - @param[in] This Protocol instance pointer. - @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and - bits 4..6 are the background color. All other bits are undefined - and must be zero. The valid Attributes are defined in this file. - - @retval EFI_SUCCESS The attribute was set. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutSetAttribute ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Attribute - ) -{ - return (EFI_SUCCESS); -} - -/** - Clears the output device(s) display to the currently selected background - color. - - @param[in] This Protocol instance pointer. - - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutClearScreen ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This - ) -{ - return (EFI_SUCCESS); -} - -/** - Sets the current coordinates of the cursor position - - @param[in] This Protocol instance pointer. - @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode - @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode - - @retval EFI_SUCCESS The operation completed successfully. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutSetCursorPosition ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN UINTN Column, - IN UINTN Row - ) -{ - return (EFI_SUCCESS); -} - -/** - Makes the cursor visible or invisible - - @param[in] This Protocol instance pointer. - @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is - set to be invisible. - - @retval EFI_SUCCESS The operation completed successfully. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutEnableCursor ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN BOOLEAN Visible - ) -{ - return (EFI_SUCCESS); -} - -/** - Write a Unicode string to the output device. - - @param[in] This Protocol instance pointer. - @param[in] WString The NULL-terminated Unicode string to be displayed on the output - device(s). All output devices must also support the Unicode - drawing defined in this file. - @retval EFI_SUCCESS The string was output to the device. - @retval EFI_DEVICE_ERROR The device reported an error while attempting to output - the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. -**/ -EFI_STATUS -EFIAPI -FileBasedSimpleTextOutOutputString ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, - IN CHAR16 *WString - ) -{ - UINTN Size; - Size = StrLen(WString) * sizeof(CHAR16); - return (ShellInfoObject.NewEfiShellProtocol->WriteFile( - ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle, - &Size, - WString)); -} - -/** - Function to create a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting output from a file. - - @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. - @param[in] HandleLocation The pointer of a location to copy handle with protocol to. - @param[in] OriginalProtocol The pointer to the original output protocol for pass thru of functions. - - @retval NULL There was insufficient memory available. - @return A pointer to the allocated protocol structure; -**/ -EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* -CreateSimpleTextOutOnFile( - IN SHELL_FILE_HANDLE FileHandleToUse, - IN EFI_HANDLE *HandleLocation, - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol - ) -{ - SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn; - EFI_STATUS Status; - - if (HandleLocation == NULL || FileHandleToUse == NULL) { - return (NULL); - } - - ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL)); - if (ProtocolToReturn == NULL) { - return (NULL); - } - ProtocolToReturn->FileHandle = FileHandleToUse; - ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol; - ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset; - ProtocolToReturn->SimpleTextOut.TestString = FileBasedSimpleTextOutTestString; - ProtocolToReturn->SimpleTextOut.QueryMode = FileBasedSimpleTextOutQueryMode; - ProtocolToReturn->SimpleTextOut.SetMode = FileBasedSimpleTextOutSetMode; - ProtocolToReturn->SimpleTextOut.SetAttribute = FileBasedSimpleTextOutSetAttribute; - ProtocolToReturn->SimpleTextOut.ClearScreen = FileBasedSimpleTextOutClearScreen; - ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition; - ProtocolToReturn->SimpleTextOut.EnableCursor = FileBasedSimpleTextOutEnableCursor; - ProtocolToReturn->SimpleTextOut.OutputString = FileBasedSimpleTextOutOutputString; - ProtocolToReturn->SimpleTextOut.Mode = AllocateZeroPool(sizeof(EFI_SIMPLE_TEXT_OUTPUT_MODE)); - if (ProtocolToReturn->SimpleTextOut.Mode == NULL) { - FreePool(ProtocolToReturn); - return (NULL); - } - ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode; - ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode; - ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute; - ProtocolToReturn->SimpleTextOut.Mode->CursorColumn = OriginalProtocol->Mode->CursorColumn; - ProtocolToReturn->SimpleTextOut.Mode->CursorRow = OriginalProtocol->Mode->CursorRow; - ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible; - - Status = gBS->InstallProtocolInterface( - &(ProtocolToReturn->TheHandle), - &gEfiSimpleTextOutProtocolGuid, - EFI_NATIVE_INTERFACE, - &(ProtocolToReturn->SimpleTextOut)); - if (!EFI_ERROR(Status)) { - *HandleLocation = ProtocolToReturn->TheHandle; - return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn); - } else { - SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode); - SHELL_FREE_NON_NULL(ProtocolToReturn); - return (NULL); - } -} - -/** - Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting output from a file. - - @param[in] SimpleTextOut The pointer to the SimpleTextOUT to close. - - @retval EFI_SUCCESS The object was closed. -**/ -EFI_STATUS -CloseSimpleTextOutOnFile( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut - ) -{ - EFI_STATUS Status; - if (SimpleTextOut == NULL) { - return (EFI_INVALID_PARAMETER); - } - Status = gBS->UninstallProtocolInterface( - ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle, - &gEfiSimpleTextOutProtocolGuid, - &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut)); - FreePool(SimpleTextOut->Mode); - FreePool(SimpleTextOut); - return (Status); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.h deleted file mode 100644 index 57b3fd9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ConsoleWrappers.h +++ /dev/null @@ -1,80 +0,0 @@ -/** @file - Function definitions for shell simple text in and out on top of file handles. - - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_CONSOLE_WRAPPERS_HEADER_ -#define _SHELL_CONSOLE_WRAPPERS_HEADER_ - -/** - Function to create a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting input from a file. - - @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. - @param[in] HandleLocation The pointer of a location to copy handle with protocol to. - - @retval NULL There was insufficient memory available. - @return A pointer to the allocated protocol structure; -**/ -EFI_SIMPLE_TEXT_INPUT_PROTOCOL* -CreateSimpleTextInOnFile( - IN SHELL_FILE_HANDLE FileHandleToUse, - IN EFI_HANDLE *HandleLocation - ); - -/** - Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting input from a file. - - @param[in] SimpleTextIn The pointer to the SimpleTextIn to close. - - @retval EFI_SUCCESS The object was closed. -**/ -EFI_STATUS -CloseSimpleTextInOnFile( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn - ); - -/** - Function to create a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting output from a file. - - @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. - @param[in] HandleLocation The pointer of a location to copy handle with protocol to. - @param[in] OriginalProtocol The pointer to the original output protocol for pass thru of functions. - - @retval NULL There was insufficient memory available. - @return A pointer to the allocated protocol structure; -**/ -EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* -CreateSimpleTextOutOnFile( - IN SHELL_FILE_HANDLE FileHandleToUse, - IN EFI_HANDLE *HandleLocation, - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol - ); - -/** - Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a - SHELL_FILE_HANDLE to support redirecting output from a file. - - @param[in] SimpleTextOut The pointer to the SimpleTextOUT to close. - - @retval EFI_SUCCESS The object was closed. -**/ -EFI_STATUS -CloseSimpleTextOutOnFile( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut - ); - -#endif //_SHELL_CONSOLE_WRAPPERS_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleInternal.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleInternal.h deleted file mode 100644 index bdf182e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleInternal.h +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - internal worker functions for FileHandleWrappers to use - - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _FILE_HANDLE_INTERNAL_HEADER_ -#define _FILE_HANDLE_INTERNAL_HEADER_ - -/** - Move the cursor position one character backward. - - @param[in] LineLength Length of a line. Get it by calling QueryMode - @param[in, out] Column Current column of the cursor position - @param[in, out] Row Current row of the cursor position -**/ -VOID -MoveCursorBackward ( - IN UINTN LineLength, - IN OUT UINTN *Column, - IN OUT UINTN *Row - ); - -/** - Move the cursor position one character forward. - - @param[in] LineLength Length of a line. - @param[in] TotalRow Total row of a screen - @param[in, out] Column Current column of the cursor position - @param[in, out] Row Current row of the cursor position -**/ -VOID -MoveCursorForward ( - IN UINTN LineLength, - IN UINTN TotalRow, - IN OUT UINTN *Column, - IN OUT UINTN *Row - ); - -/** - Prints out each previously typed command in the command list history log. - - When each screen is full it will pause for a key before continuing. - - @param[in] TotalCols How many columns are on the screen - @param[in] TotalRows How many rows are on the screen - @param[in] StartColumn which column to start at -**/ -VOID -PrintCommandHistory ( - IN CONST UINTN TotalCols, - IN CONST UINTN TotalRows, - IN CONST UINTN StartColumn - ); - -#endif //_FILE_HANDLE_INTERNAL_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c deleted file mode 100644 index f4c9e81..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c +++ /dev/null @@ -1,2153 +0,0 @@ -/** @file - EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables, - StdIn, StdOut, StdErr, etc...). - - Copyright 2016 Dell Inc. - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" -#include "FileHandleInternal.h" - -#define MEM_WRITE_REALLOC_OVERHEAD 1024 - -/** - File style interface for console (Open). - - @param[in] This Ignored. - @param[out] NewHandle Ignored. - @param[in] FileName Ignored. - @param[in] OpenMode Ignored. - @param[in] Attributes Ignored. - - @retval EFI_NOT_FOUND -**/ -EFI_STATUS -EFIAPI -FileInterfaceOpenNotFound( - IN EFI_FILE_PROTOCOL *This, - OUT EFI_FILE_PROTOCOL **NewHandle, - IN CHAR16 *FileName, - IN UINT64 OpenMode, - IN UINT64 Attributes - ) -{ - return (EFI_NOT_FOUND); -} - -/** - File style interface for console (Close, Delete, & Flush) - - @param[in] This Ignored. - - @retval EFI_SUCCESS -**/ -EFI_STATUS -EFIAPI -FileInterfaceNopGeneric( - IN EFI_FILE_PROTOCOL *This - ) -{ - return (EFI_SUCCESS); -} - -/** - File style interface for console (GetPosition). - - @param[in] This Ignored. - @param[out] Position Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceNopGetPosition( - IN EFI_FILE_PROTOCOL *This, - OUT UINT64 *Position - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for console (SetPosition). - - @param[in] This Ignored. - @param[in] Position Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceNopSetPosition( - IN EFI_FILE_PROTOCOL *This, - IN UINT64 Position - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for console (GetInfo). - - @param[in] This Ignored. - @param[in] InformationType Ignored. - @param[in, out] BufferSize Ignored. - @param[out] Buffer Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceNopGetInfo( - IN EFI_FILE_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for console (SetInfo). - - @param[in] This Ignored. - @param[in] InformationType Ignored. - @param[in] BufferSize Ignored. - @param[in] Buffer Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceNopSetInfo( - IN EFI_FILE_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN UINTN BufferSize, - IN VOID *Buffer - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for StdOut (Write). - - Writes data to the screen. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @retval EFI_UNSUPPORTED No output console is supported. - @return A return value from gST->ConOut->OutputString. -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdOutWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) { - return (EFI_UNSUPPORTED); - } - if (*((CHAR16 *)Buffer) == gUnicodeFileTag) { - return (gST->ConOut->OutputString(gST->ConOut, (CHAR16 *)Buffer + 1)); - } - return (gST->ConOut->OutputString(gST->ConOut, Buffer)); -} - -/** - File style interface for StdIn (Write). - - @param[in] This Ignored. - @param[in, out] BufferSize Ignored. - @param[in] Buffer Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdInWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for console StdErr (Write). - - Writes error to the error output. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @return A return value from gST->StdErr->OutputString. -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdErrWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - return (gST->StdErr->OutputString(gST->StdErr, Buffer)); -} - -/** - File style interface for console StdOut (Read). - - @param[in] This Ignored. - @param[in, out] BufferSize Ignored. - @param[out] Buffer Ignored. - - @retval EFI_UNSUPPORTED -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdOutRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for console StdErr (Read). - - @param[in] This Ignored. - @param[in, out] BufferSize Ignored. - @param[out] Buffer Ignored. - - @retval EFI_UNSUPPORTED Always. -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdErrRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - return (EFI_UNSUPPORTED); -} - -/** - File style interface for NUL file (Read). - - @param[in] This Ignored. - @param[in, out] BufferSize Poiner to 0 upon return. - @param[out] Buffer Ignored. - - @retval EFI_SUCCESS Always. -**/ -EFI_STATUS -EFIAPI -FileInterfaceNulRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - *BufferSize = 0; - return (EFI_SUCCESS); -} - -/** - File style interface for NUL file (Write). - - @param[in] This Ignored. - @param[in, out] BufferSize Ignored. - @param[in] Buffer Ignored. - - @retval EFI_SUCCESS -**/ -EFI_STATUS -EFIAPI -FileInterfaceNulWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - return (EFI_SUCCESS); -} - -/** - Create the TAB completion list. - - @param[in] InputString The command line to expand. - @param[in] StringLen Length of the command line. - @param[in] BufferSize Buffer size. - @param[in, out] TabCompletionList Return the TAB completion list. - @param[in, out] TabUpdatePos Return the TAB update position. -**/ -EFI_STATUS -CreateTabCompletionList ( - IN CONST CHAR16 *InputString, - IN CONST UINTN StringLen, - IN CONST UINTN BufferSize, - IN OUT EFI_SHELL_FILE_INFO **TabCompletionList, - IN OUT UINTN *TabUpdatePos -) -{ - BOOLEAN InQuotation; - UINTN TabPos; - UINTN Index; - CONST CHAR16 *Cwd; - EFI_STATUS Status; - CHAR16 *TabStr; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *FileInfo; - EFI_SHELL_FILE_INFO *TempFileInfo; - - // - // Allocate buffers - // - TabStr = AllocateZeroPool (BufferSize); - if (TabStr == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // handle auto complete of file and directory names... - // E.g.: cd fs0:\EFI\Bo - // ^ ^ - // TabPos TabUpdatePos - // - TabPos = 0; - *TabUpdatePos = 0; - FileList = NULL; - InQuotation = FALSE; - for (Index = 0; Index < StringLen; Index++) { - switch (InputString[Index]) { - case L'\"': - InQuotation = (BOOLEAN) (!InQuotation); - break; - - case L' ': - if (!InQuotation) { - TabPos = Index + 1; - *TabUpdatePos = TabPos; - } - break; - - case L':': - // - // handle the case "fs0:" - // Update the TabUpdatePos as well. - // - case L'\\': - *TabUpdatePos = Index + 1; - break; - - default: - break; - } - } - - if (StrStr (InputString + TabPos, L":") == NULL) { - // - // If file path doesn't contain ":", ... - // - Cwd = ShellInfoObject.NewEfiShellProtocol->GetCurDir (NULL); - if (Cwd != NULL) { - if (InputString[TabPos] != L'\\') { - // - // and it doesn't begin with "\\", it's a path relative to current directory. - // TabStr = "\\" - // - StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, (BufferSize) / sizeof (CHAR16) - 1); - StrCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"\\"); - } else { - // - // and it begins with "\\", it's a path pointing to root directory of current map. - // TabStr = "fsx:" - // - Index = StrStr (Cwd, L":") - Cwd + 1; - StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, Index); - } - } - } - StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), InputString + TabPos, StringLen - TabPos); - StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"*", (BufferSize) / sizeof (CHAR16) - 1 - StrLen (TabStr)); - Status = ShellInfoObject.NewEfiShellProtocol->FindFiles(TabStr, &FileList); - - // - // Filter out the non-directory for "CD" command - // Filter "." and ".." for all - // - if (!EFI_ERROR (Status) && FileList != NULL) { - // - // Skip the spaces in the beginning - // - while (*InputString == L' ') { - InputString++; - } - - for (FileInfo = (EFI_SHELL_FILE_INFO *) GetFirstNode (&FileList->Link); !IsNull (&FileList->Link, &FileInfo->Link); ) { - if (((StrCmp (FileInfo->FileName, L".") == 0) || (StrCmp (FileInfo->FileName, L"..") == 0)) || - (((InputString[0] == L'c' || InputString[0] == L'C') && (InputString[1] == L'd' || InputString[1] == L'D')) && - (ShellIsDirectory (FileInfo->FullName) != EFI_SUCCESS))) { - TempFileInfo = FileInfo; - FileInfo = (EFI_SHELL_FILE_INFO *) RemoveEntryList (&FileInfo->Link); - InternalFreeShellFileInfoNode (TempFileInfo); - } else { - FileInfo = (EFI_SHELL_FILE_INFO *) GetNextNode (&FileList->Link, &FileInfo->Link); - } - } - } - - if (FileList != NULL && !IsListEmpty (&FileList->Link)) { - Status = EFI_SUCCESS; - } else { - ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FileList); - Status = EFI_NOT_FOUND; - } - - FreePool (TabStr); - - *TabCompletionList = FileList; - return Status; -} - -/** - File style interface for console (Read). - - This will return a single line of input from the console. - - @param This A pointer to the EFI_FILE_PROTOCOL instance that is the - file handle to read data from. Not used. - @param BufferSize On input, the size of the Buffer. On output, the amount - of data returned in Buffer. In both cases, the size is - measured in bytes. - @param Buffer The buffer into which the data is read. - - - @retval EFI_SUCCESS The data was read. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file. - @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory - entry. BufferSize has been updated with the size - needed to complete the request. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -EFIAPI -FileInterfaceStdInRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - CHAR16 *CurrentString; - BOOLEAN Done; - UINTN TabUpdatePos; // Start index of the string updated by TAB stroke - UINTN Column; // Column of current cursor - UINTN Row; // Row of current cursor - UINTN StartColumn; // Column at the beginning of the line - UINTN Update; // Line index for update - UINTN Delete; // Num of chars to delete from console after update - UINTN StringLen; // Total length of the line - UINTN StringCurPos; // Line index corresponding to the cursor - UINTN MaxStr; // Maximum possible line length - UINTN TotalColumn; // Num of columns in the console - UINTN TotalRow; // Num of rows in the console - UINTN SkipLength; - UINTN OutputLength; // Length of the update string - UINTN TailRow; // Row of end of line - UINTN TailColumn; // Column of end of line - EFI_INPUT_KEY Key; - - BUFFER_LIST *LinePos; - BUFFER_LIST *NewPos; - BOOLEAN InScrolling; - EFI_STATUS Status; - BOOLEAN InTabScrolling; // Whether in TAB-completion state - EFI_SHELL_FILE_INFO *TabCompleteList; - EFI_SHELL_FILE_INFO *TabCurrent; - UINTN EventIndex; - CHAR16 *TabOutputStr; - - // - // If buffer is not large enough to hold a CHAR16, return minimum buffer size - // - if (*BufferSize < sizeof (CHAR16) * 2) { - *BufferSize = sizeof (CHAR16) * 2; - return (EFI_BUFFER_TOO_SMALL); - } - - Done = FALSE; - CurrentString = Buffer; - StringLen = 0; - StringCurPos = 0; - OutputLength = 0; - Update = 0; - Delete = 0; - LinePos = NewPos = (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory); - InScrolling = FALSE; - InTabScrolling = FALSE; - Status = EFI_SUCCESS; - TabOutputStr = NULL; - TabUpdatePos = 0; - TabCompleteList = NULL; - TabCurrent = NULL; - - // - // Get the screen setting and the current cursor location - // - Column = StartColumn = gST->ConOut->Mode->CursorColumn; - Row = gST->ConOut->Mode->CursorRow; - gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &TotalColumn, &TotalRow); - - // - // Limit the line length to the buffer size or the minimun size of the - // screen. (The smaller takes effect) - // - MaxStr = TotalColumn * (TotalRow - 1) - StartColumn; - if (MaxStr > *BufferSize / sizeof (CHAR16)) { - MaxStr = *BufferSize / sizeof (CHAR16); - } - ZeroMem (CurrentString, MaxStr * sizeof (CHAR16)); - do { - // - // Read a key - // - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR (Status)) { - - if (Status == EFI_NOT_READY) - continue; - - ZeroMem (CurrentString, MaxStr * sizeof(CHAR16)); - StringLen = 0; - break; - } - - // - // Press PageUp or PageDown to scroll the history screen up or down. - // Press any other key to quit scrolling. - // - if (Key.UnicodeChar == 0 && (Key.ScanCode == SCAN_PAGE_UP || Key.ScanCode == SCAN_PAGE_DOWN)) { - if (Key.ScanCode == SCAN_PAGE_UP) { - ConsoleLoggerDisplayHistory(FALSE, 0, ShellInfoObject.ConsoleInfo); - } else if (Key.ScanCode == SCAN_PAGE_DOWN) { - ConsoleLoggerDisplayHistory(TRUE, 0, ShellInfoObject.ConsoleInfo); - } - - InScrolling = TRUE; - } else { - if (InScrolling) { - ConsoleLoggerStopHistory(ShellInfoObject.ConsoleInfo); - InScrolling = FALSE; - } - } - - // - // If we are quitting TAB scrolling... - // - if (InTabScrolling && Key.UnicodeChar != CHAR_TAB) { - if (TabCompleteList != NULL) { - ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList); - DEBUG_CODE(TabCompleteList = NULL;); - } - InTabScrolling = FALSE; - } - - switch (Key.UnicodeChar) { - case CHAR_CARRIAGE_RETURN: - // - // All done, print a newline at the end of the string - // - TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn; - TailColumn = (StringLen - StringCurPos + Column) % TotalColumn; - ShellPrintEx ((INT32)TailColumn, (INT32)TailRow, L"%N\n"); - Done = TRUE; - break; - - case CHAR_BACKSPACE: - if (StringCurPos != 0) { - // - // If not move back beyond string beginning, move all characters behind - // the current position one character forward - // - StringCurPos--; - Update = StringCurPos; - Delete = 1; - CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos)); - - // - // Adjust the current column and row - // - MoveCursorBackward (TotalColumn, &Column, &Row); - } - break; - - case CHAR_TAB: - if (!InTabScrolling) { - TabCurrent = NULL; - // - // Initialize a tab complete operation. - // - Status = CreateTabCompletionList (CurrentString, StringLen, *BufferSize, &TabCompleteList, &TabUpdatePos); - if (!EFI_ERROR(Status)) { - InTabScrolling = TRUE; - } - - // - // We do not set up the replacement. - // The next section will do that. - // - } - - if (InTabScrolling) { - // - // We are in a tab complete operation. - // set up the next replacement. - // - ASSERT(TabCompleteList != NULL); - if (TabCurrent == NULL) { - TabCurrent = (EFI_SHELL_FILE_INFO*) GetFirstNode (&TabCompleteList->Link); - } else { - TabCurrent = (EFI_SHELL_FILE_INFO*) GetNextNode (&TabCompleteList->Link, &TabCurrent->Link); - } - - // - // Skip over the empty list beginning node - // - if (IsNull(&TabCompleteList->Link, &TabCurrent->Link)) { - TabCurrent = (EFI_SHELL_FILE_INFO*) GetNextNode (&TabCompleteList->Link, &TabCurrent->Link); - } - } - break; - - default: - if (Key.UnicodeChar >= ' ') { - // - // If we are at the buffer's end, drop the key - // - if (StringLen == MaxStr - 1 && (ShellInfoObject.ViewingSettings.InsertMode || StringCurPos == StringLen)) { - break; - } - // - // If in insert mode, make space by moving each other character 1 - // space higher in the array - // - if (ShellInfoObject.ViewingSettings.InsertMode) { - CopyMem(CurrentString + StringCurPos + 1, CurrentString + StringCurPos, (StringLen - StringCurPos)*sizeof(CurrentString[0])); - } - - CurrentString[StringCurPos] = Key.UnicodeChar; - Update = StringCurPos; - - StringCurPos += 1; - OutputLength = 1; - } - break; - - case 0: - switch (Key.ScanCode) { - case SCAN_DELETE: - // - // Move characters behind current position one character forward - // - if (StringLen != 0) { - Update = StringCurPos; - Delete = 1; - CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos)); - } - break; - - case SCAN_UP: - // - // Prepare to print the previous command - // - NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link); - if (IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link)) { - NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link); - } - break; - - case SCAN_DOWN: - // - // Prepare to print the next command - // - NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link); - if (NewPos == (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory)) { - NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link); - } - break; - - case SCAN_LEFT: - // - // Adjust current cursor position - // - if (StringCurPos != 0) { - --StringCurPos; - MoveCursorBackward (TotalColumn, &Column, &Row); - } - break; - - case SCAN_RIGHT: - // - // Adjust current cursor position - // - if (StringCurPos < StringLen) { - ++StringCurPos; - MoveCursorForward (TotalColumn, TotalRow, &Column, &Row); - } - break; - - case SCAN_HOME: - // - // Move current cursor position to the beginning of the command line - // - Row -= (StringCurPos + StartColumn) / TotalColumn; - Column = StartColumn; - StringCurPos = 0; - break; - - case SCAN_END: - // - // Move current cursor position to the end of the command line - // - TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn; - TailColumn = (StringLen - StringCurPos + Column) % TotalColumn; - Row = TailRow; - Column = TailColumn; - StringCurPos = StringLen; - break; - - case SCAN_ESC: - // - // Prepare to clear the current command line - // - CurrentString[0] = 0; - Update = 0; - Delete = StringLen; - Row -= (StringCurPos + StartColumn) / TotalColumn; - Column = StartColumn; - OutputLength = 0; - break; - - case SCAN_INSERT: - // - // Toggle the SEnvInsertMode flag - // - ShellInfoObject.ViewingSettings.InsertMode = (BOOLEAN)!ShellInfoObject.ViewingSettings.InsertMode; - break; - - case SCAN_F7: - // - // Print command history - // - PrintCommandHistory (TotalColumn, TotalRow, 4); - *CurrentString = CHAR_NULL; - Done = TRUE; - break; - } - } - - if (Done) { - break; - } - - // - // If we are in auto-complete mode, we are preparing to print - // the next file or directory name - // - if (InTabScrolling) { - TabOutputStr = AllocateZeroPool (*BufferSize); - if (TabOutputStr == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } - } - - if (InTabScrolling && TabOutputStr != NULL) { - - // - // Adjust the column and row to the start of TAB-completion string. - // - Column = (StartColumn + TabUpdatePos) % TotalColumn; - Row -= (StartColumn + StringCurPos) / TotalColumn - (StartColumn + TabUpdatePos) / TotalColumn; - OutputLength = StrLen (TabCurrent->FileName); - // - // if the output string contains blank space, quotation marks L'\"' - // should be added to the output. - // - if (StrStr(TabCurrent->FileName, L" ") != NULL){ - TabOutputStr[0] = L'\"'; - CopyMem (TabOutputStr + 1, TabCurrent->FileName, OutputLength * sizeof (CHAR16)); - TabOutputStr[OutputLength + 1] = L'\"'; - TabOutputStr[OutputLength + 2] = CHAR_NULL; - } else { - CopyMem (TabOutputStr, TabCurrent->FileName, OutputLength * sizeof (CHAR16)); - TabOutputStr[OutputLength] = CHAR_NULL; - } - OutputLength = StrLen (TabOutputStr) < MaxStr - 1 ? StrLen (TabOutputStr) : MaxStr - 1; - CopyMem (CurrentString + TabUpdatePos, TabOutputStr, OutputLength * sizeof (CHAR16)); - CurrentString[TabUpdatePos + OutputLength] = CHAR_NULL; - StringCurPos = TabUpdatePos + OutputLength; - Update = TabUpdatePos; - if (StringLen > TabUpdatePos + OutputLength) { - Delete = StringLen - TabUpdatePos - OutputLength; - } - - FreePool(TabOutputStr); - } - - // - // If we have a new position, we are preparing to print a previous or - // next command. - // - if (NewPos != (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory)) { - Column = StartColumn; - Row -= (StringCurPos + StartColumn) / TotalColumn; - - LinePos = NewPos; - NewPos = (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory); - - OutputLength = StrLen (LinePos->Buffer) < MaxStr - 1 ? StrLen (LinePos->Buffer) : MaxStr - 1; - CopyMem (CurrentString, LinePos->Buffer, OutputLength * sizeof (CHAR16)); - CurrentString[OutputLength] = CHAR_NULL; - - StringCurPos = OutputLength; - - // - // Draw new input string - // - Update = 0; - if (StringLen > OutputLength) { - // - // If old string was longer, blank its tail - // - Delete = StringLen - OutputLength; - } - } - // - // If we need to update the output do so now - // - if (Update != (UINTN) -1) { - ShellPrintEx ((INT32)Column, (INT32)Row, L"%s%.*s", CurrentString + Update, Delete, L""); - StringLen = StrLen (CurrentString); - - if (Delete != 0) { - SetMem (CurrentString + StringLen, Delete * sizeof (CHAR16), CHAR_NULL); - } - - if (StringCurPos > StringLen) { - StringCurPos = StringLen; - } - - Update = (UINTN) -1; - - // - // After using print to reflect newly updates, if we're not using - // BACKSPACE and DELETE, we need to move the cursor position forward, - // so adjust row and column here. - // - if (Key.UnicodeChar != CHAR_BACKSPACE && !(Key.UnicodeChar == 0 && Key.ScanCode == SCAN_DELETE)) { - // - // Calulate row and column of the tail of current string - // - TailRow = Row + (StringLen - StringCurPos + Column + OutputLength) / TotalColumn; - TailColumn = (StringLen - StringCurPos + Column + OutputLength) % TotalColumn; - - // - // If the tail of string reaches screen end, screen rolls up, so if - // Row does not equal TailRow, Row should be decremented - // - // (if we are recalling commands using UPPER and DOWN key, and if the - // old command is too long to fit the screen, TailColumn must be 79. - // - if (TailColumn == 0 && TailRow >= TotalRow && Row != TailRow) { - Row--; - } - // - // Calculate the cursor position after current operation. If cursor - // reaches line end, update both row and column, otherwise, only - // column will be changed. - // - if (Column + OutputLength >= TotalColumn) { - SkipLength = OutputLength - (TotalColumn - Column); - - Row += SkipLength / TotalColumn + 1; - if (Row > TotalRow - 1) { - Row = TotalRow - 1; - } - - Column = SkipLength % TotalColumn; - } else { - Column += OutputLength; - } - } - - Delete = 0; - } - // - // Set the cursor position for this key - // - gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row); - } while (!Done); - - if (CurrentString != NULL && StrLen(CurrentString) > 0) { - // - // add the line to the history buffer - // - AddLineToCommandHistory(CurrentString); - } - - // - // Return the data to the caller - // - *BufferSize = StringLen * sizeof (CHAR16); - - // - // if this was used it should be deallocated by now... - // prevent memory leaks... - // - if (TabCompleteList != NULL) { - ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList); - } - ASSERT(TabCompleteList == NULL); - - return Status; -} - -// -// FILE sytle interfaces for StdIn/StdOut/StdErr -// -EFI_FILE_PROTOCOL FileInterfaceStdIn = { - EFI_FILE_REVISION, - FileInterfaceOpenNotFound, - FileInterfaceNopGeneric, - FileInterfaceNopGeneric, - FileInterfaceStdInRead, - FileInterfaceStdInWrite, - FileInterfaceNopGetPosition, - FileInterfaceNopSetPosition, - FileInterfaceNopGetInfo, - FileInterfaceNopSetInfo, - FileInterfaceNopGeneric -}; - -EFI_FILE_PROTOCOL FileInterfaceStdOut = { - EFI_FILE_REVISION, - FileInterfaceOpenNotFound, - FileInterfaceNopGeneric, - FileInterfaceNopGeneric, - FileInterfaceStdOutRead, - FileInterfaceStdOutWrite, - FileInterfaceNopGetPosition, - FileInterfaceNopSetPosition, - FileInterfaceNopGetInfo, - FileInterfaceNopSetInfo, - FileInterfaceNopGeneric -}; - -EFI_FILE_PROTOCOL FileInterfaceStdErr = { - EFI_FILE_REVISION, - FileInterfaceOpenNotFound, - FileInterfaceNopGeneric, - FileInterfaceNopGeneric, - FileInterfaceStdErrRead, - FileInterfaceStdErrWrite, - FileInterfaceNopGetPosition, - FileInterfaceNopSetPosition, - FileInterfaceNopGetInfo, - FileInterfaceNopSetInfo, - FileInterfaceNopGeneric -}; - -EFI_FILE_PROTOCOL FileInterfaceNulFile = { - EFI_FILE_REVISION, - FileInterfaceOpenNotFound, - FileInterfaceNopGeneric, - FileInterfaceNopGeneric, - FileInterfaceNulRead, - FileInterfaceNulWrite, - FileInterfaceNopGetPosition, - FileInterfaceNopSetPosition, - FileInterfaceNopGetInfo, - FileInterfaceNopSetInfo, - FileInterfaceNopGeneric -}; - - - - -// -// This is identical to EFI_FILE_PROTOCOL except for the additional member -// for the name. -// - -typedef struct { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; - CHAR16 Name[1]; -} EFI_FILE_PROTOCOL_ENVIRONMENT; -//ANSI compliance helper to get size of the struct. -#define SIZE_OF_EFI_FILE_PROTOCOL_ENVIRONMENT EFI_FIELD_OFFSET (EFI_FILE_PROTOCOL_ENVIRONMENT, Name) - -/** - File style interface for Environment Variable (Close). - - Frees the memory for this object. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - - @retval EFI_SUCCESS -**/ -EFI_STATUS -EFIAPI -FileInterfaceEnvClose( - IN EFI_FILE_PROTOCOL *This - ) -{ - VOID* NewBuffer; - UINTN NewSize; - EFI_STATUS Status; - BOOLEAN Volatile; - UINTN TotalSize; - - // - // Most if not all UEFI commands will have an '\r\n' at the end of any output. - // Since the output was redirected to a variable, it does not make sense to - // keep this. So, before closing, strip the trailing '\r\n' from the variable - // if it exists. - // - NewBuffer = NULL; - NewSize = 0; - TotalSize = 0; - - Status = IsVolatileEnv (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &Volatile); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - TotalSize = NewSize + sizeof (CHAR16); - NewBuffer = AllocateZeroPool (TotalSize); - if (NewBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - } - - if (!EFI_ERROR(Status) && NewBuffer != NULL) { - - if (TotalSize / sizeof (CHAR16) >= 3) { - if ( (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 2] == CHAR_LINEFEED) && - (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN) - ) { - ((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL; - // - // If the NewBuffer end with \r\n\0, We will repace '\r' by '\0' and then update TotalSize. - // - TotalSize -= sizeof(CHAR16) * 2; - } - - if (Volatile) { - Status = SHELL_SET_ENVIRONMENT_VARIABLE_V ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - TotalSize - sizeof (CHAR16), - NewBuffer - ); - - if (!EFI_ERROR(Status)) { - Status = ShellAddEnvVarToList ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - NewBuffer, - TotalSize, - EFI_VARIABLE_BOOTSERVICE_ACCESS - ); - } - } else { - Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - TotalSize - sizeof (CHAR16), - NewBuffer - ); - - if (!EFI_ERROR(Status)) { - Status = ShellAddEnvVarToList ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - NewBuffer, - TotalSize, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS - ); - } - } - } - } - - SHELL_FREE_NON_NULL(NewBuffer); - FreePool((EFI_FILE_PROTOCOL_ENVIRONMENT*)This); - return (Status); -} - -/** - File style interface for Environment Variable (Delete). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - - @retval The return value from FileInterfaceEnvClose(). -**/ -EFI_STATUS -EFIAPI -FileInterfaceEnvDelete( - IN EFI_FILE_PROTOCOL *This - ) -{ - SHELL_DELETE_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name); - return (FileInterfaceEnvClose(This)); -} - -/** - File style interface for Environment Variable (Read). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[out] Buffer The pointer to the buffer to fill. - - @retval EFI_SUCCESS The data was read. -**/ -EFI_STATUS -EFIAPI -FileInterfaceEnvRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - EFI_STATUS Status; - - *BufferSize = *BufferSize / sizeof (CHAR16) * sizeof (CHAR16); - if (*BufferSize != 0) { - // - // Make sure the first unicode character is \xFEFF - // - *(CHAR16 *)Buffer = gUnicodeFileTag; - Buffer = (CHAR16 *)Buffer + 1; - *BufferSize -= sizeof (gUnicodeFileTag); - } - - Status = SHELL_GET_ENVIRONMENT_VARIABLE ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - BufferSize, - Buffer - ); - if (!EFI_ERROR (Status) || (Status == EFI_BUFFER_TOO_SMALL)) { - // - // BufferSize is valid and needs update when Status is Success or BufferTooSmall. - // - *BufferSize += sizeof (gUnicodeFileTag); - } - return Status; -} - -/** - File style interface for Volatile Environment Variable (Write). - This function also caches the environment variable into gShellEnvVarList. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @retval EFI_SUCCESS The data was successfully write to variable. - @retval SHELL_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -EFIAPI -FileInterfaceEnvVolWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - VOID* NewBuffer; - UINTN NewSize; - EFI_STATUS Status; - UINTN TotalSize; - - NewBuffer = NULL; - NewSize = 0; - TotalSize = 0; - - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - TotalSize = NewSize + *BufferSize + sizeof (CHAR16); - } else if (Status == EFI_NOT_FOUND) { - TotalSize = *BufferSize + sizeof(CHAR16); - } else { - return Status; - } - - NewBuffer = AllocateZeroPool (TotalSize); - if (NewBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (Status == EFI_BUFFER_TOO_SMALL) { - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - } - - if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) { - FreePool (NewBuffer); - return Status; - } - - CopyMem ((UINT8*)NewBuffer + NewSize, Buffer, *BufferSize); - Status = ShellAddEnvVarToList ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - NewBuffer, - TotalSize, - EFI_VARIABLE_BOOTSERVICE_ACCESS - ); - if (EFI_ERROR(Status)) { - FreePool (NewBuffer); - return Status; - } - - Status = SHELL_SET_ENVIRONMENT_VARIABLE_V ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - TotalSize - sizeof (CHAR16), - NewBuffer - ); - if (EFI_ERROR(Status)) { - ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name); - } - - FreePool (NewBuffer); - return Status; -} - - -/** - File style interface for Non Volatile Environment Variable (Write). - This function also caches the environment variable into gShellEnvVarList. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @retval EFI_SUCCESS The data was successfully write to variable. - @retval SHELL_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -EFIAPI -FileInterfaceEnvNonVolWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - VOID* NewBuffer; - UINTN NewSize; - EFI_STATUS Status; - UINTN TotalSize; - - NewBuffer = NULL; - NewSize = 0; - TotalSize = 0; - - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - TotalSize = NewSize + *BufferSize + sizeof (CHAR16); - } else if (Status == EFI_NOT_FOUND) { - TotalSize = *BufferSize + sizeof (CHAR16); - } else { - return Status; - } - - NewBuffer = AllocateZeroPool (TotalSize); - if (NewBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (Status == EFI_BUFFER_TOO_SMALL) { - Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer); - } - - if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { - FreePool (NewBuffer); - return Status; - } - - CopyMem ((UINT8*) NewBuffer + NewSize, Buffer, *BufferSize); - Status = ShellAddEnvVarToList ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - NewBuffer, - TotalSize, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS - ); - if (EFI_ERROR (Status)) { - FreePool (NewBuffer); - return Status; - } - - Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV ( - ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, - TotalSize - sizeof (CHAR16), - NewBuffer - ); - if (EFI_ERROR (Status)) { - ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name); - } - - FreePool (NewBuffer); - return Status; -} - -/** - Creates a EFI_FILE_PROTOCOL (almost) object for using to access - environment variables through file operations. - - @param EnvName The name of the Environment Variable to be operated on. - - @retval NULL Memory could not be allocated. - @return other a pointer to an EFI_FILE_PROTOCOL structure -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceEnv( - IN CONST CHAR16 *EnvName - ) -{ - EFI_STATUS Status; - EFI_FILE_PROTOCOL_ENVIRONMENT *EnvFileInterface; - UINTN EnvNameSize; - BOOLEAN Volatile; - - if (EnvName == NULL) { - return (NULL); - } - - Status = IsVolatileEnv (EnvName, &Volatile); - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // Get some memory - // - EnvNameSize = StrSize(EnvName); - EnvFileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_ENVIRONMENT)+EnvNameSize); - if (EnvFileInterface == NULL){ - return (NULL); - } - - // - // Assign the generic members - // - EnvFileInterface->Revision = EFI_FILE_REVISION; - EnvFileInterface->Open = FileInterfaceOpenNotFound; - EnvFileInterface->Close = FileInterfaceEnvClose; - EnvFileInterface->GetPosition = FileInterfaceNopGetPosition; - EnvFileInterface->SetPosition = FileInterfaceNopSetPosition; - EnvFileInterface->GetInfo = FileInterfaceNopGetInfo; - EnvFileInterface->SetInfo = FileInterfaceNopSetInfo; - EnvFileInterface->Flush = FileInterfaceNopGeneric; - EnvFileInterface->Delete = FileInterfaceEnvDelete; - EnvFileInterface->Read = FileInterfaceEnvRead; - - CopyMem(EnvFileInterface->Name, EnvName, EnvNameSize); - - // - // Assign the different members for Volatile and Non-Volatile variables - // - if (Volatile) { - EnvFileInterface->Write = FileInterfaceEnvVolWrite; - } else { - EnvFileInterface->Write = FileInterfaceEnvNonVolWrite; - } - return ((EFI_FILE_PROTOCOL *)EnvFileInterface); -} - -/** - Move the cursor position one character backward. - - @param[in] LineLength Length of a line. Get it by calling QueryMode - @param[in, out] Column Current column of the cursor position - @param[in, out] Row Current row of the cursor position -**/ -VOID -MoveCursorBackward ( - IN UINTN LineLength, - IN OUT UINTN *Column, - IN OUT UINTN *Row - ) -{ - // - // If current column is 0, move to the last column of the previous line, - // otherwise, just decrement column. - // - if (*Column == 0) { - *Column = LineLength - 1; - if (*Row > 0) { - (*Row)--; - } - return; - } - (*Column)--; -} - -/** - Move the cursor position one character forward. - - @param[in] LineLength Length of a line. - @param[in] TotalRow Total row of a screen - @param[in, out] Column Current column of the cursor position - @param[in, out] Row Current row of the cursor position -**/ -VOID -MoveCursorForward ( - IN UINTN LineLength, - IN UINTN TotalRow, - IN OUT UINTN *Column, - IN OUT UINTN *Row - ) -{ - // - // Increment Column. - // If this puts column past the end of the line, move to first column - // of the next row. - // - (*Column)++; - if (*Column >= LineLength) { - (*Column) = 0; - if ((*Row) < TotalRow - 1) { - (*Row)++; - } - } -} - -/** - Prints out each previously typed command in the command list history log. - - When each screen is full it will pause for a key before continuing. - - @param[in] TotalCols How many columns are on the screen - @param[in] TotalRows How many rows are on the screen - @param[in] StartColumn which column to start at -**/ -VOID -PrintCommandHistory ( - IN CONST UINTN TotalCols, - IN CONST UINTN TotalRows, - IN CONST UINTN StartColumn - ) -{ - BUFFER_LIST *Node; - UINTN Index; - UINTN LineNumber; - UINTN LineCount; - - ShellPrintEx (-1, -1, L"\n"); - Index = 0; - LineNumber = 0; - // - // go through history list... - // - for ( Node = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link) - ; !IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link) - ; Node = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link) - ){ - Index++; - LineCount = ((StrLen (Node->Buffer) + StartColumn + 1) / TotalCols) + 1; - - if (LineNumber + LineCount >= TotalRows) { - ShellPromptForResponseHii( - ShellPromptResponseTypeEnterContinue, - STRING_TOKEN (STR_SHELL_ENTER_TO_CONT), - ShellInfoObject.HiiHandle, - NULL - ); - LineNumber = 0; - } - ShellPrintEx (-1, -1, L"%2d. %s\n", Index, Node->Buffer); - LineNumber += LineCount; - } -} - - - - - - -// -// This is identical to EFI_FILE_PROTOCOL except for the additional members -// for the buffer, size, and position. -// - -typedef struct { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; - VOID *Buffer; - UINT64 Position; - UINT64 BufferSize; - BOOLEAN Unicode; - UINT64 FileSize; -} EFI_FILE_PROTOCOL_MEM; - -/** - File style interface for Mem (SetPosition). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[out] Position The position to set. - - @retval EFI_SUCCESS The position was successfully changed. - @retval EFI_INVALID_PARAMETER The Position was invalid. -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemSetPosition( - IN EFI_FILE_PROTOCOL *This, - OUT UINT64 Position - ) -{ - if (Position <= ((EFI_FILE_PROTOCOL_MEM*)This)->FileSize) { - ((EFI_FILE_PROTOCOL_MEM*)This)->Position = Position; - return (EFI_SUCCESS); - } else { - return (EFI_INVALID_PARAMETER); - } -} - -/** - File style interface for Mem (GetPosition). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[out] Position The pointer to the position. - - @retval EFI_SUCCESS The position was retrieved. -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemGetPosition( - IN EFI_FILE_PROTOCOL *This, - OUT UINT64 *Position - ) -{ - *Position = ((EFI_FILE_PROTOCOL_MEM*)This)->Position; - return (EFI_SUCCESS); -} - -/** - File style interface for Mem (GetInfo). - - @param This Protocol instance pointer. - @param InformationType Type of information to return in Buffer. - @param BufferSize On input size of buffer, on output amount of data in buffer. - @param Buffer The buffer to return data. - - @retval EFI_SUCCESS Data was returned. - @retval EFI_UNSUPPORT InformationType is not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - @retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in BufferSize. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemGetInfo( - IN EFI_FILE_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - EFI_FILE_INFO *FileInfo; - - if (CompareGuid (InformationType, &gEfiFileInfoGuid)) { - if (*BufferSize < sizeof (EFI_FILE_INFO)) { - *BufferSize = sizeof (EFI_FILE_INFO); - return EFI_BUFFER_TOO_SMALL; - } - if (Buffer == NULL) { - return EFI_INVALID_PARAMETER; - } - FileInfo = (EFI_FILE_INFO *)Buffer; - FileInfo->Size = sizeof (*FileInfo); - ZeroMem (FileInfo, sizeof (*FileInfo)); - FileInfo->FileSize = ((EFI_FILE_PROTOCOL_MEM*)This)->FileSize; - FileInfo->PhysicalSize = FileInfo->FileSize; - return EFI_SUCCESS; - } - - return EFI_UNSUPPORTED; -} - -/** - File style interface for Mem (Write). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @retval EFI_OUT_OF_RESOURCES The operation failed due to lack of resources. - @retval EFI_SUCCESS The data was written. -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - CHAR8 *AsciiBuffer; - EFI_FILE_PROTOCOL_MEM *MemFile; - - MemFile = (EFI_FILE_PROTOCOL_MEM *) This; - if (MemFile->Unicode) { - // - // Unicode - // - if ((UINTN)(MemFile->Position + (*BufferSize)) > (UINTN)(MemFile->BufferSize)) { - MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer); - MemFile->BufferSize += (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD; - } - CopyMem(((UINT8*)MemFile->Buffer) + MemFile->Position, Buffer, *BufferSize); - MemFile->Position += (*BufferSize); - MemFile->FileSize = MemFile->Position; - return (EFI_SUCCESS); - } else { - // - // Ascii - // - AsciiBuffer = AllocateZeroPool(*BufferSize); - if (AsciiBuffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - AsciiSPrint(AsciiBuffer, *BufferSize, "%S", Buffer); - if ((UINTN)(MemFile->Position + AsciiStrSize(AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) { - MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer); - MemFile->BufferSize += AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD; - } - CopyMem(((UINT8*)MemFile->Buffer) + MemFile->Position, AsciiBuffer, AsciiStrSize(AsciiBuffer)); - MemFile->Position += (*BufferSize / sizeof(CHAR16)); - MemFile->FileSize = MemFile->Position; - FreePool(AsciiBuffer); - return (EFI_SUCCESS); - } -} - -/** - File style interface for Mem (Read). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to fill. - - @retval EFI_SUCCESS The data was read. -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - EFI_FILE_PROTOCOL_MEM *MemFile; - - MemFile = (EFI_FILE_PROTOCOL_MEM *) This; - if (*BufferSize > (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position))) { - (*BufferSize) = (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position)); - } - CopyMem(Buffer, ((UINT8*)MemFile->Buffer) + MemFile->Position, (*BufferSize)); - MemFile->Position = MemFile->Position + (*BufferSize); - return (EFI_SUCCESS); -} - -/** - File style interface for Mem (Close). - - Frees all memory associated with this object. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - - @retval EFI_SUCCESS The 'file' was closed. -**/ -EFI_STATUS -EFIAPI -FileInterfaceMemClose( - IN EFI_FILE_PROTOCOL *This - ) -{ - SHELL_FREE_NON_NULL(((EFI_FILE_PROTOCOL_MEM*)This)->Buffer); - SHELL_FREE_NON_NULL(This); - return (EFI_SUCCESS); -} - -/** - Creates a EFI_FILE_PROTOCOL (almost) object for using to access - a file entirely in memory through file operations. - - @param[in] Unicode Boolean value with TRUE for Unicode and FALSE for Ascii. - - @retval NULL Memory could not be allocated. - @return other A pointer to an EFI_FILE_PROTOCOL structure. -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceMem( - IN CONST BOOLEAN Unicode - ) -{ - EFI_FILE_PROTOCOL_MEM *FileInterface; - - // - // Get some memory - // - FileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_MEM)); - if (FileInterface == NULL){ - return (NULL); - } - - // - // Assign the generic members - // - FileInterface->Revision = EFI_FILE_REVISION; - FileInterface->Open = FileInterfaceOpenNotFound; - FileInterface->Close = FileInterfaceMemClose; - FileInterface->GetPosition = FileInterfaceMemGetPosition; - FileInterface->SetPosition = FileInterfaceMemSetPosition; - FileInterface->GetInfo = FileInterfaceMemGetInfo; - FileInterface->SetInfo = FileInterfaceNopSetInfo; - FileInterface->Flush = FileInterfaceNopGeneric; - FileInterface->Delete = FileInterfaceNopGeneric; - FileInterface->Read = FileInterfaceMemRead; - FileInterface->Write = FileInterfaceMemWrite; - FileInterface->Unicode = Unicode; - - ASSERT(FileInterface->Buffer == NULL); - ASSERT(FileInterface->BufferSize == 0); - ASSERT(FileInterface->Position == 0); - - if (Unicode) { - FileInterface->Buffer = AllocateZeroPool(sizeof(gUnicodeFileTag)); - if (FileInterface->Buffer == NULL) { - FreePool (FileInterface); - return NULL; - } - *((CHAR16 *) (FileInterface->Buffer)) = EFI_UNICODE_BYTE_ORDER_MARK; - FileInterface->BufferSize = 2; - FileInterface->Position = 2; - } - - return ((EFI_FILE_PROTOCOL *)FileInterface); -} - -typedef struct { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; - BOOLEAN Unicode; - EFI_FILE_PROTOCOL *Orig; -} EFI_FILE_PROTOCOL_FILE; - -/** - Set a files current position - - @param This Protocol instance pointer. - @param Position Byte position from the start of the file. - - @retval EFI_SUCCESS Data was written. - @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileSetPosition( - IN EFI_FILE_PROTOCOL *This, - IN UINT64 Position - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position); -} - -/** - Get a file's current position - - @param This Protocol instance pointer. - @param Position Byte position from the start of the file. - - @retval EFI_SUCCESS Data was written. - @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileGetPosition( - IN EFI_FILE_PROTOCOL *This, - OUT UINT64 *Position - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position); -} - -/** - Get information about a file. - - @param This Protocol instance pointer. - @param InformationType Type of information to return in Buffer. - @param BufferSize On input size of buffer, on output amount of data in buffer. - @param Buffer The buffer to return data. - - @retval EFI_SUCCESS Data was returned. - @retval EFI_UNSUPPORT InformationType is not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - @retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in BufferSize. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileGetInfo( - IN EFI_FILE_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer); -} - -/** - Set information about a file - - @param This Protocol instance pointer. - @param InformationType Type of information in Buffer. - @param BufferSize Size of buffer. - @param Buffer The data to write. - - @retval EFI_SUCCESS Data was returned. - @retval EFI_UNSUPPORT InformationType is not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileSetInfo( - IN EFI_FILE_PROTOCOL *This, - IN EFI_GUID *InformationType, - IN UINTN BufferSize, - IN VOID *Buffer - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer); -} - -/** - Flush data back for the file handle. - - @param This Protocol instance pointer. - - @retval EFI_SUCCESS Data was written. - @retval EFI_UNSUPPORT Writes to Open directory are not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - @retval EFI_VOLUME_FULL The volume is full. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileFlush( - IN EFI_FILE_PROTOCOL *This - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Flush(((EFI_FILE_PROTOCOL_FILE*)This)->Orig); -} - -/** - Read data from the file. - - @param This Protocol instance pointer. - @param BufferSize On input size of buffer, on output amount of data in buffer. - @param Buffer The buffer in which data is read. - - @retval EFI_SUCCESS Data was read. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileRead( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - EFI_STATUS Status; - UINT64 Position; - CHAR8 *AsciiStrBuffer; - CHAR16 *UscStrBuffer; - UINTN Size; - if (((EFI_FILE_PROTOCOL_FILE*)This)->Unicode) { - // - // Unicode - // There might be different file tag for the Unicode file. We cannot unconditionally insert the \xFEFF. - // So we choose to leave the file content as is. - // - return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer)); - } else { - // - // Ascii - // - *BufferSize = *BufferSize / sizeof (CHAR16) * sizeof (CHAR16); - if (*BufferSize == 0) { - return EFI_SUCCESS; - } - Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Position); - if (EFI_ERROR (Status)) { - return Status; - } - if (Position == 0) { - // - // First two bytes in Buffer is for the Unicode file tag. - // - *(CHAR16 *)Buffer = gUnicodeFileTag; - Buffer = (CHAR16 *)Buffer + 1; - Size = *BufferSize / sizeof (CHAR16) - 1; - } else { - Size = *BufferSize / sizeof (CHAR16); - } - AsciiStrBuffer = AllocateZeroPool (Size + 1); - if (AsciiStrBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - UscStrBuffer = AllocateZeroPool ((Size + 1) * sizeof(CHAR16)); - if (UscStrBuffer== NULL) { - SHELL_FREE_NON_NULL(AsciiStrBuffer); - return EFI_OUT_OF_RESOURCES; - } - Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiStrBuffer); - if (!EFI_ERROR(Status)) { - AsciiStrToUnicodeStrS (AsciiStrBuffer, UscStrBuffer, Size + 1); - *BufferSize = Size * sizeof (CHAR16); - CopyMem (Buffer, UscStrBuffer, *BufferSize); - } - SHELL_FREE_NON_NULL (AsciiStrBuffer); - SHELL_FREE_NON_NULL (UscStrBuffer); - return Status; - } -} - -/** - Opens a new file relative to the source file's location. - - @param[in] This The protocol instance pointer. - @param[out] NewHandle Returns File Handle for FileName. - @param[in] FileName Null terminated string. "\", ".", and ".." are supported. - @param[in] OpenMode Open mode for file. - @param[in] Attributes Only used for EFI_FILE_MODE_CREATE. - - @retval EFI_SUCCESS The device was opened. - @retval EFI_NOT_FOUND The specified file could not be found on the device. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_MEDIA_CHANGED The media has changed. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_ACCESS_DENIED The service denied access to the file. - @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileOpen ( - IN EFI_FILE_PROTOCOL *This, - OUT EFI_FILE_PROTOCOL **NewHandle, - IN CHAR16 *FileName, - IN UINT64 OpenMode, - IN UINT64 Attributes - ) -{ - return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Open(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, NewHandle, FileName, OpenMode, Attributes); -} - -/** - Close and delete the file handle. - - @param This Protocol instance pointer. - - @retval EFI_SUCCESS The device was opened. - @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted. - -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileDelete( - IN EFI_FILE_PROTOCOL *This - ) -{ - EFI_STATUS Status; - Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Delete(((EFI_FILE_PROTOCOL_FILE*)This)->Orig); - FreePool(This); - return (Status); -} - -/** - File style interface for File (Close). - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - - @retval EFI_SUCCESS The file was closed. -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileClose( - IN EFI_FILE_PROTOCOL *This - ) -{ - EFI_STATUS Status; - Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Close(((EFI_FILE_PROTOCOL_FILE*)This)->Orig); - FreePool(This); - return (Status); -} - -/** - File style interface for File (Write). - - If the file was opened with ASCII mode the data will be processed through - AsciiSPrint before writing. - - @param[in] This The pointer to the EFI_FILE_PROTOCOL object. - @param[in, out] BufferSize Size in bytes of Buffer. - @param[in] Buffer The pointer to the buffer to write. - - @retval EFI_SUCCESS The data was written. -**/ -EFI_STATUS -EFIAPI -FileInterfaceFileWrite( - IN EFI_FILE_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - CHAR8 *AsciiBuffer; - UINTN Size; - EFI_STATUS Status; - if (((EFI_FILE_PROTOCOL_FILE*)This)->Unicode) { - // - // Unicode - // - return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer)); - } else { - // - // Ascii - // - AsciiBuffer = AllocateZeroPool(*BufferSize); - AsciiSPrint(AsciiBuffer, *BufferSize, "%S", Buffer); - Size = AsciiStrSize(AsciiBuffer) - 1; // (we dont need the null terminator) - Status = (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiBuffer)); - FreePool(AsciiBuffer); - return (Status); - } -} - -/** - Create a file interface with unicode information. - - This will create a new EFI_FILE_PROTOCOL identical to the Templace - except that the new one has Unicode and Ascii knowledge. - - @param[in] Template A pointer to the EFI_FILE_PROTOCOL object. - @param[in] Unicode TRUE for UCS-2, FALSE for ASCII. - - @return a new EFI_FILE_PROTOCOL object to be used instead of the template. -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceFile( - IN CONST EFI_FILE_PROTOCOL *Template, - IN CONST BOOLEAN Unicode - ) -{ - EFI_FILE_PROTOCOL_FILE *NewOne; - - NewOne = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_FILE)); - if (NewOne == NULL) { - return (NULL); - } - CopyMem(NewOne, Template, sizeof(EFI_FILE_PROTOCOL_FILE)); - NewOne->Orig = (EFI_FILE_PROTOCOL *)Template; - NewOne->Unicode = Unicode; - NewOne->Open = FileInterfaceFileOpen; - NewOne->Close = FileInterfaceFileClose; - NewOne->Delete = FileInterfaceFileDelete; - NewOne->Read = FileInterfaceFileRead; - NewOne->Write = FileInterfaceFileWrite; - NewOne->GetPosition = FileInterfaceFileGetPosition; - NewOne->SetPosition = FileInterfaceFileSetPosition; - NewOne->GetInfo = FileInterfaceFileGetInfo; - NewOne->SetInfo = FileInterfaceFileSetInfo; - NewOne->Flush = FileInterfaceFileFlush; - - return ((EFI_FILE_PROTOCOL *)NewOne); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.h deleted file mode 100644 index b1bf7cd..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/FileHandleWrappers.h +++ /dev/null @@ -1,93 +0,0 @@ -/** @file - EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables, StdIn, StdOut, StdErr, etc...) - - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_FILE_HANDLE_WRAPPERS_HEADER_ -#define _SHELL_FILE_HANDLE_WRAPPERS_HEADER_ - -typedef struct { - LIST_ENTRY Link; - CHAR16* Buffer; -} SHELL_LINE_LIST; - -typedef struct { - UINTN LogCount; - SHELL_LINE_LIST *Log; -} SHELL_LINE_LOG; - -/// -/// FILE sytle interfaces for StdIn. -/// -extern EFI_FILE_PROTOCOL FileInterfaceStdIn; - -/// -/// FILE sytle interfaces for StdOut. -/// -extern EFI_FILE_PROTOCOL FileInterfaceStdOut; - -/// -/// FILE sytle interfaces for StdErr. -/// -extern EFI_FILE_PROTOCOL FileInterfaceStdErr; - -/// -/// FILE style interface for NUL file. -/// -extern EFI_FILE_PROTOCOL FileInterfaceNulFile; - -/** - Creates a EFI_FILE_PROTOCOL (almost) object for using to access - environment variables through file operations. - - @param EnvName The name of the Environment Variable to be operated on. - - @retval NULL Memory could not be allocated. - @return other a pointer to an EFI_FILE_PROTOCOL structure -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceEnv( - CONST CHAR16 *EnvName - ); - -/** - Creates a EFI_FILE_PROTOCOL (almost) object for using to access - a file entirely in memory through file operations. - - @param[in] Unicode TRUE if the data is UNICODE, FALSE otherwise. - - @retval NULL Memory could not be allocated. - @return other a pointer to an EFI_FILE_PROTOCOL structure -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceMem( - IN CONST BOOLEAN Unicode - ); - -/** - Creates a EFI_FILE_PROTOCOL (almost) object for using to access - a file entirely with unicode awareness through file operations. - - @param[in] Template The pointer to the handle to start with. - @param[in] Unicode TRUE if the data is UNICODE, FALSE otherwise. - - @retval NULL Memory could not be allocated. - @return other a pointer to an EFI_FILE_PROTOCOL structure -**/ -EFI_FILE_PROTOCOL* -CreateFileInterfaceFile( - IN CONST EFI_FILE_PROTOCOL *Template, - IN CONST BOOLEAN Unicode - ); - -#endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.c deleted file mode 100644 index 23e6b9c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.c +++ /dev/null @@ -1,3189 +0,0 @@ -/** @file - This is THE shell (application) - - Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
- (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
- Copyright 2015-2018 Dell Technologies.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -// -// Initialize the global structure -// -SHELL_INFO ShellInfoObject = { - NULL, - NULL, - FALSE, - FALSE, - { - {{ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - }}, - 0, - NULL, - NULL - }, - {{NULL, NULL}, NULL}, - { - {{NULL, NULL}, NULL}, - 0, - 0, - TRUE - }, - NULL, - 0, - NULL, - NULL, - NULL, - NULL, - NULL, - {{NULL, NULL}, NULL, NULL}, - {{NULL, NULL}, NULL, NULL}, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - FALSE -}; - -STATIC CONST CHAR16 mScriptExtension[] = L".NSH"; -STATIC CONST CHAR16 mExecutableExtensions[] = L".NSH;.EFI"; -STATIC CONST CHAR16 mStartupScript[] = L"startup.nsh"; -CONST CHAR16 mNoNestingEnvVarName[] = L"nonesting"; -CONST CHAR16 mNoNestingTrue[] = L"True"; -CONST CHAR16 mNoNestingFalse[] = L"False"; - -/** - Cleans off leading and trailing spaces and tabs. - - @param[in] String pointer to the string to trim them off. -**/ -EFI_STATUS -TrimSpaces( - IN CHAR16 **String - ) -{ - ASSERT(String != NULL); - ASSERT(*String!= NULL); - // - // Remove any spaces and tabs at the beginning of the (*String). - // - while (((*String)[0] == L' ') || ((*String)[0] == L'\t')) { - CopyMem((*String), (*String)+1, StrSize((*String)) - sizeof((*String)[0])); - } - - // - // Remove any spaces and tabs at the end of the (*String). - // - while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') || ((*String)[StrLen((*String))-1] == L'\t'))) { - (*String)[StrLen((*String))-1] = CHAR_NULL; - } - - return (EFI_SUCCESS); -} - -/** - Parse for the next instance of one string within another string. Can optionally make sure that - the string was not escaped (^ character) per the shell specification. - - @param[in] SourceString The string to search within - @param[in] FindString The string to look for - @param[in] CheckForEscapeCharacter TRUE to skip escaped instances of FinfString, otherwise will return even escaped instances -**/ -CHAR16* -FindNextInstance( - IN CONST CHAR16 *SourceString, - IN CONST CHAR16 *FindString, - IN CONST BOOLEAN CheckForEscapeCharacter - ) -{ - CHAR16 *Temp; - if (SourceString == NULL) { - return (NULL); - } - Temp = StrStr(SourceString, FindString); - - // - // If nothing found, or we don't care about escape characters - // - if (Temp == NULL || !CheckForEscapeCharacter) { - return (Temp); - } - - // - // If we found an escaped character, try again on the remainder of the string - // - if ((Temp > (SourceString)) && *(Temp-1) == L'^') { - return FindNextInstance(Temp+1, FindString, CheckForEscapeCharacter); - } - - // - // we found the right character - // - return (Temp); -} - -/** - Check whether the string between a pair of % is a valid environment variable name. - - @param[in] BeginPercent pointer to the first percent. - @param[in] EndPercent pointer to the last percent. - - @retval TRUE is a valid environment variable name. - @retval FALSE is NOT a valid environment variable name. -**/ -BOOLEAN -IsValidEnvironmentVariableName( - IN CONST CHAR16 *BeginPercent, - IN CONST CHAR16 *EndPercent - ) -{ - CONST CHAR16 *Walker; - - Walker = NULL; - - ASSERT (BeginPercent != NULL); - ASSERT (EndPercent != NULL); - ASSERT (BeginPercent < EndPercent); - - if ((BeginPercent + 1) == EndPercent) { - return FALSE; - } - - for (Walker = BeginPercent + 1; Walker < EndPercent; Walker++) { - if ( - (*Walker >= L'0' && *Walker <= L'9') || - (*Walker >= L'A' && *Walker <= L'Z') || - (*Walker >= L'a' && *Walker <= L'z') || - (*Walker == L'_') - ) { - if (Walker == BeginPercent + 1 && (*Walker >= L'0' && *Walker <= L'9')) { - return FALSE; - } else { - continue; - } - } else { - return FALSE; - } - } - - return TRUE; -} - -/** - Determine if a command line contains a split operation - - @param[in] CmdLine The command line to parse. - - @retval TRUE CmdLine has a valid split. - @retval FALSE CmdLine does not have a valid split. -**/ -BOOLEAN -ContainsSplit( - IN CONST CHAR16 *CmdLine - ) -{ - CONST CHAR16 *TempSpot; - CONST CHAR16 *FirstQuote; - CONST CHAR16 *SecondQuote; - - FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE); - SecondQuote = NULL; - TempSpot = FindFirstCharacter(CmdLine, L"|", L'^'); - - if (FirstQuote == NULL || - TempSpot == NULL || - TempSpot == CHAR_NULL || - FirstQuote > TempSpot - ) { - return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)); - } - - while ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)) { - if (FirstQuote == NULL || FirstQuote > TempSpot) { - break; - } - SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE); - if (SecondQuote == NULL) { - break; - } - if (SecondQuote < TempSpot) { - FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE); - continue; - } else { - FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE); - TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^'); - continue; - } - } - - return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)); -} - -/** - Function to start monitoring for CTRL-S using SimpleTextInputEx. This - feature's enabled state was not known when the shell initially launched. - - @retval EFI_SUCCESS The feature is enabled. - @retval EFI_OUT_OF_RESOURCES There is not enough memory available. -**/ -EFI_STATUS -InternalEfiShellStartCtrlSMonitor( - VOID - ) -{ - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx; - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - - Status = gBS->OpenProtocol( - gST->ConsoleInHandle, - &gEfiSimpleTextInputExProtocolGuid, - (VOID**)&SimpleEx, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SHELL_NO_IN_EX), - ShellInfoObject.HiiHandle); - return (EFI_SUCCESS); - } - - KeyData.KeyState.KeyToggleState = 0; - KeyData.Key.ScanCode = 0; - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED; - KeyData.Key.UnicodeChar = L's'; - - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlSNotifyHandle1); - - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED; - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlSNotifyHandle2); - } - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED; - KeyData.Key.UnicodeChar = 19; - - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlSNotifyHandle3); - } - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED; - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlSNotifyHandle4); - } - return (Status); -} - - - -/** - The entry point for the application. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The entry point is executed successfully. - @retval other Some error occurs when executing this entry point. - -**/ -EFI_STATUS -EFIAPI -UefiMain ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - CHAR16 *TempString; - UINTN Size; - EFI_HANDLE ConInHandle; - EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn; - SPLIT_LIST *Split; - - if (PcdGet8(PcdShellSupportLevel) > 3) { - return (EFI_UNSUPPORTED); - } - - // - // Clear the screen - // - Status = gST->ConOut->ClearScreen(gST->ConOut); - if (EFI_ERROR(Status)) { - return (Status); - } - - // - // Populate the global structure from PCDs - // - ShellInfoObject.ImageDevPath = NULL; - ShellInfoObject.FileDevPath = NULL; - ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault); - ShellInfoObject.ViewingSettings.InsertMode = PcdGetBool(PcdShellInsertModeDefault); - ShellInfoObject.LogScreenCount = PcdGet8 (PcdShellScreenLogCount ); - - // - // verify we dont allow for spec violation - // - ASSERT(ShellInfoObject.LogScreenCount >= 3); - - // - // Initialize the LIST ENTRY objects... - // - InitializeListHead(&ShellInfoObject.BufferToFreeList.Link); - InitializeListHead(&ShellInfoObject.ViewingSettings.CommandHistory.Link); - InitializeListHead(&ShellInfoObject.SplitList.Link); - - // - // Check PCDs for optional features that are not implemented yet. - // - if ( PcdGetBool(PcdShellSupportOldProtocols) - || !FeaturePcdGet(PcdShellRequireHiiPlatform) - || FeaturePcdGet(PcdShellSupportFrameworkHii) - ) { - return (EFI_UNSUPPORTED); - } - - // - // turn off the watchdog timer - // - gBS->SetWatchdogTimer (0, 0, 0, NULL); - - // - // install our console logger. This will keep a log of the output for back-browsing - // - Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo); - if (!EFI_ERROR(Status)) { - // - // Enable the cursor to be visible - // - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - // - // If supporting EFI 1.1 we need to install HII protocol - // only do this if PcdShellRequireHiiPlatform == FALSE - // - // remove EFI_UNSUPPORTED check above when complete. - ///@todo add support for Framework HII - - // - // install our (solitary) HII package - // - ShellInfoObject.HiiHandle = HiiAddPackages (&gEfiCallerIdGuid, gImageHandle, ShellStrings, NULL); - if (ShellInfoObject.HiiHandle == NULL) { - if (PcdGetBool(PcdShellSupportFrameworkHii)) { - ///@todo Add our package into Framework HII - } - if (ShellInfoObject.HiiHandle == NULL) { - Status = EFI_NOT_STARTED; - goto FreeResources; - } - } - - // - // create and install the EfiShellParametersProtocol - // - Status = CreatePopulateInstallShellParametersProtocol(&ShellInfoObject.NewShellParametersProtocol, &ShellInfoObject.RootShellInstance); - ASSERT_EFI_ERROR(Status); - ASSERT(ShellInfoObject.NewShellParametersProtocol != NULL); - - // - // create and install the EfiShellProtocol - // - Status = CreatePopulateInstallShellProtocol(&ShellInfoObject.NewEfiShellProtocol); - ASSERT_EFI_ERROR(Status); - ASSERT(ShellInfoObject.NewEfiShellProtocol != NULL); - - // - // Now initialize the shell library (it requires Shell Parameters protocol) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - Status = ShellInitEnvVarList (); - - // - // Check the command line - // - Status = ProcessCommandLine (); - if (EFI_ERROR (Status)) { - goto FreeResources; - } - - // - // If shell support level is >= 1 create the mappings and paths - // - if (PcdGet8(PcdShellSupportLevel) >= 1) { - Status = ShellCommandCreateInitialMappingsAndPaths(); - } - - // - // Set the environment variable for nesting support - // - Size = 0; - TempString = NULL; - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest) { - // - // No change. require nesting in Shell Protocol Execute() - // - StrnCatGrow(&TempString, - &Size, - L"False", - 0); - } else { - StrnCatGrow(&TempString, - &Size, - mNoNestingTrue, - 0); - } - Status = InternalEfiShellSetEnv(mNoNestingEnvVarName, TempString, TRUE); - SHELL_FREE_NON_NULL(TempString); - Size = 0; - - // - // save the device path for the loaded image and the device path for the filepath (under loaded image) - // These are where to look for the startup.nsh file - // - Status = GetDevicePathsForImageAndFile(&ShellInfoObject.ImageDevPath, &ShellInfoObject.FileDevPath); - ASSERT_EFI_ERROR(Status); - - // - // Display the version - // - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion) { - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_MAIN_SHELL), - ShellInfoObject.HiiHandle, - SupportLevel[PcdGet8(PcdShellSupportLevel)], - gEfiShellProtocol->MajorVersion, - gEfiShellProtocol->MinorVersion - ); - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_MAIN_SUPPLIER), - ShellInfoObject.HiiHandle, - (CHAR16 *) PcdGetPtr (PcdShellSupplier) - ); - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_MAIN_UEFI), - ShellInfoObject.HiiHandle, - (gST->Hdr.Revision&0xffff0000)>>16, - (gST->Hdr.Revision&0x0000ffff), - gST->FirmwareVendor, - gST->FirmwareRevision - ); - } - - // - // Display the mapping - // - if (PcdGet8(PcdShellSupportLevel) >= 2 && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) { - Status = RunCommand(L"map"); - ASSERT_EFI_ERROR(Status); - } - - // - // init all the built in alias' - // - Status = SetBuiltInAlias(); - ASSERT_EFI_ERROR(Status); - - // - // Initialize environment variables - // - if (ShellCommandGetProfileList() != NULL) { - Status = InternalEfiShellSetEnv(L"profiles", ShellCommandGetProfileList(), TRUE); - ASSERT_EFI_ERROR(Status); - } - - Size = 100; - TempString = AllocateZeroPool(Size); - - UnicodeSPrint(TempString, Size, L"%d", PcdGet8(PcdShellSupportLevel)); - Status = InternalEfiShellSetEnv(L"uefishellsupport", TempString, TRUE); - ASSERT_EFI_ERROR(Status); - - UnicodeSPrint(TempString, Size, L"%d.%d", ShellInfoObject.NewEfiShellProtocol->MajorVersion, ShellInfoObject.NewEfiShellProtocol->MinorVersion); - Status = InternalEfiShellSetEnv(L"uefishellversion", TempString, TRUE); - ASSERT_EFI_ERROR(Status); - - UnicodeSPrint(TempString, Size, L"%d.%d", (gST->Hdr.Revision & 0xFFFF0000) >> 16, gST->Hdr.Revision & 0x0000FFFF); - Status = InternalEfiShellSetEnv(L"uefiversion", TempString, TRUE); - ASSERT_EFI_ERROR(Status); - - FreePool(TempString); - - if (!EFI_ERROR(Status)) { - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt) { - // - // Set up the event for CTRL-C monitoring... - // - Status = InernalEfiShellStartMonitor(); - } - - if (!EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) { - // - // Set up the event for CTRL-S monitoring... - // - Status = InternalEfiShellStartCtrlSMonitor(); - } - - if (!EFI_ERROR(Status) && ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) { - // - // close off the gST->ConIn - // - OldConIn = gST->ConIn; - ConInHandle = gST->ConsoleInHandle; - gST->ConIn = CreateSimpleTextInOnFile((SHELL_FILE_HANDLE)&FileInterfaceNulFile, &gST->ConsoleInHandle); - } else { - OldConIn = NULL; - ConInHandle = NULL; - } - - if (!EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) { - // - // process the startup script or launch the called app. - // - Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath); - } - - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) { - // - // begin the UI waiting loop - // - do { - // - // clean out all the memory allocated for CONST * return values - // between each shell prompt presentation - // - if (!IsListEmpty(&ShellInfoObject.BufferToFreeList.Link)){ - FreeBufferList(&ShellInfoObject.BufferToFreeList); - } - - // - // Reset page break back to default. - // - ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault); - ASSERT (ShellInfoObject.ConsoleInfo != NULL); - ShellInfoObject.ConsoleInfo->Enabled = TRUE; - ShellInfoObject.ConsoleInfo->RowCounter = 0; - - // - // Display Prompt - // - Status = DoShellPrompt(); - } while (!ShellCommandGetExit()); - } - if (OldConIn != NULL && ConInHandle != NULL) { - CloseSimpleTextInOnFile (gST->ConIn); - gST->ConIn = OldConIn; - gST->ConsoleInHandle = ConInHandle; - } - } - } - -FreeResources: - // - // uninstall protocols / free memory / etc... - // - if (ShellInfoObject.UserBreakTimer != NULL) { - gBS->CloseEvent(ShellInfoObject.UserBreakTimer); - DEBUG_CODE(ShellInfoObject.UserBreakTimer = NULL;); - } - if (ShellInfoObject.ImageDevPath != NULL) { - FreePool(ShellInfoObject.ImageDevPath); - DEBUG_CODE(ShellInfoObject.ImageDevPath = NULL;); - } - if (ShellInfoObject.FileDevPath != NULL) { - FreePool(ShellInfoObject.FileDevPath); - DEBUG_CODE(ShellInfoObject.FileDevPath = NULL;); - } - if (ShellInfoObject.NewShellParametersProtocol != NULL) { - CleanUpShellParametersProtocol(ShellInfoObject.NewShellParametersProtocol); - DEBUG_CODE(ShellInfoObject.NewShellParametersProtocol = NULL;); - } - if (ShellInfoObject.NewEfiShellProtocol != NULL){ - if (ShellInfoObject.NewEfiShellProtocol->IsRootShell()){ - InternalEfiShellSetEnv(L"cwd", NULL, TRUE); - } - CleanUpShellEnvironment (ShellInfoObject.NewEfiShellProtocol); - DEBUG_CODE(ShellInfoObject.NewEfiShellProtocol = NULL;); - } - - if (!IsListEmpty(&ShellInfoObject.BufferToFreeList.Link)){ - FreeBufferList(&ShellInfoObject.BufferToFreeList); - } - - if (!IsListEmpty(&ShellInfoObject.SplitList.Link)){ - ASSERT(FALSE); ///@todo finish this de-allocation (free SplitStdIn/Out when needed). - - for ( Split = (SPLIT_LIST*)GetFirstNode (&ShellInfoObject.SplitList.Link) - ; !IsNull (&ShellInfoObject.SplitList.Link, &Split->Link) - ; Split = (SPLIT_LIST *)GetNextNode (&ShellInfoObject.SplitList.Link, &Split->Link) - ) { - RemoveEntryList (&Split->Link); - FreePool (Split); - } - - DEBUG_CODE (InitializeListHead (&ShellInfoObject.SplitList.Link);); - } - - if (ShellInfoObject.ShellInitSettings.FileName != NULL) { - FreePool(ShellInfoObject.ShellInitSettings.FileName); - DEBUG_CODE(ShellInfoObject.ShellInitSettings.FileName = NULL;); - } - - if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) { - FreePool(ShellInfoObject.ShellInitSettings.FileOptions); - DEBUG_CODE(ShellInfoObject.ShellInitSettings.FileOptions = NULL;); - } - - if (ShellInfoObject.HiiHandle != NULL) { - HiiRemovePackages(ShellInfoObject.HiiHandle); - DEBUG_CODE(ShellInfoObject.HiiHandle = NULL;); - } - - if (!IsListEmpty(&ShellInfoObject.ViewingSettings.CommandHistory.Link)){ - FreeBufferList(&ShellInfoObject.ViewingSettings.CommandHistory); - } - - ASSERT(ShellInfoObject.ConsoleInfo != NULL); - if (ShellInfoObject.ConsoleInfo != NULL) { - ConsoleLoggerUninstall(ShellInfoObject.ConsoleInfo); - FreePool(ShellInfoObject.ConsoleInfo); - DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;); - } - - ShellFreeEnvVarList (); - - if (ShellCommandGetExit()) { - return ((EFI_STATUS)ShellCommandGetExitCode()); - } - return (Status); -} - -/** - Sets all the alias' that were registered with the ShellCommandLib library. - - @retval EFI_SUCCESS all init commands were run successfully. -**/ -EFI_STATUS -SetBuiltInAlias( - VOID - ) -{ - EFI_STATUS Status; - CONST ALIAS_LIST *List; - ALIAS_LIST *Node; - - // - // Get all the commands we want to run - // - List = ShellCommandGetInitAliasList(); - - // - // for each command in the List - // - for ( Node = (ALIAS_LIST*)GetFirstNode(&List->Link) - ; !IsNull (&List->Link, &Node->Link) - ; Node = (ALIAS_LIST *)GetNextNode(&List->Link, &Node->Link) - ){ - // - // install the alias' - // - Status = InternalSetAlias(Node->CommandString, Node->Alias, TRUE); - ASSERT_EFI_ERROR(Status); - } - return (EFI_SUCCESS); -} - -/** - Internal function to determine if 2 command names are really the same. - - @param[in] Command1 The pointer to the first command name. - @param[in] Command2 The pointer to the second command name. - - @retval TRUE The 2 command names are the same. - @retval FALSE The 2 command names are not the same. -**/ -BOOLEAN -IsCommand( - IN CONST CHAR16 *Command1, - IN CONST CHAR16 *Command2 - ) -{ - if (StringNoCaseCompare(&Command1, &Command2) == 0) { - return (TRUE); - } - return (FALSE); -} - -/** - Internal function to determine if a command is a script only command. - - @param[in] CommandName The pointer to the command name. - - @retval TRUE The command is a script only command. - @retval FALSE The command is not a script only command. -**/ -BOOLEAN -IsScriptOnlyCommand( - IN CONST CHAR16 *CommandName - ) -{ - if (IsCommand(CommandName, L"for") - ||IsCommand(CommandName, L"endfor") - ||IsCommand(CommandName, L"if") - ||IsCommand(CommandName, L"else") - ||IsCommand(CommandName, L"endif") - ||IsCommand(CommandName, L"goto")) { - return (TRUE); - } - return (FALSE); -} - -/** - This function will populate the 2 device path protocol parameters based on the - global gImageHandle. The DevPath will point to the device path for the handle that has - loaded image protocol installed on it. The FilePath will point to the device path - for the file that was loaded. - - @param[in, out] DevPath On a successful return the device path to the loaded image. - @param[in, out] FilePath On a successful return the device path to the file. - - @retval EFI_SUCCESS The 2 device paths were successfully returned. - @retval other A error from gBS->HandleProtocol. - - @sa HandleProtocol -**/ -EFI_STATUS -GetDevicePathsForImageAndFile ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath, - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; - - ASSERT(DevPath != NULL); - ASSERT(FilePath != NULL); - - Status = gBS->OpenProtocol ( - gImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&ImageDevicePath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - *DevPath = DuplicateDevicePath (ImageDevicePath); - *FilePath = DuplicateDevicePath (LoadedImage->FilePath); - gBS->CloseProtocol( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - gImageHandle, - NULL); - } - gBS->CloseProtocol( - gImageHandle, - &gEfiLoadedImageProtocolGuid, - gImageHandle, - NULL); - } - return (Status); -} - -/** - Process all Uefi Shell 2.0 command line options. - - see Uefi Shell 2.0 section 3.2 for full details. - - the command line must resemble the following: - - shell.efi [ShellOpt-options] [options] [file-name [file-name-options]] - - ShellOpt-options Options which control the initialization behavior of the shell. - These options are read from the EFI global variable "ShellOpt" - and are processed before options or file-name. - - options Options which control the initialization behavior of the shell. - - file-name The name of a UEFI shell application or script to be executed - after initialization is complete. By default, if file-name is - specified, then -nostartup is implied. Scripts are not supported - by level 0. - - file-name-options The command-line options that are passed to file-name when it - is invoked. - - This will initialize the ShellInfoObject.ShellInitSettings global variable. - - @retval EFI_SUCCESS The variable is initialized. -**/ -EFI_STATUS -ProcessCommandLine( - VOID - ) -{ - UINTN Size; - UINTN LoopVar; - CHAR16 *CurrentArg; - CHAR16 *DelayValueStr; - UINT64 DelayValue; - EFI_STATUS Status; - EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation; - - // `file-name-options` will contain arguments to `file-name` that we don't - // know about. This would cause ShellCommandLineParse to error, so we parse - // arguments manually, ignoring those after the first thing that doesn't look - // like a shell option (which is assumed to be `file-name`). - - Status = gBS->LocateProtocol ( - &gEfiUnicodeCollation2ProtocolGuid, - NULL, - (VOID **) &UnicodeCollation - ); - if (EFI_ERROR (Status)) { - Status = gBS->LocateProtocol ( - &gEfiUnicodeCollationProtocolGuid, - NULL, - (VOID **) &UnicodeCollation - ); - if (EFI_ERROR (Status)) { - return Status; - } - } - - // Set default options - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = FALSE; - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = FALSE; - ShellInfoObject.ShellInitSettings.Delay = 5; - - // - // Start LoopVar at 0 to parse only optional arguments at Argv[0] - // and parse other parameters from Argv[1]. This is for use case that - // UEFI Shell boot option is created, and OptionalData is provided - // that starts with shell command-line options. - // - for (LoopVar = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { - CurrentArg = gEfiShellParametersProtocol->Argv[LoopVar]; - if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-startup", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-nostartup", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-noconsoleout", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-noconsolein", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-nointerrupt", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-nomap", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-noversion", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-nonest", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = TRUE; - } - else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-delay", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE; - // Check for optional delay value following "-delay" - if ((LoopVar + 1) >= gEfiShellParametersProtocol->Argc) { - DelayValueStr = NULL; - } else { - DelayValueStr = gEfiShellParametersProtocol->Argv[LoopVar + 1]; - } - if (DelayValueStr != NULL){ - if (*DelayValueStr == L':') { - DelayValueStr++; - } - if (!EFI_ERROR(ShellConvertStringToUint64 ( - DelayValueStr, - &DelayValue, - FALSE, - FALSE - ))) { - ShellInfoObject.ShellInitSettings.Delay = (UINTN)DelayValue; - LoopVar++; - } - } - } else if (UnicodeCollation->StriColl ( - UnicodeCollation, - L"-exit", - CurrentArg - ) == 0) { - ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = TRUE; - } else if (StrnCmp (L"-", CurrentArg, 1) == 0) { - // Unrecognized option - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_GEN_PROBLEM), - ShellInfoObject.HiiHandle, - CurrentArg - ); - return EFI_INVALID_PARAMETER; - } else { - // - // First argument should be Shell.efi image name - // - if (LoopVar == 0) { - continue; - } - - ShellInfoObject.ShellInitSettings.FileName = NULL; - Size = 0; - // - // If first argument contains a space, then add double quotes before the argument - // - if (StrStr (CurrentArg, L" ") != NULL) { - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0); - if (ShellInfoObject.ShellInitSettings.FileName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - } - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, CurrentArg, 0); - if (ShellInfoObject.ShellInitSettings.FileName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - // - // If first argument contains a space, then add double quotes after the argument - // - if (StrStr (CurrentArg, L" ") != NULL) { - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0); - if (ShellInfoObject.ShellInitSettings.FileName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - } - // - // We found `file-name`. - // - ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = 1; - LoopVar++; - - // Add `file-name-options` - for (Size = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { - ASSERT((ShellInfoObject.ShellInitSettings.FileOptions == NULL && Size == 0) || (ShellInfoObject.ShellInitSettings.FileOptions != NULL)); - // - // Add a space between arguments - // - if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) { - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, &Size, L" ", 0); - if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) { - SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName); - return (EFI_OUT_OF_RESOURCES); - } - } - // - // If an argumnent contains a space, then add double quotes before the argument - // - if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) { - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, - &Size, - L"\"", - 0); - if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) { - SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName); - return (EFI_OUT_OF_RESOURCES); - } - } - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, - &Size, - gEfiShellParametersProtocol->Argv[LoopVar], - 0); - if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) { - SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName); - return (EFI_OUT_OF_RESOURCES); - } - // - // If an argumnent contains a space, then add double quotes after the argument - // - if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) { - StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, - &Size, - L"\"", - 0); - if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) { - SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName); - return (EFI_OUT_OF_RESOURCES); - } - } - } - } - } - - // "-nointerrupt" overrides "-delay" - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt) { - ShellInfoObject.ShellInitSettings.Delay = 0; - } - - return EFI_SUCCESS; -} - -/** - Function try to find location of the Startup.nsh file. - - The buffer is callee allocated and should be freed by the caller. - - @param ImageDevicePath The path to the image for shell. first place to look for the startup script - @param FileDevicePath The path to the file for shell. second place to look for the startup script. - - @retval NULL No Startup.nsh file was found. - @return !=NULL Pointer to NULL-terminated path. -**/ -CHAR16 * -LocateStartupScript ( - IN EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath, - IN EFI_DEVICE_PATH_PROTOCOL *FileDevicePath - ) -{ - CHAR16 *StartupScriptPath; - CHAR16 *TempSpot; - CONST CHAR16 *MapName; - UINTN Size; - - StartupScriptPath = NULL; - Size = 0; - - // - // Try to find 'Startup.nsh' in the directory where the shell itself was launched. - // - MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath (&ImageDevicePath); - if (MapName != NULL) { - StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0); - if (StartupScriptPath == NULL) { - // - // Do not locate the startup script in sys path when out of resource. - // - return NULL; - } - TempSpot = StrStr (StartupScriptPath, L";"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - - InternalEfiShellSetEnv(L"homefilesystem", StartupScriptPath, TRUE); - - StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0); - PathRemoveLastItem (StartupScriptPath); - StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0); - } - - // - // Try to find 'Startup.nsh' in the execution path defined by the envrionment variable PATH. - // - if ((StartupScriptPath == NULL) || EFI_ERROR (ShellIsFile (StartupScriptPath))) { - SHELL_FREE_NON_NULL (StartupScriptPath); - StartupScriptPath = ShellFindFilePath (mStartupScript); - } - - return StartupScriptPath; -} - -/** - Handles all interaction with the default startup script. - - this will check that the correct command line parameters were passed, handle the delay, and then start running the script. - - @param ImagePath the path to the image for shell. first place to look for the startup script - @param FilePath the path to the file for shell. second place to look for the startup script. - - @retval EFI_SUCCESS the variable is initialized. -**/ -EFI_STATUS -DoStartupScript( - IN EFI_DEVICE_PATH_PROTOCOL *ImagePath, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath - ) -{ - EFI_STATUS Status; - EFI_STATUS CalleeStatus; - UINTN Delay; - EFI_INPUT_KEY Key; - CHAR16 *FileStringPath; - CHAR16 *FullFileStringPath; - UINTN NewSize; - - Key.UnicodeChar = CHAR_NULL; - Key.ScanCode = 0; - - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup && ShellInfoObject.ShellInitSettings.FileName != NULL) { - // - // launch something else instead - // - NewSize = StrSize(ShellInfoObject.ShellInitSettings.FileName); - if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) { - NewSize += StrSize(ShellInfoObject.ShellInitSettings.FileOptions) + sizeof(CHAR16); - } - FileStringPath = AllocateZeroPool(NewSize); - if (FileStringPath == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - StrCpyS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileName); - if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) { - StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1); - StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1); - } - Status = RunShellCommand(FileStringPath, &CalleeStatus); - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit == TRUE) { - ShellCommandRegisterExit(gEfiShellProtocol->BatchIsActive(), (UINT64)CalleeStatus); - } - FreePool(FileStringPath); - return (Status); - - } - - // - // for shell level 0 we do no scripts - // Without the Startup bit overriding we allow for nostartup to prevent scripts - // - if ( (PcdGet8(PcdShellSupportLevel) < 1) - || (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup) - ){ - return (EFI_SUCCESS); - } - - gST->ConOut->EnableCursor(gST->ConOut, FALSE); - // - // print out our warning and see if they press a key - // - for ( Status = EFI_UNSUPPORTED, Delay = ShellInfoObject.ShellInitSettings.Delay - ; Delay != 0 && EFI_ERROR(Status) - ; Delay-- - ){ - ShellPrintHiiEx(0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay); - gBS->Stall (1000000); - if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - } - } - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CRLF), ShellInfoObject.HiiHandle); - gST->ConOut->EnableCursor(gST->ConOut, TRUE); - - // - // ESC was pressed - // - if (Status == EFI_SUCCESS && Key.UnicodeChar == 0 && Key.ScanCode == SCAN_ESC) { - return (EFI_SUCCESS); - } - - FileStringPath = LocateStartupScript (ImagePath, FilePath); - if (FileStringPath != NULL) { - FullFileStringPath = FullyQualifyPath(FileStringPath); - if (FullFileStringPath == NULL) { - Status = RunScriptFile (FileStringPath, NULL, FileStringPath, ShellInfoObject.NewShellParametersProtocol); - } else { - Status = RunScriptFile (FullFileStringPath, NULL, FullFileStringPath, ShellInfoObject.NewShellParametersProtocol); - FreePool(FullFileStringPath); - } - FreePool (FileStringPath); - } else { - // - // we return success since startup script is not mandatory. - // - Status = EFI_SUCCESS; - } - - return (Status); -} - -/** - Function to perform the shell prompt looping. It will do a single prompt, - dispatch the result, and then return. It is expected that the caller will - call this function in a loop many times. - - @retval EFI_SUCCESS - @retval RETURN_ABORTED -**/ -EFI_STATUS -DoShellPrompt ( - VOID - ) -{ - UINTN Column; - UINTN Row; - CHAR16 *CmdLine; - CONST CHAR16 *CurDir; - UINTN BufferSize; - EFI_STATUS Status; - LIST_ENTRY OldBufferList; - - CurDir = NULL; - - // - // Get screen setting to decide size of the command line buffer - // - gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Column, &Row); - BufferSize = Column * Row * sizeof (CHAR16); - CmdLine = AllocateZeroPool (BufferSize); - if (CmdLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - SaveBufferList(&OldBufferList); - CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd"); - - // - // Prompt for input - // - gST->ConOut->SetCursorPosition (gST->ConOut, 0, gST->ConOut->Mode->CursorRow); - - if (CurDir != NULL && StrLen(CurDir) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle); - } - - // - // Read a line from the console - // - Status = ShellInfoObject.NewEfiShellProtocol->ReadFile(ShellInfoObject.NewShellParametersProtocol->StdIn, &BufferSize, CmdLine); - - // - // Null terminate the string and parse it - // - if (!EFI_ERROR (Status)) { - // - // Reset the CTRL-C event just before running the command (yes we ignore the return values) - // - Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak); - - CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL; - Status = RunCommand(CmdLine); - } - - // - // Done with this command - // - RestoreBufferList(&OldBufferList); - FreePool (CmdLine); - return Status; -} - -/** - Add a buffer to the Buffer To Free List for safely returning buffers to other - places without risking letting them modify internal shell information. - - @param Buffer Something to pass to FreePool when the shell is exiting. -**/ -VOID* -AddBufferToFreeList ( - VOID *Buffer - ) -{ - BUFFER_LIST *BufferListEntry; - - if (Buffer == NULL) { - return (NULL); - } - - BufferListEntry = AllocateZeroPool (sizeof (BUFFER_LIST)); - if (BufferListEntry == NULL) { - return NULL; - } - - BufferListEntry->Buffer = Buffer; - InsertTailList (&ShellInfoObject.BufferToFreeList.Link, &BufferListEntry->Link); - return (Buffer); -} - - -/** - Create a new buffer list and stores the old one to OldBufferList - - @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. -**/ -VOID -SaveBufferList ( - OUT LIST_ENTRY *OldBufferList - ) -{ - CopyMem (OldBufferList, &ShellInfoObject.BufferToFreeList.Link, sizeof (LIST_ENTRY)); - InitializeListHead (&ShellInfoObject.BufferToFreeList.Link); -} - -/** - Restore previous nodes into BufferToFreeList . - - @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. -**/ -VOID -RestoreBufferList ( - IN OUT LIST_ENTRY *OldBufferList - ) -{ - FreeBufferList (&ShellInfoObject.BufferToFreeList); - CopyMem (&ShellInfoObject.BufferToFreeList.Link, OldBufferList, sizeof (LIST_ENTRY)); -} - - -/** - Add a buffer to the Line History List - - @param Buffer The line buffer to add. -**/ -VOID -AddLineToCommandHistory( - IN CONST CHAR16 *Buffer - ) -{ - BUFFER_LIST *Node; - BUFFER_LIST *Walker; - UINT16 MaxHistoryCmdCount; - UINT16 Count; - - Count = 0; - MaxHistoryCmdCount = PcdGet16(PcdShellMaxHistoryCommandCount); - - if (MaxHistoryCmdCount == 0) { - return ; - } - - - Node = AllocateZeroPool(sizeof(BUFFER_LIST)); - if (Node == NULL) { - return; - } - - Node->Buffer = AllocateCopyPool (StrSize (Buffer), Buffer); - if (Node->Buffer == NULL) { - FreePool (Node); - return; - } - - for ( Walker = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link) - ; !IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link) - ; Walker = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link) - ){ - Count++; - } - if (Count < MaxHistoryCmdCount){ - InsertTailList(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link); - } else { - Walker = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link); - RemoveEntryList(&Walker->Link); - if (Walker->Buffer != NULL) { - FreePool(Walker->Buffer); - } - FreePool(Walker); - InsertTailList(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link); - } -} - -/** - Checks if a string is an alias for another command. If yes, then it replaces the alias name - with the correct command name. - - @param[in, out] CommandString Upon entry the potential alias. Upon return the - command name if it was an alias. If it was not - an alias it will be unchanged. This function may - change the buffer to fit the command name. - - @retval EFI_SUCCESS The name was changed. - @retval EFI_SUCCESS The name was not an alias. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -ShellConvertAlias( - IN OUT CHAR16 **CommandString - ) -{ - CONST CHAR16 *NewString; - - NewString = ShellInfoObject.NewEfiShellProtocol->GetAlias(*CommandString, NULL); - if (NewString == NULL) { - return (EFI_SUCCESS); - } - FreePool(*CommandString); - *CommandString = AllocateCopyPool(StrSize(NewString), NewString); - if (*CommandString == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - return (EFI_SUCCESS); -} - -/** - This function will eliminate unreplaced (and therefore non-found) environment variables. - - @param[in,out] CmdLine The command line to update. -**/ -EFI_STATUS -StripUnreplacedEnvironmentVariables( - IN OUT CHAR16 *CmdLine - ) -{ - CHAR16 *FirstPercent; - CHAR16 *FirstQuote; - CHAR16 *SecondPercent; - CHAR16 *SecondQuote; - CHAR16 *CurrentLocator; - - for (CurrentLocator = CmdLine ; CurrentLocator != NULL ; ) { - FirstQuote = FindNextInstance(CurrentLocator, L"\"", TRUE); - FirstPercent = FindNextInstance(CurrentLocator, L"%", TRUE); - SecondPercent = FirstPercent!=NULL?FindNextInstance(FirstPercent+1, L"%", TRUE):NULL; - if (FirstPercent == NULL || SecondPercent == NULL) { - // - // If we ever don't have 2 % we are done. - // - break; - } - - if (FirstQuote!= NULL && FirstQuote < FirstPercent) { - SecondQuote = FindNextInstance(FirstQuote+1, L"\"", TRUE); - // - // Quote is first found - // - - if (SecondQuote < FirstPercent) { - // - // restart after the pair of " - // - CurrentLocator = SecondQuote + 1; - } else /* FirstPercent < SecondQuote */{ - // - // Restart on the first percent - // - CurrentLocator = FirstPercent; - } - continue; - } - - if (FirstQuote == NULL || SecondPercent < FirstQuote) { - if (IsValidEnvironmentVariableName(FirstPercent, SecondPercent)) { - // - // We need to remove from FirstPercent to SecondPercent - // - CopyMem(FirstPercent, SecondPercent + 1, StrSize(SecondPercent + 1)); - // - // don't need to update the locator. both % characters are gone. - // - } else { - CurrentLocator = SecondPercent + 1; - } - continue; - } - CurrentLocator = FirstQuote; - } - return (EFI_SUCCESS); -} - -/** - Function allocates a new command line and replaces all instances of environment - variable names that are correctly preset to their values. - - If the return value is not NULL the memory must be caller freed. - - @param[in] OriginalCommandLine The original command line - - @retval NULL An error occurred. - @return The new command line with no environment variables present. -**/ -CHAR16* -ShellConvertVariables ( - IN CONST CHAR16 *OriginalCommandLine - ) -{ - CONST CHAR16 *MasterEnvList; - UINTN NewSize; - CHAR16 *NewCommandLine1; - CHAR16 *NewCommandLine2; - CHAR16 *Temp; - UINTN ItemSize; - CHAR16 *ItemTemp; - SCRIPT_FILE *CurrentScriptFile; - ALIAS_LIST *AliasListNode; - - ASSERT(OriginalCommandLine != NULL); - - ItemSize = 0; - NewSize = StrSize(OriginalCommandLine); - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - Temp = NULL; - - ///@todo update this to handle the %0 - %9 for scripting only (borrow from line 1256 area) ? ? ? - - // - // calculate the size required for the post-conversion string... - // - if (CurrentScriptFile != NULL) { - for (AliasListNode = (ALIAS_LIST*)GetFirstNode(&CurrentScriptFile->SubstList) - ; !IsNull(&CurrentScriptFile->SubstList, &AliasListNode->Link) - ; AliasListNode = (ALIAS_LIST*)GetNextNode(&CurrentScriptFile->SubstList, &AliasListNode->Link) - ){ - for (Temp = StrStr(OriginalCommandLine, AliasListNode->Alias) - ; Temp != NULL - ; Temp = StrStr(Temp+1, AliasListNode->Alias) - ){ - // - // we need a preceding and if there is space no ^ preceding (if no space ignore) - // - if ((((Temp-OriginalCommandLine)>2) && *(Temp-2) != L'^') || ((Temp-OriginalCommandLine)<=2)) { - NewSize += StrSize(AliasListNode->CommandString); - } - } - } - } - - for (MasterEnvList = EfiShellGetEnv(NULL) - ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL //&& *(MasterEnvList+1) != CHAR_NULL - ; MasterEnvList += StrLen(MasterEnvList) + 1 - ){ - if (StrSize(MasterEnvList) > ItemSize) { - ItemSize = StrSize(MasterEnvList); - } - for (Temp = StrStr(OriginalCommandLine, MasterEnvList) - ; Temp != NULL - ; Temp = StrStr(Temp+1, MasterEnvList) - ){ - // - // we need a preceding and following % and if there is space no ^ preceding (if no space ignore) - // - if (*(Temp-1) == L'%' && *(Temp+StrLen(MasterEnvList)) == L'%' && - ((((Temp-OriginalCommandLine)>2) && *(Temp-2) != L'^') || ((Temp-OriginalCommandLine)<=2))) { - NewSize+=StrSize(EfiShellGetEnv(MasterEnvList)); - } - } - } - - // - // now do the replacements... - // - NewCommandLine1 = AllocateZeroPool (NewSize); - NewCommandLine2 = AllocateZeroPool(NewSize); - ItemTemp = AllocateZeroPool(ItemSize+(2*sizeof(CHAR16))); - if (NewCommandLine1 == NULL || NewCommandLine2 == NULL || ItemTemp == NULL) { - SHELL_FREE_NON_NULL(NewCommandLine1); - SHELL_FREE_NON_NULL(NewCommandLine2); - SHELL_FREE_NON_NULL(ItemTemp); - return (NULL); - } - CopyMem (NewCommandLine1, OriginalCommandLine, StrSize (OriginalCommandLine)); - - for (MasterEnvList = EfiShellGetEnv(NULL) - ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL - ; MasterEnvList += StrLen(MasterEnvList) + 1 - ){ - StrCpyS( ItemTemp, - ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), - L"%" - ); - StrCatS( ItemTemp, - ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), - MasterEnvList - ); - StrCatS( ItemTemp, - ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), - L"%" - ); - ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE); - StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2); - } - if (CurrentScriptFile != NULL) { - for (AliasListNode = (ALIAS_LIST*)GetFirstNode(&CurrentScriptFile->SubstList) - ; !IsNull(&CurrentScriptFile->SubstList, &AliasListNode->Link) - ; AliasListNode = (ALIAS_LIST*)GetNextNode(&CurrentScriptFile->SubstList, &AliasListNode->Link) - ){ - ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE); - StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2); - } - } - - // - // Remove non-existent environment variables - // - StripUnreplacedEnvironmentVariables(NewCommandLine1); - - // - // Now cleanup any straggler intentionally ignored "%" characters - // - ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE); - StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2); - - FreePool(NewCommandLine2); - FreePool(ItemTemp); - - return (NewCommandLine1); -} - -/** - Internal function to run a command line with pipe usage. - - @param[in] CmdLine The pointer to the command line. - @param[in] StdIn The pointer to the Standard input. - @param[in] StdOut The pointer to the Standard output. - - @retval EFI_SUCCESS The split command is executed successfully. - @retval other Some error occurs when executing the split command. -**/ -EFI_STATUS -RunSplitCommand( - IN CONST CHAR16 *CmdLine, - IN SHELL_FILE_HANDLE StdIn, - IN SHELL_FILE_HANDLE StdOut - ) -{ - EFI_STATUS Status; - CHAR16 *NextCommandLine; - CHAR16 *OurCommandLine; - UINTN Size1; - UINTN Size2; - SPLIT_LIST *Split; - SHELL_FILE_HANDLE TempFileHandle; - BOOLEAN Unicode; - - ASSERT(StdOut == NULL); - - ASSERT(StrStr(CmdLine, L"|") != NULL); - - Status = EFI_SUCCESS; - NextCommandLine = NULL; - OurCommandLine = NULL; - Size1 = 0; - Size2 = 0; - - NextCommandLine = StrnCatGrow(&NextCommandLine, &Size1, StrStr(CmdLine, L"|")+1, 0); - OurCommandLine = StrnCatGrow(&OurCommandLine , &Size2, CmdLine , StrStr(CmdLine, L"|") - CmdLine); - - if (NextCommandLine == NULL || OurCommandLine == NULL) { - SHELL_FREE_NON_NULL(OurCommandLine); - SHELL_FREE_NON_NULL(NextCommandLine); - return (EFI_OUT_OF_RESOURCES); - } else if (StrStr(OurCommandLine, L"|") != NULL || Size1 == 0 || Size2 == 0) { - SHELL_FREE_NON_NULL(OurCommandLine); - SHELL_FREE_NON_NULL(NextCommandLine); - return (EFI_INVALID_PARAMETER); - } else if (NextCommandLine[0] == L'a' && - (NextCommandLine[1] == L' ' || NextCommandLine[1] == CHAR_NULL) - ){ - CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) - sizeof(NextCommandLine[0])); - while (NextCommandLine[0] == L' ') { - CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) - sizeof(NextCommandLine[0])); - } - if (NextCommandLine[0] == CHAR_NULL) { - SHELL_FREE_NON_NULL(OurCommandLine); - SHELL_FREE_NON_NULL(NextCommandLine); - return (EFI_INVALID_PARAMETER); - } - Unicode = FALSE; - } else { - Unicode = TRUE; - } - - - // - // make a SPLIT_LIST item and add to list - // - Split = AllocateZeroPool(sizeof(SPLIT_LIST)); - if (Split == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Split->SplitStdIn = StdIn; - Split->SplitStdOut = ConvertEfiFileProtocolToShellHandle(CreateFileInterfaceMem(Unicode), NULL); - ASSERT(Split->SplitStdOut != NULL); - InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link); - - Status = RunCommand(OurCommandLine); - - // - // move the output from the first to the in to the second. - // - TempFileHandle = Split->SplitStdOut; - if (Split->SplitStdIn == StdIn) { - Split->SplitStdOut = NULL; - } else { - Split->SplitStdOut = Split->SplitStdIn; - } - Split->SplitStdIn = TempFileHandle; - ShellInfoObject.NewEfiShellProtocol->SetFilePosition (Split->SplitStdIn, 0); - - if (!EFI_ERROR(Status)) { - Status = RunCommand(NextCommandLine); - } - - // - // remove the top level from the ScriptList - // - ASSERT((SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link) == Split); - RemoveEntryList(&Split->Link); - - // - // Note that the original StdIn is now the StdOut... - // - if (Split->SplitStdOut != NULL) { - ShellInfoObject.NewEfiShellProtocol->CloseFile (Split->SplitStdOut); - } - if (Split->SplitStdIn != NULL) { - ShellInfoObject.NewEfiShellProtocol->CloseFile (Split->SplitStdIn); - } - - FreePool(Split); - FreePool(NextCommandLine); - FreePool(OurCommandLine); - - return (Status); -} - -/** - Take the original command line, substitute any variables, free - the original string, return the modified copy. - - @param[in] CmdLine pointer to the command line to update. - - @retval EFI_SUCCESS the function was successful. - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -ShellSubstituteVariables( - IN CHAR16 **CmdLine - ) -{ - CHAR16 *NewCmdLine; - NewCmdLine = ShellConvertVariables(*CmdLine); - SHELL_FREE_NON_NULL(*CmdLine); - if (NewCmdLine == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - *CmdLine = NewCmdLine; - return (EFI_SUCCESS); -} - -/** - Take the original command line, substitute any alias in the first group of space delimited characters, free - the original string, return the modified copy. - - @param[in] CmdLine pointer to the command line to update. - - @retval EFI_SUCCESS the function was successful. - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -ShellSubstituteAliases( - IN CHAR16 **CmdLine - ) -{ - CHAR16 *NewCmdLine; - CHAR16 *CommandName; - EFI_STATUS Status; - UINTN PostAliasSize; - ASSERT(CmdLine != NULL); - ASSERT(*CmdLine!= NULL); - - - CommandName = NULL; - if (StrStr((*CmdLine), L" ") == NULL){ - StrnCatGrow(&CommandName, NULL, (*CmdLine), 0); - } else { - StrnCatGrow(&CommandName, NULL, (*CmdLine), StrStr((*CmdLine), L" ") - (*CmdLine)); - } - - // - // This cannot happen 'inline' since the CmdLine can need extra space. - // - NewCmdLine = NULL; - if (!ShellCommandIsCommandOnList(CommandName)) { - // - // Convert via alias - // - Status = ShellConvertAlias(&CommandName); - if (EFI_ERROR(Status)){ - return (Status); - } - PostAliasSize = 0; - NewCmdLine = StrnCatGrow(&NewCmdLine, &PostAliasSize, CommandName, 0); - if (NewCmdLine == NULL) { - SHELL_FREE_NON_NULL(CommandName); - SHELL_FREE_NON_NULL(*CmdLine); - return (EFI_OUT_OF_RESOURCES); - } - NewCmdLine = StrnCatGrow(&NewCmdLine, &PostAliasSize, StrStr((*CmdLine), L" "), 0); - if (NewCmdLine == NULL) { - SHELL_FREE_NON_NULL(CommandName); - SHELL_FREE_NON_NULL(*CmdLine); - return (EFI_OUT_OF_RESOURCES); - } - } else { - NewCmdLine = StrnCatGrow(&NewCmdLine, NULL, (*CmdLine), 0); - } - - SHELL_FREE_NON_NULL(*CmdLine); - SHELL_FREE_NON_NULL(CommandName); - - // - // re-assign the passed in double pointer to point to our newly allocated buffer - // - *CmdLine = NewCmdLine; - - return (EFI_SUCCESS); -} - -/** - Takes the Argv[0] part of the command line and determine the meaning of it. - - @param[in] CmdName pointer to the command line to update. - - @retval Internal_Command The name is an internal command. - @retval File_Sys_Change the name is a file system change. - @retval Script_File_Name the name is a NSH script file. - @retval Unknown_Invalid the name is unknown. - @retval Efi_Application the name is an application (.EFI). -**/ -SHELL_OPERATION_TYPES -GetOperationType( - IN CONST CHAR16 *CmdName - ) -{ - CHAR16* FileWithPath; - CONST CHAR16* TempLocation; - CONST CHAR16* TempLocation2; - - FileWithPath = NULL; - // - // test for an internal command. - // - if (ShellCommandIsCommandOnList(CmdName)) { - return (Internal_Command); - } - - // - // Test for file system change request. anything ending with first : and cant have spaces. - // - if (CmdName[(StrLen(CmdName)-1)] == L':') { - if ( StrStr(CmdName, L" ") != NULL - || StrLen(StrStr(CmdName, L":")) > 1 - ) { - return (Unknown_Invalid); - } - return (File_Sys_Change); - } - - // - // Test for a file - // - if ((FileWithPath = ShellFindFilePathEx(CmdName, mExecutableExtensions)) != NULL) { - // - // See if that file has a script file extension - // - if (StrLen(FileWithPath) > 4) { - TempLocation = FileWithPath+StrLen(FileWithPath)-4; - TempLocation2 = mScriptExtension; - if (StringNoCaseCompare((VOID*)(&TempLocation), (VOID*)(&TempLocation2)) == 0) { - SHELL_FREE_NON_NULL(FileWithPath); - return (Script_File_Name); - } - } - - // - // Was a file, but not a script. we treat this as an application. - // - SHELL_FREE_NON_NULL(FileWithPath); - return (Efi_Application); - } - - SHELL_FREE_NON_NULL(FileWithPath); - // - // No clue what this is... return invalid flag... - // - return (Unknown_Invalid); -} - -/** - Determine if the first item in a command line is valid. - - @param[in] CmdLine The command line to parse. - - @retval EFI_SUCCESS The item is valid. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_NOT_FOUND The operation type is unknown or invalid. -**/ -EFI_STATUS -IsValidSplit( - IN CONST CHAR16 *CmdLine - ) -{ - CHAR16 *Temp; - CHAR16 *FirstParameter; - CHAR16 *TempWalker; - EFI_STATUS Status; - - Temp = NULL; - - Temp = StrnCatGrow(&Temp, NULL, CmdLine, 0); - if (Temp == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - FirstParameter = StrStr(Temp, L"|"); - if (FirstParameter != NULL) { - *FirstParameter = CHAR_NULL; - } - - FirstParameter = NULL; - - // - // Process the command line - // - Status = ProcessCommandLineToFinal(&Temp); - - if (!EFI_ERROR(Status)) { - FirstParameter = AllocateZeroPool(StrSize(CmdLine)); - if (FirstParameter == NULL) { - SHELL_FREE_NON_NULL(Temp); - return (EFI_OUT_OF_RESOURCES); - } - TempWalker = (CHAR16*)Temp; - if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CmdLine), TRUE))) { - if (GetOperationType(FirstParameter) == Unknown_Invalid) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter); - SetLastError(SHELL_NOT_FOUND); - Status = EFI_NOT_FOUND; - } - } - } - - SHELL_FREE_NON_NULL(Temp); - SHELL_FREE_NON_NULL(FirstParameter); - return Status; -} - -/** - Determine if a command line contains with a split contains only valid commands. - - @param[in] CmdLine The command line to parse. - - @retval EFI_SUCCESS CmdLine has only valid commands, application, or has no split. - @retval EFI_ABORTED CmdLine has at least one invalid command or application. -**/ -EFI_STATUS -VerifySplit( - IN CONST CHAR16 *CmdLine - ) -{ - CONST CHAR16 *TempSpot; - EFI_STATUS Status; - - // - // If this was the only item, then get out - // - if (!ContainsSplit(CmdLine)) { - return (EFI_SUCCESS); - } - - // - // Verify up to the pipe or end character - // - Status = IsValidSplit(CmdLine); - if (EFI_ERROR(Status)) { - return (Status); - } - - // - // recurse to verify the next item - // - TempSpot = FindFirstCharacter(CmdLine, L"|", L'^') + 1; - if (*TempSpot == L'a' && - (*(TempSpot + 1) == L' ' || *(TempSpot + 1) == CHAR_NULL) - ) { - // If it's an ASCII pipe '|a' - TempSpot += 1; - } - - return (VerifySplit(TempSpot)); -} - -/** - Process a split based operation. - - @param[in] CmdLine pointer to the command line to process - - @retval EFI_SUCCESS The operation was successful - @return an error occurred. -**/ -EFI_STATUS -ProcessNewSplitCommandLine( - IN CONST CHAR16 *CmdLine - ) -{ - SPLIT_LIST *Split; - EFI_STATUS Status; - - Status = VerifySplit(CmdLine); - if (EFI_ERROR(Status)) { - return (Status); - } - - Split = NULL; - - // - // are we in an existing split??? - // - if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) { - Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link); - } - - if (Split == NULL) { - Status = RunSplitCommand(CmdLine, NULL, NULL); - } else { - Status = RunSplitCommand(CmdLine, Split->SplitStdIn, Split->SplitStdOut); - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine); - } - return (Status); -} - -/** - Handle a request to change the current file system. - - @param[in] CmdLine The passed in command line. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ChangeMappedDrive( - IN CONST CHAR16 *CmdLine - ) -{ - EFI_STATUS Status; - Status = EFI_SUCCESS; - - // - // make sure we are the right operation - // - ASSERT(CmdLine[(StrLen(CmdLine)-1)] == L':' && StrStr(CmdLine, L" ") == NULL); - - // - // Call the protocol API to do the work - // - Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL, CmdLine); - - // - // Report any errors - // - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CmdLine); - } - - return (Status); -} - -/** - Reprocess the command line to direct all -? to the help command. - - if found, will add "help" as argv[0], and move the rest later. - - @param[in,out] CmdLine pointer to the command line to update -**/ -EFI_STATUS -DoHelpUpdate( - IN OUT CHAR16 **CmdLine - ) -{ - CHAR16 *CurrentParameter; - CHAR16 *Walker; - CHAR16 *NewCommandLine; - EFI_STATUS Status; - UINTN NewCmdLineSize; - - Status = EFI_SUCCESS; - - CurrentParameter = AllocateZeroPool(StrSize(*CmdLine)); - if (CurrentParameter == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - Walker = *CmdLine; - while(Walker != NULL && *Walker != CHAR_NULL) { - if (!EFI_ERROR(GetNextParameter(&Walker, &CurrentParameter, StrSize(*CmdLine), TRUE))) { - if (StrStr(CurrentParameter, L"-?") == CurrentParameter) { - CurrentParameter[0] = L' '; - CurrentParameter[1] = L' '; - NewCmdLineSize = StrSize(L"help ") + StrSize(*CmdLine); - NewCommandLine = AllocateZeroPool(NewCmdLineSize); - if (NewCommandLine == NULL) { - Status = EFI_OUT_OF_RESOURCES; - break; - } - - // - // We know the space is sufficient since we just calculated it. - // - StrnCpyS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), L"help ", 5); - StrnCatS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), *CmdLine, StrLen(*CmdLine)); - SHELL_FREE_NON_NULL(*CmdLine); - *CmdLine = NewCommandLine; - break; - } - } - } - - SHELL_FREE_NON_NULL(CurrentParameter); - - return (Status); -} - -/** - Function to update the shell variable "lasterror". - - @param[in] ErrorCode the error code to put into lasterror. -**/ -EFI_STATUS -SetLastError( - IN CONST SHELL_STATUS ErrorCode - ) -{ - CHAR16 LeString[19]; - if (sizeof(EFI_STATUS) == sizeof(UINT64)) { - UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ErrorCode); - } else { - UnicodeSPrint(LeString, sizeof(LeString), L"0x%x", ErrorCode); - } - DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE);); - InternalEfiShellSetEnv(L"lasterror", LeString, TRUE); - - return (EFI_SUCCESS); -} - -/** - Converts the command line to it's post-processed form. this replaces variables and alias' per UEFI Shell spec. - - @param[in,out] CmdLine pointer to the command line to update - - @retval EFI_SUCCESS The operation was successful - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @return some other error occurred -**/ -EFI_STATUS -ProcessCommandLineToFinal( - IN OUT CHAR16 **CmdLine - ) -{ - EFI_STATUS Status; - TrimSpaces(CmdLine); - - Status = ShellSubstituteAliases(CmdLine); - if (EFI_ERROR(Status)) { - return (Status); - } - - TrimSpaces(CmdLine); - - Status = ShellSubstituteVariables(CmdLine); - if (EFI_ERROR(Status)) { - return (Status); - } - ASSERT (*CmdLine != NULL); - - TrimSpaces(CmdLine); - - // - // update for help parsing - // - if (StrStr(*CmdLine, L"?") != NULL) { - // - // This may do nothing if the ? does not indicate help. - // Save all the details for in the API below. - // - Status = DoHelpUpdate(CmdLine); - } - - TrimSpaces(CmdLine); - - return (EFI_SUCCESS); -} - -/** - Run an internal shell command. - - This API will update the shell's environment since these commands are libraries. - - @param[in] CmdLine the command line to run. - @param[in] FirstParameter the first parameter on the command line - @param[in] ParamProtocol the shell parameters protocol pointer - @param[out] CommandStatus the status from the command line. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -RunInternalCommand( - IN CONST CHAR16 *CmdLine, - IN CHAR16 *FirstParameter, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol, - OUT EFI_STATUS *CommandStatus -) -{ - EFI_STATUS Status; - UINTN Argc; - CHAR16 **Argv; - SHELL_STATUS CommandReturnedStatus; - BOOLEAN LastError; - CHAR16 *Walker; - CHAR16 *NewCmdLine; - - NewCmdLine = AllocateCopyPool (StrSize (CmdLine), CmdLine); - if (NewCmdLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { - if (*Walker == L'^' && *(Walker+1) == L'#') { - CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); - } - } - - // - // get the argc and argv updated for internal commands - // - Status = UpdateArgcArgv(ParamProtocol, NewCmdLine, Internal_Command, &Argv, &Argc); - if (!EFI_ERROR(Status)) { - // - // Run the internal command. - // - Status = ShellCommandRunCommandHandler(FirstParameter, &CommandReturnedStatus, &LastError); - - if (!EFI_ERROR(Status)) { - if (CommandStatus != NULL) { - if (CommandReturnedStatus != SHELL_SUCCESS) { - *CommandStatus = (EFI_STATUS)(CommandReturnedStatus | MAX_BIT); - } else { - *CommandStatus = EFI_SUCCESS; - } - } - - // - // Update last error status. - // some commands do not update last error. - // - if (LastError) { - SetLastError(CommandReturnedStatus); - } - - // - // Pass thru the exitcode from the app. - // - if (ShellCommandGetExit()) { - // - // An Exit was requested ("exit" command), pass its value up. - // - Status = CommandReturnedStatus; - } else if (CommandReturnedStatus != SHELL_SUCCESS && IsScriptOnlyCommand(FirstParameter)) { - // - // Always abort when a script only command fails for any reason - // - Status = EFI_ABORTED; - } else if (ShellCommandGetCurrentScriptFile() != NULL && CommandReturnedStatus == SHELL_ABORTED) { - // - // Abort when in a script and a command aborted - // - Status = EFI_ABORTED; - } - } - } - - // - // This is guaranteed to be called after UpdateArgcArgv no matter what else happened. - // This is safe even if the update API failed. In this case, it may be a no-op. - // - RestoreArgcArgv(ParamProtocol, &Argv, &Argc); - - // - // If a script is running and the command is not a script only command, then - // change return value to success so the script won't halt (unless aborted). - // - // Script only commands have to be able halt the script since the script will - // not operate if they are failing. - // - if ( ShellCommandGetCurrentScriptFile() != NULL - && !IsScriptOnlyCommand(FirstParameter) - && Status != EFI_ABORTED - ) { - Status = EFI_SUCCESS; - } - - FreePool (NewCmdLine); - return (Status); -} - -/** - Function to run the command or file. - - @param[in] Type the type of operation being run. - @param[in] CmdLine the command line to run. - @param[in] FirstParameter the first parameter on the command line - @param[in] ParamProtocol the shell parameters protocol pointer - @param[out] CommandStatus the status from the command line. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -RunCommandOrFile( - IN SHELL_OPERATION_TYPES Type, - IN CONST CHAR16 *CmdLine, - IN CHAR16 *FirstParameter, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol, - OUT EFI_STATUS *CommandStatus -) -{ - EFI_STATUS Status; - EFI_STATUS StartStatus; - CHAR16 *CommandWithPath; - CHAR16 *FullCommandWithPath; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - SHELL_STATUS CalleeExitStatus; - - Status = EFI_SUCCESS; - CommandWithPath = NULL; - DevPath = NULL; - CalleeExitStatus = SHELL_INVALID_PARAMETER; - - switch (Type) { - case Internal_Command: - Status = RunInternalCommand(CmdLine, FirstParameter, ParamProtocol, CommandStatus); - break; - case Script_File_Name: - case Efi_Application: - // - // Process a fully qualified path - // - if (StrStr(FirstParameter, L":") != NULL) { - ASSERT (CommandWithPath == NULL); - if (ShellIsFile(FirstParameter) == EFI_SUCCESS) { - CommandWithPath = StrnCatGrow(&CommandWithPath, NULL, FirstParameter, 0); - } - } - - // - // Process a relative path and also check in the path environment variable - // - if (CommandWithPath == NULL) { - CommandWithPath = ShellFindFilePathEx(FirstParameter, mExecutableExtensions); - } - - // - // This should be impossible now. - // - ASSERT(CommandWithPath != NULL); - - // - // Make sure that path is not just a directory (or not found) - // - if (!EFI_ERROR(ShellIsDirectory(CommandWithPath))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter); - SetLastError(SHELL_NOT_FOUND); - } - switch (Type) { - case Script_File_Name: - FullCommandWithPath = FullyQualifyPath(CommandWithPath); - if (FullCommandWithPath == NULL) { - Status = RunScriptFile (CommandWithPath, NULL, CmdLine, ParamProtocol); - } else { - Status = RunScriptFile (FullCommandWithPath, NULL, CmdLine, ParamProtocol); - FreePool(FullCommandWithPath); - } - break; - case Efi_Application: - // - // Get the device path of the application image - // - DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CommandWithPath); - if (DevPath == NULL){ - Status = EFI_OUT_OF_RESOURCES; - break; - } - - // - // Execute the device path - // - Status = InternalShellExecuteDevicePath( - &gImageHandle, - DevPath, - CmdLine, - NULL, - &StartStatus - ); - - SHELL_FREE_NON_NULL(DevPath); - - if(EFI_ERROR (Status)) { - CalleeExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); - } else { - CalleeExitStatus = (SHELL_STATUS) StartStatus; - } - - if (CommandStatus != NULL) { - *CommandStatus = CalleeExitStatus; - } - - // - // Update last error status. - // - // Status is an EFI_STATUS. Clear top bit to convert to SHELL_STATUS - SetLastError(CalleeExitStatus); - break; - default: - // - // Do nothing. - // - break; - } - break; - default: - // - // Do nothing. - // - break; - } - - SHELL_FREE_NON_NULL(CommandWithPath); - - return (Status); -} - -/** - Function to setup StdIn, StdErr, StdOut, and then run the command or file. - - @param[in] Type the type of operation being run. - @param[in] CmdLine the command line to run. - @param[in] FirstParameter the first parameter on the command line. - @param[in] ParamProtocol the shell parameters protocol pointer - @param[out] CommandStatus the status from the command line. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -SetupAndRunCommandOrFile( - IN SHELL_OPERATION_TYPES Type, - IN CHAR16 *CmdLine, - IN CHAR16 *FirstParameter, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol, - OUT EFI_STATUS *CommandStatus -) -{ - EFI_STATUS Status; - SHELL_FILE_HANDLE OriginalStdIn; - SHELL_FILE_HANDLE OriginalStdOut; - SHELL_FILE_HANDLE OriginalStdErr; - SYSTEM_TABLE_INFO OriginalSystemTableInfo; - CONST SCRIPT_FILE *ConstScriptFile; - - // - // Update the StdIn, StdOut, and StdErr for redirection to environment variables, files, etc... unicode and ASCII - // - Status = UpdateStdInStdOutStdErr(ParamProtocol, CmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo); - - // - // The StdIn, StdOut, and StdErr are set up. - // Now run the command, script, or application - // - if (!EFI_ERROR(Status)) { - TrimSpaces(&CmdLine); - Status = RunCommandOrFile(Type, CmdLine, FirstParameter, ParamProtocol, CommandStatus); - } - - // - // Now print errors - // - if (EFI_ERROR(Status)) { - ConstScriptFile = ShellCommandGetCurrentScriptFile(); - if (ConstScriptFile == NULL || ConstScriptFile->CurrentCommand == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status)); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ConstScriptFile->CurrentCommand->Line); - } - } - - // - // put back the original StdIn, StdOut, and StdErr - // - RestoreStdInStdOutStdErr(ParamProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo); - - return (Status); -} - -/** - Function will process and run a command line. - - This will determine if the command line represents an internal shell - command or dispatch an external application. - - @param[in] CmdLine The command line to parse. - @param[out] CommandStatus The status from the command line. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -RunShellCommand( - IN CONST CHAR16 *CmdLine, - OUT EFI_STATUS *CommandStatus - ) -{ - EFI_STATUS Status; - CHAR16 *CleanOriginal; - CHAR16 *FirstParameter; - CHAR16 *TempWalker; - SHELL_OPERATION_TYPES Type; - CONST CHAR16 *CurDir; - - ASSERT(CmdLine != NULL); - if (StrLen(CmdLine) == 0) { - return (EFI_SUCCESS); - } - - Status = EFI_SUCCESS; - CleanOriginal = NULL; - - CleanOriginal = StrnCatGrow(&CleanOriginal, NULL, CmdLine, 0); - if (CleanOriginal == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - TrimSpaces(&CleanOriginal); - - // - // NULL out comments (leveraged from RunScriptFileHandle() ). - // The # character on a line is used to denote that all characters on the same line - // and to the right of the # are to be ignored by the shell. - // Afterwards, again remove spaces, in case any were between the last command-parameter and '#'. - // - for (TempWalker = CleanOriginal; TempWalker != NULL && *TempWalker != CHAR_NULL; TempWalker++) { - if (*TempWalker == L'^') { - if (*(TempWalker + 1) == L'#') { - TempWalker++; - } - } else if (*TempWalker == L'#') { - *TempWalker = CHAR_NULL; - } - } - - TrimSpaces(&CleanOriginal); - - // - // Handle case that passed in command line is just 1 or more " " characters. - // - if (StrLen (CleanOriginal) == 0) { - SHELL_FREE_NON_NULL(CleanOriginal); - return (EFI_SUCCESS); - } - - Status = ProcessCommandLineToFinal(&CleanOriginal); - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(CleanOriginal); - return (Status); - } - - // - // We don't do normal processing with a split command line (output from one command input to another) - // - if (ContainsSplit(CleanOriginal)) { - Status = ProcessNewSplitCommandLine(CleanOriginal); - SHELL_FREE_NON_NULL(CleanOriginal); - return (Status); - } - - // - // We need the first parameter information so we can determine the operation type - // - FirstParameter = AllocateZeroPool(StrSize(CleanOriginal)); - if (FirstParameter == NULL) { - SHELL_FREE_NON_NULL(CleanOriginal); - return (EFI_OUT_OF_RESOURCES); - } - TempWalker = CleanOriginal; - if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CleanOriginal), TRUE))) { - // - // Depending on the first parameter we change the behavior - // - switch (Type = GetOperationType(FirstParameter)) { - case File_Sys_Change: - Status = ChangeMappedDrive (FirstParameter); - break; - case Internal_Command: - case Script_File_Name: - case Efi_Application: - Status = SetupAndRunCommandOrFile(Type, CleanOriginal, FirstParameter, ShellInfoObject.NewShellParametersProtocol, CommandStatus); - break; - default: - // - // Whatever was typed, it was invalid. - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter); - SetLastError(SHELL_NOT_FOUND); - break; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter); - SetLastError(SHELL_NOT_FOUND); - } - // - // Check whether the current file system still exists. If not exist, we need update "cwd" and gShellCurMapping. - // - CurDir = EfiShellGetCurDir (NULL); - if (CurDir != NULL) { - if (EFI_ERROR(ShellFileExists (CurDir))) { - // - // EfiShellSetCurDir() cannot set current directory to NULL. - // EfiShellSetEnv() is not allowed to set the "cwd" variable. - // Only InternalEfiShellSetEnv () is allowed setting the "cwd" variable. - // - InternalEfiShellSetEnv (L"cwd", NULL, TRUE); - gShellCurMapping = NULL; - } - } - - SHELL_FREE_NON_NULL(CleanOriginal); - SHELL_FREE_NON_NULL(FirstParameter); - - return (Status); -} - -/** - Function will process and run a command line. - - This will determine if the command line represents an internal shell - command or dispatch an external application. - - @param[in] CmdLine The command line to parse. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -RunCommand( - IN CONST CHAR16 *CmdLine - ) -{ - return (RunShellCommand(CmdLine, NULL)); -} - -/** - Function to process a NSH script file via SHELL_FILE_HANDLE. - - @param[in] Handle The handle to the already opened file. - @param[in] Name The name of the script file. - - @retval EFI_SUCCESS the script completed successfully -**/ -EFI_STATUS -RunScriptFileHandle ( - IN SHELL_FILE_HANDLE Handle, - IN CONST CHAR16 *Name - ) -{ - EFI_STATUS Status; - SCRIPT_FILE *NewScriptFile; - UINTN LoopVar; - UINTN PrintBuffSize; - CHAR16 *CommandLine; - CHAR16 *CommandLine2; - CHAR16 *CommandLine3; - SCRIPT_COMMAND_LIST *LastCommand; - BOOLEAN Ascii; - BOOLEAN PreScriptEchoState; - BOOLEAN PreCommandEchoState; - CONST CHAR16 *CurDir; - UINTN LineCount; - CHAR16 LeString[50]; - LIST_ENTRY OldBufferList; - - ASSERT(!ShellCommandGetScriptExit()); - - PreScriptEchoState = ShellCommandGetEchoState(); - PrintBuffSize = PcdGet16(PcdShellPrintBufferSize); - - NewScriptFile = (SCRIPT_FILE*)AllocateZeroPool(sizeof(SCRIPT_FILE)); - if (NewScriptFile == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - // - // Set up the name - // - ASSERT(NewScriptFile->ScriptName == NULL); - NewScriptFile->ScriptName = StrnCatGrow(&NewScriptFile->ScriptName, NULL, Name, 0); - if (NewScriptFile->ScriptName == NULL) { - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - - // - // Save the parameters (used to replace %0 to %9 later on) - // - NewScriptFile->Argc = ShellInfoObject.NewShellParametersProtocol->Argc; - if (NewScriptFile->Argc != 0) { - NewScriptFile->Argv = (CHAR16**)AllocateZeroPool(NewScriptFile->Argc * sizeof(CHAR16*)); - if (NewScriptFile->Argv == NULL) { - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - // - // Put the full path of the script file into Argv[0] as required by section - // 3.6.2 of version 2.2 of the shell specification. - // - NewScriptFile->Argv[0] = StrnCatGrow(&NewScriptFile->Argv[0], NULL, NewScriptFile->ScriptName, 0); - for (LoopVar = 1 ; LoopVar < 10 && LoopVar < NewScriptFile->Argc; LoopVar++) { - ASSERT(NewScriptFile->Argv[LoopVar] == NULL); - NewScriptFile->Argv[LoopVar] = StrnCatGrow(&NewScriptFile->Argv[LoopVar], NULL, ShellInfoObject.NewShellParametersProtocol->Argv[LoopVar], 0); - if (NewScriptFile->Argv[LoopVar] == NULL) { - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - } - } else { - NewScriptFile->Argv = NULL; - } - - InitializeListHead(&NewScriptFile->CommandList); - InitializeListHead(&NewScriptFile->SubstList); - - // - // Now build the list of all script commands. - // - LineCount = 0; - while(!ShellFileHandleEof(Handle)) { - CommandLine = ShellFileHandleReturnLine(Handle, &Ascii); - LineCount++; - if (CommandLine == NULL || StrLen(CommandLine) == 0 || CommandLine[0] == '#') { - SHELL_FREE_NON_NULL(CommandLine); - continue; - } - NewScriptFile->CurrentCommand = AllocateZeroPool(sizeof(SCRIPT_COMMAND_LIST)); - if (NewScriptFile->CurrentCommand == NULL) { - SHELL_FREE_NON_NULL(CommandLine); - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - - NewScriptFile->CurrentCommand->Cl = CommandLine; - NewScriptFile->CurrentCommand->Data = NULL; - NewScriptFile->CurrentCommand->Line = LineCount; - - InsertTailList(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link); - } - - // - // Add this as the topmost script file - // - ShellCommandSetNewScript (NewScriptFile); - - // - // Now enumerate through the commands and run each one. - // - CommandLine = AllocateZeroPool(PrintBuffSize); - if (CommandLine == NULL) { - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - CommandLine2 = AllocateZeroPool(PrintBuffSize); - if (CommandLine2 == NULL) { - FreePool(CommandLine); - DeleteScriptFileStruct(NewScriptFile); - return (EFI_OUT_OF_RESOURCES); - } - - for ( NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode(&NewScriptFile->CommandList) - ; !IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link) - ; // conditional increment in the body of the loop - ){ - ASSERT(CommandLine2 != NULL); - StrnCpyS( CommandLine2, - PrintBuffSize/sizeof(CHAR16), - NewScriptFile->CurrentCommand->Cl, - PrintBuffSize/sizeof(CHAR16) - 1 - ); - - SaveBufferList(&OldBufferList); - - // - // NULL out comments - // - for (CommandLine3 = CommandLine2 ; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL ; CommandLine3++) { - if (*CommandLine3 == L'^') { - if ( *(CommandLine3+1) == L':') { - CopyMem(CommandLine3, CommandLine3+1, StrSize(CommandLine3) - sizeof(CommandLine3[0])); - } else if (*(CommandLine3+1) == L'#') { - CommandLine3++; - } - } else if (*CommandLine3 == L'#') { - *CommandLine3 = CHAR_NULL; - } - } - - if (CommandLine2 != NULL && StrLen(CommandLine2) >= 1) { - // - // Due to variability in starting the find and replace action we need to have both buffers the same. - // - StrnCpyS( CommandLine, - PrintBuffSize/sizeof(CHAR16), - CommandLine2, - PrintBuffSize/sizeof(CHAR16) - 1 - ); - - // - // Remove the %0 to %9 from the command line (if we have some arguments) - // - if (NewScriptFile->Argv != NULL) { - switch (NewScriptFile->Argc) { - default: - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%9", NewScriptFile->Argv[9], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 9: - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%8", NewScriptFile->Argv[8], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 8: - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%7", NewScriptFile->Argv[7], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 7: - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%6", NewScriptFile->Argv[6], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 6: - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%5", NewScriptFile->Argv[5], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 5: - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%4", NewScriptFile->Argv[4], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 4: - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%3", NewScriptFile->Argv[3], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 3: - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%2", NewScriptFile->Argv[2], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 2: - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%1", NewScriptFile->Argv[1], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - case 1: - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%0", NewScriptFile->Argv[0], FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - break; - case 0: - break; - } - } - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%1", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%2", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%3", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%4", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%5", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%6", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%7", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%8", L"\"\"", FALSE, FALSE); - Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%9", L"\"\"", FALSE, FALSE); - - StrnCpyS( CommandLine2, - PrintBuffSize/sizeof(CHAR16), - CommandLine, - PrintBuffSize/sizeof(CHAR16) - 1 - ); - - LastCommand = NewScriptFile->CurrentCommand; - - for (CommandLine3 = CommandLine2 ; CommandLine3[0] == L' ' ; CommandLine3++); - - if (CommandLine3 != NULL && CommandLine3[0] == L':' ) { - // - // This line is a goto target / label - // - } else { - if (CommandLine3 != NULL && StrLen(CommandLine3) > 0) { - if (CommandLine3[0] == L'@') { - // - // We need to save the current echo state - // and disable echo for just this command. - // - PreCommandEchoState = ShellCommandGetEchoState(); - ShellCommandSetEchoState(FALSE); - Status = RunCommand(CommandLine3+1); - - // - // If command was "@echo -off" or "@echo -on" then don't restore echo state - // - if (StrCmp (L"@echo -off", CommandLine3) != 0 && - StrCmp (L"@echo -on", CommandLine3) != 0) { - // - // Now restore the pre-'@' echo state. - // - ShellCommandSetEchoState(PreCommandEchoState); - } - } else { - if (ShellCommandGetEchoState()) { - CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd"); - if (CurDir != NULL && StrLen(CurDir) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle); - } - ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2); - } - Status = RunCommand(CommandLine3); - } - } - - if (ShellCommandGetScriptExit()) { - // - // ShellCommandGetExitCode() always returns a UINT64 - // - UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ShellCommandGetExitCode()); - DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE);); - InternalEfiShellSetEnv(L"lasterror", LeString, TRUE); - - ShellCommandRegisterExit(FALSE, 0); - Status = EFI_SUCCESS; - RestoreBufferList(&OldBufferList); - break; - } - if (ShellGetExecutionBreakFlag()) { - RestoreBufferList(&OldBufferList); - break; - } - if (EFI_ERROR(Status)) { - RestoreBufferList(&OldBufferList); - break; - } - if (ShellCommandGetExit()) { - RestoreBufferList(&OldBufferList); - break; - } - } - // - // If that commend did not update the CurrentCommand then we need to advance it... - // - if (LastCommand == NewScriptFile->CurrentCommand) { - NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link); - if (!IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) { - NewScriptFile->CurrentCommand->Reset = TRUE; - } - } - } else { - NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link); - if (!IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) { - NewScriptFile->CurrentCommand->Reset = TRUE; - } - } - RestoreBufferList(&OldBufferList); - } - - - FreePool(CommandLine); - FreePool(CommandLine2); - ShellCommandSetNewScript (NULL); - - // - // Only if this was the last script reset the state. - // - if (ShellCommandGetCurrentScriptFile()==NULL) { - ShellCommandSetEchoState(PreScriptEchoState); - } - return (EFI_SUCCESS); -} - -/** - Function to process a NSH script file. - - @param[in] ScriptPath Pointer to the script file name (including file system path). - @param[in] Handle the handle of the script file already opened. - @param[in] CmdLine the command line to run. - @param[in] ParamProtocol the shell parameters protocol pointer - - @retval EFI_SUCCESS the script completed successfully -**/ -EFI_STATUS -RunScriptFile ( - IN CONST CHAR16 *ScriptPath, - IN SHELL_FILE_HANDLE Handle OPTIONAL, - IN CONST CHAR16 *CmdLine, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol - ) -{ - EFI_STATUS Status; - SHELL_FILE_HANDLE FileHandle; - UINTN Argc; - CHAR16 **Argv; - - if (ShellIsFile(ScriptPath) != EFI_SUCCESS) { - return (EFI_INVALID_PARAMETER); - } - - // - // get the argc and argv updated for scripts - // - Status = UpdateArgcArgv(ParamProtocol, CmdLine, Script_File_Name, &Argv, &Argc); - if (!EFI_ERROR(Status)) { - - if (Handle == NULL) { - // - // open the file - // - Status = ShellOpenFileByName(ScriptPath, &FileHandle, EFI_FILE_MODE_READ, 0); - if (!EFI_ERROR(Status)) { - // - // run it - // - Status = RunScriptFileHandle(FileHandle, ScriptPath); - - // - // now close the file - // - ShellCloseFile(&FileHandle); - } - } else { - Status = RunScriptFileHandle(Handle, ScriptPath); - } - } - - // - // This is guaranteed to be called after UpdateArgcArgv no matter what else happened. - // This is safe even if the update API failed. In this case, it may be a no-op. - // - RestoreArgcArgv(ParamProtocol, &Argv, &Argc); - - return (Status); -} - -/** - Return the pointer to the first occurrence of any character from a list of characters. - - @param[in] String the string to parse - @param[in] CharacterList the list of character to look for - @param[in] EscapeCharacter An escape character to skip - - @return the location of the first character in the string - @retval CHAR_NULL no instance of any character in CharacterList was found in String -**/ -CONST CHAR16* -FindFirstCharacter( - IN CONST CHAR16 *String, - IN CONST CHAR16 *CharacterList, - IN CONST CHAR16 EscapeCharacter - ) -{ - UINT32 WalkChar; - UINT32 WalkStr; - - for (WalkStr = 0; WalkStr < StrLen(String); WalkStr++) { - if (String[WalkStr] == EscapeCharacter) { - WalkStr++; - continue; - } - for (WalkChar = 0; WalkChar < StrLen(CharacterList); WalkChar++) { - if (String[WalkStr] == CharacterList[WalkChar]) { - return (&String[WalkStr]); - } - } - } - return (String + StrLen(String)); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.h deleted file mode 100644 index a12a1ba..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.h +++ /dev/null @@ -1,396 +0,0 @@ -/** @file - function definitions for internal to shell functions. - - (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_INTERNAL_HEADER_ -#define _SHELL_INTERNAL_HEADER_ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ShellParametersProtocol.h" -#include "ShellProtocol.h" -#include "ShellEnvVar.h" -#include "ConsoleLogger.h" -#include "ShellManParser.h" -#include "ConsoleWrappers.h" -#include "FileHandleWrappers.h" - -extern CONST CHAR16 mNoNestingEnvVarName[]; -extern CONST CHAR16 mNoNestingTrue[]; -extern CONST CHAR16 mNoNestingFalse[]; - -typedef struct { - LIST_ENTRY Link; ///< Standard linked list handler. - SHELL_FILE_HANDLE SplitStdOut; ///< ConsoleOut for use in the split. - SHELL_FILE_HANDLE SplitStdIn; ///< ConsoleIn for use in the split. -} SPLIT_LIST; - -typedef struct { - UINT32 Startup:1; ///< Was "-startup" found on command line. - UINT32 NoStartup:1; ///< Was "-nostartup" found on command line. - UINT32 NoConsoleOut:1; ///< Was "-noconsoleout" found on command line. - UINT32 NoConsoleIn:1; ///< Was "-noconsolein" found on command line. - UINT32 NoInterrupt:1; ///< Was "-nointerrupt" found on command line. - UINT32 NoMap:1; ///< Was "-nomap" found on command line. - UINT32 NoVersion:1; ///< Was "-noversion" found on command line. - UINT32 Delay:1; ///< Was "-delay[:n] found on command line - UINT32 Exit:1; ///< Was "-_exit" found on command line - UINT32 NoNest:1; ///< Was "-nonest" found on command line - UINT32 Reserved:7; ///< Extra bits -} SHELL_BITS; - -typedef union { - SHELL_BITS Bits; - UINT16 AllBits; -} SHELL_BIT_UNION; - -typedef struct { - SHELL_BIT_UNION BitUnion; - UINTN Delay; ///< Seconds of delay default:5. - CHAR16 *FileName; ///< Filename to run upon successful initialization. - CHAR16 *FileOptions; ///< Options to pass to FileName. -} SHELL_INIT_SETTINGS; - -typedef struct { - BUFFER_LIST CommandHistory; - UINTN VisibleRowNumber; - UINTN OriginalVisibleRowNumber; - BOOLEAN InsertMode; ///< Is the current typing mode insert (FALSE = overwrite). -} SHELL_VIEWING_SETTINGS; - -typedef struct { - EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParametersProtocol; - EFI_SHELL_PROTOCOL *NewEfiShellProtocol; - BOOLEAN PageBreakEnabled; - BOOLEAN RootShellInstance; - SHELL_INIT_SETTINGS ShellInitSettings; - BUFFER_LIST BufferToFreeList; ///< List of buffers that were returned to the user to free. - SHELL_VIEWING_SETTINGS ViewingSettings; - EFI_HII_HANDLE HiiHandle; ///< Handle from HiiLib. - UINTN LogScreenCount; ///< How many screens of log information to save. - EFI_EVENT UserBreakTimer; ///< Timer event for polling for CTRL-C. - EFI_DEVICE_PATH_PROTOCOL *ImageDevPath; ///< DevicePath for ourselves. - EFI_DEVICE_PATH_PROTOCOL *FileDevPath; ///< DevicePath for ourselves. - CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; ///< Pointer for ConsoleInformation. - EFI_SHELL_PARAMETERS_PROTOCOL *OldShellParameters; ///< old shell parameters to reinstall upon exiting. - SHELL_PROTOCOL_HANDLE_LIST OldShellList; ///< List of other instances to reinstall when closing. - SPLIT_LIST SplitList; ///< List of Splits in FILO stack. - VOID *CtrlCNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlCNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlCNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlCNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlSNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlSNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlSNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - VOID *CtrlSNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify. - BOOLEAN HaltOutput; ///< TRUE to start a CTRL-S halt. -} SHELL_INFO; - -#pragma pack(1) -/// -/// HII specific Vendor Device Path definition. -/// -typedef struct { - VENDOR_DEVICE_PATH VendorDevicePath; - EFI_DEVICE_PATH_PROTOCOL End; -} SHELL_MAN_HII_VENDOR_DEVICE_PATH; -#pragma pack() - -extern SHELL_INFO ShellInfoObject; - -/** - Converts the command line to it's post-processed form. this replaces variables and alias' per UEFI Shell spec. - - @param[in,out] CmdLine pointer to the command line to update - - @retval EFI_SUCCESS The operation was successful - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @return some other error occurred -**/ -EFI_STATUS -ProcessCommandLineToFinal( - IN OUT CHAR16 **CmdLine - ); - -/** - Function to update the shell variable "lasterror". - - @param[in] ErrorCode the error code to put into lasterror -**/ -EFI_STATUS -SetLastError( - IN CONST SHELL_STATUS ErrorCode - ); - -/** - Sets all the alias' that were registered with the ShellCommandLib library. - - @retval EFI_SUCCESS all init commands were run successfully. -**/ -EFI_STATUS -SetBuiltInAlias( - VOID - ); - -/** - This function will populate the 2 device path protocol parameters based on the - global gImageHandle. the DevPath will point to the device path for the handle that has - loaded image protocol installed on it. the FilePath will point to the device path - for the file that was loaded. - - @param[in, out] DevPath on a successful return the device path to the loaded image - @param[in, out] FilePath on a successful return the device path to the file - - @retval EFI_SUCCESS the 2 device paths were successfully returned. - @return other a error from gBS->HandleProtocol - - @sa HandleProtocol -**/ -EFI_STATUS -GetDevicePathsForImageAndFile ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath, - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath - ); - -/** - Process all Uefi Shell 2.0 command line options. - - see Uefi Shell 2.0 section 3.2 for full details. - - the command line should resemble the following: - - shell.efi [ShellOpt-options] [options] [file-name [file-name-options]] - - ShellOpt options Options which control the initialization behavior of the shell. - These options are read from the EFI global variable "ShellOpt" - and are processed before options or file-name. - - options Options which control the initialization behavior of the shell. - - file-name The name of a UEFI shell application or script to be executed - after initialization is complete. By default, if file-name is - specified, then -nostartup is implied. Scripts are not supported - by level 0. - - file-nameoptions The command-line options that are passed to file-name when it - is invoked. - - This will initialize the ShellInitSettings global variable. - - @retval EFI_SUCCESS the variable is initialized. -**/ -EFI_STATUS -ProcessCommandLine( - VOID - ); - -/** - Handles all interaction with the default startup script. - - this will check that the correct command line parameters were passed, handle the delay, and then start running the script. - - @param[in] ImagePath The path to the image for shell. The first place to look for the startup script. - @param[in] FilePath The path to the file for shell. The second place to look for the startup script. - - @retval EFI_SUCCESS The variable is initialized. -**/ -EFI_STATUS -DoStartupScript( - IN EFI_DEVICE_PATH_PROTOCOL *ImagePath, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath - ); - -/** - Function to perform the shell prompt looping. It will do a single prompt, - dispatch the result, and then return. It is expected that the caller will - call this function in a loop many times. - - @retval EFI_SUCCESS - @retval RETURN_ABORTED -**/ -EFI_STATUS -DoShellPrompt ( - VOID - ); - -/** - Add a buffer to the Buffer To Free List for safely returning buffers to other - places without risking letting them modify internal shell information. - - @param Buffer Something to pass to FreePool when the shell is exiting. -**/ -VOID* -AddBufferToFreeList( - VOID *Buffer - ); - -/** - Add a buffer to the Command History List. - - @param Buffer[in] The line buffer to add. -**/ -VOID -AddLineToCommandHistory( - IN CONST CHAR16 *Buffer - ); - -/** - Function will process and run a command line. - - This will determine if the command line represents an internal shell command or dispatch an external application. - - @param[in] CmdLine the command line to parse - - @retval EFI_SUCCESS the command was completed - @retval EFI_ABORTED the command's operation was aborted -**/ -EFI_STATUS -RunCommand( - IN CONST CHAR16 *CmdLine - ); - -/** - Function will process and run a command line. - - This will determine if the command line represents an internal shell - command or dispatch an external application. - - @param[in] CmdLine The command line to parse. - @param[out] CommandStatus The status from the command line. - - @retval EFI_SUCCESS The command was completed. - @retval EFI_ABORTED The command's operation was aborted. -**/ -EFI_STATUS -RunShellCommand( - IN CONST CHAR16 *CmdLine, - OUT EFI_STATUS *CommandStatus - ); - - -/** - Function to process a NSH script file via SHELL_FILE_HANDLE. - - @param[in] Handle The handle to the already opened file. - @param[in] Name The name of the script file. - - @retval EFI_SUCCESS the script completed successfully -**/ -EFI_STATUS -RunScriptFileHandle ( - IN SHELL_FILE_HANDLE Handle, - IN CONST CHAR16 *Name - ); - -/** - Function to process a NSH script file. - - @param[in] ScriptPath Pointer to the script file name (including file system path). - @param[in] Handle the handle of the script file already opened. - @param[in] CmdLine the command line to run. - @param[in] ParamProtocol the shell parameters protocol pointer - - @retval EFI_SUCCESS the script completed successfully -**/ -EFI_STATUS -RunScriptFile ( - IN CONST CHAR16 *ScriptPath, - IN SHELL_FILE_HANDLE Handle OPTIONAL, - IN CONST CHAR16 *CmdLine, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol - ); - -/** - Return the pointer to the first occurrence of any character from a list of characters. - - @param[in] String the string to parse - @param[in] CharacterList the list of character to look for - @param[in] EscapeCharacter An escape character to skip - - @return the location of the first character in the string - @retval CHAR_NULL no instance of any character in CharacterList was found in String -**/ -CONST CHAR16* -FindFirstCharacter( - IN CONST CHAR16 *String, - IN CONST CHAR16 *CharacterList, - IN CONST CHAR16 EscapeCharacter - ); - -/** - Cleans off leading and trailing spaces and tabs. - - @param[in] String pointer to the string to trim them off. -**/ -EFI_STATUS -TrimSpaces( - IN CHAR16 **String - ); - -/** - - Create a new buffer list and stores the old one to OldBufferList - - @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. -**/ -VOID -SaveBufferList ( - OUT LIST_ENTRY *OldBufferList - ); - -/** - Restore previous nodes into BufferToFreeList . - - @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. -**/ -VOID -RestoreBufferList ( - IN OUT LIST_ENTRY *OldBufferList - ); - - - -#endif //_SHELL_INTERNAL_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.inf b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.inf deleted file mode 100644 index ea4204d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.inf +++ /dev/null @@ -1,110 +0,0 @@ -## @file -# This is the shell application -# -# (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = Shell - FILE_GUID = 7C04A583-9E3E-4f1c-AD65-E05268D0B4D1 # gUefiShellFileGuid - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = UefiMain - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - Shell.c - Shell.h - ShellParametersProtocol.c - ShellParametersProtocol.h - ShellProtocol.c - ShellProtocol.h - FileHandleWrappers.c - FileHandleWrappers.h - FileHandleInternal.h - ShellEnvVar.c - ShellEnvVar.h - ShellManParser.c - ShellManParser.h - Shell.uni - ConsoleLogger.c - ConsoleLogger.h - ConsoleWrappers.c - ConsoleWrappers.h - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - UefiLib - DebugLib - MemoryAllocationLib - ShellCommandLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - DevicePathLib - BaseMemoryLib - PcdLib - FileHandleLib - PrintLib - HiiLib - SortLib - HandleParsingLib - UefiHiiServicesLib - -[Guids] - gShellVariableGuid ## SOMETIMES_CONSUMES ## GUID - gShellAliasGuid ## SOMETIMES_CONSUMES ## GUID - gShellAliasGuid ## SOMETIMES_PRODUCES ## GUID - -[Protocols] - gEfiShellProtocolGuid ## PRODUCES - ## SOMETIMES_CONSUMES - gEfiShellParametersProtocolGuid ## PRODUCES - ## SOMETIMES_CONSUMES - -# gEfiShellEnvironment2Guid ## SOMETIMES_PRODUCES -# gEfiShellInterfaceGuid ## SOMETIMES_PRODUCES - - gEfiSimpleTextInputExProtocolGuid ## CONSUMES - gEfiSimpleTextInProtocolGuid ## CONSUMES - gEfiSimpleTextOutProtocolGuid ## CONSUMES - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMES - gEfiUnicodeCollation2ProtocolGuid ## CONSUMES - gEfiDevicePathProtocolGuid ## CONSUMES - gEfiHiiPackageListProtocolGuid ## SOMETIMES_PRODUCES - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellRequireHiiPlatform ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellSupportFrameworkHii ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellPageBreakDefault ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellInsertModeDefault ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellScreenLogCount ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellForceConsole ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellSupplier ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellMaxHistoryCommandCount ## CONSUMES diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.uni b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.uni deleted file mode 100644 index 6660951..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/Shell.uni +++ /dev/null @@ -1,58 +0,0 @@ -// *++ -// -// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// ShellStrings.uni -// -// Abstract: -// -// String definitions for the main UEFI Shell 2.0 application -// -// Revision History: -// -// --*/ - -/=# - -#langdef en-US "English" - -#string STR_SHELL_CURDIR #language en-US "%E%s\> %N" -#string STR_GEN_PROBLEM #language en-US "The argument '%B%s%N' is incorrect.\r\n" -#string STR_SHELL_SHELL #language en-US "%EShell> %N" - -#string STR_SHELL_STARTUP_QUESTION #language en-US "%NPress %HESC%N in %d seconds to skip %Estartup.nsh%N or any other key to continue." - -#string STR_SHELL_ENTER_TO_CONT #language en-US "%NPress ENTER to continue:%E" -#string STR_SHELL_QUIT_CONT #language en-US "%NPress ENTER to continue or 'Q' break:%E" - -#string STR_SHELL_NOT_FOUND #language en-US "%N'%E%s%N' is not recognized as an internal or external command, operable program, or script file.\r\n" - -#string STR_SHELL_CRLF #language en-US "\r\n" - -#string STR_SHELL_ERROR #language en-US "%NCommand Error Status: %r\r\n" -#string STR_SHELL_ERROR_SCRIPT #language en-US "%NScript Error Status: %r (line number %d)\r\n" - -#string STR_SHELL_INVALID_MAPPING #language en-US "%N'%B%s%N' is not a valid mapping.\r\n" -#string STR_SHELL_INVALID_SPLIT #language en-US "Invalid use of pipe (%B|%N).\r\n" - -#string STR_SHELL_INVALID_REDIR #language en-US "Unable to redirect file.\r\n" -#string STR_SHELL_REDUNDA_REDIR #language en-US "Redundant redirection specified.\r\n" - -#string STR_VER_OUTPUT_MAIN_SHELL #language en-US "UEFI %s Shell v%d.%d\r\n" -#string STR_VER_OUTPUT_MAIN_SUPPLIER #language en-US "%s\r\n" -#string STR_VER_OUTPUT_MAIN_UEFI #language en-US "UEFI v%d.%02d (%s, 0x%08x)\r\n" - -#string STR_SHELL_NO_IN_EX #language en-US "No SimpleTextInputEx was found. CTRL-based features are not usable.\r\n" - -#string STR_SHELL_IMAGE_NOT_APP #language en-US "The image is not an application.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.c deleted file mode 100644 index 5993540..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.c +++ /dev/null @@ -1,578 +0,0 @@ -/** @file - function declarations for shell environment functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -#define INIT_NAME_BUFFER_SIZE 128 -#define INIT_DATA_BUFFER_SIZE 1024 - -// -// The list is used to cache the environment variables. -// -ENV_VAR_LIST gShellEnvVarList; - -/** - Reports whether an environment variable is Volatile or Non-Volatile. - - @param EnvVarName The name of the environment variable in question - @param Volatile Return TRUE if the environment variable is volatile - - @retval EFI_SUCCESS The volatile attribute is returned successfully - @retval others Some errors happened. -**/ -EFI_STATUS -IsVolatileEnv ( - IN CONST CHAR16 *EnvVarName, - OUT BOOLEAN *Volatile - ) -{ - EFI_STATUS Status; - UINTN Size; - VOID *Buffer; - UINT32 Attribs; - - ASSERT (Volatile != NULL); - - Size = 0; - Buffer = NULL; - - // - // get the variable - // - Status = gRT->GetVariable((CHAR16*)EnvVarName, - &gShellVariableGuid, - &Attribs, - &Size, - Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = AllocateZeroPool(Size); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Status = gRT->GetVariable((CHAR16*)EnvVarName, - &gShellVariableGuid, - &Attribs, - &Size, - Buffer); - FreePool(Buffer); - } - // - // not found means volatile - // - if (Status == EFI_NOT_FOUND) { - *Volatile = TRUE; - return EFI_SUCCESS; - } - if (EFI_ERROR (Status)) { - return Status; - } - - // - // check for the Non Volatile bit - // - *Volatile = !(BOOLEAN) ((Attribs & EFI_VARIABLE_NON_VOLATILE) == EFI_VARIABLE_NON_VOLATILE); - return EFI_SUCCESS; -} - -/** - free function for ENV_VAR_LIST objects. - - @param[in] List The pointer to pointer to list. -**/ -VOID -FreeEnvironmentVariableList( - IN LIST_ENTRY *List - ) -{ - ENV_VAR_LIST *Node; - - ASSERT (List != NULL); - if (List == NULL) { - return; - } - - for ( Node = (ENV_VAR_LIST*)GetFirstNode(List) - ; !IsListEmpty(List) - ; Node = (ENV_VAR_LIST*)GetFirstNode(List) - ){ - ASSERT(Node != NULL); - RemoveEntryList(&Node->Link); - if (Node->Key != NULL) { - FreePool(Node->Key); - } - if (Node->Val != NULL) { - FreePool(Node->Val); - } - FreePool(Node); - } -} - -/** - Creates a list of all Shell-Guid-based environment variables. - - @param[in, out] ListHead The pointer to pointer to LIST ENTRY object for - storing this list. - - @retval EFI_SUCCESS the list was created sucessfully. -**/ -EFI_STATUS -GetEnvironmentVariableList( - IN OUT LIST_ENTRY *ListHead - ) -{ - CHAR16 *VariableName; - UINTN NameSize; - UINTN NameBufferSize; - EFI_STATUS Status; - EFI_GUID Guid; - UINTN ValSize; - UINTN ValBufferSize; - ENV_VAR_LIST *VarList; - - if (ListHead == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Status = EFI_SUCCESS; - - ValBufferSize = INIT_DATA_BUFFER_SIZE; - NameBufferSize = INIT_NAME_BUFFER_SIZE; - VariableName = AllocateZeroPool(NameBufferSize); - if (VariableName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - *VariableName = CHAR_NULL; - - while (!EFI_ERROR(Status)) { - NameSize = NameBufferSize; - Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid); - if (Status == EFI_NOT_FOUND){ - Status = EFI_SUCCESS; - break; - } else if (Status == EFI_BUFFER_TOO_SMALL) { - NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2; - SHELL_FREE_NON_NULL(VariableName); - VariableName = AllocateZeroPool(NameBufferSize); - if (VariableName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - break; - } - NameSize = NameBufferSize; - Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid); - } - - if (!EFI_ERROR(Status) && CompareGuid(&Guid, &gShellVariableGuid)){ - VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST)); - if (VarList == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - ValSize = ValBufferSize; - // - // We need another CHAR16 to save '\0' in VarList->Val. - // - VarList->Val = AllocateZeroPool (ValSize + sizeof (CHAR16)); - if (VarList->Val == NULL) { - SHELL_FREE_NON_NULL(VarList); - Status = EFI_OUT_OF_RESOURCES; - break; - } - Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val); - if (Status == EFI_BUFFER_TOO_SMALL){ - ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2; - SHELL_FREE_NON_NULL (VarList->Val); - // - // We need another CHAR16 to save '\0' in VarList->Val. - // - VarList->Val = AllocateZeroPool (ValBufferSize + sizeof (CHAR16)); - if (VarList->Val == NULL) { - SHELL_FREE_NON_NULL(VarList); - Status = EFI_OUT_OF_RESOURCES; - break; - } - - ValSize = ValBufferSize; - Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val); - } - if (!EFI_ERROR(Status)) { - VarList->Key = AllocateCopyPool(StrSize(VariableName), VariableName); - if (VarList->Key == NULL) { - SHELL_FREE_NON_NULL(VarList->Val); - SHELL_FREE_NON_NULL(VarList); - Status = EFI_OUT_OF_RESOURCES; - } else { - InsertTailList(ListHead, &VarList->Link); - } - } else { - SHELL_FREE_NON_NULL(VarList->Val); - SHELL_FREE_NON_NULL(VarList); - } - } // if (VarList == NULL) ... else ... - } // compare guid - } // while - SHELL_FREE_NON_NULL (VariableName); - - if (EFI_ERROR(Status)) { - FreeEnvironmentVariableList(ListHead); - } - - return (Status); -} - -/** - Sets a list of all Shell-Guid-based environment variables. this will - also eliminate all existing shell environment variables (even if they - are not on the list). - - This function will also deallocate the memory from List. - - @param[in] ListHead The pointer to LIST_ENTRY from - GetShellEnvVarList(). - - @retval EFI_SUCCESS the list was Set sucessfully. -**/ -EFI_STATUS -SetEnvironmentVariableList( - IN LIST_ENTRY *ListHead - ) -{ - ENV_VAR_LIST VarList; - ENV_VAR_LIST *Node; - EFI_STATUS Status; - UINTN Size; - - InitializeListHead(&VarList.Link); - - // - // Delete all the current environment variables - // - Status = GetEnvironmentVariableList(&VarList.Link); - ASSERT_EFI_ERROR(Status); - - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&VarList.Link) - ; !IsNull(&VarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&VarList.Link, &Node->Link) - ){ - if (Node->Key != NULL) { - Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Node->Key); - } - ASSERT_EFI_ERROR(Status); - } - - FreeEnvironmentVariableList(&VarList.Link); - - // - // set all the variables fron the list - // - for ( Node = (ENV_VAR_LIST*)GetFirstNode(ListHead) - ; !IsNull(ListHead, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(ListHead, &Node->Link) - ){ - Size = StrSize (Node->Val) - sizeof (CHAR16); - if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) { - Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV(Node->Key, Size, Node->Val); - } else { - Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val); - } - ASSERT_EFI_ERROR(Status); - } - FreeEnvironmentVariableList(ListHead); - - return (Status); -} - -/** - sets a list of all Shell-Guid-based environment variables. - - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - - @sa SetEnvironmentVariableList -**/ -EFI_STATUS -SetEnvironmentVariables( - IN CONST CHAR16 **Environment - ) -{ - CONST CHAR16 *CurrentString; - UINTN CurrentCount; - ENV_VAR_LIST *VarList; - ENV_VAR_LIST *Node; - - VarList = NULL; - - if (Environment == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Build a list identical to the ones used for get/set list functions above - // - for ( CurrentCount = 0 - ; - ; CurrentCount++ - ){ - CurrentString = Environment[CurrentCount]; - if (CurrentString == NULL) { - break; - } - ASSERT(StrStr(CurrentString, L"=") != NULL); - Node = AllocateZeroPool(sizeof(ENV_VAR_LIST)); - if (Node == NULL) { - SetEnvironmentVariableList(&VarList->Link); - return (EFI_OUT_OF_RESOURCES); - } - - Node->Key = AllocateZeroPool((StrStr(CurrentString, L"=") - CurrentString + 1) * sizeof(CHAR16)); - if (Node->Key == NULL) { - SHELL_FREE_NON_NULL(Node); - SetEnvironmentVariableList(&VarList->Link); - return (EFI_OUT_OF_RESOURCES); - } - - // - // Copy the string into the Key, leaving the last character allocated as NULL to terminate - // - StrnCpyS( Node->Key, - StrStr(CurrentString, L"=") - CurrentString + 1, - CurrentString, - StrStr(CurrentString, L"=") - CurrentString - ); - - // - // ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other) - // - Node->Val = AllocateCopyPool(StrSize(CurrentString) - StrSize(Node->Key), CurrentString + StrLen(Node->Key) + 1); - if (Node->Val == NULL) { - SHELL_FREE_NON_NULL(Node->Key); - SHELL_FREE_NON_NULL(Node); - SetEnvironmentVariableList(&VarList->Link); - return (EFI_OUT_OF_RESOURCES); - } - - Node->Atts = EFI_VARIABLE_BOOTSERVICE_ACCESS; - - if (VarList == NULL) { - VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST)); - if (VarList == NULL) { - SHELL_FREE_NON_NULL(Node->Key); - SHELL_FREE_NON_NULL(Node->Val); - SHELL_FREE_NON_NULL(Node); - return (EFI_OUT_OF_RESOURCES); - } - InitializeListHead(&VarList->Link); - } - InsertTailList(&VarList->Link, &Node->Link); - - } // for loop - - // - // set this new list as the set of all environment variables. - // this function also frees the memory and deletes all pre-existing - // shell-guid based environment variables. - // - return (SetEnvironmentVariableList(&VarList->Link)); -} - -/** - Find an environment variable in the gShellEnvVarList. - - @param Key The name of the environment variable. - @param Value The value of the environment variable, the buffer - shoule be freed by the caller. - @param ValueSize The size in bytes of the environment variable - including the tailing CHAR_NELL. - @param Atts The attributes of the variable. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_NOT_FOUND The environment variable is not found in - gShellEnvVarList. - -**/ -EFI_STATUS -ShellFindEnvVarInList ( - IN CONST CHAR16 *Key, - OUT CHAR16 **Value, - OUT UINTN *ValueSize, - OUT UINT32 *Atts OPTIONAL - ) -{ - ENV_VAR_LIST *Node; - - if (Key == NULL || Value == NULL || ValueSize == NULL) { - return SHELL_INVALID_PARAMETER; - } - - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link) - ; !IsNull(&gShellEnvVarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link) - ){ - if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) { - *Value = AllocateCopyPool(StrSize(Node->Val), Node->Val); - *ValueSize = StrSize(Node->Val); - if (Atts != NULL) { - *Atts = Node->Atts; - } - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - Add an environment variable into gShellEnvVarList. - - @param Key The name of the environment variable. - @param Value The value of environment variable. - @param ValueSize The size in bytes of the environment variable - including the tailing CHAR_NULL - @param Atts The attributes of the variable. - - @retval EFI_SUCCESS The environment variable was added to list successfully. - @retval others Some errors happened. - -**/ -EFI_STATUS -ShellAddEnvVarToList ( - IN CONST CHAR16 *Key, - IN CONST CHAR16 *Value, - IN UINTN ValueSize, - IN UINT32 Atts - ) -{ - ENV_VAR_LIST *Node; - CHAR16 *LocalKey; - CHAR16 *LocalValue; - - if (Key == NULL || Value == NULL || ValueSize == 0) { - return EFI_INVALID_PARAMETER; - } - - LocalValue = AllocateCopyPool (ValueSize, Value); - if (LocalValue == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Update the variable value if it exists in gShellEnvVarList. - // - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link) - ; !IsNull(&gShellEnvVarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link) - ){ - if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) { - Node->Atts = Atts; - SHELL_FREE_NON_NULL(Node->Val); - Node->Val = LocalValue; - return EFI_SUCCESS; - } - } - - // - // If the environment varialbe key doesn't exist in list just insert - // a new node. - // - LocalKey = AllocateCopyPool (StrSize(Key), Key); - if (LocalKey == NULL) { - FreePool (LocalValue); - return EFI_OUT_OF_RESOURCES; - } - Node = (ENV_VAR_LIST*)AllocateZeroPool (sizeof(ENV_VAR_LIST)); - if (Node == NULL) { - FreePool (LocalKey); - FreePool (LocalValue); - return EFI_OUT_OF_RESOURCES; - } - Node->Key = LocalKey; - Node->Val = LocalValue; - Node->Atts = Atts; - InsertTailList(&gShellEnvVarList.Link, &Node->Link); - - return EFI_SUCCESS; -} - -/** - Remove a specified environment variable in gShellEnvVarList. - - @param Key The name of the environment variable. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_NOT_FOUND The environment variable is not found in - gShellEnvVarList. -**/ -EFI_STATUS -ShellRemvoeEnvVarFromList ( - IN CONST CHAR16 *Key - ) -{ - ENV_VAR_LIST *Node; - - if (Key == NULL) { - return EFI_INVALID_PARAMETER; - } - - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link) - ; !IsNull(&gShellEnvVarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link) - ){ - if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) { - SHELL_FREE_NON_NULL(Node->Key); - SHELL_FREE_NON_NULL(Node->Val); - RemoveEntryList(&Node->Link); - SHELL_FREE_NON_NULL(Node); - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - Initialize the gShellEnvVarList and cache all Shell-Guid-based environment - variables. - -**/ -EFI_STATUS -ShellInitEnvVarList ( - VOID - ) -{ - EFI_STATUS Status; - - InitializeListHead(&gShellEnvVarList.Link); - Status = GetEnvironmentVariableList (&gShellEnvVarList.Link); - - return Status; -} - -/** - Destructe the gShellEnvVarList. - -**/ -VOID -ShellFreeEnvVarList ( - VOID - ) -{ - FreeEnvironmentVariableList (&gShellEnvVarList.Link); - InitializeListHead(&gShellEnvVarList.Link); - - return; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.h deleted file mode 100644 index a1ede0d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellEnvVar.h +++ /dev/null @@ -1,288 +0,0 @@ -/** @file - function definitions for shell environment functions. - - the following includes are required: -//#include -//#include - - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_ENVIRONMENT_VARIABLE_HEADER_ -#define _SHELL_ENVIRONMENT_VARIABLE_HEADER_ - -typedef struct { - LIST_ENTRY Link; - CHAR16 *Key; - CHAR16 *Val; - UINT32 Atts; -} ENV_VAR_LIST; - -// -// The list is used to cache the environment variables. -// -extern ENV_VAR_LIST gShellEnvVarList; - - -/** - Reports whether an environment variable is Volatile or Non-Volatile. - - @param EnvVarName The name of the environment variable in question - @param Volatile Return TRUE if the environment variable is volatile - - @retval EFI_SUCCESS The volatile attribute is returned successfully - @retval others Some errors happened. -**/ -EFI_STATUS -IsVolatileEnv ( - IN CONST CHAR16 *EnvVarName, - OUT BOOLEAN *Volatile - ); - -/** - Delete a Non-Violatile environment variable. - - This will use the Runtime Services call SetVariable to remove a non-violatile variable. - - @param EnvVarName The name of the environment variable in question - - @retval EFI_SUCCESS The variable was deleted sucessfully - @retval other An error ocurred - @sa SetVariable -**/ -#define SHELL_DELETE_ENVIRONMENT_VARIABLE(EnvVarName) \ - (gRT->SetVariable((CHAR16*)EnvVarName, \ - &gShellVariableGuid, \ - 0, \ - 0, \ - NULL)) - -/** - Set a Non-Violatile environment variable. - - This will use the Runtime Services call SetVariable to set a non-violatile variable. - - @param EnvVarName The name of the environment variable in question - @param BufferSize UINTN size of Buffer - @param Buffer Pointer to value to set variable to - - @retval EFI_SUCCESS The variable was changed sucessfully - @retval other An error ocurred - @sa SetVariable -**/ -#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName,BufferSize,Buffer) \ - (gRT->SetVariable((CHAR16*)EnvVarName, \ - &gShellVariableGuid, \ - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS, \ - BufferSize, \ - (VOID*)Buffer)) - -/** - Get an environment variable. - - This will use the Runtime Services call GetVariable to get a variable. - - @param EnvVarName The name of the environment variable in question - @param BufferSize Pointer to the UINTN size of Buffer - @param Buffer Pointer buffer to get variable value into - - @retval EFI_SUCCESS The variable's value was retrieved sucessfully - @retval other An error ocurred - @sa SetVariable -**/ -#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName,BufferSize,Buffer) \ - (gRT->GetVariable((CHAR16*)EnvVarName, \ - &gShellVariableGuid, \ - 0, \ - BufferSize, \ - Buffer)) - -/** - Get an environment variable. - - This will use the Runtime Services call GetVariable to get a variable. - - @param EnvVarName The name of the environment variable in question - @param Atts Pointer to the UINT32 for attributes (or NULL) - @param BufferSize Pointer to the UINTN size of Buffer - @param Buffer Pointer buffer to get variable value into - - @retval EFI_SUCCESS The variable's value was retrieved sucessfully - @retval other An error ocurred - @sa SetVariable -**/ -#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName,Atts,BufferSize,Buffer) \ - (gRT->GetVariable((CHAR16*)EnvVarName, \ - &gShellVariableGuid, \ - Atts, \ - BufferSize, \ - Buffer)) - -/** - Set a Violatile environment variable. - - This will use the Runtime Services call SetVariable to set a violatile variable. - - @param EnvVarName The name of the environment variable in question - @param BufferSize UINTN size of Buffer - @param Buffer Pointer to value to set variable to - - @retval EFI_SUCCESS The variable was changed sucessfully - @retval other An error ocurred - @sa SetVariable -**/ -#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName,BufferSize,Buffer) \ - (gRT->SetVariable((CHAR16*)EnvVarName, \ - &gShellVariableGuid, \ - EFI_VARIABLE_BOOTSERVICE_ACCESS, \ - BufferSize, \ - (VOID*)Buffer)) - -/** - Creates a list of all Shell-Guid-based environment variables. - - @param[in, out] List The pointer to pointer to LIST_ENTRY object for - storing this list. - - @retval EFI_SUCCESS the list was created sucessfully. -**/ -EFI_STATUS -GetEnvironmentVariableList( - IN OUT LIST_ENTRY *List - ); - -/** - Sets a list of all Shell-Guid-based environment variables. this will - also eliminate all pre-existing shell environment variables (even if they - are not on the list). - - This function will also deallocate the memory from List. - - @param[in] List The pointer to LIST_ENTRY from - GetShellEnvVarList(). - - @retval EFI_SUCCESS The list was Set sucessfully. -**/ -EFI_STATUS -SetEnvironmentVariableList( - IN LIST_ENTRY *List - ); - -/** - sets all Shell-Guid-based environment variables. this will - also eliminate all pre-existing shell environment variables (even if they - are not on the list). - - @param[in] Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - - @sa SetEnvironmentVariableList -**/ -EFI_STATUS -SetEnvironmentVariables( - IN CONST CHAR16 **Environment - ); - -/** - free function for ENV_VAR_LIST objects. - - @param[in] List The pointer to pointer to list. -**/ -VOID -FreeEnvironmentVariableList( - IN LIST_ENTRY *List - ); - -/** - Find an environment variable in the gShellEnvVarList. - - @param Key The name of the environment variable. - @param Value The value of the environment variable, the buffer - shoule be freed by the caller. - @param ValueSize The size in bytes of the environment variable - including the tailing CHAR_NULL. - @param Atts The attributes of the variable. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_NOT_FOUND The environment variable is not found in - gShellEnvVarList. - -**/ -EFI_STATUS -ShellFindEnvVarInList ( - IN CONST CHAR16 *Key, - OUT CHAR16 **Value, - OUT UINTN *ValueSize, - OUT UINT32 *Atts OPTIONAL - ); - -/** - Add an environment variable into gShellEnvVarList. - - @param Key The name of the environment variable. - @param Value The value of environment variable. - @param ValueSize The size in bytes of the environment variable - including the tailing CHAR_NULL - @param Atts The attributes of the variable. - - @retval EFI_SUCCESS The environment variable was added to list successfully. - @retval others Some errors happened. - -**/ -EFI_STATUS -ShellAddEnvVarToList ( - IN CONST CHAR16 *Key, - IN CONST CHAR16 *Value, - IN UINTN ValueSize, - IN UINT32 Atts - ); - -/** - Remove a specified environment variable in gShellEnvVarList. - - @param Key The name of the environment variable. - - @retval EFI_SUCCESS The command executed successfully. - @retval EFI_NOT_FOUND The environment variable is not found in - gShellEnvVarList. -**/ -EFI_STATUS -ShellRemvoeEnvVarFromList ( - IN CONST CHAR16 *Key - ); - -/** - Initialize the gShellEnvVarList and cache all Shell-Guid-based environment - variables. - -**/ -EFI_STATUS -ShellInitEnvVarList ( - VOID - ); - -/** - Destructe the gShellEnvVarList. - -**/ -VOID -ShellFreeEnvVarList ( - VOID - ); - -#endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.c deleted file mode 100644 index 874b10f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.c +++ /dev/null @@ -1,754 +0,0 @@ -/** @file - Provides interface to shell MAN file parser. - - Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
- Copyright 2015 Dell Inc. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -#define SHELL_MAN_HII_GUID \ -{ \ - 0xf62ccd0c, 0x2449, 0x453c, { 0x8a, 0xcb, 0x8c, 0xc5, 0x7c, 0xf0, 0x2a, 0x97 } \ -} - -EFI_HII_HANDLE mShellManHiiHandle = NULL; -EFI_HANDLE mShellManDriverHandle = NULL; - - -SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = { - { - { - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP, - { - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) - } - }, - SHELL_MAN_HII_GUID - }, - { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - (UINT8) (END_DEVICE_PATH_LENGTH), - (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) - } - } -}; - -/** - Verifies that the filename has .EFI on the end. - - allocates a new buffer and copies the name (appending .EFI if necessary). - Caller to free the buffer. - - @param[in] NameString original name string - - @return the new filename with .efi as the extension. -**/ -CHAR16 * -GetExecuatableFileName ( - IN CONST CHAR16 *NameString - ) -{ - CHAR16 *Buffer; - CHAR16 *SuffixStr; - if (NameString == NULL) { - return (NULL); - } - - // - // Fix the file name - // - if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".efi"), L".efi", StrLen(L".efi"))==0) { - Buffer = AllocateCopyPool(StrSize(NameString), NameString); - } else if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".man"), L".man", StrLen(L".man"))==0) { - Buffer = AllocateCopyPool(StrSize(NameString), NameString); - if (Buffer != NULL) { - SuffixStr = Buffer+StrLen(Buffer)-StrLen(L".man"); - StrnCpyS (SuffixStr, StrSize(L".man")/sizeof(CHAR16), L".efi", StrLen(L".efi")); - } - } else { - Buffer = AllocateZeroPool(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16)); - if (Buffer != NULL) { - StrnCpyS( Buffer, - (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16), - NameString, - StrLen(NameString) - ); - StrnCatS( Buffer, - (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16), - L".efi", - StrLen(L".efi") - ); - } - } - return (Buffer); - -} - -/** - Verifies that the filename has .MAN on the end. - - allocates a new buffer and copies the name (appending .MAN if necessary) - - ASSERT if ManFileName is NULL - - @param[in] ManFileName original filename - - @return the new filename with .man as the extension. -**/ -CHAR16 * -GetManFileName( - IN CONST CHAR16 *ManFileName - ) -{ - CHAR16 *Buffer; - if (ManFileName == NULL) { - return (NULL); - } - // - // Fix the file name - // - if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) { - Buffer = AllocateCopyPool(StrSize(ManFileName), ManFileName); - } else { - Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16)); - if (Buffer != NULL) { - StrnCpyS( Buffer, - (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16), - ManFileName, - StrLen(ManFileName) - ); - StrnCatS( Buffer, - (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16), - L".man", - 4 - ); - } - } - return (Buffer); -} - -/** - Search the path environment variable for possible locations and test for - which one contains a man file with the name specified. If a valid file is found - stop searching and return the (opened) SHELL_FILE_HANDLE for that file. - - @param[in] FileName Name of the file to find and open. - @param[out] Handle Pointer to the handle of the found file. The - value of this is undefined for return values - except EFI_SUCCESS. - - @retval EFI_SUCCESS The file was found. Handle is a valid SHELL_FILE_HANDLE - @retval EFI_INVALID_PARAMETER A parameter had an invalid value. - @retval EFI_NOT_FOUND The file was not found. -**/ -EFI_STATUS -SearchPathForFile( - IN CONST CHAR16 *FileName, - OUT SHELL_FILE_HANDLE *Handle - ) -{ - CHAR16 *FullFileName; - EFI_STATUS Status; - - if ( FileName == NULL - || Handle == NULL - || StrLen(FileName) == 0 - ){ - return (EFI_INVALID_PARAMETER); - } - - FullFileName = ShellFindFilePath(FileName); - if (FullFileName == NULL) { - return (EFI_NOT_FOUND); - } - - // - // now open that file - // - Status = EfiShellOpenFileByName(FullFileName, Handle, EFI_FILE_MODE_READ); - FreePool(FullFileName); - - return (Status); -} - -/** - parses through the MAN file specified by SHELL_FILE_HANDLE and returns the - detailed help for any sub section specified in the comma seperated list of - sections provided. If the end of the file or a .TH section is found then - return. - - Upon a sucessful return the caller is responsible to free the memory in *HelpText - - @param[in] Handle FileHandle to read from - @param[in] Sections name of command's sub sections to find - @param[out] HelpText pointer to pointer to string where text goes. - @param[out] HelpSize pointer to size of allocated HelpText (may be updated) - @param[in] Ascii TRUE if the file is ASCII, FALSE otherwise. - - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. - @retval EFI_SUCCESS the section was found and its description sotred in - an alloceted buffer. -**/ -EFI_STATUS -ManFileFindSections( - IN SHELL_FILE_HANDLE Handle, - IN CONST CHAR16 *Sections, - OUT CHAR16 **HelpText, - OUT UINTN *HelpSize, - IN BOOLEAN Ascii - ) -{ - EFI_STATUS Status; - CHAR16 *ReadLine; - UINTN Size; - BOOLEAN CurrentlyReading; - CHAR16 *SectionName; - UINTN SectionLen; - BOOLEAN Found; - - if ( Handle == NULL - || HelpText == NULL - || HelpSize == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - - Status = EFI_SUCCESS; - CurrentlyReading = FALSE; - Size = 1024; - Found = FALSE; - - ReadLine = AllocateZeroPool(Size); - if (ReadLine == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - for (;!ShellFileHandleEof(Handle);Size = 1024) { - Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, &Ascii); - if (ReadLine[0] == L'#') { - // - // Skip comment lines - // - continue; - } - // - // ignore too small of buffer... - // - if (Status == EFI_BUFFER_TOO_SMALL) { - Status = EFI_SUCCESS; - } - if (EFI_ERROR(Status)) { - break; - } else if (StrnCmp(ReadLine, L".TH", 3) == 0) { - // - // we hit the end of this commands section so stop. - // - break; - } else if (StrnCmp(ReadLine, L".SH", 3) == 0) { - if (Sections == NULL) { - CurrentlyReading = TRUE; - continue; - } - // - // we found a section - // - if (CurrentlyReading) { - CurrentlyReading = FALSE; - } - // - // is this a section we want to read in? - // - for ( SectionName = ReadLine + 3 - ; *SectionName == L' ' - ; SectionName++); - SectionLen = StrLen(SectionName); - SectionName = StrStr(Sections, SectionName); - if (SectionName == NULL) { - continue; - } - if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') { - CurrentlyReading = TRUE; - } - } else if (CurrentlyReading) { - Found = TRUE; - // - // copy and save the current line. - // - ASSERT((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL)); - StrnCatGrow (HelpText, HelpSize, ReadLine, 0); - StrnCatGrow (HelpText, HelpSize, L"\r\n", 0); - } - } - FreePool(ReadLine); - if (!Found && !EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - return (Status); -} - -/** - Parses a line from a MAN file to see if it is the Title Header. If it is, then - if the "Brief Description" is desired, allocate a buffer for it and return a - copy. Upon a sucessful return the caller is responsible to free the memory in - *BriefDesc - - Uses a simple state machine that allows "unlimited" whitespace before and after the - ".TH", compares Command and the MAN file commnd name without respect to case, and - allows "unlimited" whitespace and '0' and '1' characters before the Short Description. - The PCRE regex describing this functionality is: ^\s*\.TH\s+(\S)\s[\s01]*(.*)$ - where group 1 is the Command Name and group 2 is the Short Description. - - @param[in] Command name of command whose MAN file we think Line came from - @param[in] Line Pointer to a line from the MAN file - @param[out] BriefDesc pointer to pointer to string where description goes. - @param[out] BriefSize pointer to size of allocated BriefDesc - @param[out] Found TRUE if the Title Header was found and it belongs to Command - - @retval TRUE Line contained the Title Header - @retval FALSE Line did not contain the Title Header -**/ -BOOLEAN -IsTitleHeader( - IN CONST CHAR16 *Command, - IN CHAR16 *Line, - OUT CHAR16 **BriefDesc OPTIONAL, - OUT UINTN *BriefSize OPTIONAL, - OUT BOOLEAN *Found - ) -{ - // The states of a simple state machine used to recognize a title header line - // and to extract the Short Description, if desired. - typedef enum { - LookForThMacro, LookForCommandName, CompareCommands, GetBriefDescription, Final - } STATEVALUES; - - STATEVALUES State; - UINTN CommandIndex; // Indexes Command as we compare its chars to the MAN file. - BOOLEAN ReturnValue; // TRUE if this the Title Header line of *some* MAN file. - BOOLEAN ReturnFound; // TRUE if this the Title Header line of *the desired* MAN file. - - ReturnValue = FALSE; - ReturnFound = FALSE; - CommandIndex = 0; - State = LookForThMacro; - - do { - - if (*Line == L'\0') { - break; - } - - switch (State) { - - // Handle "^\s*.TH\s" - // Go to state LookForCommandName if the title header macro is present; otherwise, - // eat white space. If we see something other than white space, this is not a - // title header line. - case LookForThMacro: - if (StrnCmp (L".TH ", Line, 4) == 0 || StrnCmp (L".TH\t", Line, 4) == 0) { - Line += 4; - State = LookForCommandName; - } - else if (*Line == L' ' || *Line == L'\t') { - Line++; - } - else { - State = Final; - } - break; - - // Handle "\s*" - // Eat any "extra" whitespace after the title header macro (we have already seen - // at least one white space character). Go to state CompareCommands when a - // non-white space is seen. - case LookForCommandName: - if (*Line == L' ' || *Line == L'\t') { - Line++; - } - else { - ReturnValue = TRUE; // This is *some* command's title header line. - State = CompareCommands; - // Do not increment Line; it points to the first character of the command - // name on the title header line. - } - break; - - // Handle "(\S)\s" - // Compare Command to the title header command name, ignoring case. When we - // reach the end of the command (i.e. we see white space), the next state - // depends on whether the caller wants a copy of the Brief Description. - case CompareCommands: - if (*Line == L' ' || *Line == L'\t') { - ReturnFound = TRUE; // This is the desired command's title header line. - State = (BriefDesc == NULL) ? Final : GetBriefDescription; - } - else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) { - State = Final; - } - Line++; - break; - - // Handle "[\s01]*(.*)$" - // Skip whitespace, '0', and '1' characters, if any, prior to the brief description. - // Return the description to the caller. - case GetBriefDescription: - if (*Line != L' ' && *Line != L'\t' && *Line != L'0' && *Line != L'1') { - *BriefSize = StrSize(Line); - *BriefDesc = AllocateZeroPool(*BriefSize); - if (*BriefDesc != NULL) { - StrCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), Line); - } - State = Final; - } - Line++; - break; - - default: - break; - } - - } while (State < Final); - - *Found = ReturnFound; - return ReturnValue; -} - -/** - parses through the MAN file specified by SHELL_FILE_HANDLE and returns the - "Brief Description" for the .TH section as specified by Command. If the - command section is not found return EFI_NOT_FOUND. - - Upon a sucessful return the caller is responsible to free the memory in *BriefDesc - - @param[in] Handle FileHandle to read from - @param[in] Command name of command's section to find as entered on the - command line (may be a relative or absolute path or - be in any case: upper, lower, or mixed in numerous ways!). - @param[out] BriefDesc pointer to pointer to string where description goes. - @param[out] BriefSize pointer to size of allocated BriefDesc - @param[in, out] Ascii TRUE if the file is ASCII, FALSE otherwise, will be - set if the file handle is at the 0 position. - - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. - @retval EFI_SUCCESS the section was found and its description stored in - an allocated buffer if requested. -**/ -EFI_STATUS -ManFileFindTitleSection( - IN SHELL_FILE_HANDLE Handle, - IN CONST CHAR16 *Command, - OUT CHAR16 **BriefDesc OPTIONAL, - OUT UINTN *BriefSize OPTIONAL, - IN OUT BOOLEAN *Ascii - ) -{ - EFI_STATUS Status; - CHAR16 *ReadLine; - UINTN Size; - BOOLEAN Found; - UINTN Start; - - if ( Handle == NULL - || Command == NULL - || (BriefDesc != NULL && BriefSize == NULL) - ){ - return (EFI_INVALID_PARAMETER); - } - - Status = EFI_SUCCESS; - Size = 1024; - Found = FALSE; - - ReadLine = AllocateZeroPool(Size); - if (ReadLine == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - // - // Do not pass any leading path information that may be present to IsTitleHeader(). - // - Start = StrLen(Command); - while ((Start != 0) - && (*(Command + Start - 1) != L'\\') - && (*(Command + Start - 1) != L'/') - && (*(Command + Start - 1) != L':')) { - --Start; - } - - for (;!ShellFileHandleEof(Handle);Size = 1024) { - Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii); - // - // ignore too small of buffer... - // - if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) { - break; - } - - Status = EFI_NOT_FOUND; - if (IsTitleHeader (Command+Start, ReadLine, BriefDesc, BriefSize, &Found)) { - Status = Found ? EFI_SUCCESS : EFI_NOT_FOUND; - break; - } - } - - FreePool(ReadLine); - return (Status); -} - -/** - This function returns the help information for the specified command. The help text - will be parsed from a UEFI Shell manual page. (see UEFI Shell 2.0 Appendix B) - - If Sections is specified, then each section name listed will be compared in a casesensitive - manner, to the section names described in Appendix B. If the section exists, - it will be appended to the returned help text. If the section does not exist, no - information will be returned. If Sections is NULL, then all help text information - available will be returned. - - if BriefDesc is NULL, then the breif description will not be savedd seperatly, - but placed first in the main HelpText. - - @param[in] ManFileName Points to the NULL-terminated UEFI Shell MAN file name. - @param[in] Command Points to the NULL-terminated UEFI Shell command name. - @param[in] Sections Points to the NULL-terminated comma-delimited - section names to return. If NULL, then all - sections will be returned. - @param[out] BriefDesc On return, points to a callee-allocated buffer - containing brief description text. - @param[out] HelpText On return, points to a callee-allocated buffer - containing all specified help text. - - @retval EFI_SUCCESS The help text was returned. - @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the - returned help text. - @retval EFI_INVALID_PARAMETER HelpText is NULL. - @retval EFI_INVALID_PARAMETER ManFileName is invalid. - @retval EFI_NOT_FOUND There is no help text available for Command. -**/ -EFI_STATUS -ProcessManFile( - IN CONST CHAR16 *ManFileName, - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Sections OPTIONAL, - OUT CHAR16 **BriefDesc OPTIONAL, - OUT CHAR16 **HelpText - ) -{ - CHAR16 *TempString; - SHELL_FILE_HANDLE FileHandle; - EFI_HANDLE CmdFileImgHandle; - EFI_STATUS Status; - UINTN HelpSize; - UINTN BriefSize; - UINTN StringIdWalker; - BOOLEAN Ascii; - CHAR16 *CmdFileName; - CHAR16 *CmdFilePathName; - EFI_DEVICE_PATH_PROTOCOL *FileDevPath; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader; - - if ( ManFileName == NULL - || Command == NULL - || HelpText == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - - HelpSize = 0; - BriefSize = 0; - StringIdWalker = 0; - TempString = NULL; - Ascii = FALSE; - CmdFileName = NULL; - CmdFilePathName = NULL; - CmdFileImgHandle = NULL; - PackageListHeader = NULL; - FileDevPath = NULL; - DevPath = NULL; - - // - // See if it's in HII first - // - TempString = ShellCommandGetCommandHelp(Command); - if (TempString != NULL) { - FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL); - HelpSize = StrLen (TempString) * sizeof (CHAR16); - ShellWriteFile (FileHandle, &HelpSize, TempString); - ShellSetFilePosition (FileHandle, 0); - HelpSize = 0; - BriefSize = 0; - Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii); - if (!EFI_ERROR(Status) && HelpText != NULL){ - Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii); - } - ShellCloseFile (&FileHandle); - } else { - // - // If the image is a external app, check .MAN file first. - // - FileHandle = NULL; - TempString = GetManFileName(ManFileName); - if (TempString == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Status = SearchPathForFile(TempString, &FileHandle); - if (EFI_ERROR(Status)) { - FileDevPath = FileDevicePath(NULL, TempString); - DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath); - Status = InternalOpenFileDevicePath(DevPath, &FileHandle, EFI_FILE_MODE_READ, 0); - SHELL_FREE_NON_NULL(FileDevPath); - SHELL_FREE_NON_NULL(DevPath); - } - - if (!EFI_ERROR(Status)) { - HelpSize = 0; - BriefSize = 0; - Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii); - if (!EFI_ERROR(Status) && HelpText != NULL){ - Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii); - } - ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle); - if (!EFI_ERROR(Status)) { - // - // Get help text from .MAN file success. - // - goto Done; - } - } - - // - // Load the app image to check EFI_HII_PACKAGE_LIST_PROTOCOL. - // - CmdFileName = GetExecuatableFileName(TempString); - if (CmdFileName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } - // - // If the file in CWD then use the file name, else use the full - // path name. - // - CmdFilePathName = ShellFindFilePath(CmdFileName); - if (CmdFilePathName == NULL) { - Status = EFI_NOT_FOUND; - goto Done; - } - DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CmdFilePathName); - Status = gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle); - if(EFI_ERROR(Status)) { - *HelpText = NULL; - goto Done; - } - Status = gBS->OpenProtocol( - CmdFileImgHandle, - &gEfiHiiPackageListProtocolGuid, - (VOID**)&PackageListHeader, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if(EFI_ERROR(Status)) { - *HelpText = NULL; - goto Done; - } - - // - // If get package list on image handle, install it on HiiDatabase. - // - Status = gBS->InstallProtocolInterface ( - &mShellManDriverHandle, - &gEfiDevicePathProtocolGuid, - EFI_NATIVE_INTERFACE, - &mShellManHiiDevicePath - ); - if (EFI_ERROR(Status)) { - goto Done; - } - - Status = gHiiDatabase->NewPackageList ( - gHiiDatabase, - PackageListHeader, - mShellManDriverHandle, - &mShellManHiiHandle - ); - if (EFI_ERROR (Status)) { - goto Done; - } - - StringIdWalker = 1; - do { - SHELL_FREE_NON_NULL(TempString); - if (BriefDesc != NULL) { - SHELL_FREE_NON_NULL(*BriefDesc); - } - TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL); - if (TempString == NULL) { - Status = EFI_NOT_FOUND; - goto Done; - } - FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL); - HelpSize = StrLen (TempString) * sizeof (CHAR16); - ShellWriteFile (FileHandle, &HelpSize, TempString); - ShellSetFilePosition (FileHandle, 0); - HelpSize = 0; - BriefSize = 0; - Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii); - if (!EFI_ERROR(Status) && HelpText != NULL){ - Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii); - } - ShellCloseFile (&FileHandle); - if (!EFI_ERROR(Status)){ - // - // Found what we need and return - // - goto Done; - } - - StringIdWalker += 1; - } while (StringIdWalker < 0xFFFF && TempString != NULL); - - } - -Done: - if (mShellManDriverHandle != NULL) { - gBS->UninstallProtocolInterface ( - mShellManDriverHandle, - &gEfiDevicePathProtocolGuid, - &mShellManHiiDevicePath - ); - mShellManDriverHandle = NULL; - } - - if (mShellManHiiHandle != NULL) { - HiiRemovePackages (mShellManHiiHandle); - mShellManHiiHandle = NULL; - } - - if (CmdFileImgHandle != NULL) { - Status = gBS->UnloadImage (CmdFileImgHandle); - } - - SHELL_FREE_NON_NULL(TempString); - SHELL_FREE_NON_NULL(CmdFileName); - SHELL_FREE_NON_NULL(CmdFilePathName); - SHELL_FREE_NON_NULL(FileDevPath); - SHELL_FREE_NON_NULL(DevPath); - - return (Status); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.h deleted file mode 100644 index 7d9074d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellManParser.h +++ /dev/null @@ -1,84 +0,0 @@ -/** @file - Provides interface to shell MAN file parser. - - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_MAN_FILE_PARSER_HEADER_ -#define _SHELL_MAN_FILE_PARSER_HEADER_ - -/** - This function returns the help information for the specified command. The help text - will be parsed from a UEFI Shell manual page. (see UEFI Shell 2.0 Appendix B) - - If Sections is specified, then each section name listed will be compared in a casesensitive - manner, to the section names described in Appendix B. If the section exists, - it will be appended to the returned help text. If the section does not exist, no - information will be returned. If Sections is NULL, then all help text information - available will be returned. - - if BriefDesc is NULL, then the breif description will not be savedd seperatly, - but placed first in the main HelpText. - - @param[in] ManFileName Points to the NULL-terminated UEFI Shell MAN file name. - @param[in] Command Points to the NULL-terminated UEFI Shell command name. - @param[in] Sections Points to the NULL-terminated comma-delimited - section names to return. If NULL, then all - sections will be returned. - @param[out] BriefDesc On return, points to a callee-allocated buffer - containing brief description text. - @param[out] HelpText On return, points to a callee-allocated buffer - containing all specified help text. - - @retval EFI_SUCCESS The help text was returned. - @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the - returned help text. - @retval EFI_INVALID_PARAMETER HelpText is NULL - @retval EFI_NOT_FOUND There is no help text available for Command. -**/ -EFI_STATUS -ProcessManFile( - IN CONST CHAR16 *ManFileName, - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Sections OPTIONAL, - OUT CHAR16 **BriefDesc, - OUT CHAR16 **HelpText - ); - -/** - parses through the MAN file specified by SHELL_FILE_HANDLE and returns the - detailed help for any sub section specified in the comma seperated list of - sections provided. If the end of the file or a .TH section is found then - return. - - Upon a sucessful return the caller is responsible to free the memory in *HelpText - - @param[in] Handle FileHandle to read from - @param[in] Sections name of command's sub sections to find - @param[out] HelpText pointer to pointer to string where text goes. - @param[out] HelpSize pointer to size of allocated HelpText (may be updated) - @param[in] Ascii TRUE if the file is ASCII, FALSE otherwise. - - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. - @retval EFI_SUCCESS the section was found and its description sotred in - an alloceted buffer. -**/ -EFI_STATUS -ManFileFindSections( - IN SHELL_FILE_HANDLE Handle, - IN CONST CHAR16 *Sections, - OUT CHAR16 **HelpText, - OUT UINTN *HelpSize, - IN BOOLEAN Ascii - ); - -#endif //_SHELL_MAN_FILE_PARSER_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c deleted file mode 100644 index fb2783a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ /dev/null @@ -1,1417 +0,0 @@ -/** @file - Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, - manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- Copyright (C) 2014, Red Hat, Inc. - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -BOOLEAN AsciiRedirection = FALSE; - -/** - Return the next parameter's end from a command line string. - - @param[in] String the string to parse -**/ -CONST CHAR16* -FindEndOfParameter( - IN CONST CHAR16 *String - ) -{ - CONST CHAR16 *First; - CONST CHAR16 *CloseQuote; - - First = FindFirstCharacter(String, L" \"", L'^'); - - // - // nothing, all one parameter remaining - // - if (*First == CHAR_NULL) { - return (First); - } - - // - // If space before a quote (or neither found, i.e. both CHAR_NULL), - // then that's the end. - // - if (*First == L' ') { - return (First); - } - - CloseQuote = FindFirstCharacter (First+1, L"\"", L'^'); - - // - // We did not find a terminator... - // - if (*CloseQuote == CHAR_NULL) { - return (NULL); - } - - return (FindEndOfParameter (CloseQuote+1)); -} - -/** - Return the next parameter from a command line string. - - This function moves the next parameter from Walker into TempParameter and moves - Walker up past that parameter for recursive calling. When the final parameter - is moved *Walker will be set to NULL; - - Temp Parameter must be large enough to hold the parameter before calling this - function. - - This will also remove all remaining ^ characters after processing. - - @param[in, out] Walker pointer to string of command line. Adjusted to - reminaing command line on return - @param[in, out] TempParameter pointer to string of command line item extracted. - @param[in] Length buffer size of TempParameter. - @param[in] StripQuotation if TRUE then strip the quotation marks surrounding - the parameters. - - @return EFI_INALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string. - @return EFI_NOT_FOUND A closing " could not be found on the specified string -**/ -EFI_STATUS -GetNextParameter( - IN OUT CHAR16 **Walker, - IN OUT CHAR16 **TempParameter, - IN CONST UINTN Length, - IN BOOLEAN StripQuotation - ) -{ - CONST CHAR16 *NextDelim; - - if (Walker == NULL - ||*Walker == NULL - ||TempParameter == NULL - ||*TempParameter == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - - - // - // make sure we dont have any leading spaces - // - while ((*Walker)[0] == L' ') { - (*Walker)++; - } - - // - // make sure we still have some params now... - // - if (StrLen(*Walker) == 0) { -DEBUG_CODE_BEGIN(); - *Walker = NULL; -DEBUG_CODE_END(); - return (EFI_INVALID_PARAMETER); - } - - NextDelim = FindEndOfParameter(*Walker); - - if (NextDelim == NULL){ -DEBUG_CODE_BEGIN(); - *Walker = NULL; -DEBUG_CODE_END(); - return (EFI_NOT_FOUND); - } - - StrnCpyS(*TempParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker); - - // - // Add a CHAR_NULL if we didnt get one via the copy - // - if (*NextDelim != CHAR_NULL) { - (*TempParameter)[NextDelim - *Walker] = CHAR_NULL; - } - - // - // Update Walker for the next iteration through the function - // - *Walker = (CHAR16*)NextDelim; - - // - // Remove any non-escaped quotes in the string - // Remove any remaining escape characters in the string - // - for (NextDelim = FindFirstCharacter(*TempParameter, L"\"^", CHAR_NULL) - ; *NextDelim != CHAR_NULL - ; NextDelim = FindFirstCharacter(NextDelim, L"\"^", CHAR_NULL) - ) { - if (*NextDelim == L'^') { - - // - // eliminate the escape ^ - // - CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1)); - NextDelim++; - } else if (*NextDelim == L'\"') { - - // - // eliminate the unescaped quote - // - if (StripQuotation) { - CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1)); - } else{ - NextDelim++; - } - } - } - - return EFI_SUCCESS; -} - -/** - Function to populate Argc and Argv. - - This function parses the CommandLine and divides it into standard C style Argc/Argv - parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space - delimited and quote surrounded parameter definition. - - All special character processing (alias, environment variable, redirection, - etc... must be complete before calling this API. - - @param[in] CommandLine String of command line to parse - @param[in] StripQuotation if TRUE then strip the quotation marks surrounding - the parameters. - @param[in, out] Argv pointer to array of strings; one for each parameter - @param[in, out] Argc pointer to number of strings in Argv array - - @return EFI_SUCCESS the operation was sucessful - @return EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -ParseCommandLineToArgs( - IN CONST CHAR16 *CommandLine, - IN BOOLEAN StripQuotation, - IN OUT CHAR16 ***Argv, - IN OUT UINTN *Argc - ) -{ - UINTN Count; - CHAR16 *TempParameter; - CHAR16 *Walker; - CHAR16 *NewParam; - CHAR16 *NewCommandLine; - UINTN Size; - EFI_STATUS Status; - - ASSERT(Argc != NULL); - ASSERT(Argv != NULL); - - if (CommandLine == NULL || StrLen(CommandLine)==0) { - (*Argc) = 0; - (*Argv) = NULL; - return (EFI_SUCCESS); - } - - NewCommandLine = AllocateCopyPool(StrSize(CommandLine), CommandLine); - if (NewCommandLine == NULL){ - return (EFI_OUT_OF_RESOURCES); - } - - TrimSpaces(&NewCommandLine); - Size = StrSize(NewCommandLine); - TempParameter = AllocateZeroPool(Size); - if (TempParameter == NULL) { - SHELL_FREE_NON_NULL(NewCommandLine); - return (EFI_OUT_OF_RESOURCES); - } - - for ( Count = 0 - , Walker = (CHAR16*)NewCommandLine - ; Walker != NULL && *Walker != CHAR_NULL - ; Count++ - ) { - if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, TRUE))) { - break; - } - } - - // - // lets allocate the pointer array - // - (*Argv) = AllocateZeroPool((Count)*sizeof(CHAR16*)); - if (*Argv == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } - - *Argc = 0; - Walker = (CHAR16*)NewCommandLine; - while(Walker != NULL && *Walker != CHAR_NULL) { - SetMem16(TempParameter, Size, CHAR_NULL); - if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, StripQuotation))) { - Status = EFI_INVALID_PARAMETER; - goto Done; - } - - NewParam = AllocateCopyPool(StrSize(TempParameter), TempParameter); - if (NewParam == NULL){ - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } - ((CHAR16**)(*Argv))[(*Argc)] = NewParam; - (*Argc)++; - } - ASSERT(Count >= (*Argc)); - Status = EFI_SUCCESS; - -Done: - SHELL_FREE_NON_NULL(TempParameter); - SHELL_FREE_NON_NULL(NewCommandLine); - return (Status); -} - -/** - creates a new EFI_SHELL_PARAMETERS_PROTOCOL instance and populates it and then - installs it on our handle and if there is an existing version of the protocol - that one is cached for removal later. - - @param[in, out] NewShellParameters on a successful return, a pointer to pointer - to the newly installed interface. - @param[in, out] RootShellInstance on a successful return, pointer to boolean. - TRUE if this is the root shell instance. - - @retval EFI_SUCCESS the operation completed successfully. - @return other the operation failed. - @sa ReinstallProtocolInterface - @sa InstallProtocolInterface - @sa ParseCommandLineToArgs -**/ -EFI_STATUS -CreatePopulateInstallShellParametersProtocol ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL **NewShellParameters, - IN OUT BOOLEAN *RootShellInstance - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - CHAR16 *FullCommandLine; - UINTN Size; - - Size = 0; - FullCommandLine = NULL; - LoadedImage = NULL; - - // - // Assert for valid parameters - // - ASSERT(NewShellParameters != NULL); - ASSERT(RootShellInstance != NULL); - - // - // See if we have a shell parameters placed on us - // - Status = gBS->OpenProtocol ( - gImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID **) &ShellInfoObject.OldShellParameters, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - // - // if we don't then we must be the root shell (error is expected) - // - if (EFI_ERROR (Status)) { - *RootShellInstance = TRUE; - } - - // - // Allocate the new structure - // - *NewShellParameters = AllocateZeroPool(sizeof(EFI_SHELL_PARAMETERS_PROTOCOL)); - if ((*NewShellParameters) == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - // - // get loaded image protocol - // - Status = gBS->OpenProtocol ( - gImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - ASSERT_EFI_ERROR(Status); - // - // Build the full command line - // - Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine); - if (Status == EFI_BUFFER_TOO_SMALL) { - FullCommandLine = AllocateZeroPool(Size + LoadedImage->LoadOptionsSize); - Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine); - } - if (Status == EFI_NOT_FOUND) { - // - // no parameters via environment... ok - // - } else { - if (EFI_ERROR(Status)) { - return (Status); - } - } - if (Size == 0 && LoadedImage->LoadOptionsSize != 0) { - ASSERT(FullCommandLine == NULL); - // - // Now we need to include a NULL terminator in the size. - // - Size = LoadedImage->LoadOptionsSize + sizeof(FullCommandLine[0]); - FullCommandLine = AllocateZeroPool(Size); - } - if (FullCommandLine != NULL) { - CopyMem (FullCommandLine, LoadedImage->LoadOptions, LoadedImage->LoadOptionsSize); - // - // Populate Argc and Argv - // - Status = ParseCommandLineToArgs(FullCommandLine, - TRUE, - &(*NewShellParameters)->Argv, - &(*NewShellParameters)->Argc); - - FreePool(FullCommandLine); - - ASSERT_EFI_ERROR(Status); - } else { - (*NewShellParameters)->Argv = NULL; - (*NewShellParameters)->Argc = 0; - } - - // - // Populate the 3 faked file systems... - // - if (*RootShellInstance) { - (*NewShellParameters)->StdIn = &FileInterfaceStdIn; - (*NewShellParameters)->StdOut = &FileInterfaceStdOut; - (*NewShellParameters)->StdErr = &FileInterfaceStdErr; - Status = gBS->InstallProtocolInterface(&gImageHandle, - &gEfiShellParametersProtocolGuid, - EFI_NATIVE_INTERFACE, - (VOID*)(*NewShellParameters)); - } else { - // - // copy from the existing ones - // - (*NewShellParameters)->StdIn = ShellInfoObject.OldShellParameters->StdIn; - (*NewShellParameters)->StdOut = ShellInfoObject.OldShellParameters->StdOut; - (*NewShellParameters)->StdErr = ShellInfoObject.OldShellParameters->StdErr; - Status = gBS->ReinstallProtocolInterface(gImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID*)ShellInfoObject.OldShellParameters, - (VOID*)(*NewShellParameters)); - } - - return (Status); -} - -/** - frees all memory used by createion and installation of shell parameters protocol - and if there was an old version installed it will restore that one. - - @param NewShellParameters the interface of EFI_SHELL_PARAMETERS_PROTOCOL that is - being cleaned up. - - @retval EFI_SUCCESS the cleanup was successful - @return other the cleanup failed - @sa ReinstallProtocolInterface - @sa UninstallProtocolInterface -**/ -EFI_STATUS -CleanUpShellParametersProtocol ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParameters - ) -{ - EFI_STATUS Status; - UINTN LoopCounter; - - // - // If the old exists we need to restore it - // - if (ShellInfoObject.OldShellParameters != NULL) { - Status = gBS->ReinstallProtocolInterface(gImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID*)NewShellParameters, - (VOID*)ShellInfoObject.OldShellParameters); - DEBUG_CODE(ShellInfoObject.OldShellParameters = NULL;); - } else { - // - // No old one, just uninstall us... - // - Status = gBS->UninstallProtocolInterface(gImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID*)NewShellParameters); - } - if (NewShellParameters->Argv != NULL) { - for ( LoopCounter = 0 - ; LoopCounter < NewShellParameters->Argc - ; LoopCounter++ - ){ - FreePool(NewShellParameters->Argv[LoopCounter]); - } - FreePool(NewShellParameters->Argv); - } - FreePool(NewShellParameters); - return (Status); -} - -/** - Determin if a file name represents a unicode file. - - @param[in] FileName Pointer to the filename to open. - - @retval EFI_SUCCESS The file is a unicode file. - @return An error upon failure. -**/ -EFI_STATUS -IsUnicodeFile( - IN CONST CHAR16 *FileName - ) -{ - SHELL_FILE_HANDLE Handle; - EFI_STATUS Status; - UINT64 OriginalFilePosition; - UINTN CharSize; - CHAR16 CharBuffer; - - Status = gEfiShellProtocol->OpenFileByName(FileName, &Handle, EFI_FILE_MODE_READ); - if (EFI_ERROR(Status)) { - return (Status); - } - gEfiShellProtocol->GetFilePosition(Handle, &OriginalFilePosition); - gEfiShellProtocol->SetFilePosition(Handle, 0); - CharSize = sizeof(CHAR16); - Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer); - if (EFI_ERROR(Status) || CharBuffer != gUnicodeFileTag) { - Status = EFI_BUFFER_TOO_SMALL; - } - gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition); - gEfiShellProtocol->CloseFile(Handle); - return (Status); -} - -/** - Strips out quotes sections of a string. - - All of the characters between quotes is replaced with spaces. - - @param[in, out] TheString A pointer to the string to update. -**/ -VOID -StripQuotes ( - IN OUT CHAR16 *TheString - ) -{ - BOOLEAN RemoveNow; - - for (RemoveNow = FALSE ; TheString != NULL && *TheString != CHAR_NULL ; TheString++) { - if (*TheString == L'^' && *(TheString + 1) == L'\"') { - TheString++; - } else if (*TheString == L'\"') { - RemoveNow = (BOOLEAN)!RemoveNow; - } else if (RemoveNow) { - *TheString = L' '; - } - } -} - -/** - Calcualte the 32-bit CRC in a EFI table using the service provided by the - gRuntime service. - - @param Hdr Pointer to an EFI standard header - -**/ -VOID -CalculateEfiHdrCrc ( - IN OUT EFI_TABLE_HEADER *Hdr - ) -{ - UINT32 Crc; - - Hdr->CRC32 = 0; - - // - // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then - // Crc will come back as zero if we set it to zero here - // - Crc = 0; - gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc); - Hdr->CRC32 = Crc; -} - -/** - Fix a string to only have the file name, removing starting at the first space of whatever is quoted. - - @param[in] FileName The filename to start with. - - @retval NULL FileName was invalid. - @return The modified FileName. -**/ -CHAR16* -FixFileName ( - IN CHAR16 *FileName - ) -{ - CHAR16 *Copy; - CHAR16 *TempLocation; - - if (FileName == NULL) { - return (NULL); - } - - if (FileName[0] == L'\"') { - Copy = FileName+1; - if ((TempLocation = StrStr(Copy , L"\"")) != NULL) { - TempLocation[0] = CHAR_NULL; - } - } else { - Copy = FileName; - while(Copy[0] == L' ') { - Copy++; - } - if ((TempLocation = StrStr(Copy , L" ")) != NULL) { - TempLocation[0] = CHAR_NULL; - } - } - - if (Copy[0] == CHAR_NULL) { - return (NULL); - } - - return (Copy); -} - -/** - Fix a string to only have the environment variable name, removing starting at the first space of whatever is quoted and removing the leading and trailing %. - - @param[in] FileName The filename to start with. - - @retval NULL FileName was invalid. - @return The modified FileName. -**/ -CHAR16* -FixVarName ( - IN CHAR16 *FileName - ) -{ - CHAR16 *Copy; - CHAR16 *TempLocation; - - Copy = FileName; - - if (FileName[0] == L'%') { - Copy = FileName+1; - if ((TempLocation = StrStr(Copy , L"%")) != NULL) { - TempLocation[0] = CHAR_NULL; - } - } - - return (FixFileName(Copy)); -} - - -/** - Write the unicode file tag to the specified file. - - It is the caller's responsibility to ensure that - ShellInfoObject.NewEfiShellProtocol has been initialized before calling this - function. - - @param[in] FileHandle The file to write the unicode file tag to. - - @return Status code from ShellInfoObject.NewEfiShellProtocol->WriteFile. -**/ -EFI_STATUS -WriteFileTag ( - IN SHELL_FILE_HANDLE FileHandle - ) -{ - CHAR16 FileTag; - UINTN Size; - EFI_STATUS Status; - - FileTag = gUnicodeFileTag; - Size = sizeof FileTag; - Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (FileHandle, &Size, - &FileTag); - ASSERT (EFI_ERROR (Status) || Size == sizeof FileTag); - return Status; -} - - -/** - Funcion will replace the current StdIn and StdOut in the ShellParameters protocol - structure by parsing NewCommandLine. The current values are returned to the - user. - - This will also update the system table. - - @param[in, out] ShellParameters Pointer to parameter structure to modify. - @param[in] NewCommandLine The new command line to parse and use. - @param[out] OldStdIn Pointer to old StdIn. - @param[out] OldStdOut Pointer to old StdOut. - @param[out] OldStdErr Pointer to old StdErr. - @param[out] SystemTableInfo Pointer to old system table information. - - @retval EFI_SUCCESS Operation was sucessful, Argv and Argc are valid. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -UpdateStdInStdOutStdErr( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CHAR16 *NewCommandLine, - OUT SHELL_FILE_HANDLE *OldStdIn, - OUT SHELL_FILE_HANDLE *OldStdOut, - OUT SHELL_FILE_HANDLE *OldStdErr, - OUT SYSTEM_TABLE_INFO *SystemTableInfo - ) -{ - CHAR16 *CommandLineCopy; - CHAR16 *CommandLineWalker; - CHAR16 *StdErrFileName; - CHAR16 *StdOutFileName; - CHAR16 *StdInFileName; - CHAR16 *StdInVarName; - CHAR16 *StdOutVarName; - CHAR16 *StdErrVarName; - EFI_STATUS Status; - SHELL_FILE_HANDLE TempHandle; - UINT64 FileSize; - BOOLEAN OutUnicode; - BOOLEAN InUnicode; - BOOLEAN ErrUnicode; - BOOLEAN OutAppend; - BOOLEAN ErrAppend; - UINTN Size; - SPLIT_LIST *Split; - CHAR16 *FirstLocation; - BOOLEAN Volatile; - - OutUnicode = TRUE; - InUnicode = TRUE; - AsciiRedirection = FALSE; - ErrUnicode = TRUE; - StdInVarName = NULL; - StdOutVarName = NULL; - StdErrVarName = NULL; - StdErrFileName = NULL; - StdInFileName = NULL; - StdOutFileName = NULL; - ErrAppend = FALSE; - OutAppend = FALSE; - CommandLineCopy = NULL; - FirstLocation = NULL; - - if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) { - return (EFI_INVALID_PARAMETER); - } - - SystemTableInfo->ConIn = gST->ConIn; - SystemTableInfo->ConInHandle = gST->ConsoleInHandle; - SystemTableInfo->ConOut = gST->ConOut; - SystemTableInfo->ConOutHandle = gST->ConsoleOutHandle; - SystemTableInfo->ErrOut = gST->StdErr; - SystemTableInfo->ErrOutHandle = gST->StandardErrorHandle; - *OldStdIn = ShellParameters->StdIn; - *OldStdOut = ShellParameters->StdOut; - *OldStdErr = ShellParameters->StdErr; - - if (NewCommandLine == NULL) { - return (EFI_SUCCESS); - } - - CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0); - if (CommandLineCopy == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = EFI_SUCCESS; - Split = NULL; - FirstLocation = CommandLineCopy + StrLen(CommandLineCopy); - - StripQuotes(CommandLineCopy); - - if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) { - Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link); - if (Split != NULL && Split->SplitStdIn != NULL) { - ShellParameters->StdIn = Split->SplitStdIn; - } - if (Split != NULL && Split->SplitStdOut != NULL) { - ShellParameters->StdOut = Split->SplitStdOut; - } - } - - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>>v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 12, L' '); - StdErrVarName = CommandLineWalker += 6; - ErrAppend = TRUE; - if (StrStr(CommandLineWalker, L" 2>>v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 12, L' '); - StdOutVarName = CommandLineWalker += 6; - OutAppend = TRUE; - if (StrStr(CommandLineWalker, L" 1>>v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - StdOutVarName = CommandLineWalker += 5; - OutAppend = TRUE; - if (StrStr(CommandLineWalker, L" >>v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 8, L' '); - StdOutVarName = CommandLineWalker += 4; - OutAppend = FALSE; - if (StrStr(CommandLineWalker, L" >v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>a ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 12, L' '); - StdOutFileName = CommandLineWalker += 6; - OutAppend = TRUE; - OutUnicode = FALSE; - if (StrStr(CommandLineWalker, L" 1>>a ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>> ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 5; - OutAppend = TRUE; - } - if (StrStr(CommandLineWalker, L" 1>> ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >> ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 8, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 4; - OutAppend = TRUE; - } - if (StrStr(CommandLineWalker, L" >> ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>a ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 5; - OutAppend = TRUE; - OutUnicode = FALSE; - } - if (StrStr(CommandLineWalker, L" >>a ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>a ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 5; - OutAppend = FALSE; - OutUnicode = FALSE; - } - if (StrStr(CommandLineWalker, L" 1>a ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >a ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 8, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 4; - OutAppend = FALSE; - OutUnicode = FALSE; - } - if (StrStr(CommandLineWalker, L" >a ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>> ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdErrFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdErrFileName = CommandLineWalker += 5; - ErrAppend = TRUE; - } - if (StrStr(CommandLineWalker, L" 2>> ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdErrVarName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdErrVarName = CommandLineWalker += 5; - ErrAppend = FALSE; - } - if (StrStr(CommandLineWalker, L" 2>v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>v ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdOutVarName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutVarName = CommandLineWalker += 5; - OutAppend = FALSE; - } - if (StrStr(CommandLineWalker, L" 1>v ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>a ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 10, L' '); - if (StdErrFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdErrFileName = CommandLineWalker += 5; - ErrAppend = FALSE; - ErrUnicode = FALSE; - } - if (StrStr(CommandLineWalker, L" 2>a ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2> ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 8, L' '); - if (StdErrFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdErrFileName = CommandLineWalker += 4; - ErrAppend = FALSE; - } - if (StrStr(CommandLineWalker, L" 2> ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1> ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 8, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 4; - OutAppend = FALSE; - } - if (StrStr(CommandLineWalker, L" 1> ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" > ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 6, L' '); - if (StdOutFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdOutFileName = CommandLineWalker += 3; - OutAppend = FALSE; - } - if (StrStr(CommandLineWalker, L" > ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" < ")) != NULL) { - FirstLocation = MIN(CommandLineWalker, FirstLocation); - SetMem16(CommandLineWalker, 6, L' '); - if (StdInFileName != NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - StdInFileName = CommandLineWalker += 3; - } - if (StrStr(CommandLineWalker, L" < ") != NULL) { - Status = EFI_NOT_FOUND; - } - } - if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" SplitStdIn != NULL && (StdInVarName != NULL || StdInFileName != NULL)) - ||(Split != NULL && Split->SplitStdOut != NULL && (StdOutVarName != NULL || StdOutFileName != NULL)) - // - // Check that nothing is trying to be output to 2 locations. - // - ||(StdErrFileName != NULL && StdErrVarName != NULL) - ||(StdOutFileName != NULL && StdOutVarName != NULL) - ||(StdInFileName != NULL && StdInVarName != NULL) - // - // Check for no volatile environment variables - // - ||(StdErrVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdErrVarName, &Volatile)) && !Volatile) - ||(StdOutVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdOutVarName, &Volatile)) && !Volatile) - // - // Cant redirect during a reconnect operation. - // - ||(StrStr(NewCommandLine, L"connect -r") != NULL - && (StdOutVarName != NULL || StdOutFileName != NULL || StdErrFileName != NULL || StdErrVarName != NULL)) - // - // Check that filetypes (Unicode/Ascii) do not change during an append - // - ||(StdOutFileName != NULL && OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && EFI_ERROR(IsUnicodeFile(StdOutFileName)))) - ||(StdErrFileName != NULL && ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && EFI_ERROR(IsUnicodeFile(StdErrFileName)))) - ||(StdOutFileName != NULL && !OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && !EFI_ERROR(IsUnicodeFile(StdOutFileName)))) - ||(StdErrFileName != NULL && !ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && !EFI_ERROR(IsUnicodeFile(StdErrFileName)))) - ){ - Status = EFI_INVALID_PARAMETER; - ShellParameters->StdIn = *OldStdIn; - ShellParameters->StdOut = *OldStdOut; - ShellParameters->StdErr = *OldStdErr; - } else if (!EFI_ERROR(Status)){ - // - // Open the Std and we should not have conflicts here... - // - - // - // StdErr to a file - // - if (StdErrFileName != NULL) { - if (!ErrAppend) { - // - // delete existing file. - // - ShellInfoObject.NewEfiShellProtocol->DeleteFileByName(StdErrFileName); - } - Status = ShellOpenFileByName(StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE,0); - if (!ErrAppend && ErrUnicode && !EFI_ERROR(Status)) { - Status = WriteFileTag (TempHandle); - } - if (!ErrUnicode && !EFI_ERROR(Status)) { - TempHandle = CreateFileInterfaceFile(TempHandle, FALSE); - ASSERT(TempHandle != NULL); - } - if (!EFI_ERROR(Status)) { - ShellParameters->StdErr = TempHandle; - gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr); - } - } - - // - // StdOut to a file - // - if (!EFI_ERROR(Status) && StdOutFileName != NULL) { - if (!OutAppend) { - // - // delete existing file. - // - ShellInfoObject.NewEfiShellProtocol->DeleteFileByName(StdOutFileName); - } - Status = ShellOpenFileByName(StdOutFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE,0); - if (TempHandle == NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - if (gUnicodeCollation->MetaiMatch (gUnicodeCollation, StdOutFileName, L"NUL")) { - //no-op - } else if (!OutAppend && OutUnicode && !EFI_ERROR(Status)) { - Status = WriteFileTag (TempHandle); - } else if (OutAppend) { - Status = ShellInfoObject.NewEfiShellProtocol->GetFileSize(TempHandle, &FileSize); - if (!EFI_ERROR(Status)) { - // - // When appending to a new unicode file, write the file tag. - // Otherwise (ie. when appending to a new ASCII file, or an - // existent file with any encoding), just seek to the end. - // - Status = (FileSize == 0 && OutUnicode) ? - WriteFileTag (TempHandle) : - ShellInfoObject.NewEfiShellProtocol->SetFilePosition ( - TempHandle, - FileSize); - } - } - if (!OutUnicode && !EFI_ERROR(Status)) { - TempHandle = CreateFileInterfaceFile(TempHandle, FALSE); - ASSERT(TempHandle != NULL); - } - if (!EFI_ERROR(Status)) { - ShellParameters->StdOut = TempHandle; - gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut); - } - } - } - - // - // StdOut to a var - // - if (!EFI_ERROR(Status) && StdOutVarName != NULL) { - if (!OutAppend) { - // - // delete existing variable. - // - SHELL_SET_ENVIRONMENT_VARIABLE_V(StdOutVarName, 0, L""); - } - TempHandle = CreateFileInterfaceEnv(StdOutVarName); - ASSERT(TempHandle != NULL); - ShellParameters->StdOut = TempHandle; - gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut); - } - - // - // StdErr to a var - // - if (!EFI_ERROR(Status) && StdErrVarName != NULL) { - if (!ErrAppend) { - // - // delete existing variable. - // - SHELL_SET_ENVIRONMENT_VARIABLE_V(StdErrVarName, 0, L""); - } - TempHandle = CreateFileInterfaceEnv(StdErrVarName); - ASSERT(TempHandle != NULL); - ShellParameters->StdErr = TempHandle; - gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr); - } - - // - // StdIn from a var - // - if (!EFI_ERROR(Status) && StdInVarName != NULL) { - TempHandle = CreateFileInterfaceEnv(StdInVarName); - if (TempHandle == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - if (!InUnicode) { - TempHandle = CreateFileInterfaceFile(TempHandle, FALSE); - } - Size = 0; - if (TempHandle == NULL || ((EFI_FILE_PROTOCOL*)TempHandle)->Read(TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL) { - Status = EFI_INVALID_PARAMETER; - } else { - ShellParameters->StdIn = TempHandle; - gST->ConIn = CreateSimpleTextInOnFile(TempHandle, &gST->ConsoleInHandle); - } - } - } - - // - // StdIn from a file - // - if (!EFI_ERROR(Status) && StdInFileName != NULL) { - Status = ShellOpenFileByName( - StdInFileName, - &TempHandle, - EFI_FILE_MODE_READ, - 0); - if (!EFI_ERROR(Status)) { - if (!InUnicode) { - // - // Create the ASCII->Unicode conversion layer - // - TempHandle = CreateFileInterfaceFile(TempHandle, FALSE); - } - ShellParameters->StdIn = TempHandle; - gST->ConIn = CreateSimpleTextInOnFile(TempHandle, &gST->ConsoleInHandle); - } - } - } - } - FreePool(CommandLineCopy); - - CalculateEfiHdrCrc(&gST->Hdr); - - if (gST->ConIn == NULL ||gST->ConOut == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } - - if (Status == EFI_NOT_FOUND) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_REDUNDA_REDIR), ShellInfoObject.HiiHandle); - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle); - } - - return (Status); -} - -/** - Funcion will replace the current StdIn and StdOut in the ShellParameters protocol - structure with StdIn and StdOut. The current values are de-allocated. - - @param[in, out] ShellParameters Pointer to parameter structure to modify. - @param[in] OldStdIn Pointer to old StdIn. - @param[in] OldStdOut Pointer to old StdOut. - @param[in] OldStdErr Pointer to old StdErr. - @param[in] SystemTableInfo Pointer to old system table information. -**/ -EFI_STATUS -RestoreStdInStdOutStdErr ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN SHELL_FILE_HANDLE *OldStdIn, - IN SHELL_FILE_HANDLE *OldStdOut, - IN SHELL_FILE_HANDLE *OldStdErr, - IN SYSTEM_TABLE_INFO *SystemTableInfo - ) -{ - SPLIT_LIST *Split; - - if (ShellParameters == NULL - ||OldStdIn == NULL - ||OldStdOut == NULL - ||OldStdErr == NULL - ||SystemTableInfo == NULL) { - return (EFI_INVALID_PARAMETER); - } - if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) { - Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link); - } else { - Split = NULL; - } - if (ShellParameters->StdIn != *OldStdIn) { - if ((Split != NULL && Split->SplitStdIn != ShellParameters->StdIn) || Split == NULL) { - gEfiShellProtocol->CloseFile(ShellParameters->StdIn); - } - ShellParameters->StdIn = *OldStdIn; - } - if (ShellParameters->StdOut != *OldStdOut) { - if ((Split != NULL && Split->SplitStdOut != ShellParameters->StdOut) || Split == NULL) { - gEfiShellProtocol->CloseFile(ShellParameters->StdOut); - } - ShellParameters->StdOut = *OldStdOut; - } - if (ShellParameters->StdErr != *OldStdErr) { - gEfiShellProtocol->CloseFile(ShellParameters->StdErr); - ShellParameters->StdErr = *OldStdErr; - } - - if (gST->ConIn != SystemTableInfo->ConIn) { - CloseSimpleTextInOnFile(gST->ConIn); - gST->ConIn = SystemTableInfo->ConIn; - gST->ConsoleInHandle = SystemTableInfo->ConInHandle; - } - if (gST->ConOut != SystemTableInfo->ConOut) { - CloseSimpleTextOutOnFile(gST->ConOut); - gST->ConOut = SystemTableInfo->ConOut; - gST->ConsoleOutHandle = SystemTableInfo->ConOutHandle; - } - if (gST->StdErr != SystemTableInfo->ErrOut) { - CloseSimpleTextOutOnFile(gST->StdErr); - gST->StdErr = SystemTableInfo->ErrOut; - gST->StandardErrorHandle = SystemTableInfo->ErrOutHandle; - } - - CalculateEfiHdrCrc(&gST->Hdr); - - return (EFI_SUCCESS); -} -/** - Funcion will replace the current Argc and Argv in the ShellParameters protocol - structure by parsing NewCommandLine. The current values are returned to the - user. - - If OldArgv or OldArgc is NULL then that value is not returned. - - @param[in, out] ShellParameters Pointer to parameter structure to modify. - @param[in] NewCommandLine The new command line to parse and use. - @param[in] Type The type of operation. - @param[out] OldArgv Pointer to old list of parameters. - @param[out] OldArgc Pointer to old number of items in Argv list. - - @retval EFI_SUCCESS Operation was sucessful, Argv and Argc are valid. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -UpdateArgcArgv( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CONST CHAR16 *NewCommandLine, - IN SHELL_OPERATION_TYPES Type, - OUT CHAR16 ***OldArgv OPTIONAL, - OUT UINTN *OldArgc OPTIONAL - ) -{ - BOOLEAN StripParamQuotation; - - ASSERT(ShellParameters != NULL); - StripParamQuotation = TRUE; - - if (OldArgc != NULL) { - *OldArgc = ShellParameters->Argc; - } - if (OldArgc != NULL) { - *OldArgv = ShellParameters->Argv; - } - - if (Type == Script_File_Name) { - StripParamQuotation = FALSE; - } - - return ParseCommandLineToArgs( NewCommandLine, - StripParamQuotation, - &(ShellParameters->Argv), - &(ShellParameters->Argc) - ); -} - -/** - Funcion will replace the current Argc and Argv in the ShellParameters protocol - structure with Argv and Argc. The current values are de-allocated and the - OldArgv must not be deallocated by the caller. - - @param[in, out] ShellParameters pointer to parameter structure to modify - @param[in] OldArgv pointer to old list of parameters - @param[in] OldArgc pointer to old number of items in Argv list -**/ -VOID -RestoreArgcArgv( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CHAR16 ***OldArgv, - IN UINTN *OldArgc - ) -{ - UINTN LoopCounter; - ASSERT(ShellParameters != NULL); - ASSERT(OldArgv != NULL); - ASSERT(OldArgc != NULL); - - if (ShellParameters->Argv != NULL) { - for ( LoopCounter = 0 - ; LoopCounter < ShellParameters->Argc - ; LoopCounter++ - ){ - FreePool(ShellParameters->Argv[LoopCounter]); - } - FreePool(ShellParameters->Argv); - } - ShellParameters->Argv = *OldArgv; - *OldArgv = NULL; - ShellParameters->Argc = *OldArgc; - *OldArgc = 0; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.h deleted file mode 100644 index 2024c71..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.h +++ /dev/null @@ -1,215 +0,0 @@ -/** @file - Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, - manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL. - - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_ -#define _SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_ - -#include "Shell.h" - -typedef enum { - Internal_Command, - Script_File_Name, - Efi_Application, - File_Sys_Change, - Unknown_Invalid -} SHELL_OPERATION_TYPES; - -/** - creates a new EFI_SHELL_PARAMETERS_PROTOCOL instance and populates it and then - installs it on our handle and if there is an existing version of the protocol - that one is cached for removal later. - - @param[in, out] NewShellParameters on a successful return, a pointer to pointer - to the newly installed interface. - @param[in, out] RootShellInstance on a successful return, pointer to boolean. - TRUE if this is the root shell instance. - - @retval EFI_SUCCESS the operation completed successfully. - @return other the operation failed. - @sa ReinstallProtocolInterface - @sa InstallProtocolInterface - @sa ParseCommandLineToArgs -**/ -EFI_STATUS -CreatePopulateInstallShellParametersProtocol ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL **NewShellParameters, - IN OUT BOOLEAN *RootShellInstance - ); - -/** - frees all memory used by createion and installation of shell parameters protocol - and if there was an old version installed it will restore that one. - - @param NewShellParameters the interface of EFI_SHELL_PARAMETERS_PROTOCOL that is - being cleaned up. - - @retval EFI_SUCCESS the cleanup was successful - @return other the cleanup failed - @sa ReinstallProtocolInterface - @sa UninstallProtocolInterface -**/ -EFI_STATUS -CleanUpShellParametersProtocol ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParameters - ); - -/** - Funcion will replace the current Argc and Argv in the ShellParameters protocol - structure by parsing NewCommandLine. The current values are returned to the - user. - - @param[in, out] ShellParameters pointer to parameter structure to modify - @param[in] NewCommandLine the new command line to parse and use - @param[in] Type the type of operation. - @param[out] OldArgv pointer to old list of parameters - @param[out] OldArgc pointer to old number of items in Argv list - - @retval EFI_SUCCESS operation was sucessful, Argv and Argc are valid - @retval EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -UpdateArgcArgv( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CONST CHAR16 *NewCommandLine, - IN SHELL_OPERATION_TYPES Type, - OUT CHAR16 ***OldArgv, - OUT UINTN *OldArgc - ); - -/** - Funcion will replace the current Argc and Argv in the ShellParameters protocol - structure with Argv and Argc. The current values are de-allocated and the - OldArgv must not be deallocated by the caller. - - @param[in, out] ShellParameters pointer to parameter structure to modify - @param[in] OldArgv pointer to old list of parameters - @param[in] OldArgc pointer to old number of items in Argv list -**/ -VOID -RestoreArgcArgv( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CHAR16 ***OldArgv, - IN UINTN *OldArgc - ); - -typedef struct { - EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn; - EFI_HANDLE ConInHandle; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; - EFI_HANDLE ConOutHandle; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ErrOut; - EFI_HANDLE ErrOutHandle; -} SYSTEM_TABLE_INFO; - -/** - Funcion will replace the current StdIn and StdOut in the ShellParameters protocol - structure by parsing NewCommandLine. The current values are returned to the - user. - - This will also update the system table. - - @param[in, out] ShellParameters Pointer to parameter structure to modify. - @param[in] NewCommandLine The new command line to parse and use. - @param[out] OldStdIn Pointer to old StdIn. - @param[out] OldStdOut Pointer to old StdOut. - @param[out] OldStdErr Pointer to old StdErr. - @param[out] SystemTableInfo Pointer to old system table information. - - @retval EFI_SUCCESS Operation was sucessful, Argv and Argc are valid. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -UpdateStdInStdOutStdErr( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN CHAR16 *NewCommandLine, - OUT SHELL_FILE_HANDLE *OldStdIn, - OUT SHELL_FILE_HANDLE *OldStdOut, - OUT SHELL_FILE_HANDLE *OldStdErr, - OUT SYSTEM_TABLE_INFO *SystemTableInfo - ); - -/** - Funcion will replace the current StdIn and StdOut in the ShellParameters protocol - structure with StdIn and StdOut. The current values are de-allocated. - - @param[in, out] ShellParameters Pointer to parameter structure to modify. - @param[in] OldStdIn Pointer to old StdIn. - @param[in] OldStdOut Pointer to old StdOut. - @param[in] OldStdErr Pointer to old StdErr. - @param[in] SystemTableInfo Pointer to old system table information. -**/ -EFI_STATUS -RestoreStdInStdOutStdErr ( - IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN SHELL_FILE_HANDLE *OldStdIn, - IN SHELL_FILE_HANDLE *OldStdOut, - IN SHELL_FILE_HANDLE *OldStdErr, - IN SYSTEM_TABLE_INFO *SystemTableInfo - ); - -/** - function to populate Argc and Argv. - - This function parses the CommandLine and divides it into standard C style Argc/Argv - parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space - delimited and quote surrounded parameter definition. - - @param[in] CommandLine String of command line to parse - @param[in] StripQuotation if TRUE then strip the quotation marks surrounding - the parameters. - @param[in, out] Argv pointer to array of strings; one for each parameter - @param[in, out] Argc pointer to number of strings in Argv array - - @return EFI_SUCCESS the operation was sucessful - @return EFI_OUT_OF_RESOURCES a memory allocation failed. -**/ -EFI_STATUS -ParseCommandLineToArgs( - IN CONST CHAR16 *CommandLine, - IN BOOLEAN StripQuotation, - IN OUT CHAR16 ***Argv, - IN OUT UINTN *Argc - ); - -/** - return the next parameter from a command line string; - - This function moves the next parameter from Walker into TempParameter and moves - Walker up past that parameter for recursive calling. When the final parameter - is moved *Walker will be set to NULL; - - Temp Parameter must be large enough to hold the parameter before calling this - function. - - @param[in, out] Walker pointer to string of command line. Adjusted to - reminaing command line on return - @param[in, out] TempParameter pointer to string of command line item extracted. - @param[in] Length Length of (*TempParameter) in bytes - @param[in] StripQuotation if TRUE then strip the quotation marks surrounding - the parameters. - - @return EFI_INALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string. - @return EFI_NOT_FOUND A closing " could not be found on the specified string -**/ -EFI_STATUS -GetNextParameter( - IN OUT CHAR16 **Walker, - IN OUT CHAR16 **TempParameter, - IN CONST UINTN Length, - IN BOOLEAN StripQuotation - ); - -#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.c b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.c deleted file mode 100644 index 7af6504..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.c +++ /dev/null @@ -1,3835 +0,0 @@ -/** @file - Member functions of EFI_SHELL_PROTOCOL and functions for creation, - manipulation, and initialization of EFI_SHELL_PROTOCOL. - - (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "Shell.h" - -#define INIT_NAME_BUFFER_SIZE 128 - -/** - Close an open file handle. - - This function closes a specified file handle. All "dirty" cached file data is - flushed to the device, and the file is closed. In all cases the handle is - closed. - - @param[in] FileHandle The file handle to close. - - @retval EFI_SUCCESS The file handle was closed successfully. -**/ -EFI_STATUS -EFIAPI -EfiShellClose ( - IN SHELL_FILE_HANDLE FileHandle - ) -{ - ShellFileHandleRemove(FileHandle); - return (FileHandleClose(ConvertShellHandleToEfiFileProtocol(FileHandle))); -} - -/** - Internal worker to determine whether there is a BlockIo somewhere - upon the device path specified. - - @param[in] DevicePath The device path to test. - - @retval TRUE gEfiBlockIoProtocolGuid was installed on a handle with this device path - @retval FALSE gEfiBlockIoProtocolGuid was not found. -**/ -BOOLEAN -InternalShellProtocolIsBlockIoPresent( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; - EFI_STATUS Status; - EFI_HANDLE Handle; - - Handle = NULL; - - DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)DevicePath; - Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevicePathCopy, &Handle); - - if ((Handle != NULL) && (!EFI_ERROR(Status))) { - return (TRUE); - } - return (FALSE); -} - -/** - Internal worker to determine whether there is a file system somewhere - upon the device path specified. - - @param[in] DevicePath The device path to test. - - @retval TRUE gEfiSimpleFileSystemProtocolGuid was installed on a handle with this device path - @retval FALSE gEfiSimpleFileSystemProtocolGuid was not found. -**/ -BOOLEAN -InternalShellProtocolIsSimpleFileSystemPresent( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; - EFI_STATUS Status; - EFI_HANDLE Handle; - - Handle = NULL; - - DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)DevicePath; - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle); - - if ((Handle != NULL) && (!EFI_ERROR(Status))) { - return (TRUE); - } - return (FALSE); -} - - -/** - This function creates a mapping for a device path. - - If both DeviecPath and Mapping are NULL, this will reset the mapping to default values. - - @param DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping, - then the mapping will be deleted. - @param Mapping Points to the NULL-terminated mapping for the device path. Must end with a ':' - - @retval EFI_SUCCESS Mapping created or deleted successfully. - @retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the - boot service function LocateDevicePath(). - @retval EFI_ACCESS_DENIED The mapping is a built-in alias. - @retval EFI_INVALID_PARAMETER Mapping was NULL - @retval EFI_INVALID_PARAMETER Mapping did not end with a ':' - @retval EFI_INVALID_PARAMETER DevicePath was not pointing at a device that had a SIMPLE_FILE_SYSTEM_PROTOCOL installed. - @retval EFI_NOT_FOUND There was no mapping found to delete - @retval EFI_OUT_OF_RESOURCES Memory allocation failed -**/ -EFI_STATUS -EFIAPI -EfiShellSetMap( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, - IN CONST CHAR16 *Mapping - ) -{ - EFI_STATUS Status; - SHELL_MAP_LIST *MapListNode; - - if (Mapping == NULL){ - return (EFI_INVALID_PARAMETER); - } - - if (Mapping[StrLen(Mapping)-1] != ':') { - return (EFI_INVALID_PARAMETER); - } - - // - // Delete the mapping - // - if (DevicePath == NULL) { - if (IsListEmpty(&gShellMapList.Link)) { - return (EFI_NOT_FOUND); - } - for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &MapListNode->Link) - ; MapListNode = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListNode->Link) - ){ - if (StringNoCaseCompare(&MapListNode->MapName, &Mapping) == 0) { - RemoveEntryList(&MapListNode->Link); - SHELL_FREE_NON_NULL(MapListNode->DevicePath); - SHELL_FREE_NON_NULL(MapListNode->MapName); - SHELL_FREE_NON_NULL(MapListNode->CurrentDirectoryPath); - FreePool(MapListNode); - return (EFI_SUCCESS); - } - } // for loop - - // - // We didnt find one to delete - // - return (EFI_NOT_FOUND); - } - - // - // make sure this is a valid to add device path - // - ///@todo add BlockIo to this test... - if (!InternalShellProtocolIsSimpleFileSystemPresent(DevicePath) - && !InternalShellProtocolIsBlockIoPresent(DevicePath)) { - return (EFI_INVALID_PARAMETER); - } - - // - // First make sure there is no old mapping - // - Status = EfiShellSetMap(NULL, Mapping); - if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_FOUND)) { - return (Status); - } - - // - // now add the new one. - // - Status = ShellCommandAddMapItemAndUpdatePath(Mapping, DevicePath, 0, FALSE); - - return(Status); -} - -/** - Gets the device path from the mapping. - - This function gets the device path associated with a mapping. - - @param Mapping A pointer to the mapping - - @retval !=NULL Pointer to the device path that corresponds to the - device mapping. The returned pointer does not need - to be freed. - @retval NULL There is no device path associated with the - specified mapping. -**/ -CONST EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -EfiShellGetDevicePathFromMap( - IN CONST CHAR16 *Mapping - ) -{ - SHELL_MAP_LIST *MapListItem; - CHAR16 *NewName; - UINTN Size; - - NewName = NULL; - Size = 0; - - StrnCatGrow(&NewName, &Size, Mapping, 0); - if (Mapping[StrLen(Mapping)-1] != L':') { - StrnCatGrow(&NewName, &Size, L":", 0); - } - - MapListItem = ShellCommandFindMapItem(NewName); - - FreePool(NewName); - - if (MapListItem != NULL) { - return (MapListItem->DevicePath); - } - return(NULL); -} - -/** - Gets the mapping(s) that most closely matches the device path. - - This function gets the mapping which corresponds to the device path *DevicePath. If - there is no exact match, then the mapping which most closely matches *DevicePath - is returned, and *DevicePath is updated to point to the remaining portion of the - device path. If there is an exact match, the mapping is returned and *DevicePath - points to the end-of-device-path node. - - If there are multiple map names they will be semi-colon seperated in the - NULL-terminated string. - - @param DevicePath On entry, points to a device path pointer. On - exit, updates the pointer to point to the - portion of the device path after the mapping. - - @retval NULL No mapping was found. - @return !=NULL Pointer to NULL-terminated mapping. The buffer - is callee allocated and should be freed by the caller. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetMapFromDevicePath( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath - ) -{ - SHELL_MAP_LIST *Node; - CHAR16 *PathForReturn; - UINTN PathSize; -// EFI_HANDLE PathHandle; -// EFI_HANDLE MapHandle; -// EFI_STATUS Status; -// EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; -// EFI_DEVICE_PATH_PROTOCOL *MapPathCopy; - - if (DevicePath == NULL || *DevicePath == NULL) { - return (NULL); - } - - PathForReturn = NULL; - PathSize = 0; - - for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &Node->Link) - ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link) - ){ - // - // check for exact match - // - if (DevicePathCompare(DevicePath, &Node->DevicePath) == 0) { - ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL)); - if (PathSize != 0) { - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0); - } - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0); - } - } - if (PathForReturn != NULL) { - while (!IsDevicePathEndType (*DevicePath)) { - *DevicePath = NextDevicePathNode (*DevicePath); - } - SetDevicePathEndNode (*DevicePath); - } -/* - ///@todo finish code for inexact matches. - if (PathForReturn == NULL) { - PathSize = 0; - - DevicePathCopy = DuplicateDevicePath(*DevicePath); - ASSERT(DevicePathCopy != NULL); - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle); - ASSERT_EFI_ERROR(Status); - // - // check each of the device paths we have to get the root of the path for consist mappings - // - for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &Node->Link) - ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link) - ){ - if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) == 0) { - continue; - } - MapPathCopy = DuplicateDevicePath(Node->DevicePath); - ASSERT(MapPathCopy != NULL); - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle); - if (MapHandle == PathHandle) { - - *DevicePath = DevicePathCopy; - - MapPathCopy = NULL; - DevicePathCopy = NULL; - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0); - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0); - break; - } - } - // - // now add on the non-consistent mappings - // - for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &Node->Link) - ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link) - ){ - if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) != 0) { - continue; - } - MapPathCopy = Node->DevicePath; - ASSERT(MapPathCopy != NULL); - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle); - if (MapHandle == PathHandle) { - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0); - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0); - break; - } - } - } -*/ - - return (AddBufferToFreeList(PathForReturn)); -} - -/** - Converts a device path to a file system-style path. - - This function converts a device path to a file system path by replacing part, or all, of - the device path with the file-system mapping. If there are more than one application - file system mappings, the one that most closely matches Path will be used. - - @param Path The pointer to the device path - - @retval NULL the device path could not be found. - @return all The pointer of the NULL-terminated file path. The path - is callee-allocated and should be freed by the caller. -**/ -CHAR16 * -EFIAPI -EfiShellGetFilePathFromDevicePath( - IN CONST EFI_DEVICE_PATH_PROTOCOL *Path - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; - EFI_DEVICE_PATH_PROTOCOL *MapPathCopy; - SHELL_MAP_LIST *MapListItem; - CHAR16 *PathForReturn; - UINTN PathSize; - EFI_HANDLE PathHandle; - EFI_HANDLE MapHandle; - EFI_STATUS Status; - FILEPATH_DEVICE_PATH *FilePath; - FILEPATH_DEVICE_PATH *AlignedNode; - - PathForReturn = NULL; - PathSize = 0; - - DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)Path; - ASSERT(DevicePathCopy != NULL); - if (DevicePathCopy == NULL) { - return (NULL); - } - ///@todo BlockIo? - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle); - - if (EFI_ERROR(Status)) { - return (NULL); - } - // - // check each of the device paths we have to get the root of the path - // - for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &MapListItem->Link) - ; MapListItem = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListItem->Link) - ){ - MapPathCopy = (EFI_DEVICE_PATH_PROTOCOL*)MapListItem->DevicePath; - ASSERT(MapPathCopy != NULL); - ///@todo BlockIo? - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle); - if (MapHandle == PathHandle) { - ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL)); - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, MapListItem->MapName, 0); - // - // go through all the remaining nodes in the device path - // - for ( FilePath = (FILEPATH_DEVICE_PATH*)DevicePathCopy - ; !IsDevicePathEnd (&FilePath->Header) - ; FilePath = (FILEPATH_DEVICE_PATH*)NextDevicePathNode (&FilePath->Header) - ){ - // - // If any node is not a file path node, then the conversion can not be completed - // - if ((DevicePathType(&FilePath->Header) != MEDIA_DEVICE_PATH) || - (DevicePathSubType(&FilePath->Header) != MEDIA_FILEPATH_DP)) { - FreePool(PathForReturn); - return NULL; - } - - // - // append the path part onto the filepath. - // - ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL)); - - AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath); - if (AlignedNode == NULL) { - FreePool (PathForReturn); - return NULL; - } - - // File Path Device Path Nodes 'can optionally add a "\" separator to - // the beginning and/or the end of the Path Name string.' - // (UEFI Spec 2.4 section 9.3.6.4). - // If necessary, add a "\", but otherwise don't - // (This is specified in the above section, and also implied by the - // UEFI Shell spec section 3.7) - if ((PathSize != 0) && - (PathForReturn != NULL) && - (PathForReturn[PathSize / sizeof (CHAR16) - 1] != L'\\') && - (AlignedNode->PathName[0] != L'\\')) { - PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1); - } - - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0); - FreePool(AlignedNode); - } // for loop of remaining nodes - } - if (PathForReturn != NULL) { - break; - } - } // for loop of paths to check - return(PathForReturn); -} - -/** - Converts a file system style name to a device path. - - This function converts a file system style name to a device path, by replacing any - mapping references to the associated device path. - - @param[in] Path The pointer to the path. - - @return The pointer of the file path. The file path is callee - allocated and should be freed by the caller. - @retval NULL The path could not be found. - @retval NULL There was not enough available memory. -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -EfiShellGetDevicePathFromFilePath( - IN CONST CHAR16 *Path - ) -{ - CHAR16 *MapName; - CHAR16 *NewPath; - CONST CHAR16 *Cwd; - UINTN Size; - CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy; - EFI_DEVICE_PATH_PROTOCOL *DevicePathCopyForFree; - EFI_DEVICE_PATH_PROTOCOL *DevicePathForReturn; - EFI_HANDLE Handle; - EFI_STATUS Status; - - if (Path == NULL) { - return (NULL); - } - - MapName = NULL; - NewPath = NULL; - - if (StrStr(Path, L":") == NULL) { - Cwd = EfiShellGetCurDir(NULL); - if (Cwd == NULL) { - return (NULL); - } - Size = StrSize(Cwd) + StrSize(Path); - NewPath = AllocateZeroPool(Size); - if (NewPath == NULL) { - return (NULL); - } - StrCpyS(NewPath, Size/sizeof(CHAR16), Cwd); - StrCatS(NewPath, Size/sizeof(CHAR16), L"\\"); - if (*Path == L'\\') { - Path++; - while (PathRemoveLastItem(NewPath)) ; - } - StrCatS(NewPath, Size/sizeof(CHAR16), Path); - DevicePathForReturn = EfiShellGetDevicePathFromFilePath(NewPath); - FreePool(NewPath); - return (DevicePathForReturn); - } - - Size = 0; - // - // find the part before (but including) the : for the map name - // - ASSERT((MapName == NULL && Size == 0) || (MapName != NULL)); - MapName = StrnCatGrow(&MapName, &Size, Path, (StrStr(Path, L":")-Path+1)); - if (MapName == NULL || MapName[StrLen(MapName)-1] != L':') { - return (NULL); - } - - // - // look up the device path in the map - // - DevicePath = EfiShellGetDevicePathFromMap(MapName); - if (DevicePath == NULL) { - // - // Must have been a bad Mapname - // - return (NULL); - } - - // - // make a copy for LocateDevicePath to modify (also save a pointer to call FreePool with) - // - DevicePathCopyForFree = DevicePathCopy = DuplicateDevicePath(DevicePath); - if (DevicePathCopy == NULL) { - FreePool(MapName); - return (NULL); - } - - // - // get the handle - // - ///@todo BlockIo? - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle); - if (EFI_ERROR(Status)) { - if (DevicePathCopyForFree != NULL) { - FreePool(DevicePathCopyForFree); - } - FreePool(MapName); - return (NULL); - } - - // - // build the full device path - // - if ((*(Path+StrLen(MapName)) != CHAR_NULL) && - (*(Path+StrLen(MapName)+1) == CHAR_NULL)) { - DevicePathForReturn = FileDevicePath(Handle, L"\\"); - } else { - DevicePathForReturn = FileDevicePath(Handle, Path+StrLen(MapName)); - } - - FreePool(MapName); - if (DevicePathCopyForFree != NULL) { - FreePool(DevicePathCopyForFree); - } - - return (DevicePathForReturn); -} - -/** - Gets the name of the device specified by the device handle. - - This function gets the user-readable name of the device specified by the device - handle. If no user-readable name could be generated, then *BestDeviceName will be - NULL and EFI_NOT_FOUND will be returned. - - If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the - device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on - DeviceHandle. - - If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the - device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle. - If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and - EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then - EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority. - - @param DeviceHandle The handle of the device. - @param Flags Determines the possible sources of component names. - Valid bits are: - EFI_DEVICE_NAME_USE_COMPONENT_NAME - EFI_DEVICE_NAME_USE_DEVICE_PATH - @param Language A pointer to the language specified for the device - name, in the same format as described in the UEFI - specification, Appendix M - @param BestDeviceName On return, points to the callee-allocated NULL- - terminated name of the device. If no device name - could be found, points to NULL. The name must be - freed by the caller... - - @retval EFI_SUCCESS Get the name successfully. - @retval EFI_NOT_FOUND Fail to get the device name. - @retval EFI_INVALID_PARAMETER Flags did not have a valid bit set. - @retval EFI_INVALID_PARAMETER BestDeviceName was NULL - @retval EFI_INVALID_PARAMETER DeviceHandle was NULL -**/ -EFI_STATUS -EFIAPI -EfiShellGetDeviceName( - IN EFI_HANDLE DeviceHandle, - IN EFI_SHELL_DEVICE_NAME_FLAGS Flags, - IN CHAR8 *Language, - OUT CHAR16 **BestDeviceName - ) -{ - EFI_STATUS Status; - EFI_COMPONENT_NAME2_PROTOCOL *CompName2; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_HANDLE *HandleList; - UINTN HandleCount; - UINTN LoopVar; - CHAR16 *DeviceNameToReturn; - CHAR8 *Lang; - UINTN ParentControllerCount; - EFI_HANDLE *ParentControllerBuffer; - UINTN ParentDriverCount; - EFI_HANDLE *ParentDriverBuffer; - - if (BestDeviceName == NULL || - DeviceHandle == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - - // - // make sure one of the 2 supported bits is on - // - if (((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) == 0) && - ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) == 0)) { - return (EFI_INVALID_PARAMETER); - } - - DeviceNameToReturn = NULL; - *BestDeviceName = NULL; - HandleList = NULL; - HandleCount = 0; - Lang = NULL; - - if ((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) != 0) { - Status = ParseHandleDatabaseByRelationship( - NULL, - DeviceHandle, - HR_DRIVER_BINDING_HANDLE|HR_DEVICE_DRIVER, - &HandleCount, - &HandleList); - for (LoopVar = 0; LoopVar < HandleCount ; LoopVar++){ - // - // Go through those handles until we get one that passes for GetComponentName - // - Status = gBS->OpenProtocol( - HandleList[LoopVar], - &gEfiComponentName2ProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - Status = gBS->OpenProtocol( - HandleList[LoopVar], - &gEfiComponentNameProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - } - - if (EFI_ERROR(Status)) { - continue; - } - Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE); - Status = CompName2->GetControllerName(CompName2, DeviceHandle, NULL, Lang, &DeviceNameToReturn); - FreePool(Lang); - Lang = NULL; - if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) { - break; - } - } - if (HandleList != NULL) { - FreePool(HandleList); - } - - // - // Now check the parent controller using this as the child. - // - if (DeviceNameToReturn == NULL){ - PARSE_HANDLE_DATABASE_PARENTS(DeviceHandle, &ParentControllerCount, &ParentControllerBuffer); - for (LoopVar = 0 ; LoopVar < ParentControllerCount ; LoopVar++) { - PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ParentControllerBuffer[LoopVar], &ParentDriverCount, &ParentDriverBuffer); - for (HandleCount = 0 ; HandleCount < ParentDriverCount ; HandleCount++) { - // - // try using that driver's component name with controller and our driver as the child. - // - Status = gBS->OpenProtocol( - ParentDriverBuffer[HandleCount], - &gEfiComponentName2ProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - Status = gBS->OpenProtocol( - ParentDriverBuffer[HandleCount], - &gEfiComponentNameProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - } - - if (EFI_ERROR(Status)) { - continue; - } - Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE); - Status = CompName2->GetControllerName(CompName2, ParentControllerBuffer[LoopVar], DeviceHandle, Lang, &DeviceNameToReturn); - FreePool(Lang); - Lang = NULL; - if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) { - break; - } - - - - } - SHELL_FREE_NON_NULL(ParentDriverBuffer); - if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) { - break; - } - } - SHELL_FREE_NON_NULL(ParentControllerBuffer); - } - // - // dont return on fail since we will try device path if that bit is on - // - if (DeviceNameToReturn != NULL){ - ASSERT(BestDeviceName != NULL); - StrnCatGrow(BestDeviceName, NULL, DeviceNameToReturn, 0); - return (EFI_SUCCESS); - } - } - if ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) != 0) { - Status = gBS->OpenProtocol( - DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&DevicePath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - // - // use device path to text on the device path - // - *BestDeviceName = ConvertDevicePathToText(DevicePath, TRUE, TRUE); - return (EFI_SUCCESS); - } - } - // - // none of the selected bits worked. - // - return (EFI_NOT_FOUND); -} - -/** - Opens the root directory of a device on a handle - - This function opens the root directory of a device and returns a file handle to it. - - @param DeviceHandle The handle of the device that contains the volume. - @param FileHandle On exit, points to the file handle corresponding to the root directory on the - device. - - @retval EFI_SUCCESS Root opened successfully. - @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory - could not be opened. - @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted. - @retval EFI_DEVICE_ERROR The device had an error. - @retval Others Error status returned from EFI_SIMPLE_FILE_SYSTEM_PROTOCOL->OpenVolume(). -**/ -EFI_STATUS -EFIAPI -EfiShellOpenRootByHandle( - IN EFI_HANDLE DeviceHandle, - OUT SHELL_FILE_HANDLE *FileHandle - ) -{ - EFI_STATUS Status; - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem; - EFI_FILE_PROTOCOL *RealFileHandle; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - - // - // get the simple file system interface - // - Status = gBS->OpenProtocol(DeviceHandle, - &gEfiSimpleFileSystemProtocolGuid, - (VOID**)&SimpleFileSystem, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - - Status = gBS->OpenProtocol(DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&DevPath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - // - // Open the root volume now... - // - Status = SimpleFileSystem->OpenVolume(SimpleFileSystem, &RealFileHandle); - if (EFI_ERROR(Status)) { - return Status; - } - - *FileHandle = ConvertEfiFileProtocolToShellHandle(RealFileHandle, EfiShellGetMapFromDevicePath(&DevPath)); - return (EFI_SUCCESS); -} - -/** - Opens the root directory of a device. - - This function opens the root directory of a device and returns a file handle to it. - - @param DevicePath Points to the device path corresponding to the device where the - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed. - @param FileHandle On exit, points to the file handle corresponding to the root directory on the - device. - - @retval EFI_SUCCESS Root opened successfully. - @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory - could not be opened. - @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted. - @retval EFI_DEVICE_ERROR The device had an error - @retval EFI_INVALID_PARAMETER FileHandle is NULL. -**/ -EFI_STATUS -EFIAPI -EfiShellOpenRoot( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - OUT SHELL_FILE_HANDLE *FileHandle - ) -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // find the handle of the device with that device handle and the file system - // - ///@todo BlockIo? - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, - &DevicePath, - &Handle); - if (EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - - return (EfiShellOpenRootByHandle(Handle, FileHandle)); -} - -/** - Returns whether any script files are currently being processed. - - @retval TRUE There is at least one script file active. - @retval FALSE No script files are active now. - -**/ -BOOLEAN -EFIAPI -EfiShellBatchIsActive ( - VOID - ) -{ - if (ShellCommandGetCurrentScriptFile() == NULL) { - return (FALSE); - } - return (TRUE); -} - -/** - Worker function to open a file based on a device path. this will open the root - of the volume and then traverse down to the file itself. - - @param DevicePath Device Path of the file. - @param FileHandle Pointer to the file upon a successful return. - @param OpenMode mode to open file in. - @param Attributes the File Attributes to use when creating a new file. - - @retval EFI_SUCCESS the file is open and FileHandle is valid - @retval EFI_UNSUPPORTED the device path cotained non-path elements - @retval other an error ocurred. -**/ -EFI_STATUS -InternalOpenFileDevicePath( - IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode, - IN UINT64 Attributes OPTIONAL - ) -{ - EFI_STATUS Status; - FILEPATH_DEVICE_PATH *FilePathNode; - EFI_HANDLE Handle; - SHELL_FILE_HANDLE ShellHandle; - EFI_FILE_PROTOCOL *Handle1; - EFI_FILE_PROTOCOL *Handle2; - FILEPATH_DEVICE_PATH *AlignedNode; - - if (FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = NULL; - Handle1 = NULL; - Handle2 = NULL; - Handle = NULL; - ShellHandle = NULL; - FilePathNode = NULL; - AlignedNode = NULL; - - Status = EfiShellOpenRoot(DevicePath, &ShellHandle); - - if (!EFI_ERROR(Status)) { - Handle1 = ConvertShellHandleToEfiFileProtocol(ShellHandle); - if (Handle1 != NULL) { - // - // chop off the begining part before the file system part... - // - ///@todo BlockIo? - Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, - &DevicePath, - &Handle); - if (!EFI_ERROR(Status)) { - // - // To access as a file system, the file path should only - // contain file path components. Follow the file path nodes - // and find the target file - // - for ( FilePathNode = (FILEPATH_DEVICE_PATH *)DevicePath - ; !IsDevicePathEnd (&FilePathNode->Header) - ; FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header) - ){ - SHELL_FREE_NON_NULL(AlignedNode); - AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePathNode), FilePathNode); - // - // For file system access each node should be a file path component - // - if (DevicePathType (&FilePathNode->Header) != MEDIA_DEVICE_PATH || - DevicePathSubType (&FilePathNode->Header) != MEDIA_FILEPATH_DP - ) { - Status = EFI_UNSUPPORTED; - break; - } - - // - // Open this file path node - // - Handle2 = Handle1; - Handle1 = NULL; - - // - // if this is the last node in the DevicePath always create (if that was requested). - // - if (IsDevicePathEnd ((NextDevicePathNode (&FilePathNode->Header)))) { - Status = Handle2->Open ( - Handle2, - &Handle1, - AlignedNode->PathName, - OpenMode, - Attributes - ); - } else { - - // - // This is not the last node and we dont want to 'create' existing - // directory entries... - // - - // - // open without letting it create - // prevents error on existing files/directories - // - Status = Handle2->Open ( - Handle2, - &Handle1, - AlignedNode->PathName, - OpenMode &~EFI_FILE_MODE_CREATE, - Attributes - ); - // - // if above failed now open and create the 'item' - // if OpenMode EFI_FILE_MODE_CREATE bit was on (but disabled above) - // - if ((EFI_ERROR (Status)) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)) { - Status = Handle2->Open ( - Handle2, - &Handle1, - AlignedNode->PathName, - OpenMode, - Attributes - ); - } - } - // - // Close the last node - // - ShellInfoObject.NewEfiShellProtocol->CloseFile (Handle2); - - // - // If there's been an error, stop - // - if (EFI_ERROR (Status)) { - break; - } - } // for loop - } - } - } - SHELL_FREE_NON_NULL(AlignedNode); - if (EFI_ERROR(Status)) { - if (Handle1 != NULL) { - ShellInfoObject.NewEfiShellProtocol->CloseFile(Handle1); - } - } else { - *FileHandle = ConvertEfiFileProtocolToShellHandle(Handle1, ShellFileHandleGetPath(ShellHandle)); - } - return (Status); -} - -/** - Creates a file or directory by name. - - This function creates an empty new file or directory with the specified attributes and - returns the new file's handle. If the file already exists and is read-only, then - EFI_INVALID_PARAMETER will be returned. - - If the file already existed, it is truncated and its attributes updated. If the file is - created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL. - - If the file name begins with >v, then the file handle which is returned refers to the - shell environment variable with the specified name. If the shell environment variable - already exists and is non-volatile then EFI_INVALID_PARAMETER is returned. - - @param FileName Pointer to NULL-terminated file path - @param FileAttribs The new file's attrbiutes. the different attributes are - described in EFI_FILE_PROTOCOL.Open(). - @param FileHandle On return, points to the created file handle or directory's handle - - @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED could not open the file path - @retval EFI_NOT_FOUND the specified file could not be found on the devide, or could not - file the file system on the device. - @retval EFI_NO_MEDIA the device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no - longer supported. - @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according - the DirName. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write - when the media is write-protected. - @retval EFI_ACCESS_DENIED The service denied access to the file. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -EfiShellCreateFile( - IN CONST CHAR16 *FileName, - IN UINT64 FileAttribs, - OUT SHELL_FILE_HANDLE *FileHandle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_STATUS Status; - BOOLEAN Volatile; - - // - // Is this for an environment variable - // do we start with >v - // - if (StrStr(FileName, L">v") == FileName) { - Status = IsVolatileEnv (FileName + 2, &Volatile); - if (EFI_ERROR (Status)) { - return Status; - } - if (!Volatile) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = CreateFileInterfaceEnv(FileName+2); - return (EFI_SUCCESS); - } - - // - // We are opening a regular file. - // - DevicePath = EfiShellGetDevicePathFromFilePath(FileName); - if (DevicePath == NULL) { - return (EFI_NOT_FOUND); - } - - Status = InternalOpenFileDevicePath(DevicePath, FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, FileAttribs); - FreePool(DevicePath); - - return(Status); -} - -/** - Register a GUID and a localized human readable name for it. - - If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID - names must be used whenever a shell command outputs GUID information. - - This function is only available when the major and minor versions in the - EfiShellProtocol are greater than or equal to 2 and 1, respectively. - - @param[in] Guid A pointer to the GUID being registered. - @param[in] GuidName A pointer to the localized name for the GUID being registered. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_INVALID_PARAMETER Guid was NULL. - @retval EFI_INVALID_PARAMETER GuidName was NULL. - @retval EFI_ACCESS_DENIED Guid already is assigned a name. -**/ -EFI_STATUS -EFIAPI -EfiShellRegisterGuidName( - IN CONST EFI_GUID *Guid, - IN CONST CHAR16 *GuidName - ) -{ - return (AddNewGuidNameMapping(Guid, GuidName, NULL)); -} - -/** - Opens a file or a directory by file name. - - This function opens the specified file in the specified OpenMode and returns a file - handle. - If the file name begins with >v, then the file handle which is returned refers to the - shell environment variable with the specified name. If the shell environment variable - exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then - EFI_INVALID_PARAMETER is returned. - - If the file name is >i, then the file handle which is returned refers to the standard - input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER - is returned. - - If the file name is >o, then the file handle which is returned refers to the standard - output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER - is returned. - - If the file name is >e, then the file handle which is returned refers to the standard - error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER - is returned. - - If the file name is NUL, then the file handle that is returned refers to the standard NUL - file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is - returned. - - If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the - FileHandle is NULL. - - @param FileName Points to the NULL-terminated UCS-2 encoded file name. - @param FileHandle On return, points to the file handle. - @param OpenMode File open mode. Either EFI_FILE_MODE_READ or - EFI_FILE_MODE_WRITE from section 12.4 of the UEFI - Specification. - @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL. - @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL. - @retval EFI_NOT_FOUND The specified file could not be found on the device or the file - system could not be found on the device. FileHandle is NULL. - @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no - longer supported. FileHandle is NULL. - @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according - the FileName. FileHandle is NULL. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL. - @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write - when the media is write-protected. FileHandle is NULL. - @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle - is NULL. - @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL. -**/ -EFI_STATUS -EFIAPI -EfiShellOpenFileByName( - IN CONST CHAR16 *FileName, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_STATUS Status; - BOOLEAN Volatile; - - *FileHandle = NULL; - - // - // Is this for StdIn - // - if (StrCmp(FileName, L">i") == 0) { - // - // make sure not writing to StdIn - // - if ((OpenMode & EFI_FILE_MODE_WRITE) != 0) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = ShellInfoObject.NewShellParametersProtocol->StdIn; - ASSERT(*FileHandle != NULL); - return (EFI_SUCCESS); - } - - // - // Is this for StdOut - // - if (StrCmp(FileName, L">o") == 0) { - // - // make sure not writing to StdIn - // - if ((OpenMode & EFI_FILE_MODE_READ) != 0) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = &FileInterfaceStdOut; - return (EFI_SUCCESS); - } - - // - // Is this for NUL / NULL file - // - if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NUL") == 0) || - (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NULL") == 0)) { - *FileHandle = &FileInterfaceNulFile; - return (EFI_SUCCESS); - } - - // - // Is this for StdErr - // - if (StrCmp(FileName, L">e") == 0) { - // - // make sure not writing to StdIn - // - if ((OpenMode & EFI_FILE_MODE_READ) != 0) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = &FileInterfaceStdErr; - return (EFI_SUCCESS); - } - - // - // Is this for an environment variable - // do we start with >v - // - if (StrStr(FileName, L">v") == FileName) { - Status = IsVolatileEnv (FileName + 2, &Volatile); - if (EFI_ERROR (Status)) { - return Status; - } - if (!Volatile && - ((OpenMode & EFI_FILE_MODE_WRITE) != 0)) { - return (EFI_INVALID_PARAMETER); - } - *FileHandle = CreateFileInterfaceEnv(FileName+2); - return (EFI_SUCCESS); - } - - // - // We are opening a regular file. - // - DevicePath = EfiShellGetDevicePathFromFilePath(FileName); - - if (DevicePath == NULL) { - return (EFI_NOT_FOUND); - } - - // - // Copy the device path, open the file, then free the memory - // - Status = InternalOpenFileDevicePath(DevicePath, FileHandle, OpenMode, 0); // 0 = no specific file attributes - FreePool(DevicePath); - - return(Status); -} - -/** - Deletes the file specified by the file name. - - This function deletes a file. - - @param FileName Points to the NULL-terminated file name. - - @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed. - @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted. - @sa EfiShellCreateFile -**/ -EFI_STATUS -EFIAPI -EfiShellDeleteFileByName( - IN CONST CHAR16 *FileName - ) -{ - SHELL_FILE_HANDLE FileHandle; - EFI_STATUS Status; - - FileHandle = NULL; - - // - // get a handle to the file - // - Status = EfiShellCreateFile(FileName, - 0, - &FileHandle); - if (EFI_ERROR(Status)) { - return (Status); - } - // - // now delete the file - // - ShellFileHandleRemove(FileHandle); - return (ShellInfoObject.NewEfiShellProtocol->DeleteFile(FileHandle)); -} - -/** - Disables the page break output mode. -**/ -VOID -EFIAPI -EfiShellDisablePageBreak ( - VOID - ) -{ - ShellInfoObject.PageBreakEnabled = FALSE; -} - -/** - Enables the page break output mode. -**/ -VOID -EFIAPI -EfiShellEnablePageBreak ( - VOID - ) -{ - ShellInfoObject.PageBreakEnabled = TRUE; -} - -/** - internal worker function to load and run an image via device path. - - @param ParentImageHandle A handle of the image that is executing the specified - command line. - @param DevicePath device path of the file to execute - @param CommandLine Points to the NULL-terminated UCS-2 encoded string - containing the command line. If NULL then the command- - line will be empty. - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. If this - is NULL, then the current shell environment is used. - - @param[out] StartImageStatus Returned status from gBS->StartImage. - - @retval EFI_SUCCESS The command executed successfully. The status code - returned by the command is pointed to by StatusCode. - @retval EFI_INVALID_PARAMETER The parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED Nested shell invocations are not allowed. -**/ -EFI_STATUS -InternalShellExecuteDevicePath( - IN CONST EFI_HANDLE *ParentImageHandle, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST CHAR16 *CommandLine OPTIONAL, - IN CONST CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StartImageStatus OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_STATUS StartStatus; - EFI_STATUS CleanupStatus; - EFI_HANDLE NewHandle; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - LIST_ENTRY OrigEnvs; - EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol; - CHAR16 *ImagePath; - UINTN Index; - CHAR16 *Walker; - CHAR16 *NewCmdLine; - - if (ParentImageHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - InitializeListHead(&OrigEnvs); - ZeroMem(&ShellParamsProtocol, sizeof(EFI_SHELL_PARAMETERS_PROTOCOL)); - - NewHandle = NULL; - - NewCmdLine = AllocateCopyPool (StrSize (CommandLine), CommandLine); - if (NewCmdLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { - if (*Walker == L'^' && *(Walker+1) == L'#') { - CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); - } - } - - // - // Load the image with: - // FALSE - not from boot manager and NULL, 0 being not already in memory - // - Status = gBS->LoadImage( - FALSE, - *ParentImageHandle, - (EFI_DEVICE_PATH_PROTOCOL*)DevicePath, - NULL, - 0, - &NewHandle); - - if (EFI_ERROR(Status)) { - if (NewHandle != NULL) { - gBS->UnloadImage(NewHandle); - } - FreePool (NewCmdLine); - return (Status); - } - Status = gBS->OpenProtocol( - NewHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - - if (!EFI_ERROR(Status)) { - // - // If the image is not an app abort it. - // - if (LoadedImage->ImageCodeType != EfiLoaderCode){ - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SHELL_IMAGE_NOT_APP), - ShellInfoObject.HiiHandle - ); - goto UnloadImage; - } - - ASSERT(LoadedImage->LoadOptionsSize == 0); - if (NewCmdLine != NULL) { - LoadedImage->LoadOptionsSize = (UINT32)StrSize(NewCmdLine); - LoadedImage->LoadOptions = (VOID*)NewCmdLine; - } - - // - // Save our current environment settings for later restoration if necessary - // - if (Environment != NULL) { - Status = GetEnvironmentVariableList(&OrigEnvs); - if (!EFI_ERROR(Status)) { - Status = SetEnvironmentVariables(Environment); - } - } - - // - // Initialize and install a shell parameters protocol on the image. - // - ShellParamsProtocol.StdIn = ShellInfoObject.NewShellParametersProtocol->StdIn; - ShellParamsProtocol.StdOut = ShellInfoObject.NewShellParametersProtocol->StdOut; - ShellParamsProtocol.StdErr = ShellInfoObject.NewShellParametersProtocol->StdErr; - Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL); - ASSERT_EFI_ERROR(Status); - // - // Replace Argv[0] with the full path of the binary we're executing: - // If the command line was "foo", the binary might be called "foo.efi". - // "The first entry in [Argv] is always the full file path of the - // executable" - UEFI Shell Spec section 2.3 - // - ImagePath = EfiShellGetFilePathFromDevicePath (DevicePath); - // The image we're executing isn't necessarily in a filesystem - it might - // be memory mapped. In this case EfiShellGetFilePathFromDevicePath will - // return NULL, and we'll leave Argv[0] as UpdateArgcArgv set it. - if (ImagePath != NULL) { - if (ShellParamsProtocol.Argv == NULL) { - // Command line was empty or null. - // (UpdateArgcArgv sets Argv to NULL when CommandLine is "" or NULL) - ShellParamsProtocol.Argv = AllocatePool (sizeof (CHAR16 *)); - if (ShellParamsProtocol.Argv == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto UnloadImage; - } - ShellParamsProtocol.Argc = 1; - } else { - // Free the string UpdateArgcArgv put in Argv[0]; - FreePool (ShellParamsProtocol.Argv[0]); - } - ShellParamsProtocol.Argv[0] = ImagePath; - } - - Status = gBS->InstallProtocolInterface(&NewHandle, &gEfiShellParametersProtocolGuid, EFI_NATIVE_INTERFACE, &ShellParamsProtocol); - ASSERT_EFI_ERROR(Status); - - ///@todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols) - - // - // now start the image and if the caller wanted the return code pass it to them... - // - if (!EFI_ERROR(Status)) { - StartStatus = gBS->StartImage( - NewHandle, - 0, - NULL - ); - if (StartImageStatus != NULL) { - *StartImageStatus = StartStatus; - } - - CleanupStatus = gBS->UninstallProtocolInterface( - NewHandle, - &gEfiShellParametersProtocolGuid, - &ShellParamsProtocol - ); - ASSERT_EFI_ERROR(CleanupStatus); - - goto FreeAlloc; - } - -UnloadImage: - // Unload image - We should only get here if we didn't call StartImage - gBS->UnloadImage (NewHandle); - -FreeAlloc: - // Free Argv (Allocated in UpdateArgcArgv) - if (ShellParamsProtocol.Argv != NULL) { - for (Index = 0; Index < ShellParamsProtocol.Argc; Index++) { - if (ShellParamsProtocol.Argv[Index] != NULL) { - FreePool (ShellParamsProtocol.Argv[Index]); - } - } - FreePool (ShellParamsProtocol.Argv); - } - } - - // Restore environment variables - if (!IsListEmpty(&OrigEnvs)) { - CleanupStatus = SetEnvironmentVariableList(&OrigEnvs); - ASSERT_EFI_ERROR (CleanupStatus); - } - - FreePool (NewCmdLine); - - return(Status); -} - -/** - internal worker function to load and run an image in the current shell. - - @param CommandLine Points to the NULL-terminated UCS-2 encoded string - containing the command line. If NULL then the command- - line will be empty. - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. If this - is NULL, then the current shell environment is used. - - @param[out] StartImageStatus Returned status from the command line. - - @retval EFI_SUCCESS The command executed successfully. The status code - returned by the command is pointed to by StatusCode. - @retval EFI_INVALID_PARAMETER The parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED Nested shell invocations are not allowed. -**/ -EFI_STATUS -InternalShellExecute( - IN CONST CHAR16 *CommandLine OPTIONAL, - IN CONST CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StartImageStatus OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_STATUS CleanupStatus; - LIST_ENTRY OrigEnvs; - - InitializeListHead(&OrigEnvs); - - // - // Save our current environment settings for later restoration if necessary - // - if (Environment != NULL) { - Status = GetEnvironmentVariableList(&OrigEnvs); - if (!EFI_ERROR(Status)) { - Status = SetEnvironmentVariables(Environment); - } else { - return Status; - } - } - - Status = RunShellCommand(CommandLine, StartImageStatus); - - // Restore environment variables - if (!IsListEmpty(&OrigEnvs)) { - CleanupStatus = SetEnvironmentVariableList(&OrigEnvs); - ASSERT_EFI_ERROR (CleanupStatus); - } - - return(Status); -} - -/** - Determine if the UEFI Shell is currently running with nesting enabled or disabled. - - @retval FALSE nesting is required - @retval other nesting is enabled -**/ -STATIC -BOOLEAN -NestingEnabled( - VOID -) -{ - EFI_STATUS Status; - CHAR16 *Temp; - CHAR16 *Temp2; - UINTN TempSize; - BOOLEAN RetVal; - - RetVal = TRUE; - Temp = NULL; - Temp2 = NULL; - - if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest) { - TempSize = 0; - Temp = NULL; - Status = SHELL_GET_ENVIRONMENT_VARIABLE(mNoNestingEnvVarName, &TempSize, Temp); - if (Status == EFI_BUFFER_TOO_SMALL) { - Temp = AllocateZeroPool(TempSize + sizeof(CHAR16)); - if (Temp != NULL) { - Status = SHELL_GET_ENVIRONMENT_VARIABLE(mNoNestingEnvVarName, &TempSize, Temp); - } - } - Temp2 = StrnCatGrow(&Temp2, NULL, mNoNestingTrue, 0); - if (Temp != NULL && Temp2 != NULL && StringNoCaseCompare(&Temp, &Temp2) == 0) { - // - // Use the no nesting method. - // - RetVal = FALSE; - } - } - - SHELL_FREE_NON_NULL(Temp); - SHELL_FREE_NON_NULL(Temp2); - return (RetVal); -} - -/** - Execute the command line. - - This function creates a nested instance of the shell and executes the specified - command (CommandLine) with the specified environment (Environment). Upon return, - the status code returned by the specified command is placed in StatusCode. - - If Environment is NULL, then the current environment is used and all changes made - by the commands executed will be reflected in the current environment. If the - Environment is non-NULL, then the changes made will be discarded. - - The CommandLine is executed from the current working directory on the current - device. - - @param ParentImageHandle A handle of the image that is executing the specified - command line. - @param CommandLine Points to the NULL-terminated UCS-2 encoded string - containing the command line. If NULL then the command- - line will be empty. - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. If this - is NULL, then the current shell environment is used. - @param StatusCode Points to the status code returned by the CommandLine. - - @retval EFI_SUCCESS The command executed successfully. The status code - returned by the command is pointed to by StatusCode. - @retval EFI_INVALID_PARAMETER The parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED Nested shell invocations are not allowed. - @retval EFI_UNSUPPORTED The support level required for this function is not present. - - @sa InternalShellExecuteDevicePath -**/ -EFI_STATUS -EFIAPI -EfiShellExecute( - IN EFI_HANDLE *ParentImageHandle, - IN CHAR16 *CommandLine OPTIONAL, - IN CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StatusCode OPTIONAL - ) -{ - EFI_STATUS Status; - CHAR16 *Temp; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - UINTN Size; - - if ((PcdGet8(PcdShellSupportLevel) < 1)) { - return (EFI_UNSUPPORTED); - } - - if (NestingEnabled()) { - DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath); - - DEBUG_CODE_BEGIN(); - Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE); - FreePool(Temp); - Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE); - FreePool(Temp); - Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE); - FreePool(Temp); - DEBUG_CODE_END(); - - Temp = NULL; - Size = 0; - ASSERT((Temp == NULL && Size == 0) || (Temp != NULL)); - StrnCatGrow(&Temp, &Size, L"Shell.efi -exit ", 0); - StrnCatGrow(&Temp, &Size, CommandLine, 0); - - Status = InternalShellExecuteDevicePath( - ParentImageHandle, - DevPath, - Temp, - (CONST CHAR16**)Environment, - StatusCode); - - // - // de-allocate and return - // - FreePool(DevPath); - FreePool(Temp); - } else { - Status = InternalShellExecute( - (CONST CHAR16*)CommandLine, - (CONST CHAR16**)Environment, - StatusCode); - } - - return(Status); -} - -/** - Utility cleanup function for EFI_SHELL_FILE_INFO objects. - - 1) frees all pointers (non-NULL) - 2) Closes the SHELL_FILE_HANDLE - - @param FileListNode pointer to the list node to free -**/ -VOID -InternalFreeShellFileInfoNode( - IN EFI_SHELL_FILE_INFO *FileListNode - ) -{ - if (FileListNode->Info != NULL) { - FreePool((VOID*)FileListNode->Info); - } - if (FileListNode->FileName != NULL) { - FreePool((VOID*)FileListNode->FileName); - } - if (FileListNode->FullName != NULL) { - FreePool((VOID*)FileListNode->FullName); - } - if (FileListNode->Handle != NULL) { - ShellInfoObject.NewEfiShellProtocol->CloseFile(FileListNode->Handle); - } - FreePool(FileListNode); -} -/** - Frees the file list. - - This function cleans up the file list and any related data structures. It has no - impact on the files themselves. - - @param FileList The file list to free. Type EFI_SHELL_FILE_INFO is - defined in OpenFileList() - - @retval EFI_SUCCESS Free the file list successfully. - @retval EFI_INVALID_PARAMETER FileList was NULL or *FileList was NULL; -**/ -EFI_STATUS -EFIAPI -EfiShellFreeFileList( - IN EFI_SHELL_FILE_INFO **FileList - ) -{ - EFI_SHELL_FILE_INFO *ShellFileListItem; - - if (FileList == NULL || *FileList == NULL) { - return (EFI_INVALID_PARAMETER); - } - - for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link) - ; !IsListEmpty(&(*FileList)->Link) - ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link) - ){ - RemoveEntryList(&ShellFileListItem->Link); - InternalFreeShellFileInfoNode(ShellFileListItem); - } - InternalFreeShellFileInfoNode(*FileList); - *FileList = NULL; - return(EFI_SUCCESS); -} - -/** - Deletes the duplicate file names files in the given file list. - - This function deletes the reduplicate files in the given file list. - - @param FileList A pointer to the first entry in the file list. - - @retval EFI_SUCCESS Always success. - @retval EFI_INVALID_PARAMETER FileList was NULL or *FileList was NULL; -**/ -EFI_STATUS -EFIAPI -EfiShellRemoveDupInFileList( - IN EFI_SHELL_FILE_INFO **FileList - ) -{ - EFI_SHELL_FILE_INFO *ShellFileListItem; - EFI_SHELL_FILE_INFO *ShellFileListItem2; - EFI_SHELL_FILE_INFO *TempNode; - - if (FileList == NULL || *FileList == NULL) { - return (EFI_INVALID_PARAMETER); - } - for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link) - ; !IsNull(&(*FileList)->Link, &ShellFileListItem->Link) - ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link) - ){ - for ( ShellFileListItem2 = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link) - ; !IsNull(&(*FileList)->Link, &ShellFileListItem2->Link) - ; ShellFileListItem2 = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem2->Link) - ){ - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)ShellFileListItem->FullName, - (CHAR16*)ShellFileListItem2->FullName) == 0 - ){ - TempNode = (EFI_SHELL_FILE_INFO *)GetPreviousNode( - &(*FileList)->Link, - &ShellFileListItem2->Link - ); - RemoveEntryList(&ShellFileListItem2->Link); - InternalFreeShellFileInfoNode(ShellFileListItem2); - // Set ShellFileListItem2 to PreviousNode so we don't access Freed - // memory in GetNextNode in the loop expression above. - ShellFileListItem2 = TempNode; - } - } - } - return (EFI_SUCCESS); -} - -// -// This is the same structure as the external version, but it has no CONST qualifiers. -// -typedef struct { - LIST_ENTRY Link; ///< Linked list members. - EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL. - CHAR16 *FullName; ///< Fully qualified filename. - CHAR16 *FileName; ///< name of this file. - SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed. - EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL. -} EFI_SHELL_FILE_INFO_NO_CONST; - -/** - Allocates and duplicates a EFI_SHELL_FILE_INFO node. - - @param[in] Node The node to copy from. - @param[in] Save TRUE to set Node->Handle to NULL, FALSE otherwise. - - @retval NULL a memory allocation error ocurred - @return != NULL a pointer to the new node -**/ -EFI_SHELL_FILE_INFO* -InternalDuplicateShellFileInfo( - IN EFI_SHELL_FILE_INFO *Node, - IN BOOLEAN Save - ) -{ - EFI_SHELL_FILE_INFO_NO_CONST *NewNode; - - // - // try to confirm that the objects are in sync - // - ASSERT(sizeof(EFI_SHELL_FILE_INFO_NO_CONST) == sizeof(EFI_SHELL_FILE_INFO)); - - NewNode = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (NewNode == NULL) { - return (NULL); - } - NewNode->FullName = AllocateCopyPool(StrSize(Node->FullName), Node->FullName); - NewNode->FileName = AllocateCopyPool(StrSize(Node->FileName), Node->FileName); - NewNode->Info = AllocateCopyPool((UINTN)Node->Info->Size, Node->Info); - if ( NewNode->FullName == NULL - || NewNode->FileName == NULL - || NewNode->Info == NULL - ){ - SHELL_FREE_NON_NULL(NewNode->FullName); - SHELL_FREE_NON_NULL(NewNode->FileName); - SHELL_FREE_NON_NULL(NewNode->Info); - SHELL_FREE_NON_NULL(NewNode); - return(NULL); - } - NewNode->Status = Node->Status; - NewNode->Handle = Node->Handle; - if (!Save) { - Node->Handle = NULL; - } - - return((EFI_SHELL_FILE_INFO*)NewNode); -} - -/** - Allocates and populates a EFI_SHELL_FILE_INFO structure. if any memory operation - failed it will return NULL. - - @param[in] BasePath the Path to prepend onto filename for FullPath - @param[in] Status Status member initial value. - @param[in] FileName FileName member initial value. - @param[in] Handle Handle member initial value. - @param[in] Info Info struct to copy. - - @retval NULL An error ocurred. - @return a pointer to the newly allocated structure. -**/ -EFI_SHELL_FILE_INFO * -CreateAndPopulateShellFileInfo( - IN CONST CHAR16 *BasePath, - IN CONST EFI_STATUS Status, - IN CONST CHAR16 *FileName, - IN CONST SHELL_FILE_HANDLE Handle, - IN CONST EFI_FILE_INFO *Info - ) -{ - EFI_SHELL_FILE_INFO *ShellFileListItem; - CHAR16 *TempString; - UINTN Size; - - TempString = NULL; - Size = 0; - - ShellFileListItem = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (ShellFileListItem == NULL) { - return (NULL); - } - if (Info != NULL && Info->Size != 0) { - ShellFileListItem->Info = AllocateZeroPool((UINTN)Info->Size); - if (ShellFileListItem->Info == NULL) { - FreePool(ShellFileListItem); - return (NULL); - } - CopyMem(ShellFileListItem->Info, Info, (UINTN)Info->Size); - } else { - ShellFileListItem->Info = NULL; - } - if (FileName != NULL) { - ASSERT(TempString == NULL); - ShellFileListItem->FileName = StrnCatGrow(&TempString, 0, FileName, 0); - if (ShellFileListItem->FileName == NULL) { - FreePool(ShellFileListItem->Info); - FreePool(ShellFileListItem); - return (NULL); - } - } else { - ShellFileListItem->FileName = NULL; - } - Size = 0; - TempString = NULL; - if (BasePath != NULL) { - ASSERT((TempString == NULL && Size == 0) || (TempString != NULL)); - TempString = StrnCatGrow(&TempString, &Size, BasePath, 0); - if (TempString == NULL) { - FreePool((VOID*)ShellFileListItem->FileName); - SHELL_FREE_NON_NULL(ShellFileListItem->Info); - FreePool(ShellFileListItem); - return (NULL); - } - } - if (ShellFileListItem->FileName != NULL) { - ASSERT((TempString == NULL && Size == 0) || (TempString != NULL)); - TempString = StrnCatGrow(&TempString, &Size, ShellFileListItem->FileName, 0); - if (TempString == NULL) { - FreePool((VOID*)ShellFileListItem->FileName); - FreePool(ShellFileListItem->Info); - FreePool(ShellFileListItem); - return (NULL); - } - } - - TempString = PathCleanUpDirectories(TempString); - - ShellFileListItem->FullName = TempString; - ShellFileListItem->Status = Status; - ShellFileListItem->Handle = Handle; - - return (ShellFileListItem); -} - -/** - Find all files in a specified directory. - - @param FileDirHandle Handle of the directory to search. - @param FileList On return, points to the list of files in the directory - or NULL if there are no files in the directory. - - @retval EFI_SUCCESS File information was returned successfully. - @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_NO_MEDIA The device media is not present. - @retval EFI_INVALID_PARAMETER The FileDirHandle was not a directory. - @return An error from FileHandleGetFileName(). -**/ -EFI_STATUS -EFIAPI -EfiShellFindFilesInDir( - IN SHELL_FILE_HANDLE FileDirHandle, - OUT EFI_SHELL_FILE_INFO **FileList - ) -{ - EFI_SHELL_FILE_INFO *ShellFileList; - EFI_SHELL_FILE_INFO *ShellFileListItem; - EFI_FILE_INFO *FileInfo; - EFI_STATUS Status; - BOOLEAN NoFile; - CHAR16 *TempString; - CHAR16 *BasePath; - UINTN Size; - CHAR16 *TempSpot; - - BasePath = NULL; - Status = FileHandleGetFileName(FileDirHandle, &BasePath); - if (EFI_ERROR(Status)) { - return (Status); - } - - if (ShellFileHandleGetPath(FileDirHandle) != NULL) { - TempString = NULL; - Size = 0; - TempString = StrnCatGrow(&TempString, &Size, ShellFileHandleGetPath(FileDirHandle), 0); - if (TempString == NULL) { - SHELL_FREE_NON_NULL(BasePath); - return (EFI_OUT_OF_RESOURCES); - } - TempSpot = StrStr(TempString, L";"); - - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - - TempString = StrnCatGrow(&TempString, &Size, BasePath, 0); - if (TempString == NULL) { - SHELL_FREE_NON_NULL(BasePath); - return (EFI_OUT_OF_RESOURCES); - } - SHELL_FREE_NON_NULL(BasePath); - BasePath = TempString; - } - - NoFile = FALSE; - ShellFileList = NULL; - ShellFileListItem = NULL; - FileInfo = NULL; - Status = EFI_SUCCESS; - - - for ( Status = FileHandleFindFirstFile(FileDirHandle, &FileInfo) - ; !EFI_ERROR(Status) && !NoFile - ; Status = FileHandleFindNextFile(FileDirHandle, FileInfo, &NoFile) - ){ - if (ShellFileList == NULL) { - ShellFileList = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (ShellFileList == NULL) { - SHELL_FREE_NON_NULL (BasePath); - return EFI_OUT_OF_RESOURCES; - } - InitializeListHead(&ShellFileList->Link); - } - // - // allocate a new EFI_SHELL_FILE_INFO and populate it... - // - ShellFileListItem = CreateAndPopulateShellFileInfo( - BasePath, - EFI_SUCCESS, // success since we didnt fail to open it... - FileInfo->FileName, - NULL, // no handle since not open - FileInfo); - if (ShellFileListItem == NULL) { - Status = EFI_OUT_OF_RESOURCES; - // - // Free resources outside the loop. - // - break; - } - InsertTailList(&ShellFileList->Link, &ShellFileListItem->Link); - } - if (EFI_ERROR(Status)) { - EfiShellFreeFileList(&ShellFileList); - *FileList = NULL; - } else { - *FileList = ShellFileList; - } - SHELL_FREE_NON_NULL(BasePath); - return(Status); -} - -/** - Get the GUID value from a human readable name. - - If GuidName is a known GUID name, then update Guid to have the correct value for - that GUID. - - This function is only available when the major and minor versions in the - EfiShellProtocol are greater than or equal to 2 and 1, respectively. - - @param[in] GuidName A pointer to the localized name for the GUID being queried. - @param[out] Guid A pointer to the GUID structure to be filled in. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_INVALID_PARAMETER Guid was NULL. - @retval EFI_INVALID_PARAMETER GuidName was NULL. - @retval EFI_NOT_FOUND GuidName is not a known GUID Name. -**/ -EFI_STATUS -EFIAPI -EfiShellGetGuidFromName( - IN CONST CHAR16 *GuidName, - OUT EFI_GUID *Guid - ) -{ - EFI_GUID *NewGuid; - EFI_STATUS Status; - - if (Guid == NULL || GuidName == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Status = GetGuidFromStringName(GuidName, NULL, &NewGuid); - - if (!EFI_ERROR(Status)) { - CopyGuid(Guid, NewGuid); - } - - return (Status); -} - -/** - Get the human readable name for a GUID from the value. - - If Guid is assigned a name, then update *GuidName to point to the name. The callee - should not modify the value. - - This function is only available when the major and minor versions in the - EfiShellProtocol are greater than or equal to 2 and 1, respectively. - - @param[in] Guid A pointer to the GUID being queried. - @param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_INVALID_PARAMETER Guid was NULL. - @retval EFI_INVALID_PARAMETER GuidName was NULL. - @retval EFI_NOT_FOUND Guid is not assigned a name. -**/ -EFI_STATUS -EFIAPI -EfiShellGetGuidName( - IN CONST EFI_GUID *Guid, - OUT CONST CHAR16 **GuidName - ) -{ - CHAR16 *Name; - - if (Guid == NULL || GuidName == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Name = GetStringNameFromGuid(Guid, NULL); - if (Name == NULL || StrLen(Name) == 0) { - SHELL_FREE_NON_NULL(Name); - return (EFI_NOT_FOUND); - } - - *GuidName = AddBufferToFreeList(Name); - - return (EFI_SUCCESS); -} - - - -/** - If FileHandle is a directory then the function reads from FileHandle and reads in - each of the FileInfo structures. If one of them matches the Pattern's first - "level" then it opens that handle and calls itself on that handle. - - If FileHandle is a file and matches all of the remaining Pattern (which would be - on its last node), then add a EFI_SHELL_FILE_INFO object for this file to fileList. - - Upon a EFI_SUCCESS return fromt he function any the caller is responsible to call - FreeFileList with FileList. - - @param[in] FilePattern The FilePattern to check against. - @param[in] UnicodeCollation The pointer to EFI_UNICODE_COLLATION_PROTOCOL structure - @param[in] FileHandle The FileHandle to start with - @param[in, out] FileList pointer to pointer to list of found files. - @param[in] ParentNode The node for the parent. Same file as identified by HANDLE. - @param[in] MapName The file system name this file is on. - - @retval EFI_SUCCESS all files were found and the FileList contains a list. - @retval EFI_NOT_FOUND no files were found - @retval EFI_OUT_OF_RESOURCES a memory allocation failed -**/ -EFI_STATUS -ShellSearchHandle( - IN CONST CHAR16 *FilePattern, - IN EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation, - IN SHELL_FILE_HANDLE FileHandle, - IN OUT EFI_SHELL_FILE_INFO **FileList, - IN CONST EFI_SHELL_FILE_INFO *ParentNode OPTIONAL, - IN CONST CHAR16 *MapName - ) -{ - EFI_STATUS Status; - CONST CHAR16 *NextFilePatternStart; - CHAR16 *CurrentFilePattern; - EFI_SHELL_FILE_INFO *ShellInfo; - EFI_SHELL_FILE_INFO *ShellInfoNode; - EFI_SHELL_FILE_INFO *NewShellNode; - EFI_FILE_INFO *FileInfo; - BOOLEAN Directory; - CHAR16 *NewFullName; - UINTN Size; - - if ( FilePattern == NULL - || UnicodeCollation == NULL - || FileList == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - ShellInfo = NULL; - CurrentFilePattern = NULL; - - if (*FilePattern == L'\\') { - FilePattern++; - } - - for( NextFilePatternStart = FilePattern - ; *NextFilePatternStart != CHAR_NULL && *NextFilePatternStart != L'\\' - ; NextFilePatternStart++); - - CurrentFilePattern = AllocateZeroPool((NextFilePatternStart-FilePattern+1)*sizeof(CHAR16)); - if (CurrentFilePattern == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StrnCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern, NextFilePatternStart-FilePattern); - - if (CurrentFilePattern[0] == CHAR_NULL - &&NextFilePatternStart[0] == CHAR_NULL - ){ - // - // we want the parent or root node (if no parent) - // - if (ParentNode == NULL) { - // - // We want the root node. create the node. - // - FileInfo = FileHandleGetInfo(FileHandle); - NewShellNode = CreateAndPopulateShellFileInfo( - MapName, - EFI_SUCCESS, - L"\\", - FileHandle, - FileInfo - ); - SHELL_FREE_NON_NULL(FileInfo); - } else { - // - // Add the current parameter FileHandle to the list, then end... - // - NewShellNode = InternalDuplicateShellFileInfo((EFI_SHELL_FILE_INFO*)ParentNode, TRUE); - } - if (NewShellNode == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - NewShellNode->Handle = NULL; - if (*FileList == NULL) { - *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - InitializeListHead(&((*FileList)->Link)); - } - - // - // Add to the returning to use list - // - InsertTailList(&(*FileList)->Link, &NewShellNode->Link); - - Status = EFI_SUCCESS; - } - } else { - Status = EfiShellFindFilesInDir(FileHandle, &ShellInfo); - - if (!EFI_ERROR(Status)){ - if (StrStr(NextFilePatternStart, L"\\") != NULL){ - Directory = TRUE; - } else { - Directory = FALSE; - } - for ( ShellInfoNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ShellInfo->Link) - ; !IsNull (&ShellInfo->Link, &ShellInfoNode->Link) - ; ShellInfoNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ShellInfo->Link, &ShellInfoNode->Link) - ){ - if (UnicodeCollation->MetaiMatch(UnicodeCollation, (CHAR16*)ShellInfoNode->FileName, CurrentFilePattern)){ - if (ShellInfoNode->FullName != NULL && StrStr(ShellInfoNode->FullName, L":") == NULL) { - Size = StrSize (ShellInfoNode->FullName) + StrSize (MapName); - NewFullName = AllocateZeroPool(Size); - if (NewFullName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - StrCpyS(NewFullName, Size / sizeof(CHAR16), MapName); - StrCatS(NewFullName, Size / sizeof(CHAR16), ShellInfoNode->FullName); - FreePool ((VOID *) ShellInfoNode->FullName); - ShellInfoNode->FullName = NewFullName; - } - } - if (Directory && !EFI_ERROR(Status) && ShellInfoNode->FullName != NULL && ShellInfoNode->FileName != NULL){ - // - // should be a directory - // - - // - // don't open the . and .. directories - // - if ( (StrCmp(ShellInfoNode->FileName, L".") != 0) - && (StrCmp(ShellInfoNode->FileName, L"..") != 0) - ){ - // - // - // - if (EFI_ERROR(Status)) { - break; - } - // - // Open the directory since we need that handle in the next recursion. - // - ShellInfoNode->Status = EfiShellOpenFileByName (ShellInfoNode->FullName, &ShellInfoNode->Handle, EFI_FILE_MODE_READ); - - // - // recurse with the next part of the pattern - // - Status = ShellSearchHandle(NextFilePatternStart, UnicodeCollation, ShellInfoNode->Handle, FileList, ShellInfoNode, MapName); - EfiShellClose(ShellInfoNode->Handle); - ShellInfoNode->Handle = NULL; - } - } else if (!EFI_ERROR(Status)) { - // - // should be a file - // - - // - // copy the information we need into a new Node - // - NewShellNode = InternalDuplicateShellFileInfo(ShellInfoNode, FALSE); - if (NewShellNode == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } - if (*FileList == NULL) { - *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - InitializeListHead(&((*FileList)->Link)); - } - - // - // Add to the returning to use list - // - InsertTailList(&(*FileList)->Link, &NewShellNode->Link); - } - } - if (EFI_ERROR(Status)) { - break; - } - } - if (EFI_ERROR(Status)) { - EfiShellFreeFileList(&ShellInfo); - } else { - Status = EfiShellFreeFileList(&ShellInfo); - } - } - } - - if (*FileList == NULL || (*FileList != NULL && IsListEmpty(&(*FileList)->Link))) { - Status = EFI_NOT_FOUND; - } - - FreePool(CurrentFilePattern); - return (Status); -} - -/** - Find files that match a specified pattern. - - This function searches for all files and directories that match the specified - FilePattern. The FilePattern can contain wild-card characters. The resulting file - information is placed in the file list FileList. - - Wildcards are processed - according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. - - The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo - field is set to NULL. - - if *FileList is not NULL then it must be a pre-existing and properly initialized list. - - @param FilePattern Points to a NULL-terminated shell file path, including wildcards. - @param FileList On return, points to the start of a file list containing the names - of all matching files or else points to NULL if no matching files - were found. only on a EFI_SUCCESS return will; this be non-NULL. - - @retval EFI_SUCCESS Files found. FileList is a valid list. - @retval EFI_NOT_FOUND No files found. - @retval EFI_NO_MEDIA The device has no media - @retval EFI_DEVICE_ERROR The device reported an error - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted -**/ -EFI_STATUS -EFIAPI -EfiShellFindFiles( - IN CONST CHAR16 *FilePattern, - OUT EFI_SHELL_FILE_INFO **FileList - ) -{ - EFI_STATUS Status; - CHAR16 *PatternCopy; - CHAR16 *PatternCurrentLocation; - EFI_DEVICE_PATH_PROTOCOL *RootDevicePath; - SHELL_FILE_HANDLE RootFileHandle; - CHAR16 *MapName; - UINTN Count; - - if ( FilePattern == NULL - || FileList == NULL - || StrStr(FilePattern, L":") == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - Status = EFI_SUCCESS; - RootDevicePath = NULL; - RootFileHandle = NULL; - MapName = NULL; - PatternCopy = AllocateCopyPool(StrSize(FilePattern), FilePattern); - if (PatternCopy == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - PatternCopy = PathCleanUpDirectories(PatternCopy); - - Count = StrStr(PatternCopy, L":") - PatternCopy + 1; - ASSERT (Count <= StrLen (PatternCopy)); - - ASSERT(MapName == NULL); - MapName = StrnCatGrow(&MapName, NULL, PatternCopy, Count); - if (MapName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - RootDevicePath = EfiShellGetDevicePathFromFilePath(PatternCopy); - if (RootDevicePath == NULL) { - Status = EFI_INVALID_PARAMETER; - } else { - Status = EfiShellOpenRoot(RootDevicePath, &RootFileHandle); - if (!EFI_ERROR(Status)) { - for ( PatternCurrentLocation = PatternCopy - ; *PatternCurrentLocation != ':' - ; PatternCurrentLocation++); - PatternCurrentLocation++; - Status = ShellSearchHandle(PatternCurrentLocation, gUnicodeCollation, RootFileHandle, FileList, NULL, MapName); - EfiShellClose(RootFileHandle); - } - FreePool(RootDevicePath); - } - } - - SHELL_FREE_NON_NULL(PatternCopy); - SHELL_FREE_NON_NULL(MapName); - - return(Status); -} - -/** - Opens the files that match the path specified. - - This function opens all of the files specified by Path. Wildcards are processed - according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each - matching file has an EFI_SHELL_FILE_INFO structure created in a linked list. - - @param Path A pointer to the path string. - @param OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or - EFI_FILE_MODE_WRITE. - @param FileList Points to the start of a list of files opened. - - @retval EFI_SUCCESS Create the file list successfully. - @return Others Can't create the file list. -**/ -EFI_STATUS -EFIAPI -EfiShellOpenFileList( - IN CHAR16 *Path, - IN UINT64 OpenMode, - IN OUT EFI_SHELL_FILE_INFO **FileList - ) -{ - EFI_STATUS Status; - EFI_SHELL_FILE_INFO *ShellFileListItem; - CHAR16 *Path2; - UINTN Path2Size; - CONST CHAR16 *CurDir; - BOOLEAN Found; - - PathCleanUpDirectories(Path); - - Path2Size = 0; - Path2 = NULL; - - if (FileList == NULL || *FileList == NULL) { - return (EFI_INVALID_PARAMETER); - } - - if (*Path == L'.' && *(Path+1) == L'\\') { - Path+=2; - } - - // - // convert a local path to an absolute path - // - if (StrStr(Path, L":") == NULL) { - CurDir = EfiShellGetCurDir(NULL); - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL)); - StrnCatGrow(&Path2, &Path2Size, CurDir, 0); - StrnCatGrow(&Path2, &Path2Size, L"\\", 0); - if (*Path == L'\\') { - Path++; - while (PathRemoveLastItem(Path2)) ; - } - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL)); - StrnCatGrow(&Path2, &Path2Size, Path, 0); - } else { - ASSERT(Path2 == NULL); - StrnCatGrow(&Path2, NULL, Path, 0); - } - - PathCleanUpDirectories (Path2); - - // - // do the search - // - Status = EfiShellFindFiles(Path2, FileList); - - FreePool(Path2); - - if (EFI_ERROR(Status)) { - return (Status); - } - - Found = FALSE; - // - // We had no errors so open all the files (that are not already opened...) - // - for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link) - ; !IsNull(&(*FileList)->Link, &ShellFileListItem->Link) - ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link) - ){ - if (ShellFileListItem->Status == 0 && ShellFileListItem->Handle == NULL) { - ShellFileListItem->Status = EfiShellOpenFileByName (ShellFileListItem->FullName, &ShellFileListItem->Handle, OpenMode); - Found = TRUE; - } - } - - if (!Found) { - return (EFI_NOT_FOUND); - } - return(EFI_SUCCESS); -} - -/** - Gets the environment variable and Attributes, or list of environment variables. Can be - used instead of GetEnv(). - - This function returns the current value of the specified environment variable and - the Attributes. If no variable name was specified, then all of the known - variables will be returned. - - @param[in] Name A pointer to the environment variable name. If Name is NULL, - then the function will return all of the defined shell - environment variables. In the case where multiple environment - variables are being returned, each variable will be terminated - by a NULL, and the list will be terminated by a double NULL. - @param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for - the environment variable. In the case where Name is NULL, and - multiple environment variables are being returned, Attributes - is undefined. - - @retval NULL The environment variable doesn't exist. - @return A non-NULL value points to the variable's value. The returned - pointer does not need to be freed by the caller. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetEnvEx( - IN CONST CHAR16 *Name, - OUT UINT32 *Attributes OPTIONAL - ) -{ - EFI_STATUS Status; - VOID *Buffer; - UINTN Size; - ENV_VAR_LIST *Node; - CHAR16 *CurrentWriteLocation; - - Size = 0; - Buffer = NULL; - - if (Name == NULL) { - - // - // Build the semi-colon delimited list. (2 passes) - // - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link) - ; !IsNull(&gShellEnvVarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link) - ){ - ASSERT(Node->Key != NULL); - Size += StrSize(Node->Key); - } - - Size += 2*sizeof(CHAR16); - - Buffer = AllocateZeroPool(Size); - if (Buffer == NULL) { - return (NULL); - } - CurrentWriteLocation = (CHAR16*)Buffer; - - for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link) - ; !IsNull(&gShellEnvVarList.Link, &Node->Link) - ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link) - ){ - ASSERT(Node->Key != NULL); - StrCpyS( CurrentWriteLocation, - (Size)/sizeof(CHAR16) - (CurrentWriteLocation - ((CHAR16*)Buffer)), - Node->Key - ); - CurrentWriteLocation += StrLen(CurrentWriteLocation) + 1; - } - - } else { - // - // We are doing a specific environment variable - // - Status = ShellFindEnvVarInList(Name, (CHAR16**)&Buffer, &Size, Attributes); - - if (EFI_ERROR(Status)){ - // - // get the size we need for this EnvVariable - // - Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(Name, Attributes, &Size, Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - // - // Allocate the space and recall the get function - // - Buffer = AllocateZeroPool(Size); - Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(Name, Attributes, &Size, Buffer); - } - // - // we didnt get it (might not exist) - // free the memory if we allocated any and return NULL - // - if (EFI_ERROR(Status)) { - if (Buffer != NULL) { - FreePool(Buffer); - } - return (NULL); - } else { - // - // If we did not find the environment variable in the gShellEnvVarList - // but get it from UEFI variable storage successfully then we need update - // the gShellEnvVarList. - // - ShellFreeEnvVarList (); - Status = ShellInitEnvVarList (); - ASSERT (Status == EFI_SUCCESS); - } - } - } - - // - // return the buffer - // - return (AddBufferToFreeList(Buffer)); -} - -/** - Gets either a single or list of environment variables. - - If name is not NULL then this function returns the current value of the specified - environment variable. - - If Name is NULL, then a list of all environment variable names is returned. Each is a - NULL terminated string with a double NULL terminating the list. - - @param Name A pointer to the environment variable name. If - Name is NULL, then the function will return all - of the defined shell environment variables. In - the case where multiple environment variables are - being returned, each variable will be terminated by - a NULL, and the list will be terminated by a double - NULL. - - @retval !=NULL A pointer to the returned string. - The returned pointer does not need to be freed by the caller. - - @retval NULL The environment variable doesn't exist or there are - no environment variables. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetEnv( - IN CONST CHAR16 *Name - ) -{ - return (EfiShellGetEnvEx(Name, NULL)); -} - -/** - Internal variable setting function. Allows for setting of the read only variables. - - @param Name Points to the NULL-terminated environment variable name. - @param Value Points to the NULL-terminated environment variable value. If the value is an - empty string then the environment variable is deleted. - @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE). - - @retval EFI_SUCCESS The environment variable was successfully updated. -**/ -EFI_STATUS -InternalEfiShellSetEnv( - IN CONST CHAR16 *Name, - IN CONST CHAR16 *Value, - IN BOOLEAN Volatile - ) -{ - EFI_STATUS Status; - - if (Value == NULL || StrLen(Value) == 0) { - Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Name); - if (!EFI_ERROR(Status)) { - ShellRemvoeEnvVarFromList(Name); - } - } else { - SHELL_DELETE_ENVIRONMENT_VARIABLE(Name); - Status = ShellAddEnvVarToList( - Name, Value, StrSize(Value), - EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile ? 0 : EFI_VARIABLE_NON_VOLATILE) - ); - if (!EFI_ERROR (Status)) { - Status = Volatile - ? SHELL_SET_ENVIRONMENT_VARIABLE_V (Name, StrSize (Value) - sizeof (CHAR16), Value) - : SHELL_SET_ENVIRONMENT_VARIABLE_NV (Name, StrSize (Value) - sizeof (CHAR16), Value); - if (EFI_ERROR (Status)) { - ShellRemvoeEnvVarFromList(Name); - } - } - } - return Status; -} - -/** - Sets the environment variable. - - This function changes the current value of the specified environment variable. If the - environment variable exists and the Value is an empty string, then the environment - variable is deleted. If the environment variable exists and the Value is not an empty - string, then the value of the environment variable is changed. If the environment - variable does not exist and the Value is an empty string, there is no action. If the - environment variable does not exist and the Value is a non-empty string, then the - environment variable is created and assigned the specified value. - - For a description of volatile and non-volatile environment variables, see UEFI Shell - 2.0 specification section 3.6.1. - - @param Name Points to the NULL-terminated environment variable name. - @param Value Points to the NULL-terminated environment variable value. If the value is an - empty string then the environment variable is deleted. - @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE). - - @retval EFI_SUCCESS The environment variable was successfully updated. -**/ -EFI_STATUS -EFIAPI -EfiShellSetEnv( - IN CONST CHAR16 *Name, - IN CONST CHAR16 *Value, - IN BOOLEAN Volatile - ) -{ - if (Name == NULL || *Name == CHAR_NULL) { - return (EFI_INVALID_PARAMETER); - } - // - // Make sure we dont 'set' a predefined read only variable - // - if ((StrCmp (Name, L"cwd") == 0) || - (StrCmp (Name, L"lasterror") == 0) || - (StrCmp (Name, L"profiles") == 0) || - (StrCmp (Name, L"uefishellsupport") == 0) || - (StrCmp (Name, L"uefishellversion") == 0) || - (StrCmp (Name, L"uefiversion") == 0) || - (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest && - StrCmp (Name, mNoNestingEnvVarName) == 0) - ) { - return (EFI_INVALID_PARAMETER); - } - return (InternalEfiShellSetEnv(Name, Value, Volatile)); -} - -/** - Returns the current directory on the specified device. - - If FileSystemMapping is NULL, it returns the current working directory. If the - FileSystemMapping is not NULL, it returns the current directory associated with the - FileSystemMapping. In both cases, the returned name includes the file system - mapping (i.e. fs0:\current-dir). - - Note that the current directory string should exclude the tailing backslash character. - - @param FileSystemMapping A pointer to the file system mapping. If NULL, - then the current working directory is returned. - - @retval !=NULL The current directory. - @retval NULL Current directory does not exist. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetCurDir( - IN CONST CHAR16 *FileSystemMapping OPTIONAL - ) -{ - CHAR16 *PathToReturn; - UINTN Size; - SHELL_MAP_LIST *MapListItem; - if (!IsListEmpty(&gShellMapList.Link)) { - // - // if parameter is NULL, use current - // - if (FileSystemMapping == NULL) { - return (EfiShellGetEnv(L"cwd")); - } else { - Size = 0; - PathToReturn = NULL; - MapListItem = ShellCommandFindMapItem(FileSystemMapping); - if (MapListItem != NULL) { - ASSERT((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL)); - PathToReturn = StrnCatGrow(&PathToReturn, &Size, MapListItem->MapName, 0); - PathToReturn = StrnCatGrow(&PathToReturn, &Size, MapListItem->CurrentDirectoryPath, 0); - } - } - return (AddBufferToFreeList(PathToReturn)); - } else { - return (NULL); - } -} - -/** - Changes the current directory on the specified device. - - If the FileSystem is NULL, and the directory Dir does not contain a file system's - mapped name, this function changes the current working directory. - - If the FileSystem is NULL and the directory Dir contains a mapped name, then the - current file system and the current directory on that file system are changed. - - If FileSystem is NULL, and Dir is not NULL, then this changes the current working file - system. - - If FileSystem is not NULL and Dir is not NULL, then this function changes the current - directory on the specified file system. - - If the current working directory or the current working file system is changed then the - %cwd% environment variable will be updated - - Note that the current directory string should exclude the tailing backslash character. - - @param FileSystem A pointer to the file system's mapped name. If NULL, then the current working - directory is changed. - @param Dir Points to the NULL-terminated directory on the device specified by FileSystem. - - @retval EFI_SUCCESS The operation was sucessful - @retval EFI_NOT_FOUND The file system could not be found -**/ -EFI_STATUS -EFIAPI -EfiShellSetCurDir( - IN CONST CHAR16 *FileSystem OPTIONAL, - IN CONST CHAR16 *Dir - ) -{ - CHAR16 *MapName; - SHELL_MAP_LIST *MapListItem; - UINTN Size; - EFI_STATUS Status; - CHAR16 *TempString; - CHAR16 *DirectoryName; - UINTN TempLen; - - Size = 0; - MapName = NULL; - MapListItem = NULL; - TempString = NULL; - DirectoryName = NULL; - - if ((FileSystem == NULL && Dir == NULL) || Dir == NULL) { - return (EFI_INVALID_PARAMETER); - } - - if (IsListEmpty(&gShellMapList.Link)){ - return (EFI_NOT_FOUND); - } - - DirectoryName = StrnCatGrow(&DirectoryName, NULL, Dir, 0); - ASSERT(DirectoryName != NULL); - - PathCleanUpDirectories(DirectoryName); - - if (FileSystem == NULL) { - // - // determine the file system mapping to use - // - if (StrStr(DirectoryName, L":") != NULL) { - ASSERT(MapName == NULL); - MapName = StrnCatGrow(&MapName, NULL, DirectoryName, (StrStr(DirectoryName, L":")-DirectoryName+1)); - } - // - // find the file system mapping's entry in the list - // or use current - // - if (MapName != NULL) { - MapListItem = ShellCommandFindMapItem(MapName); - - // - // make that the current file system mapping - // - if (MapListItem != NULL) { - gShellCurMapping = MapListItem; - } - } else { - MapListItem = gShellCurMapping; - } - - if (MapListItem == NULL) { - FreePool (DirectoryName); - SHELL_FREE_NON_NULL(MapName); - return (EFI_NOT_FOUND); - } - - // - // now update the MapListItem's current directory - // - if (MapListItem->CurrentDirectoryPath != NULL && DirectoryName[StrLen(DirectoryName) - 1] != L':') { - FreePool(MapListItem->CurrentDirectoryPath); - MapListItem->CurrentDirectoryPath = NULL; - } - if (MapName != NULL) { - TempLen = StrLen(MapName); - if (TempLen != StrLen(DirectoryName)) { - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName+StrLen(MapName), 0); - } - FreePool (MapName); - } else { - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0); - } - if ((MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] == L'\\') || (MapListItem->CurrentDirectoryPath == NULL)) { - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - if (MapListItem->CurrentDirectoryPath != NULL) { - MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL; - } - } - } else { - // - // cant have a mapping in the directory... - // - if (StrStr(DirectoryName, L":") != NULL) { - FreePool (DirectoryName); - return (EFI_INVALID_PARAMETER); - } - // - // FileSystem != NULL - // - MapListItem = ShellCommandFindMapItem(FileSystem); - if (MapListItem == NULL) { - FreePool (DirectoryName); - return (EFI_INVALID_PARAMETER); - } -// gShellCurMapping = MapListItem; - if (DirectoryName != NULL) { - // - // change current dir on that file system - // - - if (MapListItem->CurrentDirectoryPath != NULL) { - FreePool(MapListItem->CurrentDirectoryPath); - DEBUG_CODE(MapListItem->CurrentDirectoryPath = NULL;); - } -// ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); -// MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, FileSystem, 0); - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0); - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0); - if (MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] == L'\\') { - ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL)); - MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL; - } - } - } - FreePool (DirectoryName); - // - // if updated the current directory then update the environment variable - // - if (MapListItem == gShellCurMapping) { - Size = 0; - ASSERT((TempString == NULL && Size == 0) || (TempString != NULL)); - StrnCatGrow(&TempString, &Size, MapListItem->MapName, 0); - ASSERT((TempString == NULL && Size == 0) || (TempString != NULL)); - StrnCatGrow(&TempString, &Size, MapListItem->CurrentDirectoryPath, 0); - Status = InternalEfiShellSetEnv(L"cwd", TempString, TRUE); - FreePool(TempString); - return (Status); - } - return(EFI_SUCCESS); -} - -/** - Return help information about a specific command. - - This function returns the help information for the specified command. The help text - can be internal to the shell or can be from a UEFI Shell manual page. - - If Sections is specified, then each section name listed will be compared in a casesensitive - manner, to the section names described in Appendix B. If the section exists, - it will be appended to the returned help text. If the section does not exist, no - information will be returned. If Sections is NULL, then all help text information - available will be returned. - - @param Command Points to the NULL-terminated UEFI Shell command name. - @param Sections Points to the NULL-terminated comma-delimited - section names to return. If NULL, then all - sections will be returned. - @param HelpText On return, points to a callee-allocated buffer - containing all specified help text. - - @retval EFI_SUCCESS The help text was returned. - @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the - returned help text. - @retval EFI_INVALID_PARAMETER HelpText is NULL - @retval EFI_NOT_FOUND There is no help text available for Command. -**/ -EFI_STATUS -EFIAPI -EfiShellGetHelpText( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Sections OPTIONAL, - OUT CHAR16 **HelpText - ) -{ - CONST CHAR16 *ManFileName; - CHAR16 *FixCommand; - EFI_STATUS Status; - - ASSERT(HelpText != NULL); - FixCommand = NULL; - - ManFileName = ShellCommandGetManFileNameHandler(Command); - - if (ManFileName != NULL) { - return (ProcessManFile(ManFileName, Command, Sections, NULL, HelpText)); - } else { - if ((StrLen(Command)> 4) - && (Command[StrLen(Command)-1] == L'i' || Command[StrLen(Command)-1] == L'I') - && (Command[StrLen(Command)-2] == L'f' || Command[StrLen(Command)-2] == L'F') - && (Command[StrLen(Command)-3] == L'e' || Command[StrLen(Command)-3] == L'E') - && (Command[StrLen(Command)-4] == L'.') - ) { - FixCommand = AllocateZeroPool(StrSize(Command) - 4 * sizeof (CHAR16)); - if (FixCommand == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StrnCpyS( FixCommand, - (StrSize(Command) - 4 * sizeof (CHAR16))/sizeof(CHAR16), - Command, - StrLen(Command)-4 - ); - Status = ProcessManFile(FixCommand, FixCommand, Sections, NULL, HelpText); - FreePool(FixCommand); - return Status; - } else { - return (ProcessManFile(Command, Command, Sections, NULL, HelpText)); - } - } -} - -/** - Gets the enable status of the page break output mode. - - User can use this function to determine current page break mode. - - @retval TRUE The page break output mode is enabled. - @retval FALSE The page break output mode is disabled. -**/ -BOOLEAN -EFIAPI -EfiShellGetPageBreak( - VOID - ) -{ - return(ShellInfoObject.PageBreakEnabled); -} - -/** - Judges whether the active shell is the root shell. - - This function makes the user to know that whether the active Shell is the root shell. - - @retval TRUE The active Shell is the root Shell. - @retval FALSE The active Shell is NOT the root Shell. -**/ -BOOLEAN -EFIAPI -EfiShellIsRootShell( - VOID - ) -{ - return(ShellInfoObject.RootShellInstance); -} - -/** - function to return a semi-colon delimeted list of all alias' in the current shell - - up to caller to free the memory. - - @retval NULL No alias' were found - @retval NULL An error ocurred getting alias' - @return !NULL a list of all alias' -**/ -CHAR16 * -InternalEfiShellGetListAlias( - VOID - ) -{ - - EFI_STATUS Status; - EFI_GUID Guid; - CHAR16 *VariableName; - UINTN NameSize; - UINTN NameBufferSize; - CHAR16 *RetVal; - UINTN RetSize; - - NameBufferSize = INIT_NAME_BUFFER_SIZE; - VariableName = AllocateZeroPool(NameBufferSize); - RetSize = 0; - RetVal = NULL; - - if (VariableName == NULL) { - return (NULL); - } - - VariableName[0] = CHAR_NULL; - - while (TRUE) { - NameSize = NameBufferSize; - Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid); - if (Status == EFI_NOT_FOUND){ - break; - } else if (Status == EFI_BUFFER_TOO_SMALL) { - NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2; - SHELL_FREE_NON_NULL(VariableName); - VariableName = AllocateZeroPool(NameBufferSize); - if (VariableName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - SHELL_FREE_NON_NULL(RetVal); - RetVal = NULL; - break; - } - - NameSize = NameBufferSize; - Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid); - } - - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL(RetVal); - RetVal = NULL; - break; - } - - if (CompareGuid(&Guid, &gShellAliasGuid)){ - ASSERT((RetVal == NULL && RetSize == 0) || (RetVal != NULL)); - RetVal = StrnCatGrow(&RetVal, &RetSize, VariableName, 0); - RetVal = StrnCatGrow(&RetVal, &RetSize, L";", 0); - } // compare guid - } // while - SHELL_FREE_NON_NULL(VariableName); - - return (RetVal); -} - -/** - Convert a null-terminated unicode string, in-place, to all lowercase. - Then return it. - - @param Str The null-terminated string to be converted to all lowercase. - - @return The null-terminated string converted into all lowercase. -**/ -CHAR16 * -ToLower ( - CHAR16 *Str - ) -{ - UINTN Index; - - for (Index = 0; Str[Index] != L'\0'; Index++) { - if (Str[Index] >= L'A' && Str[Index] <= L'Z') { - Str[Index] -= (CHAR16)(L'A' - L'a'); - } - } - return Str; -} - -/** - This function returns the command associated with a alias or a list of all - alias'. - - @param[in] Alias Points to the NULL-terminated shell alias. - If this parameter is NULL, then all - aliases will be returned in ReturnedData. - @param[out] Volatile upon return of a single command if TRUE indicates - this is stored in a volatile fashion. FALSE otherwise. - - @return If Alias is not NULL, it will return a pointer to - the NULL-terminated command for that alias. - If Alias is NULL, ReturnedData points to a ';' - delimited list of alias (e.g. - ReturnedData = "dir;del;copy;mfp") that is NULL-terminated. - @retval NULL an error ocurred - @retval NULL Alias was not a valid Alias -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetAlias( - IN CONST CHAR16 *Alias, - OUT BOOLEAN *Volatile OPTIONAL - ) -{ - CHAR16 *RetVal; - UINTN RetSize; - UINT32 Attribs; - EFI_STATUS Status; - CHAR16 *AliasLower; - CHAR16 *AliasVal; - - // Convert to lowercase to make aliases case-insensitive - if (Alias != NULL) { - AliasLower = AllocateCopyPool (StrSize (Alias), Alias); - if (AliasLower == NULL) { - return NULL; - } - ToLower (AliasLower); - - if (Volatile == NULL) { - GetVariable2 (AliasLower, &gShellAliasGuid, (VOID **)&AliasVal, NULL); - FreePool(AliasLower); - return (AddBufferToFreeList(AliasVal)); - } - RetSize = 0; - RetVal = NULL; - Status = gRT->GetVariable(AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal); - if (Status == EFI_BUFFER_TOO_SMALL) { - RetVal = AllocateZeroPool(RetSize); - Status = gRT->GetVariable(AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal); - } - if (EFI_ERROR(Status)) { - if (RetVal != NULL) { - FreePool(RetVal); - } - FreePool(AliasLower); - return (NULL); - } - if ((EFI_VARIABLE_NON_VOLATILE & Attribs) == EFI_VARIABLE_NON_VOLATILE) { - *Volatile = FALSE; - } else { - *Volatile = TRUE; - } - - FreePool (AliasLower); - return (AddBufferToFreeList(RetVal)); - } - return (AddBufferToFreeList(InternalEfiShellGetListAlias())); -} - -/** - Changes a shell command alias. - - This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. - - this function does not check for built in alias'. - - @param[in] Command Points to the NULL-terminated shell command or existing alias. - @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and - Command refers to an alias, that alias will be deleted. - @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the - Alias being set will be stored in a non-volatile fashion. - - @retval EFI_SUCCESS Alias created or deleted successfully. - @retval EFI_NOT_FOUND the Alias intended to be deleted was not found -**/ -EFI_STATUS -InternalSetAlias( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias, - IN BOOLEAN Volatile - ) -{ - EFI_STATUS Status; - CHAR16 *AliasLower; - BOOLEAN DeleteAlias; - - DeleteAlias = FALSE; - if (Alias == NULL) { - // - // We must be trying to remove one if Alias is NULL - // remove an alias (but passed in COMMAND parameter) - // - Alias = Command; - DeleteAlias = TRUE; - } - ASSERT (Alias != NULL); - - // - // Convert to lowercase to make aliases case-insensitive - // - AliasLower = AllocateCopyPool (StrSize (Alias), Alias); - if (AliasLower == NULL) { - return EFI_OUT_OF_RESOURCES; - } - ToLower (AliasLower); - - if (DeleteAlias) { - Status = gRT->SetVariable (AliasLower, &gShellAliasGuid, 0, 0, NULL); - } else { - Status = gRT->SetVariable ( - AliasLower, &gShellAliasGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile ? 0 : EFI_VARIABLE_NON_VOLATILE), - StrSize (Command), (VOID *) Command - ); - } - - FreePool (AliasLower); - - return Status; -} - -/** - Changes a shell command alias. - - This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. - - - @param[in] Command Points to the NULL-terminated shell command or existing alias. - @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and - Command refers to an alias, that alias will be deleted. - @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If - FALSE and the alias already exists, then the existing alias is unchanged and - EFI_ACCESS_DENIED is returned. - @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the - Alias being set will be stored in a non-volatile fashion. - - @retval EFI_SUCCESS Alias created or deleted successfully. - @retval EFI_NOT_FOUND the Alias intended to be deleted was not found - @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to - FALSE. - @retval EFI_INVALID_PARAMETER Command is null or the empty string. -**/ -EFI_STATUS -EFIAPI -EfiShellSetAlias( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias, - IN BOOLEAN Replace, - IN BOOLEAN Volatile - ) -{ - if (ShellCommandIsOnAliasList(Alias==NULL?Command:Alias)) { - // - // cant set over a built in alias - // - return (EFI_ACCESS_DENIED); - } else if (Command == NULL || *Command == CHAR_NULL || StrLen(Command) == 0) { - // - // Command is null or empty - // - return (EFI_INVALID_PARAMETER); - } else if (EfiShellGetAlias(Command, NULL) != NULL && !Replace) { - // - // Alias already exists, Replace not set - // - return (EFI_ACCESS_DENIED); - } else { - return (InternalSetAlias(Command, Alias, Volatile)); - } -} - -// Pure FILE_HANDLE operations are passed to FileHandleLib -// these functions are indicated by the * -EFI_SHELL_PROTOCOL mShellProtocol = { - EfiShellExecute, - EfiShellGetEnv, - EfiShellSetEnv, - EfiShellGetAlias, - EfiShellSetAlias, - EfiShellGetHelpText, - EfiShellGetDevicePathFromMap, - EfiShellGetMapFromDevicePath, - EfiShellGetDevicePathFromFilePath, - EfiShellGetFilePathFromDevicePath, - EfiShellSetMap, - EfiShellGetCurDir, - EfiShellSetCurDir, - EfiShellOpenFileList, - EfiShellFreeFileList, - EfiShellRemoveDupInFileList, - EfiShellBatchIsActive, - EfiShellIsRootShell, - EfiShellEnablePageBreak, - EfiShellDisablePageBreak, - EfiShellGetPageBreak, - EfiShellGetDeviceName, - (EFI_SHELL_GET_FILE_INFO)FileHandleGetInfo, //* - (EFI_SHELL_SET_FILE_INFO)FileHandleSetInfo, //* - EfiShellOpenFileByName, - EfiShellClose, - EfiShellCreateFile, - (EFI_SHELL_READ_FILE)FileHandleRead, //* - (EFI_SHELL_WRITE_FILE)FileHandleWrite, //* - (EFI_SHELL_DELETE_FILE)FileHandleDelete, //* - EfiShellDeleteFileByName, - (EFI_SHELL_GET_FILE_POSITION)FileHandleGetPosition, //* - (EFI_SHELL_SET_FILE_POSITION)FileHandleSetPosition, //* - (EFI_SHELL_FLUSH_FILE)FileHandleFlush, //* - EfiShellFindFiles, - EfiShellFindFilesInDir, - (EFI_SHELL_GET_FILE_SIZE)FileHandleGetSize, //* - EfiShellOpenRoot, - EfiShellOpenRootByHandle, - NULL, - SHELL_MAJOR_VERSION, - SHELL_MINOR_VERSION, - - // New for UEFI Shell 2.1 - EfiShellRegisterGuidName, - EfiShellGetGuidName, - EfiShellGetGuidFromName, - EfiShellGetEnvEx -}; - -/** - Function to create and install on the current handle. - - Will overwrite any existing ShellProtocols in the system to be sure that - the current shell is in control. - - This must be removed via calling CleanUpShellProtocol(). - - @param[in, out] NewShell The pointer to the pointer to the structure - to install. - - @retval EFI_SUCCESS The operation was successful. - @return An error from LocateHandle, CreateEvent, or other core function. -**/ -EFI_STATUS -CreatePopulateInstallShellProtocol ( - IN OUT EFI_SHELL_PROTOCOL **NewShell - ) -{ - EFI_STATUS Status; - UINTN BufferSize; - EFI_HANDLE *Buffer; - UINTN HandleCounter; - SHELL_PROTOCOL_HANDLE_LIST *OldProtocolNode; - EFI_SHELL_PROTOCOL *OldShell; - - if (NewShell == NULL) { - return (EFI_INVALID_PARAMETER); - } - - BufferSize = 0; - Buffer = NULL; - OldProtocolNode = NULL; - InitializeListHead(&ShellInfoObject.OldShellList.Link); - - // - // Initialize EfiShellProtocol object... - // - Status = gBS->CreateEvent(0, - 0, - NULL, - NULL, - &mShellProtocol.ExecutionBreak); - if (EFI_ERROR(Status)) { - return (Status); - } - - // - // Get the size of the buffer we need. - // - Status = gBS->LocateHandle(ByProtocol, - &gEfiShellProtocolGuid, - NULL, - &BufferSize, - Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - // - // Allocate and recall with buffer of correct size - // - Buffer = AllocateZeroPool(BufferSize); - if (Buffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle(ByProtocol, - &gEfiShellProtocolGuid, - NULL, - &BufferSize, - Buffer); - if (EFI_ERROR(Status)) { - FreePool(Buffer); - return (Status); - } - // - // now overwrite each of them, but save the info to restore when we end. - // - for (HandleCounter = 0 ; HandleCounter < (BufferSize/sizeof(EFI_HANDLE)) ; HandleCounter++) { - Status = gBS->OpenProtocol(Buffer[HandleCounter], - &gEfiShellProtocolGuid, - (VOID **) &OldShell, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR(Status)) { - OldProtocolNode = AllocateZeroPool(sizeof(SHELL_PROTOCOL_HANDLE_LIST)); - if (OldProtocolNode == NULL) { - if (!IsListEmpty (&ShellInfoObject.OldShellList.Link)) { - CleanUpShellProtocol (&mShellProtocol); - } - Status = EFI_OUT_OF_RESOURCES; - break; - } - // - // reinstall over the old one... - // - OldProtocolNode->Handle = Buffer[HandleCounter]; - OldProtocolNode->Interface = OldShell; - Status = gBS->ReinstallProtocolInterface( - OldProtocolNode->Handle, - &gEfiShellProtocolGuid, - OldProtocolNode->Interface, - (VOID*)(&mShellProtocol)); - if (!EFI_ERROR(Status)) { - // - // we reinstalled sucessfully. log this so we can reverse it later. - // - - // - // add to the list for subsequent... - // - InsertTailList(&ShellInfoObject.OldShellList.Link, &OldProtocolNode->Link); - } - } - } - FreePool(Buffer); - } else if (Status == EFI_NOT_FOUND) { - ASSERT(IsListEmpty(&ShellInfoObject.OldShellList.Link)); - // - // no one else published yet. just publish it ourselves. - // - Status = gBS->InstallProtocolInterface ( - &gImageHandle, - &gEfiShellProtocolGuid, - EFI_NATIVE_INTERFACE, - (VOID*)(&mShellProtocol)); - } - - if (PcdGetBool(PcdShellSupportOldProtocols)){ - ///@todo support ShellEnvironment2 - ///@todo do we need to support ShellEnvironment (not ShellEnvironment2) also? - } - - if (!EFI_ERROR(Status)) { - *NewShell = &mShellProtocol; - } - return (Status); -} - -/** - Opposite of CreatePopulateInstallShellProtocol. - - Free all memory and restore the system to the state it was in before calling - CreatePopulateInstallShellProtocol. - - @param[in, out] NewShell The pointer to the new shell protocol structure. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -CleanUpShellProtocol ( - IN OUT EFI_SHELL_PROTOCOL *NewShell - ) -{ - SHELL_PROTOCOL_HANDLE_LIST *Node2; - - // - // if we need to restore old protocols... - // - if (!IsListEmpty(&ShellInfoObject.OldShellList.Link)) { - for (Node2 = (SHELL_PROTOCOL_HANDLE_LIST *) GetFirstNode (&ShellInfoObject.OldShellList.Link) - ; !IsListEmpty (&ShellInfoObject.OldShellList.Link) - ; Node2 = (SHELL_PROTOCOL_HANDLE_LIST *) GetFirstNode (&ShellInfoObject.OldShellList.Link) - ) { - RemoveEntryList (&Node2->Link); - gBS->ReinstallProtocolInterface (Node2->Handle, &gEfiShellProtocolGuid, NewShell, Node2->Interface); - FreePool (Node2); - } - } else { - // - // no need to restore - // - gBS->UninstallProtocolInterface (gImageHandle, &gEfiShellProtocolGuid, NewShell); - } - return EFI_SUCCESS; -} - -/** - Cleanup the shell environment. - - @param[in, out] NewShell The pointer to the new shell protocol structure. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -CleanUpShellEnvironment ( - IN OUT EFI_SHELL_PROTOCOL *NewShell - ) -{ - EFI_STATUS Status; - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx; - - CleanUpShellProtocol (NewShell); - - Status = gBS->CloseEvent(NewShell->ExecutionBreak); - NewShell->ExecutionBreak = NULL; - - Status = gBS->OpenProtocol( - gST->ConsoleInHandle, - &gEfiSimpleTextInputExProtocolGuid, - (VOID**)&SimpleEx, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - - if (!EFI_ERROR (Status)) { - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle1); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle2); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle3); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle4); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle1); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle2); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle3); - Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle4); - } - return (Status); -} - -/** - Notification function for keystrokes. - - @param[in] KeyData The key that was pressed. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -NotificationFunction( - IN EFI_KEY_DATA *KeyData - ) -{ - if ( ((KeyData->Key.UnicodeChar == L'c') && - (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))) || - (KeyData->Key.UnicodeChar == 3) - ){ - if (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak == NULL) { - return (EFI_UNSUPPORTED); - } - return (gBS->SignalEvent(ShellInfoObject.NewEfiShellProtocol->ExecutionBreak)); - } else if ((KeyData->Key.UnicodeChar == L's') && - (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED)) - ){ - ShellInfoObject.HaltOutput = TRUE; - } - return (EFI_SUCCESS); -} - -/** - Function to start monitoring for CTRL-C using SimpleTextInputEx. This - feature's enabled state was not known when the shell initially launched. - - @retval EFI_SUCCESS The feature is enabled. - @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available. -**/ -EFI_STATUS -InernalEfiShellStartMonitor( - VOID - ) -{ - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx; - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - - Status = gBS->OpenProtocol( - gST->ConsoleInHandle, - &gEfiSimpleTextInputExProtocolGuid, - (VOID**)&SimpleEx, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SHELL_NO_IN_EX), - ShellInfoObject.HiiHandle); - return (EFI_SUCCESS); - } - - if (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak == NULL) { - return (EFI_UNSUPPORTED); - } - - KeyData.KeyState.KeyToggleState = 0; - KeyData.Key.ScanCode = 0; - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED; - KeyData.Key.UnicodeChar = L'c'; - - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlCNotifyHandle1); - - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED; - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlCNotifyHandle2); - } - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED; - KeyData.Key.UnicodeChar = 3; - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlCNotifyHandle3); - } - KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED; - if (!EFI_ERROR(Status)) { - Status = SimpleEx->RegisterKeyNotify( - SimpleEx, - &KeyData, - NotificationFunction, - &ShellInfoObject.CtrlCNotifyHandle4); - } - return (Status); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.h b/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.h deleted file mode 100644 index 745f0b4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/Shell/ShellProtocol.h +++ /dev/null @@ -1,944 +0,0 @@ -/** @file - Member functions of EFI_SHELL_PROTOCOL and functions for creation, - manipulation, and initialization of EFI_SHELL_PROTOCOL. - - (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SHELL_PROTOCOL_HEADER_ -#define _SHELL_PROTOCOL_HEADER_ - -#include "Shell.h" - -typedef struct { - LIST_ENTRY Link; - EFI_SHELL_PROTOCOL *Interface; - EFI_HANDLE Handle; -} SHELL_PROTOCOL_HANDLE_LIST; - -// flags values... -#define SHELL_MAP_FLAGS_CONSIST BIT1 - -/** - Function to create and install on the current handle. - - Will overwrite any existing ShellProtocols in the system to be sure that - the current shell is in control. - - This must be removed via calling CleanUpShellProtocol(). - - @param[in, out] NewShell The pointer to the pointer to the structure - to install. - - @retval EFI_SUCCESS The operation was successful. - @return An error from LocateHandle, CreateEvent, or other core function. -**/ -EFI_STATUS -CreatePopulateInstallShellProtocol ( - IN OUT EFI_SHELL_PROTOCOL **NewShell - ); - -/** - Opposite of CreatePopulateInstallShellProtocol. - - Free all memory and restore the system to the state it was in before calling - CreatePopulateInstallShellProtocol. - - @param[in, out] NewShell The pointer to the new shell protocol structure. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -CleanUpShellProtocol ( - IN OUT EFI_SHELL_PROTOCOL *NewShell - ); - -/** - Cleanup the shell environment. - - @param[in, out] NewShell The pointer to the new shell protocol structure. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -CleanUpShellEnvironment ( - IN OUT EFI_SHELL_PROTOCOL *NewShell - ); - -/** - This function creates a mapping for a device path. - - @param DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping, - then the mapping will be deleted. - @param Mapping Points to the NULL-terminated mapping for the device path. Must end with a ':' - - @retval EFI_SUCCESS Mapping created or deleted successfully. - @retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the - boot service function LocateDevicePath(). - @retval EFI_ACCESS_DENIED The mapping is a built-in alias. - @retval EFI_INVALID_PARAMETER Mapping was NULL - @retval EFI_INVALID_PARAMETER Mapping did not end with a ':' - @retval EFI_INVALID_PARAMETER DevicePath was not pointing at a device that had a SIMPLE_FILE_SYSTEM_PROTOCOL installed. - @retval EFI_NOT_FOUND There was no mapping found to delete - @retval EFI_OUT_OF_RESOURCES Memory allocation failed -**/ -EFI_STATUS -EFIAPI -EfiShellSetMap( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, - IN CONST CHAR16 *Mapping - ); - -/** - Gets the device path from the mapping. - - This function gets the device path associated with a mapping. - - @param Mapping A pointer to the mapping - - @retval !=NULL Pointer to the device path that corresponds to the - device mapping. The returned pointer does not need - to be freed. - @retval NULL There is no device path associated with the - specified mapping. -**/ -CONST EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -EfiShellGetDevicePathFromMap( - IN CONST CHAR16 *Mapping - ); - -/** - Gets the mapping that most closely matches the device path. - - This function gets the mapping which corresponds to the device path *DevicePath. If - there is no exact match, then the mapping which most closely matches *DevicePath - is returned, and *DevicePath is updated to point to the remaining portion of the - device path. If there is an exact match, the mapping is returned and *DevicePath - points to the end-of-device-path node. - - @param DevicePath On entry, points to a device path pointer. On - exit, updates the pointer to point to the - portion of the device path after the mapping. - - @retval NULL No mapping was found. - @return !=NULL Pointer to NULL-terminated mapping. The buffer - is callee allocated and should be freed by the caller. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetMapFromDevicePath( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath - ); - -/** - Converts a device path to a file system-style path. - - This function converts a device path to a file system path by replacing part, or all, of - the device path with the file-system mapping. If there are more than one application - file system mappings, the one that most closely matches Path will be used. - - @param Path The pointer to the device path - - @retval NULL the device path could not be found. - @return all The pointer of the NULL-terminated file path. The path - is callee-allocated and should be freed by the caller. -**/ -CHAR16 * -EFIAPI -EfiShellGetFilePathFromDevicePath( - IN CONST EFI_DEVICE_PATH_PROTOCOL *Path - ); - -/** - Converts a file system style name to a device path. - - This function converts a file system style name to a device path, by replacing any - mapping references to the associated device path. - - @param Path the pointer to the path - - @return all The pointer of the file path. The file path is callee - allocated and should be freed by the caller. -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -EfiShellGetDevicePathFromFilePath( - IN CONST CHAR16 *Path - ); - -/** - Gets the name of the device specified by the device handle. - - This function gets the user-readable name of the device specified by the device - handle. If no user-readable name could be generated, then *BestDeviceName will be - NULL and EFI_NOT_FOUND will be returned. - - If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the - device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on - DeviceHandle. - - If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the - device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle. - If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and - EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then - EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority. - - @param DeviceHandle The handle of the device. - @param Flags Determines the possible sources of component names. - Valid bits are: - EFI_DEVICE_NAME_USE_COMPONENT_NAME - EFI_DEVICE_NAME_USE_DEVICE_PATH - @param Language A pointer to the language specified for the device - name, in the same format as described in the UEFI - specification, Appendix M - @param BestDeviceName On return, points to the callee-allocated NULL- - terminated name of the device. If no device name - could be found, points to NULL. The name must be - freed by the caller... - - @retval EFI_SUCCESS Get the name successfully. - @retval EFI_NOT_FOUND Fail to get the device name. - @retval EFI_INVALID_PARAMETER Flags did not have a valid bit set. - @retval EFI_INVALID_PARAMETER BestDeviceName was NULL - @retval EFI_INVALID_PARAMETER DeviceHandle was NULL -**/ -EFI_STATUS -EFIAPI -EfiShellGetDeviceName( - IN EFI_HANDLE DeviceHandle, - IN EFI_SHELL_DEVICE_NAME_FLAGS Flags, - IN CHAR8 *Language, - OUT CHAR16 **BestDeviceName - ); - -/** - Opens the root directory of a device on a handle - - This function opens the root directory of a device and returns a file handle to it. - - @param DeviceHandle The handle of the device that contains the volume. - @param FileHandle On exit, points to the file handle corresponding to the root directory on the - device. - - @retval EFI_SUCCESS Root opened successfully. - @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory - could not be opened. - @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted. - @retval EFI_DEVICE_ERROR The device had an error -**/ -EFI_STATUS -EFIAPI -EfiShellOpenRootByHandle( - IN EFI_HANDLE DeviceHandle, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -/** - Opens the root directory of a device. - - This function opens the root directory of a device and returns a file handle to it. - - @param DevicePath Points to the device path corresponding to the device where the - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed. - @param FileHandle On exit, points to the file handle corresponding to the root directory on the - device. - - @retval EFI_SUCCESS Root opened successfully. - @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory - could not be opened. - @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted. - @retval EFI_DEVICE_ERROR The device had an error -**/ -EFI_STATUS -EFIAPI -EfiShellOpenRoot( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -/** - Returns whether any script files are currently being processed. - - @retval TRUE There is at least one script file active. - @retval FALSE No script files are active now. - -**/ -BOOLEAN -EFIAPI -EfiShellBatchIsActive ( - VOID - ); - -/** - Worker function to open a file based on a device path. this will open the root - of the volume and then traverse down to the file itself. - - @param DevicePath2 Device Path of the file - @param FileHandle Pointer to the file upon a successful return - @param OpenMode mode to open file in. - @param Attributes the File Attributes to use when creating a new file - - @retval EFI_SUCCESS the file is open and FileHandle is valid - @retval EFI_UNSUPPORTED the device path cotained non-path elements - @retval other an error ocurred. -**/ -EFI_STATUS -InternalOpenFileDevicePath( - IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath2, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode, - IN UINT64 Attributes OPTIONAL - ); - -/** - Creates a file or directory by name. - - This function creates an empty new file or directory with the specified attributes and - returns the new file's handle. If the file already exists and is read-only, then - EFI_INVALID_PARAMETER will be returned. - - If the file already existed, it is truncated and its attributes updated. If the file is - created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL. - - If the file name begins with >v, then the file handle which is returned refers to the - shell environment variable with the specified name. If the shell environment variable - already exists and is non-volatile then EFI_INVALID_PARAMETER is returned. - - @param FileName Pointer to NULL-terminated file path - @param FileAttribs The new file's attrbiutes. the different attributes are - described in EFI_FILE_PROTOCOL.Open(). - @param FileHandle On return, points to the created file handle or directory's handle - - @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED could not open the file path - @retval EFI_NOT_FOUND the specified file could not be found on the devide, or could not - file the file system on the device. - @retval EFI_NO_MEDIA the device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no - longer supported. - @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according - the DirName. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write - when the media is write-protected. - @retval EFI_ACCESS_DENIED The service denied access to the file. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -EfiShellCreateFile( - IN CONST CHAR16 *FileName, - IN UINT64 FileAttribs, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -/** - Opens a file or a directory by file name. - - This function opens the specified file in the specified OpenMode and returns a file - handle. - If the file name begins with >v, then the file handle which is returned refers to the - shell environment variable with the specified name. If the shell environment variable - exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then - EFI_INVALID_PARAMETER is returned. - - If the file name is >i, then the file handle which is returned refers to the standard - input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER - is returned. - - If the file name is >o, then the file handle which is returned refers to the standard - output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER - is returned. - - If the file name is >e, then the file handle which is returned refers to the standard - error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER - is returned. - - If the file name is NUL, then the file handle that is returned refers to the standard NUL - file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is - returned. - - If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the - FileHandle is NULL. - - @param FileName Points to the NULL-terminated UCS-2 encoded file name. - @param FileHandle On return, points to the file handle. - @param OpenMode File open mode. Either EFI_FILE_MODE_READ or - EFI_FILE_MODE_WRITE from section 12.4 of the UEFI - Specification. - @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL. - @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL. - @retval EFI_NOT_FOUND The specified file could not be found on the device or the file - system could not be found on the device. FileHandle is NULL. - @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no - longer supported. FileHandle is NULL. - @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according - the FileName. FileHandle is NULL. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL. - @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write - when the media is write-protected. FileHandle is NULL. - @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle - is NULL. - @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL. -**/ -EFI_STATUS -EFIAPI -EfiShellOpenFileByName( - IN CONST CHAR16 *FileName, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode - ); - -/** - Deletes the file specified by the file name. - - This function deletes a file. - - @param FileName Points to the NULL-terminated file name. - - @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed. - @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted. - @sa EfiShellCreateFile - @sa FileHandleDelete -**/ -EFI_STATUS -EFIAPI -EfiShellDeleteFileByName( - IN CONST CHAR16 *FileName - ); - -/** - Disables the page break output mode. -**/ -VOID -EFIAPI -EfiShellDisablePageBreak ( - VOID - ); - -/** - Enables the page break output mode. -**/ -VOID -EFIAPI -EfiShellEnablePageBreak ( - VOID - ); - -/** - internal worker function to run a command via Device Path - - @param ParentImageHandle A handle of the image that is executing the specified - command line. - @param DevicePath device path of the file to execute - @param CommandLine Points to the NULL-terminated UCS-2 encoded string - containing the command line. If NULL then the command- - line will be empty. - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. If this - is NULL, then the current shell environment is used. - @param[out] StartImageStatus Returned status from gBS->StartImage. - - @retval EFI_SUCCESS The command executed successfully. The status code - returned by the command is pointed to by StatusCode. - @retval EFI_INVALID_PARAMETER The parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED Nested shell invocations are not allowed. -**/ -EFI_STATUS -InternalShellExecuteDevicePath( - IN CONST EFI_HANDLE *ParentImageHandle, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST CHAR16 *CommandLine OPTIONAL, - IN CONST CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StartImageStatus OPTIONAL - ); - -/** - Execute the command line. - - This function creates a nested instance of the shell and executes the specified - command (CommandLine) with the specified environment (Environment). Upon return, - the status code returned by the specified command is placed in StatusCode. - - If Environment is NULL, then the current environment is used and all changes made - by the commands executed will be reflected in the current environment. If the - Environment is non-NULL, then the changes made will be discarded. - - The CommandLine is executed from the current working directory on the current - device. - - @param ParentImageHandle A handle of the image that is executing the specified - command line. - @param CommandLine Points to the NULL-terminated UCS-2 encoded string - containing the command line. If NULL then the command- - line will be empty. - @param Environment Points to a NULL-terminated array of environment - variables with the format 'x=y', where x is the - environment variable name and y is the value. If this - is NULL, then the current shell environment is used. - @param StatusCode Points to the status code returned by the command. - - @retval EFI_SUCCESS The command executed successfully. The status code - returned by the command is pointed to by StatusCode. - @retval EFI_INVALID_PARAMETER The parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED Nested shell invocations are not allowed. -**/ -EFI_STATUS -EFIAPI -EfiShellExecute( - IN EFI_HANDLE *ParentImageHandle, - IN CHAR16 *CommandLine OPTIONAL, - IN CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StatusCode OPTIONAL - ); - -/** - Utility cleanup function for EFI_SHELL_FILE_INFO objects. - - 1) frees all pointers (non-NULL) - 2) Closes the SHELL_FILE_HANDLE - - @param FileListNode pointer to the list node to free -**/ -VOID -FreeShellFileInfoNode( - IN EFI_SHELL_FILE_INFO *FileListNode - ); - -/** - Frees the file list. - - This function cleans up the file list and any related data structures. It has no - impact on the files themselves. - - @param FileList The file list to free. Type EFI_SHELL_FILE_INFO is - defined in OpenFileList() - - @retval EFI_SUCCESS Free the file list successfully. - @retval EFI_INVALID_PARAMETER FileList was NULL or *FileList was NULL; -**/ -EFI_STATUS -EFIAPI -EfiShellFreeFileList( - IN EFI_SHELL_FILE_INFO **FileList - ); - -/** - Deletes the duplicate file names files in the given file list. - - This function deletes the reduplicate files in the given file list. - - @param FileList A pointer to the first entry in the file list. - - @retval EFI_SUCCESS Always success. - @retval EFI_INVALID_PARAMETER FileList was NULL or *FileList was NULL; -**/ -EFI_STATUS -EFIAPI -EfiShellRemoveDupInFileList( - IN EFI_SHELL_FILE_INFO **FileList - ); - -/** - Allocates and populates a EFI_SHELL_FILE_INFO structure. if any memory operation - failed it will return NULL. - - @param[in] BasePath the Path to prepend onto filename for FullPath - @param[in] Status Status member initial value. - @param[in] FileName FileName member initial value. - @param[in] Handle Handle member initial value. - @param[in] Info Info struct to copy. - -**/ -EFI_SHELL_FILE_INFO * -CreateAndPopulateShellFileInfo( - IN CONST CHAR16 *BasePath, - IN CONST EFI_STATUS Status, - IN CONST CHAR16 *FileName, - IN CONST SHELL_FILE_HANDLE Handle, - IN CONST EFI_FILE_INFO *Info - ); - -/** - Find all files in a specified directory. - - @param FileDirHandle Handle of the directory to search. - @param FileList On return, points to the list of files in the directory - or NULL if there are no files in the directory. - - @retval EFI_SUCCESS File information was returned successfully. - @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_NO_MEDIA The device media is not present. - @retval EFI_INVALID_PARAMETER The FileDirHandle was not a directory. -**/ -EFI_STATUS -EFIAPI -EfiShellFindFilesInDir( - IN SHELL_FILE_HANDLE FileDirHandle, - OUT EFI_SHELL_FILE_INFO **FileList - ); - -/** - Find files that match a specified pattern. - - This function searches for all files and directories that match the specified - FilePattern. The FilePattern can contain wild-card characters. The resulting file - information is placed in the file list FileList. - - Wildcards are processed - according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. - - The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo - field is set to NULL. - - if *FileList is not NULL then it must be a pre-existing and properly initialized list. - - @param FilePattern Points to a NULL-terminated shell file path, including wildcards. - @param FileList On return, points to the start of a file list containing the names - of all matching files or else points to NULL if no matching files - were found. only on a EFI_SUCCESS return will; this be non-NULL. - - @retval EFI_SUCCESS Files found. FileList is a valid list. - @retval EFI_NOT_FOUND No files found. - @retval EFI_NO_MEDIA The device has no media - @retval EFI_DEVICE_ERROR The device reported an error - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted -**/ -EFI_STATUS -EFIAPI -EfiShellFindFiles( - IN CONST CHAR16 *FilePattern, - OUT EFI_SHELL_FILE_INFO **FileList - ); - -/** - Opens the files that match the path specified. - - This function opens all of the files specified by Path. Wildcards are processed - according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each - matching file has an EFI_SHELL_FILE_INFO structure created in a linked list. - - @param Path A pointer to the path string. - @param OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or - EFI_FILE_MODE_WRITE. - @param FileList Points to the start of a list of files opened. - - @retval EFI_SUCCESS Create the file list successfully. - @return Others Can't create the file list. -**/ -EFI_STATUS -EFIAPI -EfiShellOpenFileList( - IN CHAR16 *Path, - IN UINT64 OpenMode, - IN OUT EFI_SHELL_FILE_INFO **FileList - ); - -/** - Gets the environment variable. - - This function returns the current value of the specified environment variable. - - @param Name A pointer to the environment variable name - - @retval !=NULL The environment variable's value. The returned - pointer does not need to be freed by the caller. - @retval NULL The environment variable doesn't exist. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetEnv( - IN CONST CHAR16 *Name - ); - -/** - Sets the environment variable. - - This function changes the current value of the specified environment variable. If the - environment variable exists and the Value is an empty string, then the environment - variable is deleted. If the environment variable exists and the Value is not an empty - string, then the value of the environment variable is changed. If the environment - variable does not exist and the Value is an empty string, there is no action. If the - environment variable does not exist and the Value is a non-empty string, then the - environment variable is created and assigned the specified value. - - For a description of volatile and non-volatile environment variables, see UEFI Shell - 2.0 specification section 3.6.1. - - @param Name Points to the NULL-terminated environment variable name. - @param Value Points to the NULL-terminated environment variable value. If the value is an - empty string then the environment variable is deleted. - @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE). - - @retval EFI_SUCCESS The environment variable was successfully updated. -**/ -EFI_STATUS -EFIAPI -EfiShellSetEnv( - IN CONST CHAR16 *Name, - IN CONST CHAR16 *Value, - IN BOOLEAN Volatile - ); - -/** - Returns the current directory on the specified device. - - If FileSystemMapping is NULL, it returns the current working directory. If the - FileSystemMapping is not NULL, it returns the current directory associated with the - FileSystemMapping. In both cases, the returned name includes the file system - mapping (i.e. fs0:\current-dir). - - @param FileSystemMapping A pointer to the file system mapping. If NULL, - then the current working directory is returned. - - @retval !=NULL The current directory. - @retval NULL Current directory does not exist. -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetCurDir( - IN CONST CHAR16 *FileSystemMapping OPTIONAL - ); - -/** - Changes the current directory on the specified device. - - If the FileSystem is NULL, and the directory Dir does not contain a file system's - mapped name, this function changes the current working directory. If FileSystem is - NULL and the directory Dir contains a mapped name, then the current file system and - the current directory on that file system are changed. - - If FileSystem is not NULL, and Dir is NULL, then this changes the current working file - system. - - If FileSystem is not NULL and Dir is not NULL, then this function changes the current - directory on the specified file system. - - If the current working directory or the current working file system is changed then the - %cwd% environment variable will be updated - - @param FileSystem A pointer to the file system's mapped name. If NULL, then the current working - directory is changed. - @param Dir Points to the NULL-terminated directory on the device specified by FileSystem. - - @retval EFI_SUCCESS The operation was sucessful -**/ -EFI_STATUS -EFIAPI -EfiShellSetCurDir( - IN CONST CHAR16 *FileSystem OPTIONAL, - IN CONST CHAR16 *Dir - ); - -/** - Return help information about a specific command. - - This function returns the help information for the specified command. The help text - can be internal to the shell or can be from a UEFI Shell manual page. - - If Sections is specified, then each section name listed will be compared in a casesensitive - manner, to the section names described in Appendix B. If the section exists, - it will be appended to the returned help text. If the section does not exist, no - information will be returned. If Sections is NULL, then all help text information - available will be returned. - - @param Command Points to the NULL-terminated UEFI Shell command name. - @param Sections Points to the NULL-terminated comma-delimited - section names to return. If NULL, then all - sections will be returned. - @param HelpText On return, points to a callee-allocated buffer - containing all specified help text. - - @retval EFI_SUCCESS The help text was returned. - @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the - returned help text. - @retval EFI_INVALID_PARAMETER HelpText is NULL - @retval EFI_NOT_FOUND There is no help text available for Command. -**/ -EFI_STATUS -EFIAPI -EfiShellGetHelpText( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Sections OPTIONAL, - OUT CHAR16 **HelpText - ); - -/** - Gets the enable status of the page break output mode. - - User can use this function to determine current page break mode. - - @retval TRUE The page break output mode is enabled - @retval FALSE The page break output mode is disabled -**/ -BOOLEAN -EFIAPI -EfiShellGetPageBreak( - VOID - ); - -/** - Judges whether the active shell is the root shell. - - This function makes the user to know that whether the active Shell is the root shell. - - @retval TRUE The active Shell is the root Shell. - @retval FALSE The active Shell is NOT the root Shell. -**/ -BOOLEAN -EFIAPI -EfiShellIsRootShell( - VOID - ); - -/** - This function returns the command associated with a alias or a list of all - alias'. - - @param[in] Command Points to the NULL-terminated shell alias. - If this parameter is NULL, then all - aliases will be returned in ReturnedData. - @param[out] Volatile upon return of a single command if TRUE indicates - this is stored in a volatile fashion. FALSE otherwise. - @return If Alias is not NULL, it will return a pointer to - the NULL-terminated command for that alias. - If Alias is NULL, ReturnedData points to a ';' - delimited list of alias (e.g. - ReturnedData = "dir;del;copy;mfp") that is NULL-terminated. - @retval NULL an error ocurred - @retval NULL Alias was not a valid Alias -**/ -CONST CHAR16 * -EFIAPI -EfiShellGetAlias( - IN CONST CHAR16 *Command, - OUT BOOLEAN *Volatile OPTIONAL - ); - -/** - Changes a shell command alias. - - This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. - - this function does not check for built in alias'. - - @param[in] Command Points to the NULL-terminated shell command or existing alias. - @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and - Command refers to an alias, that alias will be deleted. - @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the - Alias being set will be stored in a non-volatile fashion. - - @retval EFI_SUCCESS Alias created or deleted successfully. - @retval EFI_NOT_FOUND the Alias intended to be deleted was not found -**/ -EFI_STATUS -InternalSetAlias( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias OPTIONAL, - IN BOOLEAN Volatile - ); - -/** - Changes a shell command alias. - - This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. - - - @param[in] Command Points to the NULL-terminated shell command or existing alias. - @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and - Command refers to an alias, that alias will be deleted. - @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If - FALSE and the alias already exists, then the existing alias is unchanged and - EFI_ACCESS_DENIED is returned. - @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the - Alias being set will be stored in a non-volatile fashion. - - @retval EFI_SUCCESS Alias created or deleted successfully. - @retval EFI_NOT_FOUND the Alias intended to be deleted was not found - @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to - FALSE. -**/ -EFI_STATUS -EFIAPI -EfiShellSetAlias( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias OPTIONAL, - IN BOOLEAN Replace, - IN BOOLEAN Volatile - ); - -/** - Utility cleanup function for EFI_SHELL_FILE_INFO objects. - - 1) frees all pointers (non-NULL) - 2) Closes the SHELL_FILE_HANDLE - - @param FileListNode pointer to the list node to free -**/ -VOID -InternalFreeShellFileInfoNode( - IN EFI_SHELL_FILE_INFO *FileListNode - ); - -/** - Internal variable setting function. Allows for setting of the read only variables. - - @param Name Points to the NULL-terminated environment variable name. - @param Value Points to the NULL-terminated environment variable value. If the value is an - empty string then the environment variable is deleted. - @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE). - - @retval EFI_SUCCESS The environment variable was successfully updated. -**/ -EFI_STATUS -InternalEfiShellSetEnv( - IN CONST CHAR16 *Name, - IN CONST CHAR16 *Value, - IN BOOLEAN Volatile - ); - -/** - Function to start monitoring for CTRL-C using SimpleTextInputEx. This - feature's enabled state was not known when the shell initially launched. - - @retval EFI_SUCCESS The feature is enabled. - @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available. -**/ -EFI_STATUS -InernalEfiShellStartMonitor( - VOID - ); - -/** - Notification function for keystrokes. - - @param[in] KeyData The key that was pressed. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -NotificationFunction( - IN EFI_KEY_DATA *KeyData - ); -#endif //_SHELL_PROTOCOL_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/README.txt b/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/README.txt deleted file mode 100644 index 75aa175..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -TestArgv.nsh is a very simple shell script to test how the interpreter parses -the parameters. It uses ShellCTestApp.efi to dump the parameters passed from the -intepreter. - -TestArgv.log is the desired output created using "TestArgv.nsh > TestArgv.log". diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c b/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c deleted file mode 100644 index f2fe8fb..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - This is a test application that demonstrates how to use the C-style entry point - for a shell application. - - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -/** - UEFI application entry point which has an interface similar to a - standard C main function. - - The ShellCEntryLib library instance wrappers the actual UEFI application - entry point and calls this ShellAppMain function. - - @param[in] Argc The number of items in Argv. - @param[in] Argv Array of pointers to strings. - - @retval 0 The application exited normally. - @retval Other An error occurred. - -**/ -INTN -EFIAPI -ShellAppMain ( - IN UINTN Argc, - IN CHAR16 **Argv - ) -{ - UINTN Index; - if (Argc == 1) { - Print (L"Argv[1] = NULL\n"); - } - for (Index = 1; Index < Argc; Index++) { - Print(L"Argv[%d]: \"%s\"\n", Index, Argv[Index]); - } - - return 0; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf b/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf deleted file mode 100644 index 474584d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# This is the shell application -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = ShellCTestApp - FILE_GUID = 7a6ca3b8-ee1b-489c-b300-24544a7bd418 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = ShellCEntryLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - ShellCTestApp.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - ShellCEntryLib - UefiLib diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log b/Voyager/Voyager/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log deleted file mode 100644 index e76781ea0e4387cf97ad42d5ccbb8a72f99c8d61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3320 zcmcha-EPxB5QWcmCEmeumCH&=6Q>ChNOt0IgFvXzn?fx_-5;r<5dp;01K+G=wZUFT z4t8bPp6txdIXgS!+5Gvv(y4}eu8(@DK)Jr?M)ycZJiqFh4zz8t!R9;qGkw-KWlGU6 zxW|e#<(=u6YsOfniB5PQBgI;RVq;?^SS}e^XwK6tSG z6wbzGjsFynkz~r3x3bglzc99*ns>FZui6^ z$5YB|TUqKjByMDk?-*&K5xNLzj@B?UxXl@z5|O#n4|!TFACSWa^b?g9C`41Yx6R&)JgoC}xQDkv=M_BguC@=X z_VFub)Wt8{BYpw9>Dyh?wdWUj{k8Yy=e7?s%VdA_OxK=ax7AVIi9j!?v^V;o*Iex? zci_HvU3V0JeYCINP<_-?Kz|&lkDlgVdws7rCUrUWuxkIe(mHWBeXox7|KwFjS1x)? zS%r09qknC-&tLv^TVGjo`)hx_$9HL)bB_OC+-1c#^Us}awf4$0 -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#**/ -echo -on -set Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA ValueOfGuid -set Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580 ^# -set Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC ^" -set Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE -alias ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE ShellCTestApp - -# -# '^' should escape all special characters (including space) -# but has no impact to non-special characters -# -ShellCTestApp ^^ -ShellCTestApp ^# -ShellCTestApp ^%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% -ShellCTestApp ^" -ShellCTestApp ^ 1 -ShellCTestApp ^ -ShellCTestApp ^1 -ShellCTestApp ^^^" -ShellCTestApp ^^^ - -# -# '#' should be processed before %% replacement, and inside '"' -# -ShellCTestApp #%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% -#ShellCTestApp "#" -ShellCTestApp %Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580% - -# -# '%' should be processed before grouping parameters -# -ShellCTestApp "%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% 2%Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC% - -# -# alias should be processed after %% replacement -# -%Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE% - -# -# '"' should be stripped, space inside '"' should be kept, -# -ShellCTestApp "p 1" -ShellCTestApp "p"1 -ShellCTestApp "p 1"e"x""" - -set -d Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA -set -d Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580 -set -d Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC -set -d Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE -alias -d ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE -echo -off \ No newline at end of file diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.c b/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.c deleted file mode 100644 index 5ab6a0c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - This is a simple shell application - - Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/** - as the real entry point for the application. - - @param[in] ImageHandle The firmware allocated handle for the EFI image. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The entry point is executed successfully. - @retval other Some error occurs when executing this entry point. - -**/ -EFI_STATUS -EFIAPI -UefiMain ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - Print(L"ShellExecute - Pass"); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.inf b/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.inf deleted file mode 100644 index 8e4a642..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellExecTestApp/SA.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# Sample UEFI Application Reference EDKII Module -# -# This is a simple shell application -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = EmptyApplication - FILE_GUID = 8F7D7B1D-0E1C-4c98-B12E-4EC99C4081AC - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = UefiMain - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - SA.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - UefiApplicationEntryPoint - UefiLib - diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c b/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c deleted file mode 100644 index cea2f1c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c +++ /dev/null @@ -1,83 +0,0 @@ -/** @file - This is a test application that demonstrates how to use the sorting functions. - - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include -#include - -/** - Test comparator. - - @param[in] b1 The first INTN - @param[in] b2 The other INTN - - @retval 0 They are the same. - @retval -1 b1 is less than b2 - @retval 1 b1 is greater then b2 -**/ -INTN -EFIAPI -Test(CONST VOID *b1, CONST VOID *b2) -{ - if (*(INTN*)b1 == *(INTN*)b2) { - return (0); - } - if (*(INTN*)b1 < *(INTN*)b2) { - return(-1); - } - return (1); -} - -/** - UEFI application entry point which has an interface similar to a - standard C main function. - - The ShellCEntryLib library instance wrappers the actual UEFI application - entry point and calls this ShellAppMain function. - - @param Argc Argument count - @param Argv The parsed arguments - - @retval 0 The application exited normally. - @retval Other An error occurred. - -**/ -INTN -EFIAPI -ShellAppMain ( - IN UINTN Argc, - IN CHAR16 **Argv - ) -{ - INTN Array[10]; - - Array[0] = 2; - Array[1] = 3; - Array[2] = 4; - Array[3] = 1; - Array[4] = 5; - Array[5] = 6; - Array[6] = 7; - Array[7] = 8; - Array[8] = 1; - Array[9] = 5; - - Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]); - PerformQuickSort(Array, 10, sizeof(INTN), Test); - Print(L"POST-SORT\r\n"); - Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]); - return 0; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf b/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf deleted file mode 100644 index 77be188..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# This is the shell sorting testing application -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = ShellSortTestApp - FILE_GUID = 079E8E98-AE93-4b9a-8A71-1DC869F23E09 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = ShellCEntryLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - ShellSortTestApp.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - ShellCEntryLib - UefiLib - SortLib - diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c deleted file mode 100644 index 0e13e62..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ /dev/null @@ -1,972 +0,0 @@ -/** @file - Shell command for Displaying Performance Metrics. - - The Dp command reads performance data and presents it in several - different formats depending upon the needs of the user. Both - Trace and Measured Profiling information is processed and presented. - - Dp uses the "PerformanceLib" to read the measurement records. - The "TimerLib" provides information about the timer, such as frequency, - beginning, and ending counter values. - Measurement records contain identifying information (Handle, Token, Module) - and start and end time values. - Dp uses this information to group records in different ways. It also uses - timer information to calculate elapsed time for each measurement. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. - (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Dp.h" -#include "Literals.h" -#include "DpInternal.h" - -#pragma pack(1) - -typedef struct { - EFI_ACPI_DESCRIPTION_HEADER Header; - UINT32 Entry; -} RSDT_TABLE; - -typedef struct { - EFI_ACPI_DESCRIPTION_HEADER Header; - UINT64 Entry; -} XSDT_TABLE; - -#pragma pack() - -EFI_HANDLE mDpHiiHandle; - -typedef struct { - EFI_HANDLE Handle; - EFI_GUID ModuleGuid; -} HANDLE_GUID_MAP; - -HANDLE_GUID_MAP *mCacheHandleGuidTable; -UINTN mCachePairCount = 0; - -// -/// Module-Global Variables -///@{ -CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1]; -CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE]; -UINT64 mInterestThreshold; -BOOLEAN mShowId = FALSE; -UINT8 *mBootPerformanceTable; -UINTN mBootPerformanceTableSize; -BOOLEAN mPeiPhase = FALSE; -BOOLEAN mDxePhase = FALSE; - -PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO. -MEASUREMENT_RECORD *mMeasurementList = NULL; -UINTN mMeasurementNum = 0; - -/// Items for which to gather cumulative statistics. -PERF_CUM_DATA CumData[] = { - PERF_INIT_CUM_DATA (LOAD_IMAGE_TOK), - PERF_INIT_CUM_DATA (START_IMAGE_TOK), - PERF_INIT_CUM_DATA (DRIVERBINDING_START_TOK), - PERF_INIT_CUM_DATA (DRIVERBINDING_SUPPORT_TOK), - PERF_INIT_CUM_DATA (DRIVERBINDING_STOP_TOK) -}; - -/// Number of items for which we are gathering cumulative statistics. -UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA); - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-v", TypeFlag}, // -v Verbose Mode - {L"-A", TypeFlag}, // -A All, Cooked - {L"-R", TypeFlag}, // -R RAW All - {L"-s", TypeFlag}, // -s Summary - {L"-x", TypeFlag}, // -x eXclude Cumulative Items - {L"-i", TypeFlag}, // -i Display Identifier - {L"-c", TypeValue}, // -c Display cumulative data. - {L"-n", TypeValue}, // -n # Number of records to display for A and R - {L"-t", TypeValue}, // -t # Threshold of interest - {NULL, TypeMax} - }; - -///@} - -/** - Display the trailing Verbose information. -**/ -VOID -DumpStatistics( void ) -{ - EFI_STRING StringPtr; - EFI_STRING StringPtrUnknown; - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL); - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown : StringPtr); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), mDpHiiHandle, SummaryData.NumTrace); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), mDpHiiHandle, SummaryData.NumIncomplete); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), mDpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDpHiiHandle, SummaryData.NumPEIMs); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle, SummaryData.NumGlobal); - SHELL_FREE_NON_NULL (StringPtr); - SHELL_FREE_NON_NULL (StringPtrUnknown); -} - -/** - Get Boot performance table form Acpi table. - -**/ -EFI_STATUS -GetBootPerformanceTable ( - ) -{ - FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable; - - FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *) EfiLocateFirstAcpiTable ( - EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE - ); - if (FirmwarePerformanceTable == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); - return EFI_NOT_FOUND; - } - - mBootPerformanceTable = (UINT8*) (UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer; - mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *) mBootPerformanceTable)->Header.Length; - - return EFI_SUCCESS; -} - -/** - Get Handle form Module Guid. - - @param ModuleGuid Module Guid. - @param Handle The handle to be returned. - -**/ -VOID -GetHandleFormModuleGuid ( - IN EFI_GUID *ModuleGuid, - IN OUT EFI_HANDLE *Handle - ) -{ - UINTN Index; - - if (IsZeroGuid (ModuleGuid)) { - *Handle = NULL; - } - // - // Try to get the Handle form the caached array. - // - for (Index = 0; Index < mCachePairCount; Index++) { - if (CompareGuid (ModuleGuid, &mCacheHandleGuidTable[Index].ModuleGuid)) { - *Handle = mCacheHandleGuidTable[Index].Handle; - break; - } - } - if (Index >= mCachePairCount) { - *Handle = NULL; - } -} - -/** -Cache the GUID and handle mapping pairs. In order to save time for searching. - -**/ -EFI_STATUS -BuildCachedGuidHandleTable ( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - UINTN Index; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; - EFI_GUID *TempGuid; - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath; - - Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status); - return Status; - } - - mCacheHandleGuidTable = AllocateZeroPool (HandleCount * sizeof (HANDLE_GUID_MAP)); - if (mCacheHandleGuidTable == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (Index = 0; Index < HandleCount; Index++) { - // - // Try Handle as ImageHandle. - // - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiLoadedImageProtocolGuid, - (VOID**) &LoadedImage - ); - if (EFI_ERROR (Status)) { - // - // Try Handle as Controller Handle - // - Status = gBS->OpenProtocol ( - HandleBuffer[Index], - &gEfiDriverBindingProtocolGuid, - (VOID **) &DriverBinding, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - // - // Get Image protocol from ImageHandle - // - Status = gBS->HandleProtocol ( - DriverBinding->ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**) &LoadedImage - ); - } - } - - if (!EFI_ERROR (Status) && LoadedImage != NULL) { - // - // Get Module Guid from DevicePath. - // - if (LoadedImage->FilePath != NULL && - LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH && - LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP - ) { - FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LoadedImage->FilePath; - TempGuid = &FvFilePath->FvFileName; - - mCacheHandleGuidTable[mCachePairCount].Handle = HandleBuffer[Index]; - CopyGuid (&mCacheHandleGuidTable[mCachePairCount].ModuleGuid, TempGuid); - mCachePairCount ++; - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - HandleBuffer = NULL; - } - return EFI_SUCCESS; -} - -/** - Get Measurement form Fpdt records. - - @param RecordHeader Pointer to the start record. - @param IsStart Is start record or End record. - @param Measurement Pointer to the measurement which need to be filled. - -**/ -VOID -GetMeasurementInfo ( - IN EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader, - IN BOOLEAN IsStart, - IN OUT MEASUREMENT_RECORD *Measurement - ) -{ - VOID *ModuleGuid; - EFI_HANDLE StartHandle; - - switch (RecordHeader->Type) { - case FPDT_GUID_EVENT_TYPE: - ModuleGuid = &(((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Guid); - Measurement->Identifier = ((UINT32)((FPDT_GUID_EVENT_RECORD *)RecordHeader)->ProgressID); - if (IsStart) { - Measurement->StartTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp; - } else { - Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp; - } - switch (Measurement->Identifier) { - case MODULE_START_ID: - case MODULE_END_ID: - if (mPeiPhase) { - Measurement->Token = ALit_PEIM; - Measurement->Module = ALit_PEIM; - } else if (mDxePhase) { - Measurement->Token = ALit_START_IMAGE; - Measurement->Module = ALit_START_IMAGE; - } - break; - default: - ASSERT(FALSE); - } - - if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) { - Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid); - } else { - GetHandleFormModuleGuid(ModuleGuid, &StartHandle); - Measurement->Handle = StartHandle; - // - // When no perf entry to record the PEI and DXE phase, - // For start image, we need detect the PEIM and non PEIM here. - // - if (Measurement->Token == NULL) { - if (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) { - Measurement->Token = ALit_PEIM; - Measurement->Module = ALit_PEIM; - Measurement->Handle = ModuleGuid; - } else { - Measurement->Token = ALit_START_IMAGE; - Measurement->Module = ALit_START_IMAGE; - } - } - } - break; - - case FPDT_DYNAMIC_STRING_EVENT_TYPE: - ModuleGuid = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid); - Measurement->Identifier = ((UINT32)((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->ProgressID); - if (IsStart) { - Measurement->StartTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp; - } else { - Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp; - } - switch (Measurement->Identifier) { - case MODULE_START_ID: - case MODULE_END_ID: - if (mPeiPhase) { - Measurement->Token = ALit_PEIM; - } else if (mDxePhase) { - Measurement->Token = ALit_START_IMAGE; - } - break; - - case MODULE_LOADIMAGE_START_ID: - case MODULE_LOADIMAGE_END_ID: - Measurement->Token = ALit_LOAD_IMAGE; - break; - - case MODULE_DB_START_ID: - case MODULE_DB_END_ID: - Measurement->Token = ALit_DB_START; - break; - - case MODULE_DB_SUPPORT_START_ID: - case MODULE_DB_SUPPORT_END_ID: - Measurement->Token = ALit_DB_SUPPORT; - break; - - case MODULE_DB_STOP_START_ID: - case MODULE_DB_STOP_END_ID: - Measurement->Token = ALit_DB_STOP; - break; - - default: - Measurement->Token = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String; - break; - } - - Measurement->Module = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String; - - if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) { - Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid); - } else { - GetHandleFormModuleGuid(ModuleGuid, &StartHandle); - Measurement->Handle = StartHandle; - // - // When no perf entry to record the PEI and DXE phase, - // For start image, we need detect the PEIM and non PEIM here. - // - if (Measurement->Token == NULL && (Measurement->Identifier == MODULE_START_ID || Measurement->Identifier == MODULE_END_ID)) { - if (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) { - Measurement->Token = ALit_PEIM; - Measurement->Handle = ModuleGuid; - } else { - Measurement->Token = ALit_START_IMAGE; - } - } - } - break; - - case FPDT_GUID_QWORD_EVENT_TYPE: - ModuleGuid = &(((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Guid); - Measurement->Identifier = ((UINT32)((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->ProgressID); - if (IsStart) { - Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp; - } else { - Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp; - } - switch (Measurement->Identifier) { - case MODULE_DB_START_ID: - Measurement->Token = ALit_DB_START; - Measurement->Module = ALit_DB_START; - break; - - case MODULE_DB_SUPPORT_START_ID: - case MODULE_DB_SUPPORT_END_ID: - Measurement->Token = ALit_DB_SUPPORT; - Measurement->Module = ALit_DB_SUPPORT; - break; - - case MODULE_DB_STOP_START_ID: - case MODULE_DB_STOP_END_ID: - Measurement->Token = ALit_DB_STOP; - Measurement->Module = ALit_DB_STOP; - break; - - case MODULE_LOADIMAGE_START_ID: - case MODULE_LOADIMAGE_END_ID: - Measurement->Token = ALit_LOAD_IMAGE; - Measurement->Module = ALit_LOAD_IMAGE; - break; - - default: - ASSERT(FALSE); - } - GetHandleFormModuleGuid(ModuleGuid, &StartHandle); - Measurement->Handle = StartHandle; - break; - - case FPDT_GUID_QWORD_STRING_EVENT_TYPE: - ModuleGuid = &(((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Guid); - Measurement->Identifier = ((UINT32)((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->ProgressID); - if (IsStart) { - Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD*)RecordHeader)->Timestamp; - } else { - Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp; - } - // - // Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE. - // - switch (Measurement->Identifier) { - case MODULE_DB_END_ID: - Measurement->Token = ALit_DB_START; - Measurement->Module = ALit_DB_START; - break; - default: - ASSERT(FALSE); - } - GetHandleFormModuleGuid(ModuleGuid, &StartHandle); - Measurement->Handle = StartHandle; - break; - - case FPDT_DUAL_GUID_STRING_EVENT_TYPE: - ModuleGuid = &(((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Guid1); - Measurement->Identifier = ((UINT32)((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->ProgressID); - if (IsStart) { - Measurement->StartTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp; - } else { - Measurement->EndTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp; - } - Measurement->Token = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String; - Measurement->Module = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String; - GetHandleFormModuleGuid(ModuleGuid, &StartHandle); - Measurement->Handle = StartHandle; - break; - - default: - break; - } -} - -/** - Search the start measurement in the mMeasurementList for the end measurement. - - @param EndMeasureMent Measurement for end record. - -**/ -VOID -SearchMeasurement ( - IN MEASUREMENT_RECORD *EndMeasureMent - ) -{ - INTN Index; - - for (Index = mMeasurementNum - 1; Index >= 0; Index--) { - if (AsciiStrCmp (EndMeasureMent->Token, ALit_PEIM) == 0) { - if (mMeasurementList[Index].EndTimeStamp == 0 && EndMeasureMent->Handle!= NULL && mMeasurementList[Index].Handle != NULL&& - CompareGuid(mMeasurementList[Index].Handle, EndMeasureMent->Handle) && - (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) && - (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0)) { - mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp; - break; - } - } else if (EndMeasureMent->Identifier == PERF_CROSSMODULE_END_ID) { - if (mMeasurementList[Index].EndTimeStamp == 0 && - (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) && - (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0) && - mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID) { - mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp; - break; - } - } else { - if (mMeasurementList[Index].EndTimeStamp == 0 && mMeasurementList[Index].Handle == EndMeasureMent->Handle && - (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) && - (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0)) { - mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp; - break; - } - } - } -} - -/** - Generate the measure record array. - -**/ -EFI_STATUS -BuildMeasurementList ( - ) -{ - EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader; - UINT8 *PerformanceTablePtr; - UINT16 StartProgressId; - UINTN TableLength; - UINT8 *StartRecordEvent; - MEASUREMENT_RECORD MeasureMent; - - mMeasurementList = AllocateZeroPool (mBootPerformanceTableSize); - if (mMeasurementList == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - TableLength = sizeof (BOOT_PERFORMANCE_TABLE); - PerformanceTablePtr = (mBootPerformanceTable + TableLength); - - while (TableLength < mBootPerformanceTableSize) { - RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER*) PerformanceTablePtr; - StartRecordEvent = (UINT8 *)RecordHeader; - StartProgressId = ((FPDT_GUID_EVENT_RECORD *)StartRecordEvent)->ProgressID; - - // - // If the record with ProgressId 0, the record doesn't appear in pairs. The timestamp in the record is the EndTimeStamp, its StartTimeStamp is 0. - // If the record is the start record, fill the info to the measurement in the mMeasurementList. - // If the record is the end record, find the related start measurement in the mMeasurementList and fill the EndTimeStamp. - // - if (StartProgressId == 0) { - GetMeasurementInfo (RecordHeader, FALSE, &(mMeasurementList[mMeasurementNum])); - mMeasurementNum ++; - } else if (((StartProgressId >= PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x000F) == 0)) || - (StartProgressId < PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x0001) != 0)))) { - // - // Since PEIM and StartImage has same Type and ID when PCD PcdEdkiiFpdtStringRecordEnableOnly = FALSE - // So we need to identify these two kinds of record through different phase. - // - if(StartProgressId == PERF_CROSSMODULE_START_ID ){ - if (AsciiStrCmp (((FPDT_DYNAMIC_STRING_EVENT_RECORD *)StartRecordEvent)->String, ALit_PEI) == 0) { - mPeiPhase = TRUE; - } else if (AsciiStrCmp (((FPDT_DYNAMIC_STRING_EVENT_RECORD *)StartRecordEvent)->String, ALit_DXE) == 0) { - mDxePhase = TRUE; - mPeiPhase = FALSE; - } - } - // Get measurement info form the start record to the mMeasurementList. - GetMeasurementInfo (RecordHeader, TRUE, &(mMeasurementList[mMeasurementNum])); - mMeasurementNum ++; - } else { - ZeroMem(&MeasureMent, sizeof(MEASUREMENT_RECORD)); - GetMeasurementInfo (RecordHeader, FALSE, &MeasureMent); - SearchMeasurement (&MeasureMent); - } - TableLength += RecordHeader->Length; - PerformanceTablePtr += RecordHeader->Length; - } - return EFI_SUCCESS; -} - -/** - Initialize the cumulative data. - -**/ -VOID -InitCumulativeData ( - VOID - ) -{ - UINTN Index; - - for (Index = 0; Index < NumCum; ++Index) { - CumData[Index].Count = 0; - CumData[Index].MinDur = PERF_MAXDUR; - CumData[Index].MaxDur = 0; - CumData[Index].Duration = 0; - } -} - -/** - Initialize the Summary data. - -**/ -VOID -InitSummaryData ( - VOID - ) -{ - SummaryData.NumTrace = 0; - SummaryData.NumIncomplete = 0; - SummaryData.NumSummary = 0; - SummaryData.NumHandles = 0; - SummaryData.NumPEIMs = 0; - SummaryData.NumGlobal = 0; -} - -/** - Dump performance data. - - @param[in] ImageHandle The image handle. - @param[in] SystemTable The system table. - - @retval SHELL_SUCCESS Command completed successfully. - @retval SHELL_INVALID_PARAMETER Command usage error. - @retval SHELL_ABORTED The user aborts the operation. - @retval value Unknown error. -**/ -SHELL_STATUS -RunDp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - LIST_ENTRY *ParamPackage; - CONST CHAR16 *CmdLineArg; - EFI_STATUS Status; - - PERFORMANCE_PROPERTY *PerformanceProperty; - UINTN Number2Display; - - EFI_STRING StringPtr; - BOOLEAN SummaryMode; - BOOLEAN VerboseMode; - BOOLEAN AllMode; - BOOLEAN RawMode; - BOOLEAN ExcludeMode; - BOOLEAN CumulativeMode; - CONST CHAR16 *CustomCumulativeToken; - PERF_CUM_DATA *CustomCumulativeData; - UINTN NameSize; - SHELL_STATUS ShellStatus; - TIMER_INFO TimerInfo; - UINT64 Intermediate; - - StringPtr = NULL; - SummaryMode = FALSE; - VerboseMode = FALSE; - AllMode = FALSE; - RawMode = FALSE; - ExcludeMode = FALSE; - CumulativeMode = FALSE; - CustomCumulativeData = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // Process Command Line arguments - // - Status = ShellCommandLineParse (ParamList, &ParamPackage, NULL, TRUE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(ParamPackage) > 1){ - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_MANY), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } - - // - // Boolean options - // - VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v"); - SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s")); - AllMode = ShellCommandLineGetFlag (ParamPackage, L"-A"); - RawMode = ShellCommandLineGetFlag (ParamPackage, L"-R"); - ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); - mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); - CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); - - if (AllMode && RawMode) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CONFLICT_ARG), mDpHiiHandle, L"-A", L"-R"); - return SHELL_INVALID_PARAMETER; - } - - // Options with Values - if (ShellCommandLineGetFlag (ParamPackage, L"-n")) { - CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); - if (CmdLineArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } else { - if (!(RawMode || AllMode)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_NO_RAW_ALL), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } - Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-n"); - return SHELL_INVALID_PARAMETER; - } else { - Number2Display = (UINTN)Intermediate; - if (Number2Display == 0 || Number2Display > MAXIMUM_DISPLAYCOUNT) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_RANGE), mDpHiiHandle, L"-n", 0, MAXIMUM_DISPLAYCOUNT); - return SHELL_INVALID_PARAMETER; - } - } - } - } else { - Number2Display = DEFAULT_DISPLAYCOUNT; - } - - if (ShellCommandLineGetFlag (ParamPackage, L"-t")) { - CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t"); - if (CmdLineArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-t"); - return SHELL_INVALID_PARAMETER; - } else { - mInterestThreshold = Intermediate; - } - } - } else { - mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us - } - - if (ShellCommandLineGetFlag (ParamPackage, L"-c")) { - CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c"); - if (CustomCumulativeToken == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle); - return SHELL_INVALID_PARAMETER; - } else { - CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA)); - if (CustomCumulativeData == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Done; - } - CustomCumulativeData->MinDur = PERF_MAXDUR; - CustomCumulativeData->MaxDur = 0; - CustomCumulativeData->Count = 0; - CustomCumulativeData->Duration = 0; - NameSize = StrLen (CustomCumulativeToken) + 1; - CustomCumulativeData->Name = AllocateZeroPool (NameSize); - if (CustomCumulativeData->Name == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Done; - } - UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize); - } - } - - // - // DP dump performance data by parsing FPDT table in ACPI table. - // Folloing 3 steps are to get the measurement form the FPDT table. - // - - // - //1. Get FPDT from ACPI table. - // - Status = GetBootPerformanceTable (); - if (EFI_ERROR (Status)) { - ShellStatus = Status; - goto Done; - } - - // - //2. Cache the ModuleGuid and hanlde mapping table. - // - Status = BuildCachedGuidHandleTable(); - if (EFI_ERROR (Status)) { - ShellStatus = Status; - goto Done; - } - - // - //3. Build the measurement array form the FPDT records. - // - Status = BuildMeasurementList (); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Done; - } - - // - // Initialize the pre-defined cumulative data. - // - InitCumulativeData (); - - // - // Initialize the Summary data. - // - InitSummaryData (); - - // - // Timer specific processing - // - // Get the Performance counter characteristics: - // Freq = Frequency in Hz - // StartCount = Value loaded into the counter when it starts counting - // EndCount = Value counter counts to before it needs to be reset - // - Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty); - if (EFI_ERROR (Status) || (PerformanceProperty == NULL)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND), mDpHiiHandle); - goto Done; - } - - TimerInfo.Frequency = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000); - TimerInfo.StartCount = 0; - TimerInfo.EndCount = 0xFFFF; - TimerInfo.CountUp = TRUE; - - // - // Print header - // - // print DP's build version - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_BUILD_REVISION), mDpHiiHandle, DP_MAJOR_VERSION, DP_MINOR_VERSION); - - // print performance timer characteristics - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), mDpHiiHandle, TimerInfo.Frequency); - - if (VerboseMode && !RawMode) { - StringPtr = HiiGetString (mDpHiiHandle, - (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)), NULL); - ASSERT (StringPtr != NULL); - // Print Timer count range and direction - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TIMER_PROPERTIES), mDpHiiHandle, - StringPtr, - TimerInfo.StartCount, - TimerInfo.EndCount - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_VERBOSE_THRESHOLD), mDpHiiHandle, mInterestThreshold); - } - -/**************************************************************************** -**** Print Sections based on command line options -**** -**** Option modes have the following priority: -**** v Verbose -- Valid in combination with any other options -**** t Threshold -- Modifies All, Raw, and Cooked output -**** Default is 0 for All and Raw mode -**** Default is DEFAULT_THRESHOLD for "Cooked" mode -**** n Number2Display Used by All and Raw mode. Otherwise ignored. -**** A All -- R and S options are ignored -**** R Raw -- S option is ignored -**** s Summary -- Modifies "Cooked" output only -**** Cooked (Default) -****************************************************************************/ - GatherStatistics (CustomCumulativeData); - if (CumulativeMode) { - ProcessCumulative (CustomCumulativeData); - } else if (AllMode) { - Status = DumpAllTrace( Number2Display, ExcludeMode); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - } else if (RawMode) { - Status = DumpRawTrace( Number2Display, ExcludeMode); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - } else { - //------------- Begin Cooked Mode Processing - ProcessPhases (); - if ( ! SummaryMode) { - Status = ProcessHandles ( ExcludeMode); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - Status = ProcessPeims (); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - Status = ProcessGlobal (); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - ProcessCumulative (NULL); - } - } //------------- End of Cooked Mode Processing - if ( VerboseMode || SummaryMode) { - DumpStatistics(); - } - -Done: - if (ParamPackage != NULL) { - ShellCommandLineFreeVarList (ParamPackage); - } - SHELL_FREE_NON_NULL (StringPtr); - if (CustomCumulativeData != NULL) { - SHELL_FREE_NON_NULL (CustomCumulativeData->Name); - } - SHELL_FREE_NON_NULL (CustomCumulativeData); - - SHELL_FREE_NON_NULL (mMeasurementList); - - SHELL_FREE_NON_NULL (mCacheHandleGuidTable); - - mMeasurementNum = 0; - mCachePairCount = 0; - return ShellStatus; -} - - -/** - Retrive HII package list from ImageHandle and publish to HII database. - - @param ImageHandle The image handle of the process. - - @return HII handle. -**/ -EFI_HANDLE -InitializeHiiPackage ( - EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - EFI_HII_PACKAGE_LIST_HEADER *PackageList; - EFI_HANDLE HiiHandle; - - // - // Retrieve HII package list from ImageHandle - // - Status = gBS->OpenProtocol ( - ImageHandle, - &gEfiHiiPackageListProtocolGuid, - (VOID **)&PackageList, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // Publish HII package list to HII Database. - // - Status = gHiiDatabase->NewPackageList ( - gHiiDatabase, - PackageList, - NULL, - &HiiHandle - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return NULL; - } - return HiiHandle; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h deleted file mode 100644 index 12c78ab..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h +++ /dev/null @@ -1,146 +0,0 @@ -/** @file - Header file for 'dp' command functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _DP_H_ -#define _DP_H_ - - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE mDpHiiHandle; - -#define DP_MAJOR_VERSION 2 -#define DP_MINOR_VERSION 5 - -/** - * The value assigned to DP_DEBUG controls which debug output - * is generated. Set it to ZERO to disable. -**/ -#define DP_DEBUG 0 - -#define DEFAULT_THRESHOLD 1000 ///< One millisecond. -#define DEFAULT_DISPLAYCOUNT 50 -#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number. - -#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL - -/// Determine whether 0 <= C < L. If L == 0, return true regardless of C. -#define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) ) - -/// Structure for storing Timer specific information. -typedef struct { - UINT64 StartCount; ///< Value timer is initialized with. - UINT64 EndCount; ///< Value timer has just before it wraps. - UINT32 Frequency; ///< Timer count frequency in KHz. - BOOLEAN CountUp; ///< TRUE if the counter counts up. -} TIMER_INFO; - -/** Initialize one PERF_CUM_DATA structure instance for token t. - * - * This parameterized macro takes a single argument, t, which is expected - * to resolve to a pointer to an ASCII string literal. This parameter may - * take any one of the following forms: - * - PERF_INIT_CUM_DATA("Token") A string literal - * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer; - * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N]; -**/ -#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U } - -typedef struct { - UINT64 Duration; ///< Cumulative duration for this item. - UINT64 MinDur; ///< Smallest duration encountered. - UINT64 MaxDur; ///< Largest duration encountered. - CHAR8 *Name; ///< ASCII name of this item. - UINT32 Count; ///< Total number of measurements accumulated. -} PERF_CUM_DATA; - -typedef struct { - UINT32 NumTrace; ///< Number of recorded TRACE performance measurements. - UINT32 NumIncomplete; ///< Number of measurements with no END value. - UINT32 NumSummary; ///< Number of summary section measurements. - UINT32 NumHandles; ///< Number of measurements with handles. - UINT32 NumPEIMs; ///< Number of measurements of PEIMs. - UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle. -} PERF_SUMMARY_DATA; - -typedef struct { - CONST VOID *Handle; - CONST CHAR8 *Token; ///< Measured token string name. - CONST CHAR8 *Module; ///< Module string name. - UINT64 StartTimeStamp; ///< Start time point. - UINT64 EndTimeStamp; ///< End time point. - UINT32 Identifier; ///< Identifier. -} MEASUREMENT_RECORD; - -typedef struct { - CHAR8 *Name; ///< Measured token string name. - UINT64 CumulativeTime; ///< Accumulated Elapsed Time. - UINT64 MinTime; ///< Minimum Elapsed Time. - UINT64 MaxTime; ///< Maximum Elapsed Time. - UINT32 Count; ///< Number of measurements accumulated. -} PROFILE_RECORD; - -/** - Dump performance data. - - @param[in] ImageHandle The image handle. - @param[in] SystemTable The system table. - - @retval SHELL_SUCCESS Command completed successfully. - @retval SHELL_INVALID_PARAMETER Command usage error. - @retval SHELL_ABORTED The user aborts the operation. - @retval value Unknown error. -**/ -SHELL_STATUS -RunDp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Retrive HII package list from ImageHandle and publish to HII database. - - @param ImageHandle The image handle of the process. - - @return HII handle. -**/ -EFI_HANDLE -InitializeHiiPackage ( - EFI_HANDLE ImageHandle - ); -#endif // _DP_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni deleted file mode 100644 index 0b593b7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni +++ /dev/null @@ -1,134 +0,0 @@ -// *++ -// -// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-// (C) Copyright 2015 Hewlett Packard Enterprise Development LP
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// -// Module Name: -// -// DpStrings.uni -// -// Abstract: -// -// String definitions for the Shell dp command -// -// Revision History: -// -// --*/ - -/=# - -#langdef en-US "English" - -#string STR_DP_UP #language en-US "UP" -#string STR_DP_DOWN #language en-US "DOWN" -#string STR_DP_DASHES #language en-US "-------------------------------------------------------------------------------\n" -#string STR_DP_SECTION_HEADER #language en-US "\n==[ %s ]========\n" -#string STR_DP_INVALID_ARG #language en-US "Invalid argument(s)\n" -#string STR_DP_TOO_MANY #language en-US "Too many arguments\n" -#string STR_DP_TOO_FEW #language en-US "Too few arguments\n" -#string STR_DP_INVALID_NUM_ARG #language en-US "Invalid argument(s), the value of %H%s%N must be numbers\n" -#string STR_DP_INVALID_RANGE #language en-US "Invalid argument(s), the value of %H%s%N must be between %H%d%N and %H%d%N\n" -#string STR_DP_CONFLICT_ARG #language en-US "Invalid argument(s), %H%s%N can not be used together with %H%s%N\n" -#string STR_DP_NO_RAW_ALL #language en-US "Invalid argument(s), -n flag must use with -A or -R\n" -#string STR_DP_HANDLES_ERROR #language en-US "Locate all handles error - %r\n" -#string STR_DP_ERROR_NAME #language en-US "Unknown driver name" -#string STR_PERF_PROPERTY_NOT_FOUND #language en-US "Performance property not found\n" -#string STR_DP_BUILD_REVISION #language en-US "\nDP Build Version: %d.%d\n" -#string STR_DP_KHZ #language en-US "System Performance Timer Frequency: %,8d (KHz)\n" -#string STR_DP_TIMER_PROPERTIES #language en-US "System Performance Timer counts %s from 0x%Lx to 0x%Lx\n" -#string STR_DP_VERBOSE_THRESHOLD #language en-US "Measurements less than %,Ld microseconds are not displayed.\n" -#string STR_DP_SECTION_PHASES #language en-US "Major Phases" -#string STR_DP_SEC_PHASE #language en-US " SEC Phase Duration: %L8d (us)\n" -#string STR_DP_PHASE_BDSTO #language en-US " BDS Timeout: %L8d (ms) included in BDS Duration\n" -#string STR_DP_PHASE_DURATION #language en-US "%5a Phase Duration: %L8d (ms)\n" -#string STR_DP_TOTAL_DURATION #language en-US "Total Duration: %L8d (ms)\n" -#string STR_DP_SECTION_DRIVERS #language en-US "Drivers by Handle" -#string STR_DP_HANDLE_SECTION #language en-US "Index: Handle Driver Name Description Time(us)\n" -#string STR_DP_HANDLE_VARS #language en-US "%5d: [%3x] %36s %11s %L8d\n" -#string STR_DP_HANDLE_SECTION2 #language en-US "Index: Handle Driver Name Description Time(us) ID\n" -#string STR_DP_HANDLE_VARS2 #language en-US "%5d: [%3x] %36s %11s %L8d %5d\n" -#string STR_DP_SECTION_PEIMS #language en-US "PEIMs" -#string STR_DP_PEIM_SECTION #language en-US "Index: Instance GUID Token Time(us)\n" -#string STR_DP_PEIM_VARS #language en-US "%5d: %g PEIM %L8d\n" -#string STR_DP_PEIM_SECTION2 #language en-US "Index: Instance GUID Token Time(us) ID\n" -#string STR_DP_PEIM_VARS2 #language en-US "%5d: %g PEIM %L8d %5d\n" -#string STR_DP_SECTION_GENERAL #language en-US "General" -#string STR_DP_GLOBAL_SECTION #language en-US "Index Name Description Time(us)\n" -#string STR_DP_GLOBAL_VARS #language en-US "%5d:%25s %31s %L8d\n" -#string STR_DP_GLOBAL_SECTION2 #language en-US "Index Name Description Time(us) ID\n" -#string STR_DP_GLOBAL_VARS2 #language en-US "%5d:%25s %31s %L8d %5d\n" -#string STR_DP_SECTION_CUMULATIVE #language en-US "Cumulative" -#string STR_DP_CUMULATIVE_SECT_1 #language en-US "(Times in microsec.) Cumulative Average Shortest Longest\n" -#string STR_DP_CUMULATIVE_SECT_2 #language en-US " Name Count Duration Duration Duration Duration\n" -#string STR_DP_CUMULATIVE_STATS #language en-US "%11a %8d %L10d %L10d %L10d %L10d\n" -#string STR_DP_SECTION_STATISTICS #language en-US "Statistics" -#string STR_DP_STATS_NUMTRACE #language en-US "There were %d measurements taken, of which:\n" -#string STR_DP_STATS_NUMINCOMPLETE #language en-US "%,8d are incomplete.\n" -#string STR_DP_STATS_NUMPHASES #language en-US "%,8d are major execution phases.\n" -#string STR_DP_STATS_NUMHANDLES #language en-US "%,8d have non-NULL handles, %d are NULL.\n" -#string STR_DP_STATS_NUMPEIMS #language en-US "%,8d are PEIMs.\n" -#string STR_DP_STATS_NUMGLOBALS #language en-US "%,8d are general measurements.\n" -#string STR_DP_STATS_NUMPROFILE #language en-US "%,8d are profiling records.\n" -#string STR_DP_SECTION_ALL #language en-US "Sequential Trace Records" -#string STR_DP_ALL_HEADR #language en-US "\nIndex Handle Module Token Time(us)\n" -#string STR_DP_ALL_VARS #language en-US "%5d:%3s0x%08p %36s %13s %L8d\n" -#string STR_DP_ALL_DASHES2 #language en-US "-------------------------------------------------------------------------------------\n" -#string STR_DP_ALL_HEADR2 #language en-US "\nIndex Handle Module Token Time(us) ID\n" -#string STR_DP_ALL_VARS2 #language en-US "%5d:%3s0x%08p %36s %13s %L8d %5d\n" -#string STR_DP_SECTION_RAWTRACE #language en-US "RAW Trace" -#string STR_DP_RAW_DASHES #language en-US "---------------------------------------------------------------------------------------------------------------------------\n" -#string STR_DP_RAW_VARS #language en-US "%5d: %16LX %16LX %16LX %31a %31a\n" -#string STR_DP_RAW_HEADR #language en-US "\nIndex Handle Start Count End Count Token Module\n" -#string STR_DP_RAW_DASHES2 #language en-US "---------------------------------------------------------------------------------------------------------------------------------\n" -#string STR_DP_RAW_VARS2 #language en-US "%5d: %16LX %16LX %16LX %31a %31a %5d\n" -#string STR_DP_RAW_HEADR2 #language en-US "\nIndex Handle Start Count End Count Token Module ID\n" -#string STR_DP_INCOMPLETE #language en-US " I " -#string STR_DP_COMPLETE #language en-US " " -#string STR_ALIT_UNKNOWN #language en-US "Unknown" -#string STR_DP_GET_ACPI_FPDT_FAIL #language en-US "Fail to get Firmware Performance Data Table (FPDT) in ACPI Table\n" - -#string STR_GET_HELP_DP #language en-US "" -".TH dp 0 "Display performance metrics"\r\n" -".SH NAME\r\n" -"Displays performance metrics that are stored in memory.\r\n" -".SH SYNOPSIS\r\n" -"DP [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]][-i] [-?]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays on multiple pages\r\n" -" -v - Displays additional information\r\n" -" -x - Prevents display of individual measurements for cumulative items\r\n" -" -s - Displays summary information only\r\n" -" -A - Displays all measurements in a list\r\n" -" -R - Displays all measurements in raw format\r\n" -" -t VALUE - Sets display threshold to VALUE microseconds\r\n" -" -n COUNT - Limits display to COUNT lines in All and Raw modes\r\n" -" -i - Displays identifier\r\n" -" -c TOKEN - Display pre-defined and custom cumulative data\r\n" -" Pre-defined cumulative token are:\r\n" -" 1. LoadImage:\r\n" -" 2. StartImage:\r\n" -" 3. DB:Start:\r\n" -" 4. DB:Support:\r\n" -" -? - Displays DP help information\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. Displays Performance metrics that are stored in memory.\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_NOT_FOUND The requested option was not found.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly formatted or its value was out of bounds.\r\n" -" SHELL_UNSUPPORTED The action as requested was unsupported.\r\n" -" SHELL_OUT_OF_RESOURCES There was insufficient free space for the request to be completed.\r\n" diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c deleted file mode 100644 index 4bd9281..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - Entrypoint of "dp" shell standalone application. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "Dp.h" - -// -// String token ID of help message text. -// Shell supports to find help message in the resource section of an application image if -// .MAN file is not found. This global variable is added to make build tool recognizes -// that the help string is consumed by user and then build tool will add the string into -// the resource section. Thus the application can use '-?' option to show help message in -// Shell. -// -GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP); - -/** - Entry point of Tftp standalone application. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS Tftp command is executed sucessfully. - @retval EFI_ABORTED HII package was failed to initialize. - @retval others Other errors when executing tftp command. -**/ -EFI_STATUS -EFIAPI -DpAppInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - mDpHiiHandle = InitializeHiiPackage (ImageHandle); - if (mDpHiiHandle == NULL) { - return EFI_ABORTED; - } - - Status = (EFI_STATUS)RunDp (ImageHandle, SystemTable); - HiiRemovePackages (mDpHiiHandle); - return Status; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf deleted file mode 100644 index ffbc54a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf +++ /dev/null @@ -1,69 +0,0 @@ -## @file -# Provides Shell 'dp' standalone application. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = dp - FILE_GUID = 1831A379-2D48-45BD-9744-D4059D93815D - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = DpAppInitialize -# -# This flag specifies whether HII resource section is generated into PE image. -# - UEFI_HII_RESOURCE_SECTION = TRUE - -[Sources.common] - Dp.uni - Dp.c - Dp.h - Literals.h - Literals.c - DpInternal.h - DpUtilities.c - DpTrace.c - DpApp.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - UefiApplicationEntryPoint - SortLib - PrintLib - DevicePathLib - PerformanceLib - DxeServicesLib - PeCoffGetEntryPointLib - -[Guids] - gPerformanceProtocolGuid ## CONSUMES ## SystemTable - -[Protocols] - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMES - gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMES - gEfiHiiPackageListProtocolGuid ## CONSUMES - diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c deleted file mode 100644 index 032acfc..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c +++ /dev/null @@ -1,131 +0,0 @@ -/** @file - Produce "dp" shell dynamic command. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "Dp.h" -#include - -/** - This is the shell command handler function pointer callback type. This - function handles the command when it is invoked in the shell. - - @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. - @param[in] SystemTable The pointer to the system table. - @param[in] ShellParameters The parameters associated with the command. - @param[in] Shell The instance of the shell protocol used in the context - of processing this command. - - @return EFI_SUCCESS the operation was sucessful - @return other the operation failed. -**/ -SHELL_STATUS -EFIAPI -DpCommandHandler ( - IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN EFI_SYSTEM_TABLE *SystemTable, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN EFI_SHELL_PROTOCOL *Shell - ) -{ - gEfiShellParametersProtocol = ShellParameters; - gEfiShellProtocol = Shell; - return RunDp (gImageHandle, SystemTable); -} - -/** - This is the command help handler function pointer callback type. This - function is responsible for displaying help information for the associated - command. - - @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. - @param[in] Language The pointer to the language string to use. - - @return string Pool allocated help string, must be freed by caller -**/ -CHAR16 * -EFIAPI -DpCommandGetHelp ( - IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN CONST CHAR8 *Language - ) -{ - return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), Language); -} - -EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = { - L"dp", - DpCommandHandler, - DpCommandGetHelp -}; - -/** - Entry point of Tftp Dynamic Command. - - Produce the DynamicCommand protocol to handle "tftp" command. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS Tftp command is executed sucessfully. - @retval EFI_ABORTED HII package was failed to initialize. - @retval others Other errors when executing tftp command. -**/ -EFI_STATUS -EFIAPI -DpCommandInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - mDpHiiHandle = InitializeHiiPackage (ImageHandle); - if (mDpHiiHandle == NULL) { - return EFI_ABORTED; - } - - Status = gBS->InstallProtocolInterface ( - &ImageHandle, - &gEfiShellDynamicCommandProtocolGuid, - EFI_NATIVE_INTERFACE, - &mDpDynamicCommand - ); - ASSERT_EFI_ERROR (Status); - return Status; -} - -/** - Tftp driver unload handler. - - @param ImageHandle The image handle of the process. - - @retval EFI_SUCCESS The image is unloaded. - @retval Others Failed to unload the image. -**/ -EFI_STATUS -EFIAPI -DpUnload ( - IN EFI_HANDLE ImageHandle -) -{ - EFI_STATUS Status; - Status = gBS->UninstallProtocolInterface ( - ImageHandle, - &gEfiShellDynamicCommandProtocolGuid, - &mDpDynamicCommand - ); - if (EFI_ERROR (Status)) { - return Status; - } - HiiRemovePackages (mDpHiiHandle); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf deleted file mode 100644 index c6de1ed..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +++ /dev/null @@ -1,73 +0,0 @@ -## @file -# Provides Shell 'dp' dynamic command. -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = dpDynamicCommand - FILE_GUID = 0253F9FA-129A-4A8D-B12E-7DC2B6376302 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = DpCommandInitialize - UNLOAD_IMAGE = DpUnload -# -# This flag specifies whether HII resource section is generated into PE image. -# - UEFI_HII_RESOURCE_SECTION = TRUE - -[Sources.common] - Dp.uni - Dp.c - Dp.h - Literals.h - Literals.c - DpInternal.h - DpUtilities.c - DpTrace.c - DpDynamicCommand.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - UefiDriverEntryPoint - SortLib - PrintLib - DevicePathLib - PerformanceLib - DxeServicesLib - PeCoffGetEntryPointLib - -[Guids] - gPerformanceProtocolGuid ## CONSUMES ## SystemTable - -[Protocols] - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMES - gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMES - gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMES - gEfiHiiPackageListProtocolGuid ## CONSUMES - gEfiShellDynamicCommandProtocolGuid ## PRODUCES - -[DEPEX] - TRUE diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h deleted file mode 100644 index 0b35ddb..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h +++ /dev/null @@ -1,321 +0,0 @@ -/** @file - Declarations of objects defined internally to the Dp Application. - - Declarations of data and functions which are private to the Dp application. - This file should never be referenced by anything other than components of the - Dp application. In addition to global data, function declarations for - DpUtilities.c, DpTrace.c, and DpProfile.c are included here. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. - (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#ifndef _DP_INTELNAL_H_ -#define _DP_INTELNAL_H_ - -#define DP_GAUGE_STRING_LENGTH 36 - -// -/// Module-Global Variables -///@{ -extern EFI_HII_HANDLE mDpHiiHandle; -extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1]; -extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE]; -extern UINT64 mInterestThreshold; -extern BOOLEAN mShowId; -extern UINT8 *mBootPerformanceTable; -extern UINTN mBootPerformanceTableLength; -extern MEASUREMENT_RECORD *mMeasurementList; -extern UINTN mMeasurementNum; - -extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO. - -/// Items for which to gather cumulative statistics. -extern PERF_CUM_DATA CumData[]; - -/// Number of items for which we are gathering cumulative statistics. -extern UINT32 const NumCum; - -///@} - -/** - Calculate an event's duration in timer ticks. - - Given the count direction and the event's start and end timer values, - calculate the duration of the event in timer ticks. Information for - the current measurement is pointed to by the parameter. - - If the measurement's start time is 1, it indicates that the developer - is indicating that the measurement began at the release of reset. - The start time is adjusted to the timer's starting count before performing - the elapsed time calculation. - - The calculated duration, in ticks, is the absolute difference between - the measurement's ending and starting counts. - - @param Measurement Pointer to a MEASUREMENT_RECORD structure containing - data for the current measurement. - - @return The 64-bit duration of the event. -**/ -UINT64 -GetDuration ( - IN OUT MEASUREMENT_RECORD *Measurement - ); - -/** - Determine whether the Measurement record is for an EFI Phase. - - The Token and Module members of the measurement record are checked. - Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL. - - @param[in] Measurement A pointer to the Measurement record to test. - - @retval TRUE The measurement record is for an EFI Phase. - @retval FALSE The measurement record is NOT for an EFI Phase. -**/ -BOOLEAN -IsPhase( - IN MEASUREMENT_RECORD *Measurement - ); - -/** - Determine whether the Measurement record is for core code. - - @param[in] Measurement A pointer to the Measurement record to test. - - @retval TRUE The measurement record is used for core. - @retval FALSE The measurement record is NOT used for core. - -**/ -BOOLEAN -IsCorePerf( - IN MEASUREMENT_RECORD *Measurement - ); - -/** - Get the file name portion of the Pdb File Name. - - The portion of the Pdb File Name between the last backslash and - either a following period or the end of the string is converted - to Unicode and copied into UnicodeBuffer. The name is truncated, - if necessary, to ensure that UnicodeBuffer is not overrun. - - @param[in] PdbFileName Pdb file name. - @param[out] UnicodeBuffer The resultant Unicode File Name. - -**/ -VOID -DpGetShortPdbFileName ( - IN CHAR8 *PdbFileName, - OUT CHAR16 *UnicodeBuffer - ); - -/** - Get a human readable name for an image handle. - The following methods will be tried orderly: - 1. Image PDB - 2. ComponentName2 protocol - 3. FFS UI section - 4. Image GUID - 5. Image DevicePath - 6. Unknown Driver Name - - @param[in] Handle - - @post The resulting Unicode name string is stored in the - mGaugeString global array. - -**/ -VOID -DpGetNameFromHandle ( - IN EFI_HANDLE Handle - ); - -/** - Calculate the Duration in microseconds. - - Duration is multiplied by 1000, instead of Frequency being divided by 1000 or - multiplying the result by 1000, in order to maintain precision. Since Duration is - a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow. - - The time is calculated as (Duration * 1000) / Timer_Frequency. - - @param[in] Duration The event duration in timer ticks. - - @return A 64-bit value which is the Elapsed time in microseconds. -**/ -UINT64 -DurationInMicroSeconds ( - IN UINT64 Duration - ); - -/** - Get index of Measurement Record's match in the CumData array. - - If the Measurement's Token value matches a Token in one of the CumData - records, the index of the matching record is returned. The returned - index is a signed value so that negative values can indicate that - the Measurement didn't match any entry in the CumData array. - - @param[in] Measurement A pointer to a Measurement Record to match against the CumData array. - - @retval <0 Token is not in the CumData array. - @retval >=0 Return value is the index into CumData where Token is found. -**/ -INTN -GetCumulativeItem( - IN MEASUREMENT_RECORD *Measurement - ); - -/** - Collect verbose statistics about the logged performance measurements. - - General Summary information for all Trace measurements is gathered and - stored within the SummaryData structure. This information is both - used internally by subsequent reporting functions, and displayed - at the end of verbose reports. - - @pre The SummaryData and CumData structures must be initialized - prior to calling this function. - - @post The SummaryData and CumData structures contain statistics for the - current performance logs. - - @param[in, out] CustomCumulativeData The pointer to the custom cumulative data. - -**/ -VOID -GatherStatistics( - IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL - ); - -/** - Gather and print ALL Trace Records. - - Displays all "interesting" Trace measurements in order.
- The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - The mGaugeString and mUnicodeToken global arrays are used for temporary string storage. - They must not be in use by a calling function. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. - @return Others from a call to gBS->LocateHandleBuffer(). -**/ -EFI_STATUS -DumpAllTrace( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ); - -/** - Gather and print Raw Trace Records. - - All Trace measurements with a duration greater than or equal to - mInterestThreshold are printed without interpretation. - - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -DumpRawTrace( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ); - -/** - Gather and print Major Phase metrics. - -**/ -VOID -ProcessPhases( - VOID - ); - - -/** - Gather and print Handle data. - - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. - @return Others from a call to gBS->LocateHandleBuffer(). -**/ -EFI_STATUS -ProcessHandles( - IN BOOLEAN ExcludeFlag - ); - - -/** - Gather and print PEIM data. - - Only prints complete PEIM records - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -ProcessPeims( - VOID - ); - -/** - Gather and print global data. - - Strips out incomplete or "Execution Phase" records - Only prints records where Handle is NULL - Increment TIndex for every record, even skipped ones, so that we have an - indication of every measurement record taken. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -ProcessGlobal( - VOID - ); - -/** - Gather and print cumulative data. - - Traverse the measurement records and:
- For each record with a Token listed in the CumData array:
- - Update the instance count and the total, minimum, and maximum durations. - Finally, print the gathered cumulative statistics. - - @param[in] CustomCumulativeData The pointer to the custom cumulative data. - -**/ -VOID -ProcessCumulative( - IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c deleted file mode 100644 index 392f629..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c +++ /dev/null @@ -1,910 +0,0 @@ -/** @file - Trace reporting for the Dp utility. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. - (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Dp.h" -#include "Literals.h" -#include "DpInternal.h" - -/** - Attempts to retrieve a performance measurement log entry from the performance measurement log. - - - @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve. - 0, then the first performance measurement log entry is retrieved. - On exit, the key of the next performance log entry. - @param Handle Pointer to environment specific context used to identify the component - being measured. - @param Token Pointer to a Null-terminated ASCII string that identifies the component - being measured. - @param Module Pointer to a Null-terminated ASCII string that identifies the module - being measured. - @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement - was started. - @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement - was ended. - @param Identifier Pointer to the 32-bit identifier that was recorded when the measurement - was ended. - - @return The key for the next performance log entry (in general case). - -**/ -UINTN -GetPerformanceMeasurementRecord ( - IN UINTN LogEntryKey, - OUT CONST VOID **Handle, - OUT CONST CHAR8 **Token, - OUT CONST CHAR8 **Module, - OUT UINT64 *StartTimeStamp, - OUT UINT64 *EndTimeStamp, - OUT UINT32 *Identifier - ) -{ - if (LogEntryKey == mMeasurementNum) { - return 0; - } - - *Handle = (VOID *) (UINTN) mMeasurementList[LogEntryKey].Handle; - *Token = mMeasurementList[LogEntryKey].Token; - *Module = mMeasurementList[LogEntryKey].Module; - *StartTimeStamp = mMeasurementList[LogEntryKey].StartTimeStamp; - *EndTimeStamp = mMeasurementList[LogEntryKey].EndTimeStamp; - *Identifier = mMeasurementList[LogEntryKey].Identifier; - - LogEntryKey ++; - - return LogEntryKey; -} - -/** - Collect verbose statistics about the logged performance measurements. - - General Summary information for all Trace measurements is gathered and - stored within the SummaryData structure. This information is both - used internally by subsequent reporting functions, and displayed - at the end of verbose reports. - - @pre The SummaryData and CumData structures must be initialized - prior to calling this function. - - @post The SummaryData and CumData structures contain statistics for the - current performance logs. - - @param[in, out] CustomCumulativeData A pointer to the cumtom cumulative data. - -**/ -VOID -GatherStatistics( - IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL - ) -{ - MEASUREMENT_RECORD Measurement; - UINT64 Duration; - UINTN LogEntryKey; - INTN TIndex; - - LogEntryKey = 0; - while ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - { - ++SummaryData.NumTrace; // Count the number of TRACE Measurement records - if (Measurement.EndTimeStamp == 0) { - ++SummaryData.NumIncomplete; // Count the incomplete records - continue; - } - - if (Measurement.Handle != NULL) { - ++SummaryData.NumHandles; // Count the number of measurements with non-NULL handles - } - - if (IsPhase( &Measurement)) { - ++SummaryData.NumSummary; // Count the number of major phases - } - else { // !IsPhase - if(Measurement.Handle == NULL) { - ++SummaryData.NumGlobal; - } - } - - if (AsciiStrCmp (Measurement.Token, ALit_PEIM) == 0) { - ++SummaryData.NumPEIMs; // Count PEIM measurements - } - - Duration = GetDuration (&Measurement); - TIndex = GetCumulativeItem (&Measurement); - if (TIndex >= 0) { - CumData[TIndex].Duration += Duration; - CumData[TIndex].Count++; - if ( Duration < CumData[TIndex].MinDur ) { - CumData[TIndex].MinDur = Duration; - } - if ( Duration > CumData[TIndex].MaxDur ) { - CumData[TIndex].MaxDur = Duration; - } - } - - // - // Collect the data for custom cumulative data. - // - if ((CustomCumulativeData != NULL) && (AsciiStrCmp (Measurement.Token, CustomCumulativeData->Name) == 0)) { - CustomCumulativeData->Duration += Duration; - CustomCumulativeData->Count++; - if (Duration < CustomCumulativeData->MinDur) { - CustomCumulativeData->MinDur = Duration; - } - if (Duration > CustomCumulativeData->MaxDur) { - CustomCumulativeData->MaxDur = Duration; - } - } - } -} - -/** - Gather and print ALL Trace Records. - - Displays all "interesting" Trace measurements in order.
- The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - The mGaugeString and mUnicodeToken global arrays are used for temporary string storage. - They must not be in use by a calling function. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. - @return Others from a call to gBS->LocateHandleBuffer(). -**/ -EFI_STATUS -DumpAllTrace( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ) -{ - MEASUREMENT_RECORD Measurement; - UINT64 ElapsedTime; - UINT64 Duration; - CHAR16 *IncFlag; - UINTN LogEntryKey; - UINTN Count; - UINTN Index; - UINTN TIndex; - - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - EFI_STATUS Status; - EFI_STRING StringPtrUnknown; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (IncFlag == NULL) ? StringPtrUnknown : IncFlag); - FreePool (StringPtrUnknown); - - // Get Handle information - // - Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status); - } - else { - // We have successfully populated the HandleBuffer - // Display ALL Measurement Records - // Up to Limit lines displayed - // Display only records with Elapsed times >= mInterestThreshold - // Display driver names in Module field for records with Handles. - // - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR2), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), mDpHiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle); - } - - LogEntryKey = 0; - Count = 0; - Index = 0; - while ( WITHIN_LIMIT(Count, Limit) && - ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - ) - { - ++Index; // Count every record. First record is 1. - ElapsedTime = 0; - SHELL_FREE_NON_NULL (IncFlag); - if (Measurement.EndTimeStamp != 0) { - Duration = GetDuration (&Measurement); - ElapsedTime = DurationInMicroSeconds ( Duration ); - IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL); - } - else { - IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records - } - if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) || - ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0)) - ) { // Ignore "uninteresting" or excluded records - continue; - } - ++Count; // Count the number of records printed - - // If Handle is non-zero, see if we can determine a name for the driver - AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString)); // Use Module by default - AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken)); - if (Measurement.Handle != NULL) { - // See if the Handle is in the HandleBuffer - for (TIndex = 0; TIndex < HandleCount; TIndex++) { - if (Measurement.Handle == HandleBuffer[TIndex]) { - DpGetNameFromHandle (HandleBuffer[TIndex]); - break; - } - } - } - - if (AsciiStrCmp (Measurement.Token, ALit_PEIM) == 0) { - UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", Measurement.Handle); - } - - // Ensure that the argument strings are not too long. - mGaugeString[DP_GAUGE_STRING_LENGTH] = 0; - mUnicodeToken[13] = 0; - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), mDpHiiHandle, - Index, // 1 based, Which measurement record is being printed - IncFlag, - Measurement.Handle, - mGaugeString, - mUnicodeToken, - ElapsedTime, - Measurement.Identifier - ); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), mDpHiiHandle, - Index, // 1 based, Which measurement record is being printed - IncFlag, - Measurement.Handle, - mGaugeString, - mUnicodeToken, - ElapsedTime - ); - } - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - SHELL_FREE_NON_NULL (IncFlag); - - return Status; -} - -/** - Gather and print Raw Trace Records. - - All Trace measurements with a duration greater than or equal to - mInterestThreshold are printed without interpretation. - - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -DumpRawTrace( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ) -{ - MEASUREMENT_RECORD Measurement; - UINT64 ElapsedTime; - UINT64 Duration; - UINTN LogEntryKey; - UINTN Count; - UINTN Index; - - EFI_STRING StringPtr; - EFI_STRING StringPtrUnknown; - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown : StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), mDpHiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), mDpHiiHandle); - } - - LogEntryKey = 0; - Count = 0; - Index = 0; - while ( WITHIN_LIMIT(Count, Limit) && - ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - ) - { - ++Index; // Count every record. First record is 1. - ElapsedTime = 0; - if (Measurement.EndTimeStamp != 0) { - Duration = GetDuration (&Measurement); - ElapsedTime = DurationInMicroSeconds ( Duration ); - } - if ((ElapsedTime < mInterestThreshold) || - ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0)) - ) { // Ignore "uninteresting" or Excluded records - continue; - } - ++Count; // Count the number of records printed - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), mDpHiiHandle, - Index, // 1 based, Which measurement record is being printed - Measurement.Handle, - Measurement.StartTimeStamp, - Measurement.EndTimeStamp, - Measurement.Token, - Measurement.Module, - Measurement.Identifier - ); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), mDpHiiHandle, - Index, // 1 based, Which measurement record is being printed - Measurement.Handle, - Measurement.StartTimeStamp, - Measurement.EndTimeStamp, - Measurement.Token, - Measurement.Module - ); - } - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - } - return Status; -} - -/** - Gather and print Major Phase metrics. - -**/ -VOID -ProcessPhases( - VOID - ) -{ - MEASUREMENT_RECORD Measurement; - UINT64 BdsTimeoutValue; - UINT64 SecTime; - UINT64 PeiTime; - UINT64 DxeTime; - UINT64 BdsTime; - UINT64 ElapsedTime; - UINT64 Duration; - UINT64 Total; - EFI_STRING StringPtr; - UINTN LogEntryKey; - EFI_STRING StringPtrUnknown; - - BdsTimeoutValue = 0; - SecTime = 0; - PeiTime = 0; - DxeTime = 0; - BdsTime = 0; - // - // Get Execution Phase Statistics - // - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown : StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - LogEntryKey = 0; - while ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - { - if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records - continue; - } - Duration = GetDuration (&Measurement); - if ( Measurement.Handle != NULL - && (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0) - ) - { - BdsTimeoutValue = Duration; - } else if (AsciiStrCmp (Measurement.Token, ALit_SEC) == 0) { - SecTime = Duration; - } else if (AsciiStrCmp (Measurement.Token, ALit_PEI) == 0) { - PeiTime = Duration; - } else if (AsciiStrCmp (Measurement.Token, ALit_DXE) == 0) { - DxeTime = Duration; - } else if (AsciiStrCmp (Measurement.Token, ALit_BDS) == 0) { - BdsTime = Duration; - } - } - - Total = 0; - - // print SEC phase duration time - // - if (SecTime > 0) { - ElapsedTime = DurationInMicroSeconds ( SecTime ); // Calculate elapsed time in microseconds - Total += DivU64x32 (ElapsedTime, 1000); // Accumulate time in milliseconds - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), mDpHiiHandle, ElapsedTime); - } - - // print PEI phase duration time - // - if (PeiTime > 0) { - ElapsedTime = DivU64x32 (PeiTime, 1000000); - Total += ElapsedTime; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_PEI, ElapsedTime); - } - - // print DXE phase duration time - // - if (DxeTime > 0) { - ElapsedTime = DivU64x32 (DxeTime, 1000000); - Total += ElapsedTime; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_DXE, ElapsedTime); - } - - // print BDS phase duration time - // - if (BdsTime > 0) { - ElapsedTime = DivU64x32 (BdsTime, 1000000); - Total += ElapsedTime; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_BDS, ElapsedTime); - } - - if (BdsTimeoutValue > 0) { - ElapsedTime = DivU64x32 (BdsTimeoutValue, 1000000); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), mDpHiiHandle, ALit_BdsTO, ElapsedTime); - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), mDpHiiHandle, Total); -} - -/** - Gather and print Handle data. - - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. - @return Others from a call to gBS->LocateHandleBuffer(). -**/ -EFI_STATUS -ProcessHandles( - IN BOOLEAN ExcludeFlag - ) -{ - MEASUREMENT_RECORD Measurement; - UINT64 ElapsedTime; - UINT64 Duration; - EFI_HANDLE *HandleBuffer; - EFI_STRING StringPtr; - UINTN Index; - UINTN LogEntryKey; - UINTN Count; - UINTN HandleCount; - EFI_STATUS Status; - EFI_STRING StringPtrUnknown; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown : StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status); - } - else { -#if DP_DEBUG == 2 - Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0]))); -#endif - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION2), mDpHiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), mDpHiiHandle); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle); - - LogEntryKey = 0; - Count = 0; - while ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - { - Count++; - Duration = GetDuration (&Measurement); - ElapsedTime = DurationInMicroSeconds ( Duration ); - if ((ElapsedTime < mInterestThreshold) || - (Measurement.EndTimeStamp == 0) || - (!IsCorePerf (&Measurement)) || - ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0)) - ) { // Ignore "uninteresting" or excluded records - continue; - } - mGaugeString[0] = 0; // Empty driver name by default - AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken)); - // See if the Handle is in the HandleBuffer - for (Index = 0; Index < HandleCount; Index++) { - if (Measurement.Handle == HandleBuffer[Index]) { - DpGetNameFromHandle (HandleBuffer[Index]); // Name is put into mGaugeString - break; - } - } - // Ensure that the argument strings are not too long. - mGaugeString[DP_GAUGE_STRING_LENGTH] = 0; - mUnicodeToken[11] = 0; - if (mGaugeString[0] != 0) { - // Display the record if it has a valid handle. - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS2), mDpHiiHandle, - Count, // 1 based, Which measurement record is being printed - Index + 1, // 1 based, Which handle is being printed - mGaugeString, - mUnicodeToken, - ElapsedTime, - Measurement.Identifier - ); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS), mDpHiiHandle, - Count, // 1 based, Which measurement record is being printed - Index + 1, // 1 based, Which handle is being printed - mGaugeString, - mUnicodeToken, - ElapsedTime - ); - } - } - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - return Status; -} - -/** - Gather and print PEIM data. - - Only prints complete PEIM records - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -ProcessPeims( - VOID -) -{ - MEASUREMENT_RECORD Measurement; - UINT64 Duration; - UINT64 ElapsedTime; - EFI_STRING StringPtr; - UINTN LogEntryKey; - UINTN TIndex; - EFI_STRING StringPtrUnknown; - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown : StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), mDpHiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDpHiiHandle); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle); - TIndex = 0; - LogEntryKey = 0; - while ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - { - TIndex++; - if ((Measurement.EndTimeStamp == 0) || - (AsciiStrCmp (Measurement.Token, ALit_PEIM) != 0) - ) { - continue; - } - - Duration = GetDuration (&Measurement); - ElapsedTime = DurationInMicroSeconds ( Duration ); // Calculate elapsed time in microseconds - if (ElapsedTime >= mInterestThreshold) { - // PEIM FILE Handle is the start address of its FFS file that contains its file guid. - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), mDpHiiHandle, - TIndex, // 1 based, Which measurement record is being printed - Measurement.Handle, // file guid - ElapsedTime, - Measurement.Identifier - ); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), mDpHiiHandle, - TIndex, // 1 based, Which measurement record is being printed - Measurement.Handle, // file guid - ElapsedTime - ); - } - } - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - } - return Status; -} - -/** - Gather and print global data. - - Strips out incomplete or "Execution Phase" records - Only prints records where Handle is NULL - Increment TIndex for every record, even skipped ones, so that we have an - indication of every measurement record taken. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The user aborts the operation. -**/ -EFI_STATUS -ProcessGlobal( - VOID -) -{ - MEASUREMENT_RECORD Measurement; - UINT64 Duration; - UINT64 ElapsedTime; - EFI_STRING StringPtr; - UINTN LogEntryKey; - UINTN Index; // Index, or number, of the measurement record being processed - EFI_STRING StringPtrUnknown; - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown: StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION2), mDpHiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), mDpHiiHandle); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle); - - Index = 1; - LogEntryKey = 0; - - while ((LogEntryKey = GetPerformanceMeasurementRecord ( - LogEntryKey, - &Measurement.Handle, - &Measurement.Token, - &Measurement.Module, - &Measurement.StartTimeStamp, - &Measurement.EndTimeStamp, - &Measurement.Identifier)) != 0) - { - AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString)); - AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken)); - mGaugeString[25] = 0; - mUnicodeToken[31] = 0; - if ( ! ( IsPhase( &Measurement) || - IsCorePerf (&Measurement) || - (Measurement.EndTimeStamp == 0) - )) - { - Duration = GetDuration (&Measurement); - ElapsedTime = DurationInMicroSeconds ( Duration ); - if (ElapsedTime >= mInterestThreshold) { - if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS2), mDpHiiHandle, - Index, - mGaugeString, - mUnicodeToken, - ElapsedTime, - Measurement.Identifier - ); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS), mDpHiiHandle, - Index, - mGaugeString, - mUnicodeToken, - ElapsedTime - ); - } - } - } - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - Index++; - } - return Status; -} - -/** - Gather and print cumulative data. - - Traverse the measurement records and:
- For each record with a Token listed in the CumData array:
- - Update the instance count and the total, minimum, and maximum durations. - Finally, print the gathered cumulative statistics. - - @param[in] CustomCumulativeData A pointer to the cumtom cumulative data. - -**/ -VOID -ProcessCumulative( - IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL - ) -{ - UINT64 AvgDur; // the computed average duration - UINT64 Dur; - UINT64 MinDur; - UINT64 MaxDur; - EFI_STRING StringPtr; - UINTN TIndex; - EFI_STRING StringPtrUnknown; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown: StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_SECT_1), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_SECT_2), mDpHiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle); - - for ( TIndex = 0; TIndex < NumCum; ++TIndex) { - if (CumData[TIndex].Count != 0) { - AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count); - AvgDur = DurationInMicroSeconds(AvgDur); - Dur = DurationInMicroSeconds(CumData[TIndex].Duration); - MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur); - MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle, - CumData[TIndex].Name, - CumData[TIndex].Count, - Dur, - AvgDur, - MinDur, - MaxDur - ); - } - } - - // - // Print the custom cumulative data. - // - if (CustomCumulativeData != NULL) { - if (CustomCumulativeData->Count != 0) { - AvgDur = DivU64x32 (CustomCumulativeData->Duration, CustomCumulativeData->Count); - AvgDur = DurationInMicroSeconds (AvgDur); - Dur = DurationInMicroSeconds (CustomCumulativeData->Duration); - MaxDur = DurationInMicroSeconds (CustomCumulativeData->MaxDur); - MinDur = DurationInMicroSeconds (CustomCumulativeData->MinDur); - } else { - AvgDur = 0; - Dur = 0; - MaxDur = 0; - MinDur = 0; - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle, - CustomCumulativeData->Name, - CustomCumulativeData->Count, - Dur, - AvgDur, - MinDur, - MaxDur - ); - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c deleted file mode 100644 index 0b6c5d9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c +++ /dev/null @@ -1,428 +0,0 @@ -/** @file - Utility functions used by the Dp application. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. - (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include "Dp.h" -#include "Literals.h" -#include "DpInternal.h" - -/** - Calculate an event's duration in timer ticks. - - Given the count direction and the event's start and end timer values, - calculate the duration of the event in timer ticks. Information for - the current measurement is pointed to by the parameter. - - If the measurement's start time is 1, it indicates that the developer - is indicating that the measurement began at the release of reset. - The start time is adjusted to the timer's starting count before performing - the elapsed time calculation. - - The calculated duration, in ticks, is the absolute difference between - the measurement's ending and starting counts. - - @param Measurement Pointer to a MEASUREMENT_RECORD structure containing - data for the current measurement. - - @return The 64-bit duration of the event. -**/ -UINT64 -GetDuration ( - IN OUT MEASUREMENT_RECORD *Measurement - ) -{ - UINT64 Duration; - BOOLEAN Error; - - if (Measurement->EndTimeStamp == 0) { - return 0; - } - - Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp; - Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp); - - if (Error) { - DEBUG ((EFI_D_ERROR, ALit_TimerLibError)); - Duration = 0; - } - return Duration; -} - -/** - Determine whether the Measurement record is for an EFI Phase. - - The Token and Module members of the measurement record are checked. - Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL. - - @param[in] Measurement A pointer to the Measurement record to test. - - @retval TRUE The measurement record is for an EFI Phase. - @retval FALSE The measurement record is NOT for an EFI Phase. -**/ -BOOLEAN -IsPhase( - IN MEASUREMENT_RECORD *Measurement - ) -{ - BOOLEAN RetVal; - - RetVal = (BOOLEAN)( - ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0) || - (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0) || - (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0) || - (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0)) - ); - return RetVal; -} - -/** - Determine whether the Measurement record is for core code. - - @param[in] Measurement A pointer to the Measurement record to test. - - @retval TRUE The measurement record is used for core. - @retval FALSE The measurement record is NOT used for core. - -**/ -BOOLEAN -IsCorePerf( - IN MEASUREMENT_RECORD *Measurement - ) -{ - BOOLEAN RetVal; - - RetVal = (BOOLEAN)( - ((Measurement->Identifier == MODULE_START_ID) || - (Measurement->Identifier == MODULE_END_ID) || - (Measurement->Identifier == MODULE_LOADIMAGE_START_ID) || - (Measurement->Identifier == MODULE_LOADIMAGE_END_ID) || - (Measurement->Identifier == MODULE_DB_START_ID) || - (Measurement->Identifier == MODULE_DB_END_ID) || - (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) || - (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID) || - (Measurement->Identifier == MODULE_DB_STOP_START_ID) || - (Measurement->Identifier == MODULE_DB_STOP_START_ID)) - ); - return RetVal; -} - -/** - Get the file name portion of the Pdb File Name. - - The portion of the Pdb File Name between the last backslash and - either a following period or the end of the string is converted - to Unicode and copied into UnicodeBuffer. The name is truncated, - if necessary, to ensure that UnicodeBuffer is not overrun. - - @param[in] PdbFileName Pdb file name. - @param[out] UnicodeBuffer The resultant Unicode File Name. - -**/ -VOID -DpGetShortPdbFileName ( - IN CHAR8 *PdbFileName, - OUT CHAR16 *UnicodeBuffer - ) -{ - UINTN IndexA; // Current work location within an ASCII string. - UINTN IndexU; // Current work location within a Unicode string. - UINTN StartIndex; - UINTN EndIndex; - - ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16)); - - if (PdbFileName == NULL) { - StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1); - } else { - StartIndex = 0; - for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) - ; - for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) { - if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) { - StartIndex = IndexA + 1; - } - - if (PdbFileName[IndexA] == '.') { - EndIndex = IndexA; - } - } - - IndexU = 0; - for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) { - UnicodeBuffer[IndexU] = (CHAR16) PdbFileName[IndexA]; - IndexU++; - if (IndexU >= DP_GAUGE_STRING_LENGTH) { - UnicodeBuffer[DP_GAUGE_STRING_LENGTH] = 0; - break; - } - } - } -} - -/** - Get a human readable name for an image handle. - The following methods will be tried orderly: - 1. Image PDB - 2. ComponentName2 protocol - 3. FFS UI section - 4. Image GUID - 5. Image DevicePath - 6. Unknown Driver Name - - @param[in] Handle - - @post The resulting Unicode name string is stored in the - mGaugeString global array. - -**/ -VOID -DpGetNameFromHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *Image; - CHAR8 *PdbFileName; - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; - EFI_STRING StringPtr; - EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_GUID *NameGuid; - CHAR16 *NameString; - UINTN StringSize; - CHAR8 *PlatformLanguage; - CHAR8 *BestLanguage; - EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2; - - Image = NULL; - LoadedImageDevicePath = NULL; - DevicePath = NULL; - - // - // Method 1: Get the name string from image PDB - // - Status = gBS->HandleProtocol ( - Handle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &Image - ); - - if (EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - Handle, - &gEfiDriverBindingProtocolGuid, - (VOID **) &DriverBinding, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - Status = gBS->HandleProtocol ( - DriverBinding->ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &Image - ); - } - } - - if (!EFI_ERROR (Status)) { - PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase); - - if (PdbFileName != NULL) { - DpGetShortPdbFileName (PdbFileName, mGaugeString); - return; - } - } - - // - // Method 2: Get the name string from ComponentName2 protocol - // - Status = gBS->HandleProtocol ( - Handle, - &gEfiComponentName2ProtocolGuid, - (VOID **) &ComponentName2 - ); - if (!EFI_ERROR (Status)) { - // - // Firstly use platform language setting, secondly use driver's first supported language. - // - GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&PlatformLanguage, NULL); - BestLanguage = GetBestLanguage( - ComponentName2->SupportedLanguages, - FALSE, - (PlatformLanguage != NULL) ? PlatformLanguage : "", - ComponentName2->SupportedLanguages, - NULL - ); - SHELL_FREE_NON_NULL (PlatformLanguage); - - Status = ComponentName2->GetDriverName ( - ComponentName2, - BestLanguage != NULL ? BestLanguage : "en-US", - &StringPtr - ); - if (!EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (BestLanguage); - StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr, DP_GAUGE_STRING_LENGTH); - mGaugeString[DP_GAUGE_STRING_LENGTH] = 0; - return; - } - } - - Status = gBS->HandleProtocol ( - Handle, - &gEfiLoadedImageDevicePathProtocolGuid, - (VOID **) &LoadedImageDevicePath - ); - if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) { - DevicePath = LoadedImageDevicePath; - } else if (Image != NULL) { - DevicePath = Image->FilePath; - } - - if (DevicePath != NULL) { - // - // Try to get image GUID from image DevicePath - // - NameGuid = NULL; - while (!IsDevicePathEndType (DevicePath)) { - NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath); - if (NameGuid != NULL) { - break; - } - DevicePath = NextDevicePathNode (DevicePath); - } - - if (NameGuid != NULL) { - // - // Try to get the image's FFS UI section by image GUID - // - NameString = NULL; - StringSize = 0; - Status = GetSectionFromAnyFv ( - NameGuid, - EFI_SECTION_USER_INTERFACE, - 0, - (VOID **) &NameString, - &StringSize - ); - - if (!EFI_ERROR (Status)) { - // - // Method 3. Get the name string from FFS UI section - // - StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString, DP_GAUGE_STRING_LENGTH); - mGaugeString[DP_GAUGE_STRING_LENGTH] = 0; - FreePool (NameString); - } else { - // - // Method 4: Get the name string from image GUID - // - UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid); - } - return; - } else { - // - // Method 5: Get the name string from image DevicePath - // - NameString = ConvertDevicePathToText (DevicePath, TRUE, FALSE); - if (NameString != NULL) { - StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString, DP_GAUGE_STRING_LENGTH); - mGaugeString[DP_GAUGE_STRING_LENGTH] = 0; - FreePool (NameString); - return; - } - } - } - - // - // Method 6: Unknown Driver Name - // - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL); - ASSERT (StringPtr != NULL); - StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr, DP_GAUGE_STRING_LENGTH); - FreePool (StringPtr); -} - -/** - Calculate the Duration in microseconds. - - Duration is multiplied by 1000, instead of Frequency being divided by 1000 or - multiplying the result by 1000, in order to maintain precision. Since Duration is - a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow. - - The time is calculated as (Duration * 1000) / Timer_Frequency. - - @param[in] Duration The event duration in timer ticks. - - @return A 64-bit value which is the Elapsed time in microseconds. -**/ -UINT64 -DurationInMicroSeconds ( - IN UINT64 Duration - ) -{ - return DivU64x32 (Duration, 1000); -} - -/** - Get index of Measurement Record's match in the CumData array. - - If the Measurement's Token value matches a Token in one of the CumData - records, the index of the matching record is returned. The returned - index is a signed value so that negative values can indicate that - the Measurement didn't match any entry in the CumData array. - - @param[in] Measurement A pointer to a Measurement Record to match against the CumData array. - - @retval <0 Token is not in the CumData array. - @retval >=0 Return value is the index into CumData where Token is found. -**/ -INTN -GetCumulativeItem( - IN MEASUREMENT_RECORD *Measurement - ) -{ - INTN Index; - - for( Index = 0; Index < (INTN)NumCum; ++Index) { - if (AsciiStrCmp (Measurement->Token, CumData[Index].Name) == 0) { - return Index; // Exit, we found a match - } - } - // If the for loop exits, Token was not found. - return -1; // Indicate failure -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c deleted file mode 100644 index ea8f1a0..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c +++ /dev/null @@ -1,28 +0,0 @@ -/** @file - Definitions of ASCII string literals used by DP. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#include - -// ASCII String literals which probably don't need translation -CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n"; -CHAR8 const ALit_SEC[] = SEC_TOK; -CHAR8 const ALit_DXE[] = DXE_TOK; -CHAR8 const ALit_PEI[] = PEI_TOK; -CHAR8 const ALit_BDS[] = BDS_TOK; -CHAR8 const ALit_START_IMAGE[] = START_IMAGE_TOK; -CHAR8 const ALit_LOAD_IMAGE[] = LOAD_IMAGE_TOK; -CHAR8 const ALit_DB_START[] = DRIVERBINDING_START_TOK; -CHAR8 const ALit_DB_SUPPORT[] = DRIVERBINDING_SUPPORT_TOK; -CHAR8 const ALit_DB_STOP[] = DRIVERBINDING_STOP_TOK; - -CHAR8 const ALit_BdsTO[] = "BdsTimeOut"; -CHAR8 const ALit_PEIM[] = "PEIM"; diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h deleted file mode 100644 index a46304d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - Declarations of ASCII string literals used by DP. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#ifndef _LITERALS_H_ -#define _LITERALS_H_ - -// ASCII String literals which probably don't need translation -extern CHAR8 const ALit_TimerLibError[]; -extern CHAR8 const ALit_SEC[]; -extern CHAR8 const ALit_DXE[]; -extern CHAR8 const ALit_SHELL[]; -extern CHAR8 const ALit_PEI[]; -extern CHAR8 const ALit_BDS[]; -extern CHAR8 const ALit_PEIM[]; -extern CHAR8 const ALit_START_IMAGE[]; -extern CHAR8 const ALit_LOAD_IMAGE[]; -extern CHAR8 const ALit_DB_START[]; -extern CHAR8 const ALit_DB_SUPPORT[]; -extern CHAR8 const ALit_DB_STOP[]; -extern CHAR8 const ALit_BdsTO[]; -extern CHAR8 const ALit_PEIM[]; - -#endif // _LITERALS_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c deleted file mode 100644 index bc29249..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ /dev/null @@ -1,1135 +0,0 @@ -/** @file - The implementation for the 'tftp' Shell command. - - Copyright (c) 2015, ARM Ltd. All rights reserved.
- Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Tftp.h" - -#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32 -EFI_HANDLE mTftpHiiHandle; - -/* - Constant strings and definitions related to the message indicating the amount of - progress in the dowloading of a TFTP file. -*/ - -// Frame for the progression slider -STATIC CONST CHAR16 mTftpProgressFrame[] = L"[ ]"; - -// Number of steps in the progression slider -#define TFTP_PROGRESS_SLIDER_STEPS ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3) - -// Size in number of characters plus one (final zero) of the message to -// indicate the progress of a TFTP download. The format is "[(progress slider: -// 40 characters)] (nb of KBytes downloaded so far: 7 characters) Kb". There -// are thus the number of characters in mTftpProgressFrame[] plus 11 characters -// (2 // spaces, "Kb" and seven characters for the number of KBytes). -#define TFTP_PROGRESS_MESSAGE_SIZE ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) + 12) - -// String to delete the TFTP progress message to be able to update it : -// (TFTP_PROGRESS_MESSAGE_SIZE-1) '\b' -STATIC CONST CHAR16 mTftpProgressDelete[] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; - -// Local File Handle -SHELL_FILE_HANDLE mFileHandle; - -// Path of the local file, Unicode encoded -CONST CHAR16 *mLocalFilePath; - -/** - Check and convert the UINT16 option values of the 'tftp' command - - @param[in] ValueStr Value as an Unicode encoded string - @param[out] Value UINT16 value - - @return TRUE The value was returned. - @return FALSE A parsing error occured. -**/ -STATIC -BOOLEAN -StringToUint16 ( - IN CONST CHAR16 *ValueStr, - OUT UINT16 *Value - ); - -/** - Get the name of the NIC. - - @param[in] ControllerHandle The network physical device handle. - @param[in] NicNumber The network physical device number. - @param[out] NicName Address where to store the NIC name. - The memory area has to be at least - IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH - double byte wide. - - @return EFI_SUCCESS The name of the NIC was returned. - @return Others The creation of the child for the Managed - Network Service failed or the opening of - the Managed Network Protocol failed or - the operational parameters for the - Managed Network Protocol could not be - read. -**/ -STATIC -EFI_STATUS -GetNicName ( - IN EFI_HANDLE ControllerHandle, - IN UINTN NicNumber, - OUT CHAR16 *NicName - ); - -/** - Create a child for the service identified by its service binding protocol GUID - and get from the child the interface of the protocol identified by its GUID. - - @param[in] ControllerHandle Controller handle. - @param[in] ServiceBindingProtocolGuid Service binding protocol GUID of the - service to be created. - @param[in] ProtocolGuid GUID of the protocol to be open. - @param[out] ChildHandle Address where the handler of the - created child is returned. NULL is - returned in case of error. - @param[out] Interface Address where a pointer to the - protocol interface is returned in - case of success. - - @return EFI_SUCCESS The child was created and the protocol opened. - @return Others Either the creation of the child or the opening - of the protocol failed. -**/ -STATIC -EFI_STATUS -CreateServiceChildAndOpenProtocol ( - IN EFI_HANDLE ControllerHandle, - IN EFI_GUID *ServiceBindingProtocolGuid, - IN EFI_GUID *ProtocolGuid, - OUT EFI_HANDLE *ChildHandle, - OUT VOID **Interface - ); - -/** - Close the protocol identified by its GUID on the child handle of the service - identified by its service binding protocol GUID, then destroy the child - handle. - - @param[in] ControllerHandle Controller handle. - @param[in] ServiceBindingProtocolGuid Service binding protocol GUID of the - service to be destroyed. - @param[in] ProtocolGuid GUID of the protocol to be closed. - @param[in] ChildHandle Handle of the child to be destroyed. - -**/ -STATIC -VOID -CloseProtocolAndDestroyServiceChild ( - IN EFI_HANDLE ControllerHandle, - IN EFI_GUID *ServiceBindingProtocolGuid, - IN EFI_GUID *ProtocolGuid, - IN EFI_HANDLE ChildHandle - ); - -/** - Worker function that gets the size in numbers of bytes of a file from a TFTP - server before to download the file. - - @param[in] Mtftp4 MTFTP4 protocol interface - @param[in] FilePath Path of the file, ASCII encoded - @param[out] FileSize Address where to store the file size in number of - bytes. - - @retval EFI_SUCCESS The size of the file was returned. - @retval EFI_UNSUPPORTED The server does not support the "tsize" option. - @retval Others Error when retrieving the information from the server - (see EFI_MTFTP4_PROTOCOL.GetInfo() status codes) - or error when parsing the response of the server. -**/ -STATIC -EFI_STATUS -GetFileSize ( - IN EFI_MTFTP4_PROTOCOL *Mtftp4, - IN CONST CHAR8 *FilePath, - OUT UINTN *FileSize - ); - -/** - Worker function that download the data of a file from a TFTP server given - the path of the file and its size. - - @param[in] Mtftp4 MTFTP4 protocol interface - @param[in] FilePath Path of the file, Unicode encoded - @param[in] AsciiFilePath Path of the file, ASCII encoded - @param[in] FileSize Size of the file in number of bytes - @param[in] BlockSize Value of the TFTP blksize option - @param[in] WindowSize Value of the TFTP window size option - - @retval EFI_SUCCESS The file was downloaded. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval Others The downloading of the file from the server failed - (see EFI_MTFTP4_PROTOCOL.ReadFile() status codes). - -**/ -STATIC -EFI_STATUS -DownloadFile ( - IN EFI_MTFTP4_PROTOCOL *Mtftp4, - IN CONST CHAR16 *FilePath, - IN CONST CHAR8 *AsciiFilePath, - IN UINTN FileSize, - IN UINT16 BlockSize, - IN UINT16 WindowSize - ); - -/** - Update the progress of a file download - This procedure is called each time a new TFTP packet is received. - - @param[in] This MTFTP4 protocol interface - @param[in] Token Parameters for the download of the file - @param[in] PacketLen Length of the packet - @param[in] Packet Address of the packet - - @retval EFI_SUCCESS All packets are accepted. - -**/ -STATIC -EFI_STATUS -EFIAPI -CheckPacket ( - IN EFI_MTFTP4_PROTOCOL *This, - IN EFI_MTFTP4_TOKEN *Token, - IN UINT16 PacketLen, - IN EFI_MTFTP4_PACKET *Packet - ); - -EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = { - TRUE, // Use default setting - { { 0, 0, 0, 0 } }, // StationIp - Not relevant as UseDefaultSetting=TRUE - { { 0, 0, 0, 0 } }, // SubnetMask - Not relevant as UseDefaultSetting=TRUE - 0, // LocalPort - Automatically assigned port number. - { { 0, 0, 0, 0 } }, // GatewayIp - Not relevant as UseDefaultSetting=TRUE - { { 0, 0, 0, 0 } }, // ServerIp - Not known yet - 69, // InitialServerPort - Standard TFTP server port - 6, // TryCount - The number of times to transmit request packets and wait for a response. - 4 // TimeoutValue - Retransmission timeout in seconds. -}; - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-i", TypeValue}, - {L"-l", TypeValue}, - {L"-r", TypeValue}, - {L"-c", TypeValue}, - {L"-t", TypeValue}, - {L"-s", TypeValue}, - {L"-w", TypeValue}, - {NULL , TypeMax} - }; - -/// -/// The default block size (512) of tftp is defined in the RFC1350. -/// -#define MTFTP_DEFAULT_BLKSIZE 512 -/// -/// The valid range of block size option is defined in the RFC2348. -/// -#define MTFTP_MIN_BLKSIZE 8 -#define MTFTP_MAX_BLKSIZE 65464 -/// -/// The default windowsize (1) of tftp. -/// -#define MTFTP_DEFAULT_WINDOWSIZE 1 -/// -/// The valid range of window size option. -/// Note that: RFC 7440 does not mention max window size value, but for the -/// stability reason, the value is limited to 64. -/// -#define MTFTP_MIN_WINDOWSIZE 1 -#define MTFTP_MAX_WINDOWSIZE 64 - -/** - Function for 'tftp' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @return SHELL_SUCCESS The 'tftp' command completed successfully. - @return SHELL_ABORTED The Shell Library initialization failed. - @return SHELL_INVALID_PARAMETER At least one of the command's arguments is - not valid. - @return SHELL_OUT_OF_RESOURCES A memory allocation failed. - @return SHELL_NOT_FOUND Network Interface Card not found or server - error or file error. - -**/ -SHELL_STATUS -RunTftp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - SHELL_STATUS ShellStatus; - EFI_STATUS Status; - LIST_ENTRY *CheckPackage; - CHAR16 *ProblemParam; - UINTN ParamCount; - CONST CHAR16 *UserNicName; - BOOLEAN NicFound; - CONST CHAR16 *ValueStr; - CONST CHAR16 *RemoteFilePath; - CHAR8 *AsciiRemoteFilePath; - UINTN FilePathSize; - CONST CHAR16 *Walker; - EFI_MTFTP4_CONFIG_DATA Mtftp4ConfigData; - EFI_HANDLE *Handles; - UINTN HandleCount; - UINTN NicNumber; - CHAR16 NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH]; - EFI_HANDLE ControllerHandle; - EFI_HANDLE Mtftp4ChildHandle; - EFI_MTFTP4_PROTOCOL *Mtftp4; - UINTN FileSize; - UINT16 BlockSize; - UINT16 WindowSize; - - ShellStatus = SHELL_INVALID_PARAMETER; - ProblemParam = NULL; - NicFound = FALSE; - AsciiRemoteFilePath = NULL; - Handles = NULL; - FileSize = 0; - BlockSize = MTFTP_DEFAULT_BLKSIZE; - WindowSize = MTFTP_DEFAULT_WINDOWSIZE; - - // - // Initialize the Shell library (we must be in non-auto-init...) - // - Status = ShellInitialize (); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return SHELL_ABORTED; - } - - // - // Parse the command line. - // - Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE); - if (EFI_ERROR (Status)) { - if ((Status == EFI_VOLUME_CORRUPTED) && - (ProblemParam != NULL) ) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle, - L"tftp", ProblemParam - ); - FreePool (ProblemParam); - } else { - ASSERT (FALSE); - } - goto Error; - } - - // - // Check the number of parameters - // - ParamCount = ShellCommandLineGetCount (CheckPackage); - if (ParamCount > 4) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), - mTftpHiiHandle, L"tftp" - ); - goto Error; - } - if (ParamCount < 3) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), - mTftpHiiHandle, L"tftp" - ); - goto Error; - } - - CopyMem (&Mtftp4ConfigData, &DefaultMtftp4ConfigData, sizeof (EFI_MTFTP4_CONFIG_DATA)); - - // - // Check the host IPv4 address - // - ValueStr = ShellCommandLineGetRawValue (CheckPackage, 1); - Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - mTftpHiiHandle, L"tftp", ValueStr - ); - goto Error; - } - - RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2); - ASSERT(RemoteFilePath != NULL); - FilePathSize = StrLen (RemoteFilePath) + 1; - AsciiRemoteFilePath = AllocatePool (FilePathSize); - if (AsciiRemoteFilePath == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Error; - } - UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize); - - if (ParamCount == 4) { - mLocalFilePath = ShellCommandLineGetRawValue (CheckPackage, 3); - } else { - Walker = RemoteFilePath + StrLen (RemoteFilePath); - while ((--Walker) >= RemoteFilePath) { - if ((*Walker == L'\\') || - (*Walker == L'/' ) ) { - break; - } - } - mLocalFilePath = Walker + 1; - } - - // - // Get the name of the Network Interface Card to be used if any. - // - UserNicName = ShellCommandLineGetValue (CheckPackage, L"-i"); - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-l"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.LocalPort)) { - goto Error; - } - } - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-r"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.InitialServerPort)) { - goto Error; - } - } - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-c"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TryCount)) { - goto Error; - } - - if (Mtftp4ConfigData.TryCount == 0) { - Mtftp4ConfigData.TryCount = 6; - } - } - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-t"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) { - goto Error; - } - if (Mtftp4ConfigData.TimeoutValue == 0) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - mTftpHiiHandle, L"tftp", ValueStr - ); - goto Error; - } - } - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &BlockSize)) { - goto Error; - } - if (BlockSize < MTFTP_MIN_BLKSIZE || BlockSize > MTFTP_MAX_BLKSIZE) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - mTftpHiiHandle, L"tftp", ValueStr - ); - goto Error; - } - } - - ValueStr = ShellCommandLineGetValue (CheckPackage, L"-w"); - if (ValueStr != NULL) { - if (!StringToUint16 (ValueStr, &WindowSize)) { - goto Error; - } - if (WindowSize < MTFTP_MIN_WINDOWSIZE || WindowSize > MTFTP_MAX_WINDOWSIZE) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - mTftpHiiHandle, L"tftp", ValueStr - ); - goto Error; - } - } - - // - // Locate all MTFTP4 Service Binding protocols - // - ShellStatus = SHELL_NOT_FOUND; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiManagedNetworkServiceBindingProtocolGuid, - NULL, - &HandleCount, - &Handles - ); - if (EFI_ERROR (Status) || (HandleCount == 0)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NO_NIC), - mTftpHiiHandle - ); - goto Error; - } - - for (NicNumber = 0; - (NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS); - NicNumber++) { - ControllerHandle = Handles[NicNumber]; - - Status = GetNicName (ControllerHandle, NicNumber, NicName); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NAME), - mTftpHiiHandle, NicNumber, Status - ); - continue; - } - - if (UserNicName != NULL) { - if (StrCmp (NicName, UserNicName) != 0) { - continue; - } - NicFound = TRUE; - } - - Status = CreateServiceChildAndOpenProtocol ( - ControllerHandle, - &gEfiMtftp4ServiceBindingProtocolGuid, - &gEfiMtftp4ProtocolGuid, - &Mtftp4ChildHandle, - (VOID**)&Mtftp4 - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL), - mTftpHiiHandle, NicName, Status - ); - continue; - } - - Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_CONFIGURE), - mTftpHiiHandle, NicName, Status - ); - goto NextHandle; - } - - Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE), - mTftpHiiHandle, RemoteFilePath, NicName, Status - ); - goto NextHandle; - } - - Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD), - mTftpHiiHandle, RemoteFilePath, NicName, Status - ); - goto NextHandle; - } - - ShellStatus = SHELL_SUCCESS; - - NextHandle: - - CloseProtocolAndDestroyServiceChild ( - ControllerHandle, - &gEfiMtftp4ServiceBindingProtocolGuid, - &gEfiMtftp4ProtocolGuid, - Mtftp4ChildHandle - ); - } - - if ((UserNicName != NULL) && (!NicFound)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND), - mTftpHiiHandle, UserNicName - ); - } - - Error: - - ShellCommandLineFreeVarList (CheckPackage); - if (AsciiRemoteFilePath != NULL) { - FreePool (AsciiRemoteFilePath); - } - if (Handles != NULL) { - FreePool (Handles); - } - - if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR(Status))) { - ShellStatus = Status & ~MAX_BIT; - } - - return ShellStatus; -} - -/** - Check and convert the UINT16 option values of the 'tftp' command - - @param[in] ValueStr Value as an Unicode encoded string - @param[out] Value UINT16 value - - @return TRUE The value was returned. - @return FALSE A parsing error occured. -**/ -STATIC -BOOLEAN -StringToUint16 ( - IN CONST CHAR16 *ValueStr, - OUT UINT16 *Value - ) -{ - UINTN Val; - - Val = ShellStrToUintn (ValueStr); - if (Val > MAX_UINT16) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - mTftpHiiHandle, L"tftp", ValueStr - ); - return FALSE; - } - - *Value = (UINT16)Val; - return TRUE; -} - -/** - Get the name of the NIC. - - @param[in] ControllerHandle The network physical device handle. - @param[in] NicNumber The network physical device number. - @param[out] NicName Address where to store the NIC name. - The memory area has to be at least - IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH - double byte wide. - - @return EFI_SUCCESS The name of the NIC was returned. - @return Others The creation of the child for the Managed - Network Service failed or the opening of - the Managed Network Protocol failed or - the operational parameters for the - Managed Network Protocol could not be - read. -**/ -STATIC -EFI_STATUS -GetNicName ( - IN EFI_HANDLE ControllerHandle, - IN UINTN NicNumber, - OUT CHAR16 *NicName - ) -{ - EFI_STATUS Status; - EFI_HANDLE MnpHandle; - EFI_MANAGED_NETWORK_PROTOCOL *Mnp; - EFI_SIMPLE_NETWORK_MODE SnpMode; - - Status = CreateServiceChildAndOpenProtocol ( - ControllerHandle, - &gEfiManagedNetworkServiceBindingProtocolGuid, - &gEfiManagedNetworkProtocolGuid, - &MnpHandle, - (VOID**)&Mnp - ); - if (EFI_ERROR (Status)) { - goto Error; - } - - Status = Mnp->GetModeData (Mnp, NULL, &SnpMode); - if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) { - goto Error; - } - - UnicodeSPrint ( - NicName, - IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH, - SnpMode.IfType == NET_IFTYPE_ETHERNET ? - L"eth%d" : - L"unk%d" , - NicNumber - ); - - Status = EFI_SUCCESS; - -Error: - - if (MnpHandle != NULL) { - CloseProtocolAndDestroyServiceChild ( - ControllerHandle, - &gEfiManagedNetworkServiceBindingProtocolGuid, - &gEfiManagedNetworkProtocolGuid, - MnpHandle - ); - } - - return Status; -} - -/** - Create a child for the service identified by its service binding protocol GUID - and get from the child the interface of the protocol identified by its GUID. - - @param[in] ControllerHandle Controller handle. - @param[in] ServiceBindingProtocolGuid Service binding protocol GUID of the - service to be created. - @param[in] ProtocolGuid GUID of the protocol to be open. - @param[out] ChildHandle Address where the handler of the - created child is returned. NULL is - returned in case of error. - @param[out] Interface Address where a pointer to the - protocol interface is returned in - case of success. - - @return EFI_SUCCESS The child was created and the protocol opened. - @return Others Either the creation of the child or the opening - of the protocol failed. -**/ -STATIC -EFI_STATUS -CreateServiceChildAndOpenProtocol ( - IN EFI_HANDLE ControllerHandle, - IN EFI_GUID *ServiceBindingProtocolGuid, - IN EFI_GUID *ProtocolGuid, - OUT EFI_HANDLE *ChildHandle, - OUT VOID **Interface - ) -{ - EFI_STATUS Status; - - *ChildHandle = NULL; - Status = NetLibCreateServiceChild ( - ControllerHandle, - gImageHandle, - ServiceBindingProtocolGuid, - ChildHandle - ); - if (!EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - *ChildHandle, - ProtocolGuid, - Interface, - gImageHandle, - ControllerHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - NetLibDestroyServiceChild ( - ControllerHandle, - gImageHandle, - ServiceBindingProtocolGuid, - *ChildHandle - ); - *ChildHandle = NULL; - } - } - - return Status; -} - -/** - Close the protocol identified by its GUID on the child handle of the service - identified by its service binding protocol GUID, then destroy the child - handle. - - @param[in] ControllerHandle Controller handle. - @param[in] ServiceBindingProtocolGuid Service binding protocol GUID of the - service to be destroyed. - @param[in] ProtocolGuid GUID of the protocol to be closed. - @param[in] ChildHandle Handle of the child to be destroyed. - -**/ -STATIC -VOID -CloseProtocolAndDestroyServiceChild ( - IN EFI_HANDLE ControllerHandle, - IN EFI_GUID *ServiceBindingProtocolGuid, - IN EFI_GUID *ProtocolGuid, - IN EFI_HANDLE ChildHandle - ) -{ - gBS->CloseProtocol ( - ChildHandle, - ProtocolGuid, - gImageHandle, - ControllerHandle - ); - - NetLibDestroyServiceChild ( - ControllerHandle, - gImageHandle, - ServiceBindingProtocolGuid, - ChildHandle - ); -} - -/** - Worker function that gets the size in numbers of bytes of a file from a TFTP - server before to download the file. - - @param[in] Mtftp4 MTFTP4 protocol interface - @param[in] FilePath Path of the file, ASCII encoded - @param[out] FileSize Address where to store the file size in number of - bytes. - - @retval EFI_SUCCESS The size of the file was returned. - @retval EFI_UNSUPPORTED The server does not support the "tsize" option. - @retval Others Error when retrieving the information from the server - (see EFI_MTFTP4_PROTOCOL.GetInfo() status codes) - or error when parsing the response of the server. -**/ -STATIC -EFI_STATUS -GetFileSize ( - IN EFI_MTFTP4_PROTOCOL *Mtftp4, - IN CONST CHAR8 *FilePath, - OUT UINTN *FileSize - ) -{ - EFI_STATUS Status; - EFI_MTFTP4_OPTION ReqOpt[1]; - EFI_MTFTP4_PACKET *Packet; - UINT32 PktLen; - EFI_MTFTP4_OPTION *TableOfOptions; - EFI_MTFTP4_OPTION *Option; - UINT32 OptCnt; - UINT8 OptBuf[128]; - - ReqOpt[0].OptionStr = (UINT8*)"tsize"; - OptBuf[0] = '0'; - OptBuf[1] = 0; - ReqOpt[0].ValueStr = OptBuf; - - Status = Mtftp4->GetInfo ( - Mtftp4, - NULL, - (UINT8*)FilePath, - NULL, - 1, - ReqOpt, - &PktLen, - &Packet - ); - - if (EFI_ERROR (Status)) { - goto Error; - } - - Status = Mtftp4->ParseOptions ( - Mtftp4, - PktLen, - Packet, - (UINT32 *) &OptCnt, - &TableOfOptions - ); - if (EFI_ERROR (Status)) { - goto Error; - } - - Option = TableOfOptions; - while (OptCnt != 0) { - if (AsciiStrnCmp ((CHAR8 *)Option->OptionStr, "tsize", 5) == 0) { - *FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr); - break; - } - OptCnt--; - Option++; - } - FreePool (TableOfOptions); - - if (OptCnt == 0) { - Status = EFI_UNSUPPORTED; - } - -Error : - - return Status; -} - -/** - Worker function that download the data of a file from a TFTP server given - the path of the file and its size. - - @param[in] Mtftp4 MTFTP4 protocol interface - @param[in] FilePath Path of the file, Unicode encoded - @param[in] AsciiFilePath Path of the file, ASCII encoded - @param[in] FileSize Size of the file in number of bytes - @param[in] BlockSize Value of the TFTP blksize option - @param[in] WindowSize Value of the TFTP window size option - - @retval EFI_SUCCESS The file was downloaded. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval Others The downloading of the file from the server failed - (see EFI_MTFTP4_PROTOCOL.ReadFile() status codes). - -**/ -STATIC -EFI_STATUS -DownloadFile ( - IN EFI_MTFTP4_PROTOCOL *Mtftp4, - IN CONST CHAR16 *FilePath, - IN CONST CHAR8 *AsciiFilePath, - IN UINTN FileSize, - IN UINT16 BlockSize, - IN UINT16 WindowSize - ) -{ - EFI_STATUS Status; - DOWNLOAD_CONTEXT *TftpContext; - EFI_MTFTP4_TOKEN Mtftp4Token; - UINT8 BlksizeBuf[10]; - UINT8 WindowsizeBuf[10]; - - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); - - TftpContext = AllocatePool (sizeof (DOWNLOAD_CONTEXT)); - if (TftpContext == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Error; - } - TftpContext->FileSize = FileSize; - TftpContext->DownloadedNbOfBytes = 0; - TftpContext->LastReportedNbOfBytes = 0; - - Mtftp4Token.Filename = (UINT8*)AsciiFilePath; - Mtftp4Token.CheckPacket = CheckPacket; - Mtftp4Token.Context = (VOID*)TftpContext; - Mtftp4Token.OptionCount = 0; - Mtftp4Token.OptionList = AllocatePool (sizeof (EFI_MTFTP4_OPTION) * 2); - if (Mtftp4Token.OptionList == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Error; - } - - if (BlockSize != MTFTP_DEFAULT_BLKSIZE) { - Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "blksize"; - AsciiSPrint ((CHAR8 *) BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize); - Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = BlksizeBuf; - Mtftp4Token.OptionCount ++; - } - - if (WindowSize != MTFTP_DEFAULT_WINDOWSIZE) { - Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "windowsize"; - AsciiSPrint ((CHAR8 *) WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize); - Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = WindowsizeBuf; - Mtftp4Token.OptionCount ++; - } - - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING), - mTftpHiiHandle, FilePath - ); - - // - // OPEN FILE - // - if (!EFI_ERROR (ShellFileExists (mLocalFilePath))) { - ShellDeleteFileByName (mLocalFilePath); - } - - Status = ShellOpenFileByName ( - mLocalFilePath, - &mFileHandle, - EFI_FILE_MODE_CREATE | - EFI_FILE_MODE_WRITE | - EFI_FILE_MODE_READ, - 0 - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), - mTftpHiiHandle, L"tftp", mLocalFilePath - ); - goto Error; - } - - Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token); - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), - mTftpHiiHandle - ); - - // - // CLOSE FILE - // - ShellCloseFile (&mFileHandle); - -Error : - if (TftpContext != NULL) { - FreePool (TftpContext); - } - - if (Mtftp4Token.OptionList != NULL) { - FreePool (Mtftp4Token.OptionList); - } - - return Status; -} - -/** - Update the progress of a file download - This procedure is called each time a new TFTP packet is received. - - @param[in] This MTFTP4 protocol interface - @param[in] Token Parameters for the download of the file - @param[in] PacketLen Length of the packet - @param[in] Packet Address of the packet - - @retval EFI_SUCCESS All packets are accepted. - -**/ -STATIC -EFI_STATUS -EFIAPI -CheckPacket ( - IN EFI_MTFTP4_PROTOCOL *This, - IN EFI_MTFTP4_TOKEN *Token, - IN UINT16 PacketLen, - IN EFI_MTFTP4_PACKET *Packet - ) -{ - DOWNLOAD_CONTEXT *Context; - CHAR16 Progress[TFTP_PROGRESS_MESSAGE_SIZE]; - UINTN NbOfKb; - UINTN Index; - UINTN LastStep; - UINTN Step; - UINTN DownloadLen; - EFI_STATUS Status; - - if ((NTOHS (Packet->OpCode)) != EFI_MTFTP4_OPCODE_DATA) { - return EFI_SUCCESS; - } - - Context = (DOWNLOAD_CONTEXT*)Token->Context; - - // - // The data in the packet are prepended with two UINT16 : - // . OpCode = EFI_MTFTP4_OPCODE_DATA - // . Block = the number of this block of data - // - DownloadLen = (UINTN)PacketLen - sizeof (Packet->OpCode) - sizeof (Packet->Data.Block); - - ShellSetFilePosition(mFileHandle, Context->DownloadedNbOfBytes); - Status = ShellWriteFile (mFileHandle, &DownloadLen, Packet->Data.Data); - if (EFI_ERROR (Status)) { - if (Context->DownloadedNbOfBytes > 0) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), - mTftpHiiHandle - ); - } - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_WRITE), - mTftpHiiHandle, mLocalFilePath, Status - ); - return Status; - } - - if (Context->DownloadedNbOfBytes == 0) { - ShellPrintEx (-1, -1, L"%s 0 Kb", mTftpProgressFrame); - } - - Context->DownloadedNbOfBytes += DownloadLen; - NbOfKb = Context->DownloadedNbOfBytes / 1024; - - Progress[0] = L'\0'; - LastStep = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize; - Step = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize; - - if (Step <= LastStep) { - return EFI_SUCCESS; - } - - ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete); - - Status = StrCpyS (Progress, TFTP_PROGRESS_MESSAGE_SIZE, mTftpProgressFrame); - if (EFI_ERROR(Status)) { - return Status; - } - for (Index = 1; Index < Step; Index++) { - Progress[Index] = L'='; - } - Progress[Step] = L'>'; - - UnicodeSPrint ( - Progress + (sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 1, - sizeof (Progress) - sizeof (mTftpProgressFrame), - L" %7d Kb", - NbOfKb - ); - Context->LastReportedNbOfBytes = Context->DownloadedNbOfBytes; - - ShellPrintEx (-1, -1, L"%s", Progress); - - return EFI_SUCCESS; -} - -/** - Retrive HII package list from ImageHandle and publish to HII database. - - @param ImageHandle The image handle of the process. - - @return HII handle. -**/ -EFI_HANDLE -InitializeHiiPackage ( - EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - EFI_HII_PACKAGE_LIST_HEADER *PackageList; - EFI_HANDLE HiiHandle; - - // - // Retrieve HII package list from ImageHandle - // - Status = gBS->OpenProtocol ( - ImageHandle, - &gEfiHiiPackageListProtocolGuid, - (VOID **)&PackageList, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // Publish HII package list to HII Database. - // - Status = gHiiDatabase->NewPackageList ( - gHiiDatabase, - PackageList, - NULL, - &HiiHandle - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return NULL; - } - return HiiHandle; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h deleted file mode 100644 index 700b99f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h +++ /dev/null @@ -1,75 +0,0 @@ -/** @file - Header file for 'tftp' command functions. - - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
- Copyright (c) 2015, ARM Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _TFTP_H_ -#define _TFTP_H_ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE mTftpHiiHandle; - -typedef struct { - UINTN FileSize; - UINTN DownloadedNbOfBytes; - UINTN LastReportedNbOfBytes; -} DOWNLOAD_CONTEXT; - -/** - Function for 'tftp' command. - - @param[in] ImageHandle The image handle. - @param[in] SystemTable The system table. - - @retval SHELL_SUCCESS Command completed successfully. - @retval SHELL_INVALID_PARAMETER Command usage error. - @retval SHELL_ABORTED The user aborts the operation. - @retval value Unknown error. -**/ -SHELL_STATUS -RunTftp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Retrive HII package list from ImageHandle and publish to HII database. - - @param ImageHandle The image handle of the process. - - @return HII handle. -**/ -EFI_HANDLE -InitializeHiiPackage ( - EFI_HANDLE ImageHandle - ); -#endif // _TFTP_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni deleted file mode 100644 index a7c5883..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni +++ /dev/null @@ -1,100 +0,0 @@ -// /** -// -// (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
-// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// Tftp.uni -// -// Abstract: -// -// String definitions for UEFI Shell TFTP command -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_CRLF #language en-US "\r\n" - -#string STR_TFTP_ERR_NO_NIC #language en-US "No network interface card found.\r\n" -#string STR_TFTP_ERR_NIC_NAME #language en-US "Failed to get the name of the network interface card number %d - %r\r\n" -#string STR_TFTP_ERR_OPEN_PROTOCOL #language en-US "Unable to open MTFTP4 protocol on '%H%s%N' - %r\r\n" -#string STR_TFTP_ERR_CONFIGURE #language en-US "Unable to configure MTFTP4 protocol on '%H%s%N' - %r\r\n" -#string STR_TFTP_ERR_FILE_SIZE #language en-US "Unable to get the size of the file '%H%s%N' on '%H%s%N' - %r\r\n" -#string STR_TFTP_ERR_DOWNLOAD #language en-US "Unable to download the file '%H%s%N' on '%H%s%N' - %r\r\n" -#string STR_TFTP_ERR_WRITE #language en-US "Unable to write into file '%H%s%N' - %r\r\n" -#string STR_TFTP_ERR_NIC_NOT_FOUND #language en-US "Network Interface Card '%H%s%N' not found.\r\n" -#string STR_TFTP_DOWNLOADING #language en-US "Downloading the file '%H%s%N'\r\n" -#string STR_TFTP_STRING #language en-US "%s" - -#string STR_GET_HELP_TFTP #language en-US "" -".TH tftp 0 "Download a file from TFTP server."\r\n" -".SH NAME\r\n" -"Download a file from TFTP server.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"TFTP [-i interface] [-l ] [-r ] [-c ] [-t ]\r\n" -" [-s ] [-w ] host remotefilepath [localfilepath]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -i interface - Specifies an adapter name, i.e., eth0.\r\n" -" -l port - Specifies the local port number. Default value is 0\r\n" -" and the port number is automatically assigned.\r\n" -" -r port - Specifies the remote port number. Default value is 69.\r\n" -" -c - The number of times to transmit request packets and\r\n" -" wait for a response. The default value is 6. Set to zero\r\n" -" also means to use the default value.\r\n" -" -t - The number of seconds to wait for a response after\r\n" -" sending a request packet. Default value is 4s.\r\n" -" -s - Specifies the TFTP blksize option as defined in RFC 2348.\r\n" -" Valid range is between 8 and 65464, default value is 512.\r\n" -" -w - Specifies the TFTP windowsize option as defined in RFC 7440.\r\n" -" Valid range is between 1 and 64, default value is 1.\r\n" -" host - Specify TFTP Server IPv4 address.\r\n" -" remotefilepath - TFTP server file path to download the file.\r\n" -" localfilepath - Local destination file path.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The TFTP command allows to get the file specified by its 'remotefilepath'\r\n" -" path from the TFTP server specified by its 'host' IPv4 address. If the\r\n" -" optional 'localfilepath' parameter is provided, the downloaded file is\r\n" -" stored locally using the provided file path. If the local file path is\r\n" -" not specified, the file is stored in the current directory using the file\r\n" -" server's name.\r\n" -" 2. Before using the TFTP command, the network interface intended to be\r\n" -" used to retrieve the file must be configured. This configuration may be\r\n" -" done by means of the 'ifconfig' command.\r\n" -" 3. If a network interface is defined with the '-i' option then only this\r\n" -" interface will be used to retrieve the remote file. Otherwise, all network\r\n" -" interfaces are tried in the order they have been discovered during the\r\n" -" DXE phase.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To get the file "dir1/file1.dat" from the TFTP server 192.168.1.1 and\r\n" -" store it as file2.dat in the current directory :\r\n" -" fs0:\> tftp 192.168.1.1 dir1/file1.dat file2.dat\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c deleted file mode 100644 index 32c854c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - Entrypoint of "tftp" shell standalone application. - - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
- Copyright (c) 2015, ARM Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "Tftp.h" - -// -// String token ID of help message text. -// Shell supports to find help message in the resource section of an application image if -// .MAN file is not found. This global variable is added to make build tool recognizes -// that the help string is consumed by user and then build tool will add the string into -// the resource section. Thus the application can use '-?' option to show help message in -// Shell. -// -GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_TFTP); - -/** - Entry point of Tftp standalone application. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS Tftp command is executed sucessfully. - @retval EFI_ABORTED HII package was failed to initialize. - @retval others Other errors when executing tftp command. -**/ -EFI_STATUS -EFIAPI -TftpAppInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - mTftpHiiHandle = InitializeHiiPackage (ImageHandle); - if (mTftpHiiHandle == NULL) { - return EFI_ABORTED; - } - - Status = (EFI_STATUS)RunTftp (ImageHandle, SystemTable); - HiiRemovePackages (mTftpHiiHandle); - return Status; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf deleted file mode 100644 index c768b77..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf +++ /dev/null @@ -1,59 +0,0 @@ -## @file -# Provides Shell 'tftp' standalone application. -# -# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-# Copyright (c) 2015, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = tftp - FILE_GUID = 8DC58D0D-67F5-4B97-9DFC-E442BB9A5648 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = TftpAppInitialize -# -# This flag specifies whether HII resource section is generated into PE image. -# - UEFI_HII_RESOURCE_SECTION = TRUE - -[Sources.common] - Tftp.uni - Tftp.h - Tftp.c - TftpApp.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - UefiApplicationEntryPoint - UefiHiiServicesLib - HiiLib - FileHandleLib - NetLib - -[Protocols] - gEfiManagedNetworkServiceBindingProtocolGuid ## CONSUMES - gEfiMtftp4ServiceBindingProtocolGuid ## CONSUMES - gEfiMtftp4ProtocolGuid ## CONSUMES - gEfiHiiPackageListProtocolGuid ## CONSUMES diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c deleted file mode 100644 index 8b96901..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c +++ /dev/null @@ -1,132 +0,0 @@ -/** @file - Produce "tftp" shell dynamic command. - - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
- Copyright (c) 2015, ARM Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "Tftp.h" -#include - -/** - This is the shell command handler function pointer callback type. This - function handles the command when it is invoked in the shell. - - @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. - @param[in] SystemTable The pointer to the system table. - @param[in] ShellParameters The parameters associated with the command. - @param[in] Shell The instance of the shell protocol used in the context - of processing this command. - - @return EFI_SUCCESS the operation was sucessful - @return other the operation failed. -**/ -SHELL_STATUS -EFIAPI -TftpCommandHandler ( - IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN EFI_SYSTEM_TABLE *SystemTable, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN EFI_SHELL_PROTOCOL *Shell - ) -{ - gEfiShellParametersProtocol = ShellParameters; - gEfiShellProtocol = Shell; - return RunTftp (gImageHandle, SystemTable); -} - -/** - This is the command help handler function pointer callback type. This - function is responsible for displaying help information for the associated - command. - - @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. - @param[in] Language The pointer to the language string to use. - - @return string Pool allocated help string, must be freed by caller -**/ -CHAR16 * -EFIAPI -TftpCommandGetHelp ( - IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN CONST CHAR8 *Language - ) -{ - return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language); -} - -EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = { - L"tftp", - TftpCommandHandler, - TftpCommandGetHelp -}; - -/** - Entry point of Tftp Dynamic Command. - - Produce the DynamicCommand protocol to handle "tftp" command. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS Tftp command is executed sucessfully. - @retval EFI_ABORTED HII package was failed to initialize. - @retval others Other errors when executing tftp command. -**/ -EFI_STATUS -EFIAPI -TftpCommandInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - mTftpHiiHandle = InitializeHiiPackage (ImageHandle); - if (mTftpHiiHandle == NULL) { - return EFI_ABORTED; - } - - Status = gBS->InstallProtocolInterface ( - &ImageHandle, - &gEfiShellDynamicCommandProtocolGuid, - EFI_NATIVE_INTERFACE, - &mTftpDynamicCommand - ); - ASSERT_EFI_ERROR (Status); - return Status; -} - -/** - Tftp driver unload handler. - - @param ImageHandle The image handle of the process. - - @retval EFI_SUCCESS The image is unloaded. - @retval Others Failed to unload the image. -**/ -EFI_STATUS -EFIAPI -TftpUnload ( - IN EFI_HANDLE ImageHandle -) -{ - EFI_STATUS Status; - Status = gBS->UninstallProtocolInterface ( - ImageHandle, - &gEfiShellDynamicCommandProtocolGuid, - &mTftpDynamicCommand - ); - if (EFI_ERROR (Status)) { - return Status; - } - HiiRemovePackages (mTftpHiiHandle); - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf b/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf deleted file mode 100644 index 594a056..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +++ /dev/null @@ -1,64 +0,0 @@ -## @file -# Provides Shell 'tftp' dynamic command. -# -# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-# Copyright (c) 2015, ARM Ltd. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = tftpDynamicCommand - FILE_GUID = A487A478-51EF-48AA-8794-7BEE2A0562F1 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = TftpCommandInitialize - UNLOAD_IMAGE = TftpUnload -# -# This flag specifies whether HII resource section is generated into PE image. -# - UEFI_HII_RESOURCE_SECTION = TRUE - -[Sources.common] - Tftp.uni - Tftp.h - Tftp.c - TftpDynamicCommand.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiHiiServicesLib - HiiLib - FileHandleLib - NetLib - -[Protocols] - gEfiManagedNetworkServiceBindingProtocolGuid ## CONSUMES - gEfiMtftp4ServiceBindingProtocolGuid ## CONSUMES - gEfiMtftp4ProtocolGuid ## CONSUMES - gEfiHiiPackageListProtocolGuid ## CONSUMES - gEfiShellDynamicCommandProtocolGuid ## PRODUCES - -[DEPEX] - TRUE diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c deleted file mode 100644 index 9be6211..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ /dev/null @@ -1,3745 +0,0 @@ -/** @file - Provides interface to advanced shell functionality for parsing both handle and protocol database. - - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiHandleParsingLib.h" -#include "IndustryStandard/Acpi10.h" -#include "IndustryStandard/Pci.h" -#include -#include - -EFI_HANDLE mHandleParsingHiiHandle = NULL; -HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0}; -GUID_INFO_BLOCK *mGuidList; -UINTN mGuidListCount; - -/** - Function to find the file name associated with a LoadedImageProtocol. - - @param[in] LoadedImage An instance of LoadedImageProtocol. - - @retval A string representation of the file name associated - with LoadedImage, or NULL if no name can be found. -**/ -CHAR16* -FindLoadedImageFileName ( - IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage - ) -{ - EFI_GUID *NameGuid; - EFI_STATUS Status; - EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; - VOID *Buffer; - UINTN BufferSize; - UINT32 AuthenticationStatus; - - if ((LoadedImage == NULL) || (LoadedImage->FilePath == NULL)) { - return NULL; - } - - NameGuid = EfiGetNameGuidFromFwVolDevicePathNode((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath); - - if (NameGuid == NULL) { - return NULL; - } - - // - // Get the FirmwareVolume2Protocol of the device handle that this image was loaded from. - // - Status = gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID**) &Fv); - - // - // FirmwareVolume2Protocol is PI, and is not required to be available. - // - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // Read the user interface section of the image. - // - Buffer = NULL; - Status = Fv->ReadSection(Fv, NameGuid, EFI_SECTION_USER_INTERFACE, 0, &Buffer, &BufferSize, &AuthenticationStatus); - - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // ReadSection returns just the section data, without any section header. For - // a user interface section, the only data is the file name. - // - return Buffer; -} - -/** - Function to translate the EFI_MEMORY_TYPE into a string. - - @param[in] Memory The memory type. - - @retval A string representation of the type allocated from BS Pool. -**/ -CHAR16* -ConvertMemoryType ( - IN CONST EFI_MEMORY_TYPE Memory - ) -{ - CHAR16 *RetVal; - RetVal = NULL; - - switch (Memory) { - case EfiReservedMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiReservedMemoryType", 0); break; - case EfiLoaderCode: StrnCatGrow(&RetVal, NULL, L"EfiLoaderCode", 0); break; - case EfiLoaderData: StrnCatGrow(&RetVal, NULL, L"EfiLoaderData", 0); break; - case EfiBootServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesCode", 0); break; - case EfiBootServicesData: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesData", 0); break; - case EfiRuntimeServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesCode", 0); break; - case EfiRuntimeServicesData: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesData", 0); break; - case EfiConventionalMemory: StrnCatGrow(&RetVal, NULL, L"EfiConventionalMemory", 0); break; - case EfiUnusableMemory: StrnCatGrow(&RetVal, NULL, L"EfiUnusableMemory", 0); break; - case EfiACPIReclaimMemory: StrnCatGrow(&RetVal, NULL, L"EfiACPIReclaimMemory", 0); break; - case EfiACPIMemoryNVS: StrnCatGrow(&RetVal, NULL, L"EfiACPIMemoryNVS", 0); break; - case EfiMemoryMappedIO: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIO", 0); break; - case EfiMemoryMappedIOPortSpace: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0); break; - case EfiPalCode: StrnCatGrow(&RetVal, NULL, L"EfiPalCode", 0); break; - case EfiMaxMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiMaxMemoryType", 0); break; - default: ASSERT(FALSE); - } - return (RetVal); -} - -/** - Function to translate the EFI_GRAPHICS_PIXEL_FORMAT into a string. - - @param[in] Fmt The format type. - - @retval A string representation of the type allocated from BS Pool. -**/ -CHAR16* -ConvertPixelFormat ( - IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt - ) -{ - CHAR16 *RetVal; - RetVal = NULL; - - switch (Fmt) { - case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0); break; - case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0); break; - case PixelBitMask: StrnCatGrow(&RetVal, NULL, L"PixelBitMask", 0); break; - case PixelBltOnly: StrnCatGrow(&RetVal, NULL, L"PixelBltOnly", 0); break; - case PixelFormatMax: StrnCatGrow(&RetVal, NULL, L"PixelFormatMax", 0); break; - default: ASSERT(FALSE); - } - return (RetVal); -} - -/** - Constructor for the library. - - @param[in] ImageHandle Ignored. - @param[in] SystemTable Ignored. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -HandleParsingLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - mGuidListCount = 0; - mGuidList = NULL; - - // - // Do nothing with mHandleParsingHiiHandle. Initialize HII as needed. - // - return (EFI_SUCCESS); -} - -/** - Initialization function for HII packages. - -**/ -VOID -HandleParsingHiiInit (VOID) -{ - if (mHandleParsingHiiHandle == NULL) { - mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL); - ASSERT (mHandleParsingHiiHandle != NULL); - } -} - -/** - Destructor for the library. free any resources. - - @param[in] ImageHandle Ignored. - @param[in] SystemTable Ignored. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -HandleParsingLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINTN LoopCount; - - for (LoopCount = 0; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++) { - SHELL_FREE_NON_NULL(mGuidList[LoopCount].GuidId); - } - - SHELL_FREE_NON_NULL(mGuidList); - if (mHandleParsingHiiHandle != NULL) { - HiiRemovePackages(mHandleParsingHiiHandle); - } - return (EFI_SUCCESS); -} - -/** - Function to dump information about LoadedImage. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has LoadedImage installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -LoadedImageProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR16 *Temp; - CHAR16 *FileName; - CHAR8 *PdbFileName; - CHAR16 *FilePath; - CHAR16 *CodeType; - CHAR16 *DataType; - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return NULL; - } - - FileName = FindLoadedImageFileName(LoadedImage); - FilePath = ConvertDevicePathToText(LoadedImage->FilePath, TRUE, TRUE); - if (!Verbose) { - if (FileName == NULL) { - FileName = FilePath; - } else { - SHELL_FREE_NON_NULL(FilePath); - } - return FileName; - } - - HandleParsingHiiInit(); - RetVal = NULL; - if (FileName != NULL) { - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_NAME), NULL); - - if (Temp != NULL) { - RetVal = CatSPrint(NULL, Temp, FileName); - } - - SHELL_FREE_NON_NULL(Temp); - SHELL_FREE_NON_NULL(FileName); - } - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL); - if (Temp == NULL) { - return NULL; - } - PdbFileName = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase); - DataType = ConvertMemoryType(LoadedImage->ImageDataType); - CodeType = ConvertMemoryType(LoadedImage->ImageCodeType); - - RetVal = CatSPrint( - RetVal, - Temp, - LoadedImage->Revision, - LoadedImage->ParentHandle, - LoadedImage->SystemTable, - LoadedImage->DeviceHandle, - FilePath, - PdbFileName, - LoadedImage->LoadOptionsSize, - LoadedImage->LoadOptions, - LoadedImage->ImageBase, - LoadedImage->ImageSize, - CodeType, - DataType, - LoadedImage->Unload - ); - - - SHELL_FREE_NON_NULL(Temp); - SHELL_FREE_NON_NULL(FilePath); - SHELL_FREE_NON_NULL(CodeType); - SHELL_FREE_NON_NULL(DataType); - - return RetVal; -} - -/** - Function to dump information about GOP. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has LoadedImage installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -GraphicsOutputProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR16 *Temp; - CHAR16 *Fmt; - CHAR16 *TempRetVal; - UINTN GopInfoSize; - UINT32 Mode; - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopInfo; - - if (!Verbose) { - return (CatSPrint(NULL, L"GraphicsOutput")); - } - - HandleParsingHiiInit(); - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL); - if (Temp == NULL) { - return NULL; - } - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiGraphicsOutputProtocolGuid, - (VOID**)&GraphicsOutput, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (Temp); - return NULL; - } - - Fmt = ConvertPixelFormat(GraphicsOutput->Mode->Info->PixelFormat); - - RetVal = CatSPrint( - NULL, - Temp, - GraphicsOutput->Mode->MaxMode, - GraphicsOutput->Mode->Mode, - GraphicsOutput->Mode->FrameBufferBase, - (UINT64)GraphicsOutput->Mode->FrameBufferSize, - (UINT64)GraphicsOutput->Mode->SizeOfInfo, - GraphicsOutput->Mode->Info->Version, - GraphicsOutput->Mode->Info->HorizontalResolution, - GraphicsOutput->Mode->Info->VerticalResolution, - Fmt, - GraphicsOutput->Mode->Info->PixelsPerScanLine, - GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.RedMask, - GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.GreenMask, - GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask - ); - - SHELL_FREE_NON_NULL (Temp); - - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_MAIN), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL (RetVal); - goto EXIT; - } - - TempRetVal = CatSPrint (RetVal, Temp); - SHELL_FREE_NON_NULL (RetVal); - if (TempRetVal == NULL) { - goto EXIT; - } - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (Temp); - - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_ENTRY), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL (RetVal); - goto EXIT; - } - - - for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) { - Status = GraphicsOutput->QueryMode ( - GraphicsOutput, - Mode, - &GopInfoSize, - &GopInfo - ); - if (EFI_ERROR (Status)) { - continue; - } - - TempRetVal = CatSPrint ( - RetVal, - Temp, - Mode, - GopInfo->HorizontalResolution, - GopInfo->VerticalResolution - ); - - SHELL_FREE_NON_NULL (GopInfo); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } - - -EXIT: - SHELL_FREE_NON_NULL(Temp); - SHELL_FREE_NON_NULL(Fmt); - - return RetVal; -} - -/** - Function to dump information about EDID Discovered Protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has LoadedImage installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -EdidDiscoveredProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR16 *Temp; - CHAR16 *TempRetVal; - - if (!Verbose) { - return (CatSPrint (NULL, L"EDIDDiscovered")); - } - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiEdidDiscoveredProtocolGuid, - (VOID**)&EdidDiscovered, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return NULL; - } - - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_DISCOVERED_MAIN), NULL); - if (Temp == NULL) { - return NULL; - } - - RetVal = CatSPrint (NULL, Temp, EdidDiscovered->SizeOfEdid); - SHELL_FREE_NON_NULL (Temp); - - if (EdidDiscovered->SizeOfEdid != 0) { - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_DISCOVERED_DATA), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL (RetVal); - return NULL; - } - TempRetVal = CatSPrint (RetVal, Temp); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - - TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidDiscovered->SizeOfEdid, EdidDiscovered->Edid); - RetVal = TempRetVal; - } - return RetVal; -} - -/** - Function to dump information about EDID Active Protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has LoadedImage installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -EdidActiveProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_EDID_ACTIVE_PROTOCOL *EdidActive; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR16 *Temp; - CHAR16 *TempRetVal; - - if (!Verbose) { - return (CatSPrint (NULL, L"EDIDActive")); - } - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiEdidActiveProtocolGuid, - (VOID**)&EdidActive, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return NULL; - } - - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_ACTIVE_MAIN), NULL); - if (Temp == NULL) { - return NULL; - } - - RetVal = CatSPrint (NULL, Temp, EdidActive->SizeOfEdid); - SHELL_FREE_NON_NULL (Temp); - - if (EdidActive->SizeOfEdid != 0) { - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_EDID_ACTIVE_DATA), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL (RetVal); - return NULL; - } - TempRetVal = CatSPrint (RetVal, Temp); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - - TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidActive->SizeOfEdid, EdidActive->Edid); - RetVal = TempRetVal; - } - return RetVal; -} - -/** - Function to dump information about PciRootBridgeIo. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has PciRootBridgeIo installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -PciRootBridgeIoDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration; - UINT64 Supports; - UINT64 Attributes; - CHAR16 *Temp; - CHAR16 *Temp2; - CHAR16 *RetVal; - EFI_STATUS Status; - - RetVal = NULL; - - if (!Verbose) { - return (CatSPrint(NULL, L"PciRootBridgeIo")); - } - - HandleParsingHiiInit(); - - Status = gBS->HandleProtocol( - TheHandle, - &gEfiPciRootBridgeIoProtocolGuid, - (VOID**)&PciRootBridgeIo); - - if (EFI_ERROR(Status)) { - return NULL; - } - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_PH), NULL); - if (Temp == NULL) { - return NULL; - } - Temp2 = CatSPrint(NULL, Temp, PciRootBridgeIo->ParentHandle); - FreePool(Temp); - RetVal = Temp2; - Temp2 = NULL; - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SEG), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL(RetVal); - return NULL; - } - Temp2 = CatSPrint(RetVal, Temp, PciRootBridgeIo->SegmentNumber); - FreePool(Temp); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - - Supports = 0; - Attributes = 0; - Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes); - if (!EFI_ERROR(Status)) { - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_ATT), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL(RetVal); - return NULL; - } - Temp2 = CatSPrint(RetVal, Temp, Attributes); - FreePool(Temp); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SUPPORTS), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL(RetVal); - return NULL; - } - Temp2 = CatSPrint(RetVal, Temp, Supports); - FreePool(Temp); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - } - - Configuration = NULL; - Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Configuration); - if (!EFI_ERROR(Status) && Configuration != NULL) { - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_TITLE), NULL); - if (Temp == NULL) { - SHELL_FREE_NON_NULL(RetVal); - return NULL; - } - Temp2 = CatSPrint(RetVal, Temp, Supports); - FreePool(Temp); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { - Temp = NULL; - switch (Configuration->ResType) { - case ACPI_ADDRESS_SPACE_TYPE_MEM: - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_MEM), NULL); - break; - case ACPI_ADDRESS_SPACE_TYPE_IO: - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_IO), NULL); - break; - case ACPI_ADDRESS_SPACE_TYPE_BUS: - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_BUS), NULL); - break; - } - if (Temp != NULL) { - Temp2 = CatSPrint(RetVal, L"\r\n%s", Temp); - FreePool(Temp); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - } - - Temp2 = CatSPrint(RetVal, - L"%%H%02x %016lx %016lx %02x%%N", - Configuration->SpecificFlag, - Configuration->AddrRangeMin, - Configuration->AddrRangeMax, - Configuration->AddrSpaceGranularity - ); - FreePool(RetVal); - RetVal = Temp2; - Temp2 = NULL; - Configuration++; - } - } - return (RetVal); -} - -/** - Function to dump information about SimpleTextOut. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has SimpleTextOut installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -TxtOutProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Dev; - INTN Index; - UINTN Col; - UINTN Row; - EFI_STATUS Status; - CHAR16 *RetVal; - UINTN Size; - CHAR16 *Temp; - UINTN NewSize; - - if (!Verbose) { - return (NULL); - } - - HandleParsingHiiInit(); - - RetVal = NULL; - Size = 0; - - Status = gBS->HandleProtocol( - TheHandle, - &gEfiSimpleTextOutProtocolGuid, - (VOID**)&Dev); - - ASSERT_EFI_ERROR(Status); - ASSERT (Dev != NULL && Dev->Mode != NULL); - - Size = (Dev->Mode->MaxMode + 1) * 80; - RetVal = AllocateZeroPool(Size); - - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_TXT_OUT_DUMP_HEADER), NULL); - if (Temp != NULL) { - UnicodeSPrint(RetVal, Size, Temp, Dev, Dev->Mode->Attribute); - FreePool(Temp); - } - - // - // Dump TextOut Info - // - Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_TXT_OUT_DUMP_LINE), NULL); - for (Index = 0; Index < Dev->Mode->MaxMode; Index++) { - Status = Dev->QueryMode (Dev, Index, &Col, &Row); - NewSize = Size - StrSize(RetVal); - UnicodeSPrint( - RetVal + StrLen(RetVal), - NewSize, - Temp == NULL?L"":Temp, - Index == Dev->Mode->Mode ? L'*' : L' ', - Index, - !EFI_ERROR(Status)?(INTN)Col:-1, - !EFI_ERROR(Status)?(INTN)Row:-1 - ); - } - FreePool(Temp); - return (RetVal); -} - -STATIC CONST UINTN VersionStringSize = 60; - -/** - Function to dump information about EfiDriverSupportedEfiVersion protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -DriverEfiVersionProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL *DriverEfiVersion; - EFI_STATUS Status; - CHAR16 *RetVal; - - Status = gBS->HandleProtocol( - TheHandle, - &gEfiDriverSupportedEfiVersionProtocolGuid, - (VOID**)&DriverEfiVersion); - - ASSERT_EFI_ERROR(Status); - - RetVal = AllocateZeroPool(VersionStringSize); - if (RetVal != NULL) { - UnicodeSPrint (RetVal, VersionStringSize, L"0x%08x", DriverEfiVersion->FirmwareVersion); - } - return (RetVal); -} -/** - Function to convert device path to string. - - This will allocate the return buffer from boot services pool. - - @param[in] DevPath Pointer to device path instance. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - @param[in] Length Maximum allowed text length of the device path. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -ConvertDevicePathToShortText( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath, - IN CONST BOOLEAN Verbose, - IN CONST UINTN Length - ) -{ - CHAR16 *Temp; - CHAR16 *Temp2; - UINTN Size; - - // - // I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line) - // - Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE); - if (!Verbose && Temp != NULL && StrLen(Temp) > Length) { - Temp2 = NULL; - Size = 0; - Temp2 = StrnCatGrow(&Temp2, &Size, L"..", 0); - Temp2 = StrnCatGrow(&Temp2, &Size, Temp+(StrLen(Temp) - (Length - 2)), 0); - FreePool(Temp); - Temp = Temp2; - } - return (Temp); -} - -/** - Function to dump protocol information. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - @param[in] Protocol The protocol is needed to dump. - - @retval A pointer to a string containing the information. -**/ -STATIC CHAR16* -EFIAPI -DevicePathProtocolDumpInformationEx ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose, - IN EFI_GUID *Protocol -) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - CHAR16 *DevPathStr; - CHAR16 *DevPathStrTemp; - UINTN Size; - EFI_STATUS Status; - DevPathStr = NULL; - DevPathStrTemp = NULL; - Status = gBS->OpenProtocol(TheHandle, Protocol, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - DevPathStr = ConvertDevicePathToShortText (DevPath, Verbose, 30); - if (Verbose) { - Size = StrSize(DevPathStr) + sizeof(CHAR16) * 2; - DevPathStrTemp = AllocateZeroPool (Size); - if (DevPathStrTemp != NULL) { - StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), L" ", 2); - StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), DevPathStr, StrLen (DevPathStr)); - } - FreePool (DevPathStr); - DevPathStr = DevPathStrTemp; - } - gBS->CloseProtocol(TheHandle, Protocol, gImageHandle, NULL); - } - return DevPathStr; -} - -/** - Function to dump information about DevicePath protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -DevicePathProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiDevicePathProtocolGuid); -} - -/** - Function to dump information about LoadedImageDevicePath protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -LoadedImageDevicePathProtocolDumpInformation( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiLoadedImageDevicePathProtocolGuid); -} - -/** - Function to dump information about BusSpecificDriverOverride protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -BusSpecificDriverOverrideProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - CHAR16 *GetString; - CHAR16 *RetVal; - CHAR16 *TempRetVal; - EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_HANDLE ImageHandle; - UINTN Size; - - if (!Verbose) { - return NULL; - } - Size = 0; - GetString = NULL; - RetVal = NULL; - TempRetVal = NULL; - ImageHandle = 0; - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiBusSpecificDriverOverrideProtocolGuid, - (VOID**)&BusSpecificDriverOverride, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return NULL; - } - HandleParsingHiiInit (); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BSDO_DUMP_MAIN), NULL); - if (GetString == NULL) { - return NULL; - } - do { - Status = BusSpecificDriverOverride->GetDriver ( - BusSpecificDriverOverride, - &ImageHandle - ); - if (!EFI_ERROR (Status)) { - Status = gBS->HandleProtocol ( - ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImage - ); - if(!EFI_ERROR (Status)) { - TempRetVal = CatSPrint ( - TempRetVal, - GetString, - ConvertHandleToHandleIndex (ImageHandle), - ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE) - ); - StrnCatGrow (&RetVal, &Size, TempRetVal, 0); - SHELL_FREE_NON_NULL (TempRetVal); - } - } - } while (!EFI_ERROR (Status)); - - SHELL_FREE_NON_NULL (GetString); - return RetVal; -} - -/** - Function to dump information about BlockIo protocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -BlockIoProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_BLOCK_IO_PROTOCOL *BlockIo; - EFI_BLOCK_IO_MEDIA *BlockMedia; - CHAR16 *GetString; - CHAR16 *RetVal; - - if (!Verbose) { - return NULL; - } - GetString = NULL; - RetVal = NULL; - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiBlockIoProtocolGuid, - (VOID**)&BlockIo, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return NULL; - } - BlockMedia = BlockIo->Media; - // - // Per spec: - // The function (ReadBlocks) must return EFI_NO_MEDIA or - // EFI_MEDIA_CHANGED even if LBA, BufferSize, or Buffer are invalid so the caller can probe - // for changes in media state. - // - BlockIo->ReadBlocks ( - BlockIo, - BlockIo->Media->MediaId, - 0, - 0, - NULL - ); - - HandleParsingHiiInit (); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BLOCKIO_INFO), NULL); - if (GetString == NULL) { - return NULL; - } - RetVal = CatSPrint ( - RetVal, - GetString, - BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ", - BlockMedia->MediaPresent ? L"" : L"not-present ", - BlockMedia->MediaId, - BlockMedia->BlockSize, - BlockMedia->LastBlock, - MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize), - BlockMedia->LogicalPartition ? L"partition" : L"raw", - BlockMedia->ReadOnly ? L"ro" : L"rw", - BlockMedia->WriteCaching ? L"cached" : L"!cached" - ); - - SHELL_FREE_NON_NULL (GetString); - return RetVal; -} - -/** - Function to dump information about DebugSupport Protocol. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -DebugSupportProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport; - CHAR16 *GetString; - CHAR16 *RetVal; - - if (!Verbose) { - return NULL; - } - GetString = NULL; - RetVal = NULL; - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiDebugSupportProtocolGuid, - (VOID**)&DebugSupport, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return NULL; - } - HandleParsingHiiInit (); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_DEBUGSUPPORT_INFO), NULL); - if (GetString == NULL) { - return NULL; - } - // - // Dump Debug support info - // - switch (DebugSupport->Isa) { - case (IsaIa32): - RetVal = CatSPrint (RetVal, GetString, L"IA-32"); - break; - case (IsaIpf): - RetVal = CatSPrint (RetVal, GetString, L"IPF"); - break; - case (IsaEbc): - RetVal = CatSPrint (RetVal, GetString, L"EBC"); - break; - default: - SHELL_FREE_NON_NULL (GetString); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_DEBUGSUPPORT_UNKNOWN), NULL); - RetVal = GetString != NULL ? CatSPrint (RetVal, GetString, DebugSupport->Isa) : NULL; - break; - } - - SHELL_FREE_NON_NULL (GetString); - return RetVal; -} - -/** - Function to dump information about PciIoProtocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has PciRootBridgeIo installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -PciIoProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_PCI_IO_PROTOCOL *PciIo; - PCI_TYPE00 Pci; - UINTN Segment; - UINTN Bus; - UINTN Device; - UINTN Function; - UINTN Index; - CHAR16 *GetString; - CHAR16 *TempRetVal; - CHAR16 *RetVal; - - if (!Verbose) { - return (NULL); - } - RetVal = NULL; - GetString = NULL; - TempRetVal = NULL; - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiPciIoProtocolGuid, - (VOID**)&PciIo, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR(Status)) { - return NULL; - } - PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci); - PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function); - HandleParsingHiiInit (); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIIO_DUMP_MAIN), NULL); - if (GetString == NULL) { - return NULL; - } - RetVal = CatSPrint ( - NULL, - GetString, - Segment, - Bus, - Device, - Function, - PciIo->RomSize, - PciIo->RomImage, - Pci.Hdr.VendorId, - Pci.Hdr.DeviceId, - Pci.Hdr.ClassCode[0], - Pci.Hdr.ClassCode[1], - Pci.Hdr.ClassCode[2] - ); - for (Index = 0; Index < sizeof (Pci); Index ++) { - if ((Index % 0x10) == 0) { - TempRetVal = CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *) (&Pci) + Index)); - } else { - TempRetVal = CatSPrint (RetVal, L"%02x", *((UINT8 *) (&Pci) + Index)); - } - FreePool (RetVal); - RetVal = TempRetVal; - TempRetVal = NULL; - } - - FreePool(GetString); - return RetVal; -} - -/** - Function to dump information about UsbIoProtocol. - - This will allocate the return buffer from boot services pool. - - @param[in] TheHandle The handle that has PciRootBridgeIo installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A poitner to a string containing the information. -**/ -CHAR16* -EFIAPI -UsbIoProtocolDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_USB_IO_PROTOCOL *UsbIo; - EFI_USB_INTERFACE_DESCRIPTOR InterfaceDesc; - CHAR16 *GetString; - CHAR16 *RetVal; - - if (!Verbose) { - return (NULL); - } - RetVal = NULL; - GetString = NULL; - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiUsbIoProtocolGuid, - (VOID**)&UsbIo, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR(Status)) { - return NULL; - } - UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc); - HandleParsingHiiInit (); - GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_USBIO_DUMP_MAIN), NULL); - if (GetString == NULL) { - return NULL; - } - RetVal = CatSPrint ( - NULL, - GetString, - InterfaceDesc.InterfaceNumber, - InterfaceDesc.InterfaceClass, - InterfaceDesc.InterfaceSubClass, - InterfaceDesc.InterfaceProtocol - ); - - FreePool (GetString); - return RetVal; -} - -/** - Function to dump information about EfiAdapterInformation Protocol. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -AdapterInformationDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_ADAPTER_INFORMATION_PROTOCOL *EfiAdptrInfoProtocol; - UINTN InfoTypesBufferCount; - UINTN GuidIndex; - EFI_GUID *InfoTypesBuffer; - CHAR16 *GuidStr; - CHAR16 *TempStr; - CHAR16 *RetVal; - CHAR16 *TempRetVal; - VOID *InformationBlock; - UINTN InformationBlockSize; - - if (!Verbose) { - return (CatSPrint(NULL, L"AdapterInfo")); - } - - InfoTypesBuffer = NULL; - InformationBlock = NULL; - - - Status = gBS->OpenProtocol ( - (EFI_HANDLE) (TheHandle), - &gEfiAdapterInformationProtocolGuid, - (VOID **) &EfiAdptrInfoProtocol, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return NULL; - } - - // - // Get a list of supported information types for this instance of the protocol. - // - Status = EfiAdptrInfoProtocol->GetSupportedTypes ( - EfiAdptrInfoProtocol, - &InfoTypesBuffer, - &InfoTypesBufferCount - ); - RetVal = NULL; - if (EFI_ERROR (Status)) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GET_SUPP_TYPES_FAILED), NULL); - if (TempStr != NULL) { - RetVal = CatSPrint (NULL, TempStr, Status); - } else { - goto ERROR_EXIT; - } - } else { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SUPP_TYPE_HEADER), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - RetVal = CatSPrint (NULL, TempStr); - SHELL_FREE_NON_NULL (TempStr); - - for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_NUMBER), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), &InfoTypesBuffer[GuidIndex]); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_STRING), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - - if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) { - TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoMediaStateGuid"); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) { - TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoNetworkBootGuid"); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid)) { - TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoSanMacAddressGuid"); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) { - TempRetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoUndiIpv6SupportGuid"); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else { - - GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL); - if (GuidStr == NULL) { - TempRetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType"); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - - SHELL_FREE_NON_NULL (TempStr); - SHELL_FREE_NON_NULL(GuidStr); - // - // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP - // - continue; - } else { - TempRetVal = CatSPrint (RetVal, TempStr, GuidStr); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL(GuidStr); - } - } - - SHELL_FREE_NON_NULL (TempStr); - - Status = EfiAdptrInfoProtocol->GetInformation ( - EfiAdptrInfoProtocol, - &InfoTypesBuffer[GuidIndex], - &InformationBlock, - &InformationBlockSize - ); - - if (EFI_ERROR (Status)) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GETINFO_FAILED), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, Status); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else { - if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_MEDIA_STATE), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState, - ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_NETWORK_BOOT_INFO), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4BootCapablity, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6BootCapablity, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBootCapablity, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->OffloadCapability, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiMpioCapability, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4Boot, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6Boot, - ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBoot - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SAN_MAC_ADDRESS_INFO), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[0], - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[1], - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[2], - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[3], - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[4], - ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[5] - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoUndiIpv6SupportGuid) == TRUE) { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNDI_IPV6_INFO), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - - TempRetVal = CatSPrint ( - RetVal, - TempStr, - ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *)InformationBlock)->Ipv6Support - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } else { - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNKNOWN_INFO_TYPE), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - } - } - SHELL_FREE_NON_NULL (TempStr); - SHELL_FREE_NON_NULL (InformationBlock); - } - } - - SHELL_FREE_NON_NULL (InfoTypesBuffer); - return RetVal; - -ERROR_EXIT: - SHELL_FREE_NON_NULL (RetVal); - SHELL_FREE_NON_NULL (InfoTypesBuffer); - SHELL_FREE_NON_NULL (InformationBlock); - return NULL; -} - -/** - Function to dump information about EFI_FIRMWARE_MANAGEMENT_PROTOCOL Protocol. - - @param[in] TheHandle The handle that has the protocol installed. - @param[in] Verbose TRUE for additional information, FALSE otherwise. - - @retval A pointer to a string containing the information. -**/ -CHAR16* -EFIAPI -FirmwareManagementDumpInformation ( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ) -{ - EFI_STATUS Status; - EFI_FIRMWARE_MANAGEMENT_PROTOCOL *EfiFwMgmtProtocol; - EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; - EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1 *ImageInfoV1; - EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2 *ImageInfoV2; - UINT64 AttributeSetting; - UINTN ImageInfoSize; - UINTN DescriptorSize; - UINT32 DescriptorVersion; - UINT32 PackageVersion; - UINT8 DescriptorCount; - UINT8 Index; - UINT8 Index1; - UINT8 ImageCount; - CHAR16 *PackageVersionName; - CHAR16 *TempStr; - CHAR16 *RetVal; - CHAR16 *TempRetVal; - CHAR16 *AttributeSettingStr; - BOOLEAN Found; - BOOLEAN AttributeSupported; - - // - // Initialize local variables - // - ImageCount = 0; - ImageInfoSize = 1; - AttributeSetting = 0; - Found = FALSE; - AttributeSupported = FALSE; - ImageInfo = NULL; - ImageInfoV1 = NULL; - ImageInfoV2 = NULL; - PackageVersionName = NULL; - RetVal = NULL; - TempRetVal = NULL; - TempStr = NULL; - AttributeSettingStr = NULL; - - if (!Verbose) { - return (CatSPrint(NULL, L"FirmwareManagement")); - } - - Status = gBS->OpenProtocol ( - (EFI_HANDLE) (TheHandle), - &gEfiFirmwareManagementProtocolGuid, - (VOID **) &EfiFwMgmtProtocol, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return NULL; - } - - Status = EfiFwMgmtProtocol->GetImageInfo ( - EfiFwMgmtProtocol, - &ImageInfoSize, - ImageInfo, - &DescriptorVersion, - &DescriptorCount, - &DescriptorSize, - &PackageVersion, - &PackageVersionName - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - ImageInfo = AllocateZeroPool (ImageInfoSize); - - if (ImageInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = EfiFwMgmtProtocol->GetImageInfo ( - EfiFwMgmtProtocol, - &ImageInfoSize, - ImageInfo, - &DescriptorVersion, - &DescriptorCount, - &DescriptorSize, - &PackageVersion, - &PackageVersionName - ); - } - } - - if (EFI_ERROR (Status)) { - goto ERROR_EXIT; - } - - // - // Decode Image Descriptor data only if its version is supported - // - if (DescriptorVersion <= EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION) { - - if (ImageInfo == NULL) { - goto ERROR_EXIT; - } - - ImageInfoV1 = (EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1 *)ImageInfo; - ImageInfoV2 = (EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2 *)ImageInfo; - - // - // Set ImageInfoSize in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_INFO_SIZE), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - RetVal = CatSPrint (NULL, TempStr, ImageInfoSize); - SHELL_FREE_NON_NULL (TempStr); - - // - // Set DescriptorVersion in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_VERSION), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, DescriptorVersion); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - // - // Set DescriptorCount in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_COUNT), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, DescriptorCount); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - - // - // Set DescriptorSize in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_SIZE), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, DescriptorSize); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - // - // Set PackageVersion in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_PACKAGE_VERSION), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, PackageVersion); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - // - // Set PackageVersionName in return buffer - // - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_PACKAGE_VERSION_NAME), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint (RetVal, TempStr, PackageVersionName); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - - for (Index = 0; Index < DescriptorCount; Index++) { - // - // First check if Attribute is supported - // and generate a string for AttributeSetting field - // - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSupported = FALSE; - AttributeSetting = 0; - if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) { - if (ImageInfoV1[Index].AttributesSupported != 0x0) { - AttributeSupported = TRUE; - AttributeSetting = ImageInfoV1[Index].AttributesSetting; - } - } else if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2) { - if (ImageInfoV2[Index].AttributesSupported != 0x0) { - AttributeSupported = TRUE; - AttributeSetting = ImageInfoV2[Index].AttributesSetting; - } - } else { - if (ImageInfo[Index].AttributesSupported != 0x0) { - AttributeSupported = TRUE; - AttributeSetting = ImageInfo[Index].AttributesSetting; - } - } - - if (!AttributeSupported) { - AttributeSettingStr = CatSPrint (NULL, L"None"); - } else { - AttributeSettingStr = CatSPrint (NULL, L"("); - - if ((AttributeSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != 0x0) { - TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_IMAGE_UPDATABLE"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - if ((AttributeSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0x0) { - TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_RESET_REQUIRED"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - if ((AttributeSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != 0x0) { - TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - if ((AttributeSetting & IMAGE_ATTRIBUTE_IN_USE) != 0x0) { - TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_IN_USE"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - if ((AttributeSetting & IMAGE_ATTRIBUTE_UEFI_IMAGE) != 0x0) { - TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_UEFI_IMAGE"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - TempRetVal = CatSPrint (AttributeSettingStr, L" )"); - SHELL_FREE_NON_NULL (AttributeSettingStr); - AttributeSettingStr = TempRetVal; - } - - if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) { - if (ImageInfoV1[Index].ImageIndex != 0x0) { - ImageCount++; - } - - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO_V1), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - Index, - ImageInfoV1[Index].ImageIndex, - &ImageInfoV1[Index].ImageTypeId, - ImageInfoV1[Index].ImageId, - ImageInfoV1[Index].ImageIdName, - ImageInfoV1[Index].Version, - ImageInfoV1[Index].VersionName, - ImageInfoV1[Index].Size, - ImageInfoV1[Index].AttributesSupported, - AttributeSettingStr, - ImageInfoV1[Index].Compatibilities - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - } else if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2) { - if (ImageInfoV2[Index].ImageIndex != 0x0) { - ImageCount++; - } - - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO_V2), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - Index, - ImageInfoV2[Index].ImageIndex, - &ImageInfoV2[Index].ImageTypeId, - ImageInfoV2[Index].ImageId, - ImageInfoV2[Index].ImageIdName, - ImageInfoV2[Index].Version, - ImageInfoV2[Index].VersionName, - ImageInfoV2[Index].Size, - ImageInfoV2[Index].AttributesSupported, - AttributeSettingStr, - ImageInfoV2[Index].Compatibilities, - ImageInfoV2[Index].LowestSupportedImageVersion - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - } else { - if (ImageInfo[Index].ImageIndex != 0x0) { - ImageCount++; - } - - TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO), NULL); - if (TempStr == NULL) { - goto ERROR_EXIT; - } - TempRetVal = CatSPrint ( - RetVal, - TempStr, - Index, - ImageInfo[Index].ImageIndex, - &ImageInfo[Index].ImageTypeId, - ImageInfo[Index].ImageId, - ImageInfo[Index].ImageIdName, - ImageInfo[Index].Version, - ImageInfo[Index].VersionName, - ImageInfo[Index].Size, - ImageInfo[Index].AttributesSupported, - AttributeSettingStr, - ImageInfo[Index].Compatibilities, - ImageInfo[Index].LowestSupportedImageVersion, - ImageInfo[Index].LastAttemptVersion, - ImageInfo[Index].LastAttemptStatus, - ImageInfo[Index].HardwareInstance - ); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - SHELL_FREE_NON_NULL (TempStr); - } - } - } - - if (ImageCount > 0) { - for (Index=0; IndexOpenProtocol ( - TheHandle, - &gEfiPartitionInfoProtocolGuid, - (VOID**)&PartitionInfo, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return NULL; - } - - HandleParsingHiiInit (); - - switch (PartitionInfo->Type) { - case PARTITION_TYPE_OTHER: - PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_OTHER), NULL); - break; - case PARTITION_TYPE_MBR: - PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_MBR), NULL); - break; - case PARTITION_TYPE_GPT: - PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_GPT), NULL); - break; - default: - PartitionType = NULL; - break; - } - if (PartitionType == NULL) { - return NULL; - } - - if (PartitionInfo->System == 1) { - EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_EFI_SYS_PART), NULL); - } else { - EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_NOT_EFI_SYS_PART), NULL); - } - if (EfiSystemPartition == NULL) { - SHELL_FREE_NON_NULL (PartitionType); - return NULL; - } - - RetVal = CatSPrint ( - NULL, - L"%s\r\n%s", - PartitionType, - EfiSystemPartition - ); - - SHELL_FREE_NON_NULL (EfiSystemPartition); - SHELL_FREE_NON_NULL (PartitionType); - return RetVal; -} - -// -// Put the information on the NT32 protocol GUIDs here so we are not dependant on the Nt32Pkg -// -#define LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID \ - { \ - 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ - } - -#define LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID \ - { \ - 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ - } - -#define LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID \ - { \ - 0xc95a93d, 0xa006, 0x11d4, { 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ - } -STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID; -STATIC CONST EFI_GUID WinNtIoProtocolGuid = LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID; -STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID; - -// -// Deprecated protocols we dont want to link from IntelFrameworkModulePkg -// -#define LOCAL_EFI_ISA_IO_PROTOCOL_GUID \ - { \ - 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ - } -#define LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID \ - { \ - 0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } \ - } -STATIC CONST EFI_GUID EfiIsaIoProtocolGuid = LOCAL_EFI_ISA_IO_PROTOCOL_GUID; -STATIC CONST EFI_GUID EfiIsaAcpiProtocolGuid = LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID; - - -STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = { - {STRING_TOKEN(STR_WINNT_THUNK), (EFI_GUID*)&WinNtThunkProtocolGuid, NULL}, - {STRING_TOKEN(STR_WINNT_DRIVER_IO), (EFI_GUID*)&WinNtIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_WINNT_SERIAL_PORT), (EFI_GUID*)&WinNtSerialPortGuid, NULL}, - {0, NULL, NULL}, -}; - -STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { - {STRING_TOKEN(STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, LoadedImageProtocolDumpInformation}, - {STRING_TOKEN(STR_DEVICE_PATH), &gEfiDevicePathProtocolGuid, DevicePathProtocolDumpInformation}, - {STRING_TOKEN(STR_IMAGE_PATH), &gEfiLoadedImageDevicePathProtocolGuid, LoadedImageDevicePathProtocolDumpInformation}, - {STRING_TOKEN(STR_DEVICE_PATH_UTIL), &gEfiDevicePathUtilitiesProtocolGuid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_TXT), &gEfiDevicePathToTextProtocolGuid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_FTXT), &gEfiDevicePathFromTextProtocolGuid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_PC), &gEfiPcAnsiGuid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_VT100), &gEfiVT100Guid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_VT100P), &gEfiVT100PlusGuid, NULL}, - {STRING_TOKEN(STR_DEVICE_PATH_VTUTF8), &gEfiVTUTF8Guid, NULL}, - {STRING_TOKEN(STR_DRIVER_BINDING), &gEfiDriverBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_PLATFORM_OVERRIDE), &gEfiPlatformDriverOverrideProtocolGuid, NULL}, - {STRING_TOKEN(STR_BUS_OVERRIDE), &gEfiBusSpecificDriverOverrideProtocolGuid, BusSpecificDriverOverrideProtocolDumpInformation}, - {STRING_TOKEN(STR_DRIVER_DIAG), &gEfiDriverDiagnosticsProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_DIAG2), &gEfiDriverDiagnostics2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_CN), &gEfiComponentNameProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_CN2), &gEfiComponentName2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_PLAT_DRV_CFG), &gEfiPlatformToDriverConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_VERSION), &gEfiDriverSupportedEfiVersionProtocolGuid, DriverEfiVersionProtocolDumpInformation}, - {STRING_TOKEN(STR_TXT_IN), &gEfiSimpleTextInProtocolGuid, NULL}, - {STRING_TOKEN(STR_TXT_IN_EX), &gEfiSimpleTextInputExProtocolGuid, NULL}, - {STRING_TOKEN(STR_TXT_OUT), &gEfiSimpleTextOutProtocolGuid, TxtOutProtocolDumpInformation}, - {STRING_TOKEN(STR_SIM_POINTER), &gEfiSimplePointerProtocolGuid, NULL}, - {STRING_TOKEN(STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL}, - {STRING_TOKEN(STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation}, - {STRING_TOKEN(STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, EdidDiscoveredProtocolDumpInformation}, - {STRING_TOKEN(STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, EdidActiveProtocolDumpInformation}, - {STRING_TOKEN(STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL}, - {STRING_TOKEN(STR_CON_IN), &gEfiConsoleInDeviceGuid, NULL}, - {STRING_TOKEN(STR_CON_OUT), &gEfiConsoleOutDeviceGuid, NULL}, - {STRING_TOKEN(STR_STD_ERR), &gEfiStandardErrorDeviceGuid, NULL}, - {STRING_TOKEN(STR_LOAD_FILE), &gEfiLoadFileProtocolGuid, NULL}, - {STRING_TOKEN(STR_LOAD_FILE2), &gEfiLoadFile2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL}, - {STRING_TOKEN(STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, BlockIoProtocolDumpInformation}, - {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL}, - {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation}, - {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, PciIoProtocolDumpInformation}, - {STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL}, - {STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL}, - {STRING_TOKEN(STR_ISCSI), &gEfiIScsiInitiatorNameProtocolGuid, NULL}, - {STRING_TOKEN(STR_USB_IO), &gEfiUsbIoProtocolGuid, UsbIoProtocolDumpInformation}, - {STRING_TOKEN(STR_USB_HC), &gEfiUsbHcProtocolGuid, NULL}, - {STRING_TOKEN(STR_USB_HC2), &gEfiUsb2HcProtocolGuid, NULL}, - {STRING_TOKEN(STR_DEBUG_SUPPORT), &gEfiDebugSupportProtocolGuid, DebugSupportProtocolDumpInformation}, - {STRING_TOKEN(STR_DEBUG_PORT), &gEfiDebugPortProtocolGuid, NULL}, - {STRING_TOKEN(STR_DECOMPRESS), &gEfiDecompressProtocolGuid, NULL}, - {STRING_TOKEN(STR_ACPI_TABLE), &gEfiAcpiTableProtocolGuid, NULL}, - {STRING_TOKEN(STR_EBC_INTERPRETER), &gEfiEbcProtocolGuid, NULL}, - {STRING_TOKEN(STR_SNP), &gEfiSimpleNetworkProtocolGuid, NULL}, - {STRING_TOKEN(STR_NII), &gEfiNetworkInterfaceIdentifierProtocolGuid, NULL}, - {STRING_TOKEN(STR_NII_31), &gEfiNetworkInterfaceIdentifierProtocolGuid_31, NULL}, - {STRING_TOKEN(STR_PXE_BC), &gEfiPxeBaseCodeProtocolGuid, NULL}, - {STRING_TOKEN(STR_PXE_CB), &gEfiPxeBaseCodeCallbackProtocolGuid, NULL}, - {STRING_TOKEN(STR_BIS), &gEfiBisProtocolGuid, NULL}, - {STRING_TOKEN(STR_MNP_SB), &gEfiManagedNetworkServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_MNP), &gEfiManagedNetworkProtocolGuid, NULL}, - {STRING_TOKEN(STR_ARP_SB), &gEfiArpServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_ARP), &gEfiArpProtocolGuid, NULL}, - {STRING_TOKEN(STR_DHCPV4_SB), &gEfiDhcp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_DHCPV4), &gEfiDhcp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCPV4_SB), &gEfiTcp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCPV4), &gEfiTcp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_IPV4_SB), &gEfiIp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_IPV4), &gEfiIp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_IPV4_CFG), &gEfiIp4ConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_IPV4_CFG2), &gEfiIp4Config2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_UDPV4_SB), &gEfiUdp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_UDPV4), &gEfiUdp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_MTFTPV4_SB), &gEfiMtftp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_MTFTPV4), &gEfiMtftp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_AUTH_INFO), &gEfiAuthenticationInfoProtocolGuid, NULL}, - {STRING_TOKEN(STR_HASH_SB), &gEfiHashServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_HASH), &gEfiHashProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_FONT), &gEfiHiiFontProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_STRING), &gEfiHiiStringProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_IMAGE), &gEfiHiiImageProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_DATABASE), &gEfiHiiDatabaseProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_CONFIG_ROUT), &gEfiHiiConfigRoutingProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_CONFIG_ACC), &gEfiHiiConfigAccessProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_FORM_BROWSER2), &gEfiFormBrowser2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_FAM_OVERRIDE), &gEfiDriverFamilyOverrideProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCD), &gPcdProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCG), &gEfiTcgProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_PACKAGE_LIST), &gEfiHiiPackageListProtocolGuid, NULL}, - -// -// the ones under this are deprecated by the current UEFI Spec, but may be found anyways... -// - {STRING_TOKEN(STR_SHELL_INTERFACE), &gEfiShellInterfaceGuid, NULL}, - {STRING_TOKEN(STR_SHELL_ENV2), &gEfiShellEnvironment2Guid, NULL}, - {STRING_TOKEN(STR_SHELL_ENV), &gEfiShellEnvironment2Guid, NULL}, - {STRING_TOKEN(STR_DEVICE_IO), &gEfiDeviceIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_UGA_DRAW), &gEfiUgaDrawProtocolGuid, NULL}, - {STRING_TOKEN(STR_UGA_IO), &gEfiUgaIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_ESP), &gEfiPartTypeSystemPartGuid, NULL}, - {STRING_TOKEN(STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL}, - -// -// these are using local (non-global) definitions to reduce package dependancy. -// - {STRING_TOKEN(STR_ISA_IO), (EFI_GUID*)&EfiIsaIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_ISA_ACPI), (EFI_GUID*)&EfiIsaAcpiProtocolGuid, NULL}, - -// -// the ones under this are GUID identified structs, not protocols -// - {STRING_TOKEN(STR_FILE_INFO), &gEfiFileInfoGuid, NULL}, - {STRING_TOKEN(STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL}, - -// -// the ones under this are misc GUIDS. -// - {STRING_TOKEN(STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL}, - -// -// UEFI 2.2 -// - {STRING_TOKEN(STR_IP6_SB), &gEfiIp6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_IP6), &gEfiIp6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_IP6_CONFIG), &gEfiIp6ConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_MTFTP6_SB), &gEfiMtftp6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_MTFTP6), &gEfiMtftp6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_DHCP6_SB), &gEfiDhcp6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_DHCP6), &gEfiDhcp6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_UDP6_SB), &gEfiUdp6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_UDP6), &gEfiUdp6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCP6_SB), &gEfiTcp6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCP6), &gEfiTcp6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_VLAN_CONFIG), &gEfiVlanConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_EAP), &gEfiEapProtocolGuid, NULL}, - {STRING_TOKEN(STR_EAP_MGMT), &gEfiEapManagementProtocolGuid, NULL}, - {STRING_TOKEN(STR_FTP4_SB), &gEfiFtp4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_FTP4), &gEfiFtp4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_IP_SEC_CONFIG), &gEfiIpSecConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_DH), &gEfiDriverHealthProtocolGuid, NULL}, - {STRING_TOKEN(STR_DEF_IMG_LOAD), &gEfiDeferredImageLoadProtocolGuid, NULL}, - {STRING_TOKEN(STR_USER_CRED), &gEfiUserCredentialProtocolGuid, NULL}, - {STRING_TOKEN(STR_USER_MNGR), &gEfiUserManagerProtocolGuid, NULL}, - {STRING_TOKEN(STR_ATA_PASS_THRU), &gEfiAtaPassThruProtocolGuid, NULL}, - -// -// UEFI 2.3 -// - {STRING_TOKEN(STR_FW_MGMT), &gEfiFirmwareManagementProtocolGuid, FirmwareManagementDumpInformation}, - {STRING_TOKEN(STR_IP_SEC), &gEfiIpSecProtocolGuid, NULL}, - {STRING_TOKEN(STR_IP_SEC2), &gEfiIpSec2ProtocolGuid, NULL}, - -// -// UEFI 2.3.1 -// - {STRING_TOKEN(STR_KMS), &gEfiKmsProtocolGuid, NULL}, - {STRING_TOKEN(STR_BLK_IO2), &gEfiBlockIo2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_SSC), &gEfiStorageSecurityCommandProtocolGuid, NULL}, - {STRING_TOKEN(STR_UCRED2), &gEfiUserCredential2ProtocolGuid, NULL}, - -// -// UEFI 2.4 -// - {STRING_TOKEN(STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, AdapterInformationDumpInformation}, - -// -// UEFI2.5 -// - {STRING_TOKEN(STR_TLS_SB), &gEfiTlsServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_TLS), &gEfiTlsProtocolGuid, NULL}, - {STRING_TOKEN(STR_TLS_CONFIG), &gEfiTlsConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_SUPPLICANT_SB), &gEfiSupplicantServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_SUPPLICANT), &gEfiSupplicantProtocolGuid, NULL}, - -// -// UEFI2.6 -// - {STRING_TOKEN(STR_WIFI2), &gEfiWiFi2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_RAMDISK), &gEfiRamDiskProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_ID), &gEfiHiiImageDecoderProtocolGuid, NULL}, - {STRING_TOKEN(STR_HII_IE), &gEfiHiiImageExProtocolGuid, NULL}, - {STRING_TOKEN(STR_SD_MPT), &gEfiSdMmcPassThruProtocolGuid, NULL}, - {STRING_TOKEN(STR_ERASE_BLOCK), &gEfiEraseBlockProtocolGuid, NULL}, - -// -// UEFI2.7 -// - {STRING_TOKEN(STR_BLUETOOTH_ATTR), &gEfiBluetoothAttributeProtocolGuid, NULL}, - {STRING_TOKEN(STR_BLUETOOTH_ATTR_SB), &gEfiBluetoothAttributeServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_BLUETOOTH_LE_CONFIG), &gEfiBluetoothLeConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_UFS_DEV_CONFIG), &gEfiUfsDeviceConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_HTTP_BOOT_CALL), &gEfiHttpBootCallbackProtocolGuid, NULL}, - {STRING_TOKEN(STR_RESET_NOTI), &gEfiResetNotificationProtocolGuid, NULL}, - {STRING_TOKEN(STR_PARTITION_INFO), &gEfiPartitionInfoProtocolGuid, PartitionInfoProtocolDumpInformation}, - {STRING_TOKEN(STR_HII_POPUP), &gEfiHiiPopupProtocolGuid, NULL}, - -// -// PI Spec ones -// - {STRING_TOKEN(STR_IDE_CONT_INIT), &gEfiIdeControllerInitProtocolGuid, NULL}, - {STRING_TOKEN(STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, NULL}, - -// -// PI Spec 1.0 -// - {STRING_TOKEN(STR_BDS_ARCH), &gEfiBdsArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_CPU_ARCH), &gEfiCpuArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MET_ARCH), &gEfiMetronomeArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MON_ARCH), &gEfiMonotonicCounterArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_RTC_ARCH), &gEfiRealTimeClockArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_RESET_ARCH), &gEfiResetArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_RT_ARCH), &gEfiRuntimeArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_SEC_ARCH), &gEfiSecurityArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_TIMER_ARCH), &gEfiTimerArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_VAR_ARCH), &gEfiVariableWriteArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_V_ARCH), &gEfiVariableArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_SECP), &gEfiSecurityPolicyProtocolGuid, NULL}, - {STRING_TOKEN(STR_WDT_ARCH), &gEfiWatchdogTimerArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_SCR), &gEfiStatusCodeRuntimeProtocolGuid, NULL}, - {STRING_TOKEN(STR_SMB_HC), &gEfiSmbusHcProtocolGuid, NULL}, - {STRING_TOKEN(STR_FV_2), &gEfiFirmwareVolume2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_FV_BLOCK), &gEfiFirmwareVolumeBlockProtocolGuid, NULL}, - {STRING_TOKEN(STR_CAP_ARCH), &gEfiCapsuleArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MP_SERVICE), &gEfiMpServiceProtocolGuid, NULL}, - {STRING_TOKEN(STR_HBRAP), &gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIP), &gEfiPciPlatformProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIO), &gEfiPciOverrideProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIE), &gEfiPciEnumerationCompleteProtocolGuid, NULL}, - {STRING_TOKEN(STR_IPCID), &gEfiIncompatiblePciDeviceSupportProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIHPI), &gEfiPciHotPlugInitProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIHPR), &gEfiPciHotPlugRequestProtocolGuid, NULL}, - {STRING_TOKEN(STR_SMBIOS), &gEfiSmbiosProtocolGuid, NULL}, - {STRING_TOKEN(STR_S3_SAVE), &gEfiS3SaveStateProtocolGuid, NULL}, - {STRING_TOKEN(STR_S3_S_SMM), &gEfiS3SmmSaveStateProtocolGuid, NULL}, - {STRING_TOKEN(STR_RSC), &gEfiRscHandlerProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid, NULL}, - {STRING_TOKEN(STR_ACPI_SDT), &gEfiAcpiSdtProtocolGuid, NULL}, - {STRING_TOKEN(STR_SIO), &gEfiSioProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_CPU2), &gEfiSmmCpuIo2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_BASE2), &gEfiSmmBase2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_ACC_2), &gEfiSmmAccess2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_CON_2), &gEfiSmmControl2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_CONFIG), &gEfiSmmConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_RTL), &gEfiSmmReadyToLockProtocolGuid, NULL}, - {STRING_TOKEN(STR_DS_RTL), &gEfiDxeSmmReadyToLockProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_COMM), &gEfiSmmCommunicationProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_STAT), &gEfiSmmStatusCodeProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_CPU), &gEfiSmmCpuProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_PCIRBIO), &gEfiSmmPciRootBridgeIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_SWD), &gEfiSmmSwDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_SXD), &gEfiSmmSxDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_PTD2), &gEfiSmmPeriodicTimerDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_UD2), &gEfiSmmUsbDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_GD2), &gEfiSmmGpiDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_SBD2), &gEfiSmmStandbyButtonDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_PBD2), &gEfiSmmPowerButtonDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_S_ITD2), &gEfiSmmIoTrapDispatch2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCD), &gEfiPcdProtocolGuid, NULL}, - {STRING_TOKEN(STR_FVB2), &gEfiFirmwareVolumeBlock2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_CPUIO2), &gEfiCpuIo2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_LEGACY_R2), &gEfiLegacyRegion2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_SAL_MIP), &gEfiSalMcaInitPmiProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_BS), &gEfiExtendedSalBootServiceProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_BIO), &gEfiExtendedSalBaseIoServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_STALL), &gEfiExtendedSalStallServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_RTC), &gEfiExtendedSalRtcServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_VS), &gEfiExtendedSalVariableServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_MTC), &gEfiExtendedSalMtcServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_RESET), &gEfiExtendedSalResetServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_SC), &gEfiExtendedSalStatusCodeServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_FBS), &gEfiExtendedSalFvBlockServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_MP), &gEfiExtendedSalMpServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_PAL), &gEfiExtendedSalPalServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_BASE), &gEfiExtendedSalBaseServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_MCA), &gEfiExtendedSalMcaServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_PCI), &gEfiExtendedSalPciServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_CACHE), &gEfiExtendedSalCacheServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_ES_MCA_LOG), &gEfiExtendedSalMcaLogServicesProtocolGuid, NULL}, - {STRING_TOKEN(STR_S2ARCH), &gEfiSecurity2ArchProtocolGuid, NULL}, - {STRING_TOKEN(STR_EODXE), &gEfiSmmEndOfDxeProtocolGuid, NULL}, - {STRING_TOKEN(STR_ISAHC), &gEfiIsaHcProtocolGuid, NULL}, - {STRING_TOKEN(STR_ISAHC_B), &gEfiIsaHcServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_SIO_C), &gEfiSioControlProtocolGuid, NULL}, - {STRING_TOKEN(STR_GET_PCD), &gEfiGetPcdInfoProtocolGuid, NULL}, - {STRING_TOKEN(STR_I2C_M), &gEfiI2cMasterProtocolGuid, NULL}, - {STRING_TOKEN(STR_I2CIO), &gEfiI2cIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_I2CEN), &gEfiI2cEnumerateProtocolGuid, NULL}, - {STRING_TOKEN(STR_I2C_H), &gEfiI2cHostProtocolGuid, NULL}, - {STRING_TOKEN(STR_I2C_BCM), &gEfiI2cBusConfigurationManagementProtocolGuid, NULL}, - {STRING_TOKEN(STR_TCG2), &gEfiTcg2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_TIMESTAMP), &gEfiTimestampProtocolGuid, NULL}, - {STRING_TOKEN(STR_RNG), &gEfiRngProtocolGuid, NULL}, - {STRING_TOKEN(STR_NVMEPT), &gEfiNvmExpressPassThruProtocolGuid, NULL}, - {STRING_TOKEN(STR_H2_SB), &gEfiHash2ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_HASH2), &gEfiHash2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_BIO_C), &gEfiBlockIoCryptoProtocolGuid, NULL}, - {STRING_TOKEN(STR_SCR), &gEfiSmartCardReaderProtocolGuid, NULL}, - {STRING_TOKEN(STR_SCE), &gEfiSmartCardEdgeProtocolGuid, NULL}, - {STRING_TOKEN(STR_USB_FIO), &gEfiUsbFunctionIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_BC_HC), &gEfiBluetoothHcProtocolGuid, NULL}, - {STRING_TOKEN(STR_BC_IO_SB), &gEfiBluetoothIoServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_BC_IO), &gEfiBluetoothIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_BC_C), &gEfiBluetoothConfigProtocolGuid, NULL}, - {STRING_TOKEN(STR_REG_EXP), &gEfiRegularExpressionProtocolGuid, NULL}, - {STRING_TOKEN(STR_B_MGR_P), &gEfiBootManagerPolicyProtocolGuid, NULL}, - {STRING_TOKEN(STR_CKH), &gEfiConfigKeywordHandlerProtocolGuid, NULL}, - {STRING_TOKEN(STR_WIFI), &gEfiWiFiProtocolGuid, NULL}, - {STRING_TOKEN(STR_EAP_M), &gEfiEapManagement2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_EAP_C), &gEfiEapConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_PKCS7), &gEfiPkcs7VerifyProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_DNS4_SB), &gEfiDns4ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_DNS4), &gEfiDns4ProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_DNS6_SB), &gEfiDns6ServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_DNS6), &gEfiDns6ProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_HTTP_SB), &gEfiHttpServiceBindingProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_HTTP), &gEfiHttpProtocolGuid, NULL}, - {STRING_TOKEN(STR_NET_HTTP_U), &gEfiHttpUtilitiesProtocolGuid, NULL}, - {STRING_TOKEN(STR_REST), &gEfiRestProtocolGuid, NULL}, - -// -// PI 1.5 -// - {STRING_TOKEN(STR_MM_EOD), &gEfiMmEndOfDxeProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_ITD), &gEfiMmIoTrapDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_PBD), &gEfiMmPowerButtonDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_SBD), &gEfiMmStandbyButtonDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_GD), &gEfiMmGpiDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_UD), &gEfiMmUsbDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_PTD), &gEfiMmPeriodicTimerDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_SXD), &gEfiMmSxDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_SWD), &gEfiMmSwDispatchProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_PRBI), &gEfiMmPciRootBridgeIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_CPU), &gEfiMmCpuProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_STACODE), &gEfiMmStatusCodeProtocolGuid, NULL}, - {STRING_TOKEN(STR_DXEMM_RTL), &gEfiDxeMmReadyToLockProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_CONFIG), &gEfiMmConfigurationProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_RTL), &gEfiMmReadyToLockProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_CONTROL), &gEfiMmControlProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_ACCESS), &gEfiMmAccessProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_BASE), &gEfiMmBaseProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_CPUIO), &gEfiMmCpuIoProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_RH), &gEfiMmRscHandlerProtocolGuid, NULL}, - {STRING_TOKEN(STR_MM_COM), &gEfiMmCommunicationProtocolGuid, NULL}, - -// -// UEFI Shell Spec 2.0 -// - {STRING_TOKEN(STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL}, - {STRING_TOKEN(STR_SHELL), &gEfiShellProtocolGuid, NULL}, - -// -// UEFI Shell Spec 2.1 -// - {STRING_TOKEN(STR_SHELL_DYNAMIC), &gEfiShellDynamicCommandProtocolGuid, NULL}, - -// -// Misc -// - {STRING_TOKEN(STR_PCDINFOPROT), &gGetPcdInfoProtocolGuid, NULL}, - -// -// terminator -// - {0, NULL, NULL}, -}; - -/** - Function to get the node for a protocol or struct from it's GUID. - - if Guid is NULL, then ASSERT. - - @param[in] Guid The GUID to look for the name of. - - @return The node. -**/ -CONST GUID_INFO_BLOCK * -InternalShellGetNodeFromGuid( - IN CONST EFI_GUID* Guid - ) -{ - CONST GUID_INFO_BLOCK *ListWalker; - UINTN LoopCount; - - ASSERT(Guid != NULL); - - for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) { - if (CompareGuid(ListWalker->GuidId, Guid)) { - return (ListWalker); - } - } - - if (PcdGetBool(PcdShellIncludeNtGuids)) { - for (ListWalker = mGuidStringListNT ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { - if (CompareGuid(ListWalker->GuidId, Guid)) { - return (ListWalker); - } - } - } - for (ListWalker = mGuidStringList ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { - if (CompareGuid(ListWalker->GuidId, Guid)) { - return (ListWalker); - } - } - return (NULL); -} - -/** -Function to add a new GUID/Name mapping. - -@param[in] Guid The Guid -@param[in] NameID The STRING id of the HII string to use -@param[in] DumpFunc The pointer to the dump function - - -@retval EFI_SUCCESS The operation was sucessful -@retval EFI_OUT_OF_RESOURCES A memory allocation failed -@retval EFI_INVALID_PARAMETER Guid NameId was invalid -**/ -EFI_STATUS -InsertNewGuidNameMapping( - IN CONST EFI_GUID *Guid, - IN CONST EFI_STRING_ID NameID, - IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL - ) -{ - ASSERT(Guid != NULL); - ASSERT(NameID != 0); - - mGuidList = ReallocatePool(mGuidListCount * sizeof(GUID_INFO_BLOCK), mGuidListCount+1 * sizeof(GUID_INFO_BLOCK), mGuidList); - if (mGuidList == NULL) { - mGuidListCount = 0; - return (EFI_OUT_OF_RESOURCES); - } - mGuidListCount++; - - mGuidList[mGuidListCount - 1].GuidId = AllocateCopyPool(sizeof(EFI_GUID), Guid); - mGuidList[mGuidListCount - 1].StringId = NameID; - mGuidList[mGuidListCount - 1].DumpInfo = DumpFunc; - - if (mGuidList[mGuidListCount - 1].GuidId == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - return (EFI_SUCCESS); -} - -/** - Function to add a new GUID/Name mapping. - - This cannot overwrite an existing mapping. - - @param[in] Guid The Guid - @param[in] TheName The Guid's name - @param[in] Lang RFC4646 language code list or NULL - - @retval EFI_SUCCESS The operation was sucessful - @retval EFI_ACCESS_DENIED There was a duplicate - @retval EFI_OUT_OF_RESOURCES A memory allocation failed - @retval EFI_INVALID_PARAMETER Guid or TheName was NULL -**/ -EFI_STATUS -EFIAPI -AddNewGuidNameMapping( - IN CONST EFI_GUID *Guid, - IN CONST CHAR16 *TheName, - IN CONST CHAR8 *Lang OPTIONAL - ) -{ - EFI_STRING_ID NameID; - - HandleParsingHiiInit(); - - if (Guid == NULL || TheName == NULL){ - return (EFI_INVALID_PARAMETER); - } - - if ((InternalShellGetNodeFromGuid(Guid)) != NULL) { - return (EFI_ACCESS_DENIED); - } - - NameID = HiiSetString(mHandleParsingHiiHandle, 0, (CHAR16*)TheName, Lang); - if (NameID == 0) { - return (EFI_OUT_OF_RESOURCES); - } - - return (InsertNewGuidNameMapping(Guid, NameID, NULL)); -} - -/** - Function to get the name of a protocol or struct from it's GUID. - - if Guid is NULL, then ASSERT. - - @param[in] Guid The GUID to look for the name of. - @param[in] Lang The language to use. - - @return pointer to string of the name. The caller - is responsible to free this memory. -**/ -CHAR16* -EFIAPI -GetStringNameFromGuid( - IN CONST EFI_GUID *Guid, - IN CONST CHAR8 *Lang OPTIONAL - ) -{ - CONST GUID_INFO_BLOCK *Id; - - HandleParsingHiiInit(); - - Id = InternalShellGetNodeFromGuid(Guid); - if (Id == NULL) { - return NULL; - } - return HiiGetString (mHandleParsingHiiHandle, Id->StringId, Lang); -} - -/** - Function to dump protocol information from a handle. - - This function will return a allocated string buffer containing the - information. The caller is responsible for freeing the memory. - - If Guid is NULL, ASSERT(). - If TheHandle is NULL, ASSERT(). - - @param[in] TheHandle The handle to dump information from. - @param[in] Guid The GUID of the protocol to dump. - @param[in] Verbose TRUE for extra info. FALSE otherwise. - - @return The pointer to string. - @retval NULL An error was encountered. -**/ -CHAR16* -EFIAPI -GetProtocolInformationDump( - IN CONST EFI_HANDLE TheHandle, - IN CONST EFI_GUID *Guid, - IN CONST BOOLEAN Verbose - ) -{ - CONST GUID_INFO_BLOCK *Id; - - ASSERT(TheHandle != NULL); - ASSERT(Guid != NULL); - - if (TheHandle == NULL || Guid == NULL) { - return (NULL); - } - - Id = InternalShellGetNodeFromGuid(Guid); - if (Id != NULL && Id->DumpInfo != NULL) { - return (Id->DumpInfo(TheHandle, Verbose)); - } - return (NULL); -} - -/** - Function to get the Guid for a protocol or struct based on it's string name. - - do not modify the returned Guid. - - @param[in] Name The pointer to the string name. - @param[in] Lang The pointer to the language code. - @param[out] Guid The pointer to the Guid. - - @retval EFI_SUCCESS The operation was sucessful. -**/ -EFI_STATUS -EFIAPI -GetGuidFromStringName( - IN CONST CHAR16 *Name, - IN CONST CHAR8 *Lang OPTIONAL, - OUT EFI_GUID **Guid - ) -{ - CONST GUID_INFO_BLOCK *ListWalker; - CHAR16 *String; - UINTN LoopCount; - - HandleParsingHiiInit(); - - ASSERT(Guid != NULL); - if (Guid == NULL) { - return (EFI_INVALID_PARAMETER); - } - *Guid = NULL; - - if (PcdGetBool(PcdShellIncludeNtGuids)) { - for (ListWalker = mGuidStringListNT ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { - String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); - if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { - *Guid = ListWalker->GuidId; - } - SHELL_FREE_NON_NULL(String); - if (*Guid != NULL) { - return (EFI_SUCCESS); - } - } - } - for (ListWalker = mGuidStringList ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { - String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); - if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { - *Guid = ListWalker->GuidId; - } - SHELL_FREE_NON_NULL(String); - if (*Guid != NULL) { - return (EFI_SUCCESS); - } - } - - for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) { - String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); - if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { - *Guid = ListWalker->GuidId; - } - SHELL_FREE_NON_NULL(String); - if (*Guid != NULL) { - return (EFI_SUCCESS); - } - } - - return (EFI_NOT_FOUND); -} - -/** - Get best support language for this driver. - - First base on the user input language to search, second base on the current - platform used language to search, third get the first language from the - support language list. The caller need to free the buffer of the best language. - - @param[in] SupportedLanguages The support languages for this driver. - @param[in] InputLanguage The user input language. - @param[in] Iso639Language Whether get language for ISO639. - - @return The best support language for this driver. -**/ -CHAR8 * -EFIAPI -GetBestLanguageForDriver ( - IN CONST CHAR8 *SupportedLanguages, - IN CONST CHAR8 *InputLanguage, - IN BOOLEAN Iso639Language - ) -{ - CHAR8 *LanguageVariable; - CHAR8 *BestLanguage; - - GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&LanguageVariable, NULL); - - BestLanguage = GetBestLanguage( - SupportedLanguages, - Iso639Language, - (InputLanguage != NULL) ? InputLanguage : "", - (LanguageVariable != NULL) ? LanguageVariable : "", - SupportedLanguages, - NULL - ); - - if (LanguageVariable != NULL) { - FreePool (LanguageVariable); - } - - return BestLanguage; -} - -/** - Function to retrieve the driver name (if possible) from the ComponentName or - ComponentName2 protocol - - @param[in] TheHandle The driver handle to get the name of. - @param[in] Language The language to use. - - @retval NULL The name could not be found. - @return A pointer to the string name. Do not de-allocate the memory. -**/ -CONST CHAR16* -EFIAPI -GetStringNameFromHandle( - IN CONST EFI_HANDLE TheHandle, - IN CONST CHAR8 *Language - ) -{ - EFI_COMPONENT_NAME2_PROTOCOL *CompNameStruct; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR8 *BestLang; - - BestLang = NULL; - - Status = gBS->OpenProtocol( - TheHandle, - &gEfiComponentName2ProtocolGuid, - (VOID**)&CompNameStruct, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE); - Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal); - if (BestLang != NULL) { - FreePool (BestLang); - BestLang = NULL; - } - if (!EFI_ERROR(Status)) { - return (RetVal); - } - } - Status = gBS->OpenProtocol( - TheHandle, - &gEfiComponentNameProtocolGuid, - (VOID**)&CompNameStruct, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE); - Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal); - if (BestLang != NULL) { - FreePool (BestLang); - } - if (!EFI_ERROR(Status)) { - return (RetVal); - } - } - return (NULL); -} - -/** - Function to initialize the file global mHandleList object for use in - vonverting handles to index and index to handle. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -InternalShellInitHandleList( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - HANDLE_LIST *ListWalker; - - if (mHandleList.NextIndex != 0) { - return EFI_SUCCESS; - } - InitializeListHead(&mHandleList.List.Link); - mHandleList.NextIndex = 1; - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - &HandleCount, - &HandleBuffer - ); - ASSERT_EFI_ERROR(Status); - if (EFI_ERROR(Status)) { - return (Status); - } - for (mHandleList.NextIndex = 1 ; mHandleList.NextIndex <= HandleCount ; mHandleList.NextIndex++){ - ListWalker = AllocateZeroPool(sizeof(HANDLE_LIST)); - if (ListWalker != NULL) { - ListWalker->TheHandle = HandleBuffer[mHandleList.NextIndex - 1]; - ListWalker->TheIndex = mHandleList.NextIndex; - InsertTailList (&mHandleList.List.Link, &ListWalker->Link); - } - } - FreePool(HandleBuffer); - return (EFI_SUCCESS); -} - -/** - Function to retrieve the human-friendly index of a given handle. If the handle - does not have a index one will be automatically assigned. The index value is valid - until the termination of the shell application. - - @param[in] TheHandle The handle to retrieve an index for. - - @retval 0 A memory allocation failed. - @return The index of the handle. - -**/ -UINTN -EFIAPI -ConvertHandleToHandleIndex( - IN CONST EFI_HANDLE TheHandle - ) -{ - EFI_STATUS Status; - EFI_GUID **ProtocolBuffer; - UINTN ProtocolCount; - HANDLE_LIST *ListWalker; - - if (TheHandle == NULL) { - return 0; - } - - InternalShellInitHandleList(); - - for (ListWalker = (HANDLE_LIST*)GetFirstNode(&mHandleList.List.Link) - ; !IsNull(&mHandleList.List.Link,&ListWalker->Link) - ; ListWalker = (HANDLE_LIST*)GetNextNode(&mHandleList.List.Link,&ListWalker->Link) - ){ - if (ListWalker->TheHandle == TheHandle) { - // - // Verify that TheHandle is still present in the Handle Database - // - Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount); - if (EFI_ERROR (Status)) { - // - // TheHandle is not present in the Handle Database, so delete from the handle list - // - RemoveEntryList (&ListWalker->Link); - return 0; - } - FreePool (ProtocolBuffer); - return (ListWalker->TheIndex); - } - } - - // - // Verify that TheHandle is valid handle - // - Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount); - if (EFI_ERROR (Status)) { - // - // TheHandle is not valid, so do not add to handle list - // - return 0; - } - FreePool (ProtocolBuffer); - - ListWalker = AllocateZeroPool(sizeof(HANDLE_LIST)); - if (ListWalker == NULL) { - return 0; - } - ListWalker->TheHandle = TheHandle; - ListWalker->TheIndex = mHandleList.NextIndex++; - InsertTailList(&mHandleList.List.Link,&ListWalker->Link); - return (ListWalker->TheIndex); -} - - - -/** - Function to retrieve the EFI_HANDLE from the human-friendly index. - - @param[in] TheIndex The index to retrieve the EFI_HANDLE for. - - @retval NULL The index was invalid. - @return The EFI_HANDLE that index represents. - -**/ -EFI_HANDLE -EFIAPI -ConvertHandleIndexToHandle( - IN CONST UINTN TheIndex - ) -{ - EFI_STATUS Status; - EFI_GUID **ProtocolBuffer; - UINTN ProtocolCount; - HANDLE_LIST *ListWalker; - - InternalShellInitHandleList(); - - if (TheIndex >= mHandleList.NextIndex) { - return NULL; - } - - for (ListWalker = (HANDLE_LIST*)GetFirstNode(&mHandleList.List.Link) - ; !IsNull(&mHandleList.List.Link,&ListWalker->Link) - ; ListWalker = (HANDLE_LIST*)GetNextNode(&mHandleList.List.Link,&ListWalker->Link) - ){ - if (ListWalker->TheIndex == TheIndex && ListWalker->TheHandle != NULL) { - // - // Verify that LinkWalker->TheHandle is valid handle - // - Status = gBS->ProtocolsPerHandle(ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount); - if (!EFI_ERROR (Status)) { - FreePool (ProtocolBuffer); - } else { - // - // TheHandle is not valid, so do not add to handle list - // - ListWalker->TheHandle = NULL; - } - return (ListWalker->TheHandle); - } - } - return NULL; -} - -/** - Gets all the related EFI_HANDLEs based on the mask supplied. - - This function scans all EFI_HANDLES in the UEFI environment's handle database - and returns the ones with the specified relationship (Mask) to the specified - controller handle. - - If both DriverBindingHandle and ControllerHandle are NULL, then ASSERT. - If MatchingHandleCount is NULL, then ASSERT. - - If MatchingHandleBuffer is not NULL upon a successful return the memory must be - caller freed. - - @param[in] DriverBindingHandle The handle with Driver Binding protocol on it. - @param[in] ControllerHandle The handle with Device Path protocol on it. - @param[in] MatchingHandleCount The pointer to UINTN that specifies the number of HANDLES in - MatchingHandleBuffer. - @param[out] MatchingHandleBuffer On a successful return, a buffer of MatchingHandleCount - EFI_HANDLEs with a terminating NULL EFI_HANDLE. - @param[out] HandleType An array of type information. - - @retval EFI_SUCCESS The operation was successful, and any related handles - are in MatchingHandleBuffer. - @retval EFI_NOT_FOUND No matching handles were found. - @retval EFI_INVALID_PARAMETER A parameter was invalid or out of range. -**/ -EFI_STATUS -EFIAPI -ParseHandleDatabaseByRelationshipWithType ( - IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL, - IN CONST EFI_HANDLE ControllerHandle OPTIONAL, - IN UINTN *HandleCount, - OUT EFI_HANDLE **HandleBuffer, - OUT UINTN **HandleType - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - EFI_GUID **ProtocolGuidArray; - UINTN ArrayCount; - UINTN ProtocolIndex; - EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo; - UINTN OpenInfoCount; - UINTN OpenInfoIndex; - UINTN ChildIndex; - INTN DriverBindingHandleIndex; - - ASSERT(HandleCount != NULL); - ASSERT(HandleBuffer != NULL); - ASSERT(HandleType != NULL); - ASSERT(DriverBindingHandle != NULL || ControllerHandle != NULL); - - *HandleCount = 0; - *HandleBuffer = NULL; - *HandleType = NULL; - - // - // Retrieve the list of all handles from the handle database - // - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - HandleCount, - HandleBuffer - ); - if (EFI_ERROR (Status)) { - return (Status); - } - - *HandleType = AllocateZeroPool (*HandleCount * sizeof (UINTN)); - if (*HandleType == NULL) { - SHELL_FREE_NON_NULL (*HandleBuffer); - *HandleCount = 0; - return EFI_OUT_OF_RESOURCES; - } - - DriverBindingHandleIndex = -1; - for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) { - if (DriverBindingHandle != NULL && (*HandleBuffer)[HandleIndex] == DriverBindingHandle) { - DriverBindingHandleIndex = (INTN)HandleIndex; - } - } - - for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) { - // - // Retrieve the list of all the protocols on each handle - // - Status = gBS->ProtocolsPerHandle ( - (*HandleBuffer)[HandleIndex], - &ProtocolGuidArray, - &ArrayCount - ); - if (EFI_ERROR (Status)) { - continue; - } - - for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { - - // - // Set the bit describing what this handle has - // - if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_IMAGE_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_BINDING_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid)) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE; - } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) ) { - (*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE; - } - // - // Retrieve the list of agents that have opened each protocol - // - Status = gBS->OpenProtocolInformation ( - (*HandleBuffer)[HandleIndex], - ProtocolGuidArray[ProtocolIndex], - &OpenInfo, - &OpenInfoCount - ); - if (EFI_ERROR (Status)) { - continue; - } - - if (ControllerHandle == NULL) { - // - // ControllerHandle == NULL and DriverBindingHandle != NULL. - // Return information on all the controller handles that the driver specified by DriverBindingHandle is managing - // - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); - if (DriverBindingHandleIndex != -1) { - (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER; - } - } - if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); - if (DriverBindingHandleIndex != -1) { - (*HandleType)[DriverBindingHandleIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); - } - for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { - if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); - } - } - } - } - } - if (DriverBindingHandle == NULL && ControllerHandle != NULL) { - if (ControllerHandle == (*HandleBuffer)[HandleIndex]) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { - for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { - if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)HR_DEVICE_DRIVER; - } - } - } - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { - if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); - } - if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); - } - } - } - } - } else { - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE); - } - } - } - } - } - if (DriverBindingHandle != NULL && ControllerHandle != NULL) { - if (ControllerHandle == (*HandleBuffer)[HandleIndex]) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { - if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) { - if (DriverBindingHandleIndex != -1) { - (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER; - } - } - } - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) { - for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { - if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); - } - } - } - - for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { - if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { - (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); - } - } - } - } - } else { - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { - if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) { - (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE); - } - } - } - } - } - FreePool (OpenInfo); - } - FreePool (ProtocolGuidArray); - } - return EFI_SUCCESS; -} - -/** - Gets all the related EFI_HANDLEs based on the single EFI_HANDLE and the mask - supplied. - - This function will scan all EFI_HANDLES in the UEFI environment's handle database - and return all the ones with the specified relationship (Mask) to the specified - controller handle. - - If both DriverBindingHandle and ControllerHandle are NULL, then ASSERT. - If MatchingHandleCount is NULL, then ASSERT. - - If MatchingHandleBuffer is not NULL upon a sucessful return the memory must be - caller freed. - - @param[in] DriverBindingHandle Handle to a object with Driver Binding protocol - on it. - @param[in] ControllerHandle Handle to a device with Device Path protocol on it. - @param[in] Mask Mask of what relationship(s) is desired. - @param[in] MatchingHandleCount Poitner to UINTN specifying number of HANDLES in - MatchingHandleBuffer. - @param[out] MatchingHandleBuffer On a sucessful return a buffer of MatchingHandleCount - EFI_HANDLEs and a terminating NULL EFI_HANDLE. - - @retval EFI_SUCCESS The operation was sucessful and any related handles - are in MatchingHandleBuffer; - @retval EFI_NOT_FOUND No matching handles were found. - @retval EFI_INVALID_PARAMETER A parameter was invalid or out of range. -**/ -EFI_STATUS -EFIAPI -ParseHandleDatabaseByRelationship ( - IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL, - IN CONST EFI_HANDLE ControllerHandle OPTIONAL, - IN CONST UINTN Mask, - IN UINTN *MatchingHandleCount, - OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL - ) -{ - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN *HandleType; - UINTN HandleIndex; - - ASSERT(MatchingHandleCount != NULL); - ASSERT(DriverBindingHandle != NULL || ControllerHandle != NULL); - - if ((Mask & HR_VALID_MASK) != Mask) { - return (EFI_INVALID_PARAMETER); - } - - if ((Mask & HR_CHILD_HANDLE) != 0 && DriverBindingHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - *MatchingHandleCount = 0; - if (MatchingHandleBuffer != NULL) { - *MatchingHandleBuffer = NULL; - } - - HandleBuffer = NULL; - HandleType = NULL; - - Status = ParseHandleDatabaseByRelationshipWithType ( - DriverBindingHandle, - ControllerHandle, - &HandleCount, - &HandleBuffer, - &HandleType - ); - if (!EFI_ERROR (Status)) { - // - // Count the number of handles that match the attributes in Mask - // - for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { - if ((HandleType[HandleIndex] & Mask) == Mask) { - (*MatchingHandleCount)++; - } - } - // - // If no handles match the attributes in Mask then return EFI_NOT_FOUND - // - if (*MatchingHandleCount == 0) { - Status = EFI_NOT_FOUND; - } else { - - if (MatchingHandleBuffer == NULL) { - // - // Someone just wanted the count... - // - Status = EFI_SUCCESS; - } else { - // - // Allocate a handle buffer for the number of handles that matched the attributes in Mask - // - *MatchingHandleBuffer = AllocateZeroPool ((*MatchingHandleCount +1)* sizeof (EFI_HANDLE)); - if (*MatchingHandleBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - for (HandleIndex = 0, *MatchingHandleCount = 0 - ; HandleIndex < HandleCount - ; HandleIndex++ - ) { - // - // Fill the allocated buffer with the handles that matched the attributes in Mask - // - if ((HandleType[HandleIndex] & Mask) == Mask) { - (*MatchingHandleBuffer)[(*MatchingHandleCount)++] = HandleBuffer[HandleIndex]; - } - } - - // - // Make the last one NULL - // - (*MatchingHandleBuffer)[*MatchingHandleCount] = NULL; - - Status = EFI_SUCCESS; - } // *MatchingHandleBuffer == NULL (ELSE) - } // MacthingHandleBuffer == NULL (ELSE) - } // *MatchingHandleCount == 0 (ELSE) - } // no error on ParseHandleDatabaseByRelationshipWithType - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - if (HandleType != NULL) { - FreePool (HandleType); - } - - ASSERT ((MatchingHandleBuffer == NULL) || - (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) || - (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)); - return Status; -} - -/** - Gets handles for any child controllers of the passed in controller. - - @param[in] ControllerHandle The handle of the "parent controller" - @param[out] MatchingHandleCount Pointer to the number of handles in - MatchingHandleBuffer on return. - @param[out] MatchingHandleBuffer Buffer containing handles on a successful - return. - - - @retval EFI_SUCCESS The operation was sucessful. -**/ -EFI_STATUS -EFIAPI -ParseHandleDatabaseForChildControllers( - IN CONST EFI_HANDLE ControllerHandle, - OUT UINTN *MatchingHandleCount, - OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - UINTN DriverBindingHandleCount; - EFI_HANDLE *DriverBindingHandleBuffer; - UINTN DriverBindingHandleIndex; - UINTN ChildControllerHandleCount; - EFI_HANDLE *ChildControllerHandleBuffer; - UINTN ChildControllerHandleIndex; - EFI_HANDLE *HandleBufferForReturn; - - if (MatchingHandleCount == NULL) { - return (EFI_INVALID_PARAMETER); - } - *MatchingHandleCount = 0; - - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS ( - ControllerHandle, - &DriverBindingHandleCount, - &DriverBindingHandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Get a buffer big enough for all the controllers. - // - HandleBufferForReturn = GetHandleListByProtocol(NULL); - if (HandleBufferForReturn == NULL) { - FreePool (DriverBindingHandleBuffer); - return (EFI_NOT_FOUND); - } - - for (DriverBindingHandleIndex = 0; DriverBindingHandleIndex < DriverBindingHandleCount; DriverBindingHandleIndex++) { - Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN ( - DriverBindingHandleBuffer[DriverBindingHandleIndex], - ControllerHandle, - &ChildControllerHandleCount, - &ChildControllerHandleBuffer - ); - if (EFI_ERROR (Status)) { - continue; - } - - for (ChildControllerHandleIndex = 0; - ChildControllerHandleIndex < ChildControllerHandleCount; - ChildControllerHandleIndex++ - ) { - for (HandleIndex = 0; HandleIndex < *MatchingHandleCount; HandleIndex++) { - if (HandleBufferForReturn[HandleIndex] == ChildControllerHandleBuffer[ChildControllerHandleIndex]) { - break; - } - } - if (HandleIndex >= *MatchingHandleCount) { - HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex]; - } - } - - FreePool (ChildControllerHandleBuffer); - } - - FreePool (DriverBindingHandleBuffer); - - if (MatchingHandleBuffer == NULL || *MatchingHandleCount == 0) { - // - // The caller is not interested in the actual handles, or we've found none. - // - FreePool (HandleBufferForReturn); - HandleBufferForReturn = NULL; - } - - if (MatchingHandleBuffer != NULL) { - *MatchingHandleBuffer = HandleBufferForReturn; - } - - ASSERT ((MatchingHandleBuffer == NULL) || - (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) || - (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)); - - return (EFI_SUCCESS); -} - -/** - Appends 1 buffer to another buffer. This will re-allocate the destination buffer - if necessary to fit all of the data. - - If DestinationBuffer is NULL, then ASSERT(). - - @param[in, out] DestinationBuffer The pointer to the pointer to the buffer to append onto. - @param[in, out] DestinationSize The pointer to the size of DestinationBuffer. - @param[in] SourceBuffer The pointer to the buffer to append onto DestinationBuffer. - @param[in] SourceSize The number of bytes of SourceBuffer to append. - - @retval NULL A memory allocation failed. - @retval NULL A parameter was invalid. - @return A pointer to (*DestinationBuffer). -**/ -VOID* -BuffernCatGrow ( - IN OUT VOID **DestinationBuffer, - IN OUT UINTN *DestinationSize, - IN VOID *SourceBuffer, - IN UINTN SourceSize - ) -{ - UINTN LocalDestinationSize; - UINTN LocalDestinationFinalSize; - - ASSERT(DestinationBuffer != NULL); - - if (SourceSize == 0 || SourceBuffer == NULL) { - return (*DestinationBuffer); - } - - if (DestinationSize == NULL) { - LocalDestinationSize = 0; - } else { - LocalDestinationSize = *DestinationSize; - } - - LocalDestinationFinalSize = LocalDestinationSize + SourceSize; - - if (DestinationSize != NULL) { - *DestinationSize = LocalDestinationSize; - } - - if (LocalDestinationSize == 0) { - // allcoate - *DestinationBuffer = AllocateZeroPool(LocalDestinationFinalSize); - } else { - // reallocate - *DestinationBuffer = ReallocatePool(LocalDestinationSize, LocalDestinationFinalSize, *DestinationBuffer); - } - - ASSERT(*DestinationBuffer != NULL); - - // copy - return (CopyMem(((UINT8*)(*DestinationBuffer)) + LocalDestinationSize, SourceBuffer, SourceSize)); -} - -/** - Gets handles for any child devices produced by the passed in driver. - - @param[in] DriverHandle The handle of the driver. - @param[in] MatchingHandleCount Pointer to the number of handles in - MatchingHandleBuffer on return. - @param[out] MatchingHandleBuffer Buffer containing handles on a successful - return. - @retval EFI_SUCCESS The operation was sucessful. - @sa ParseHandleDatabaseByRelationship -**/ -EFI_STATUS -EFIAPI -ParseHandleDatabaseForChildDevices( - IN CONST EFI_HANDLE DriverHandle, - IN UINTN *MatchingHandleCount, - OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL - ) -{ - EFI_HANDLE *Buffer; - EFI_HANDLE *Buffer2; - UINTN Count1; - UINTN Count2; - UINTN HandleIndex; - EFI_STATUS Status; - UINTN HandleBufferSize; - - ASSERT(MatchingHandleCount != NULL); - - HandleBufferSize = 0; - Buffer = NULL; - Buffer2 = NULL; - *MatchingHandleCount = 0; - - Status = PARSE_HANDLE_DATABASE_DEVICES ( - DriverHandle, - &Count1, - &Buffer - ); - if (!EFI_ERROR (Status)) { - for (HandleIndex = 0; HandleIndex < Count1; HandleIndex++) { - // - // now find the children - // - Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN ( - DriverHandle, - Buffer[HandleIndex], - &Count2, - &Buffer2 - ); - if (EFI_ERROR(Status)) { - break; - } - // - // save out required and optional data elements - // - *MatchingHandleCount += Count2; - if (MatchingHandleBuffer != NULL) { - *MatchingHandleBuffer = BuffernCatGrow((VOID**)MatchingHandleBuffer, &HandleBufferSize, Buffer2, Count2 * sizeof(Buffer2[0])); - } - - // - // free the memory - // - if (Buffer2 != NULL) { - FreePool(Buffer2); - } - } - } - - if (Buffer != NULL) { - FreePool(Buffer); - } - return (Status); -} - -/** - Function to get all handles that support a given protocol or all handles. - - @param[in] ProtocolGuid The guid of the protocol to get handles for. If NULL - then the function will return all handles. - - @retval NULL A memory allocation failed. - @return A NULL terminated list of handles. -**/ -EFI_HANDLE* -EFIAPI -GetHandleListByProtocol ( - IN CONST EFI_GUID *ProtocolGuid OPTIONAL - ) -{ - EFI_HANDLE *HandleList; - UINTN Size; - EFI_STATUS Status; - - Size = 0; - HandleList = NULL; - - // - // We cannot use LocateHandleBuffer since we need that NULL item on the ends of the list! - // - if (ProtocolGuid == NULL) { - Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleList = AllocateZeroPool(Size + sizeof(EFI_HANDLE)); - if (HandleList == NULL) { - return (NULL); - } - Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList); - HandleList[Size/sizeof(EFI_HANDLE)] = NULL; - } - } else { - Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleList = AllocateZeroPool(Size + sizeof(EFI_HANDLE)); - if (HandleList == NULL) { - return (NULL); - } - Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList); - HandleList[Size/sizeof(EFI_HANDLE)] = NULL; - } - } - if (EFI_ERROR(Status)) { - if (HandleList != NULL) { - FreePool(HandleList); - } - return (NULL); - } - return (HandleList); -} - -/** - Function to get all handles that support some protocols. - - @param[in] ProtocolGuids A NULL terminated list of protocol GUIDs. - - @retval NULL A memory allocation failed. - @retval NULL ProtocolGuids was NULL. - @return A NULL terminated list of EFI_HANDLEs. -**/ -EFI_HANDLE* -EFIAPI -GetHandleListByProtocolList ( - IN CONST EFI_GUID **ProtocolGuids - ) -{ - EFI_HANDLE *HandleList; - UINTN Size; - UINTN TotalSize; - UINTN TempSize; - EFI_STATUS Status; - CONST EFI_GUID **GuidWalker; - EFI_HANDLE *HandleWalker1; - EFI_HANDLE *HandleWalker2; - - Size = 0; - HandleList = NULL; - TotalSize = sizeof(EFI_HANDLE); - - for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++,Size = 0){ - Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &Size, NULL); - if (Status == EFI_BUFFER_TOO_SMALL) { - TotalSize += Size; - } - } - - // - // No handles were found... - // - if (TotalSize == sizeof(EFI_HANDLE)) { - return (NULL); - } - - HandleList = AllocateZeroPool(TotalSize); - if (HandleList == NULL) { - return (NULL); - } - - Size = 0; - for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++){ - TempSize = TotalSize - Size; - Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &TempSize, HandleList+(Size/sizeof(EFI_HANDLE))); - - // - // Allow for missing protocols... Only update the 'used' size upon success. - // - if (!EFI_ERROR(Status)) { - Size += TempSize; - } - } - ASSERT(HandleList[(TotalSize/sizeof(EFI_HANDLE))-1] == NULL); - - for (HandleWalker1 = HandleList ; HandleWalker1 != NULL && *HandleWalker1 != NULL ; HandleWalker1++) { - for (HandleWalker2 = HandleWalker1 + 1; HandleWalker2 != NULL && *HandleWalker2 != NULL ; HandleWalker2++) { - if (*HandleWalker1 == *HandleWalker2) { - // - // copy memory back 1 handle width. - // - CopyMem(HandleWalker2, HandleWalker2 + 1, TotalSize - ((HandleWalker2-HandleList+1)*sizeof(EFI_HANDLE))); - } - } - } - - return (HandleList); -} - -/** - Return all supported GUIDs. - - @param[out] Guids The buffer to return all supported GUIDs. - @param[in, out] Count On input, the count of GUIDs the buffer can hold, - On output, the count of GUIDs to return. - - @retval EFI_INVALID_PARAMETER Count is NULL. - @retval EFI_BUFFER_TOO_SMALL Buffer is not enough to hold all GUIDs. - @retval EFI_SUCCESS GUIDs are returned successfully. -**/ -EFI_STATUS -EFIAPI -GetAllMappingGuids ( - OUT EFI_GUID *Guids, - IN OUT UINTN *Count - ) -{ - UINTN GuidCount; - UINTN NtGuidCount; - UINTN Index; - - if (Count == NULL) { - return EFI_INVALID_PARAMETER; - } - - NtGuidCount = 0; - if (PcdGetBool (PcdShellIncludeNtGuids)) { - NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1; - } - GuidCount = ARRAY_SIZE (mGuidStringList) - 1; - - if (*Count < NtGuidCount + GuidCount + mGuidListCount) { - *Count = NtGuidCount + GuidCount + mGuidListCount; - return EFI_BUFFER_TOO_SMALL; - } - - for (Index = 0; Index < NtGuidCount; Index++) { - CopyGuid (&Guids[Index], mGuidStringListNT[Index].GuidId); - } - - for (Index = 0; Index < GuidCount; Index++) { - CopyGuid (&Guids[NtGuidCount + Index], mGuidStringList[Index].GuidId); - } - - for (Index = 0; Index < mGuidListCount; Index++) { - CopyGuid (&Guids[NtGuidCount + GuidCount + Index], mGuidList[Index].GuidId); - } - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h deleted file mode 100644 index 8f0b9ae..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h +++ /dev/null @@ -1,300 +0,0 @@ -/** @file - Provides interface to advanced shell functionality for parsing both handle and protocol database. - - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2013-2016 Hewlett-Packard Development Company, L.P.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_HANDLE_PARSING_LIB_INTERNAL_H_ -#define _UEFI_HANDLE_PARSING_LIB_INTERNAL_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1 1 -#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2 2 - -/// -/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec < 2.4a -/// -typedef struct { - /// - /// A unique number identifying the firmware image within the device. The number is - /// between 1 and DescriptorCount. - /// - UINT8 ImageIndex; - /// - /// A unique number identifying the firmware image type. - /// - EFI_GUID ImageTypeId; - /// - /// A unique number identifying the firmware image. - /// - UINT64 ImageId; - /// - /// A pointer to a null-terminated string representing the firmware image name. - /// - CHAR16 *ImageIdName; - /// - /// Identifies the version of the device firmware. The format is vendor specific and new - /// version must have a greater value than an old version. - /// - UINT32 Version; - /// - /// A pointer to a null-terminated string representing the firmware image version name. - /// - CHAR16 *VersionName; - /// - /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid. - /// - UINTN Size; - /// - /// Image attributes that are supported by this device. See 'Image Attribute Definitions' - /// for possible returned values of this parameter. A value of 1 indicates the attribute is - /// supported and the current setting value is indicated in AttributesSetting. A - /// value of 0 indicates the attribute is not supported and the current setting value in - /// AttributesSetting is meaningless. - /// - UINT64 AttributesSupported; - /// - /// Image attributes. See 'Image Attribute Definitions' for possible returned values of - /// this parameter. - /// - UINT64 AttributesSetting; - /// - /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned - /// values of this parameter. - /// - UINT64 Compatibilities; -} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1; - - -/// -/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5 -/// -typedef struct { - /// - /// A unique number identifying the firmware image within the device. The number is - /// between 1 and DescriptorCount. - /// - UINT8 ImageIndex; - /// - /// A unique number identifying the firmware image type. - /// - EFI_GUID ImageTypeId; - /// - /// A unique number identifying the firmware image. - /// - UINT64 ImageId; - /// - /// A pointer to a null-terminated string representing the firmware image name. - /// - CHAR16 *ImageIdName; - /// - /// Identifies the version of the device firmware. The format is vendor specific and new - /// version must have a greater value than an old version. - /// - UINT32 Version; - /// - /// A pointer to a null-terminated string representing the firmware image version name. - /// - CHAR16 *VersionName; - /// - /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid. - /// - UINTN Size; - /// - /// Image attributes that are supported by this device. See 'Image Attribute Definitions' - /// for possible returned values of this parameter. A value of 1 indicates the attribute is - /// supported and the current setting value is indicated in AttributesSetting. A - /// value of 0 indicates the attribute is not supported and the current setting value in - /// AttributesSetting is meaningless. - /// - UINT64 AttributesSupported; - /// - /// Image attributes. See 'Image Attribute Definitions' for possible returned values of - /// this parameter. - /// - UINT64 AttributesSetting; - /// - /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned - /// values of this parameter. - /// - UINT64 Compatibilities; - /// - /// Describes the lowest ImageDescriptor version that the device will accept. Only - /// present in version 2 or higher. - UINT32 LowestSupportedImageVersion; -} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2; - -typedef struct { - LIST_ENTRY Link; - EFI_HANDLE TheHandle; - UINTN TheIndex; -}HANDLE_LIST; - -typedef struct { - HANDLE_LIST List; - UINTN NextIndex; -} HANDLE_INDEX_LIST; - -typedef -CHAR16 * -(EFIAPI *DUMP_PROTOCOL_INFO)( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose - ); - -typedef struct _GUID_INFO_BLOCK{ - EFI_STRING_ID StringId; - EFI_GUID *GuidId; - DUMP_PROTOCOL_INFO DumpInfo; -} GUID_INFO_BLOCK; - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf deleted file mode 100644 index b4b5eda..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf +++ /dev/null @@ -1,356 +0,0 @@ -## @file -# Provides interface to advanced shell functionality for parsing both handle and protocol database. -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiHandleParsingLib - FILE_GUID = 3CDC7177-CC2A-4678-BA8F-1A936A093FA4 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = HandleParsingLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER - CONSTRUCTOR = HandleParsingLibConstructor - DESTRUCTOR = HandleParsingLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiHandleParsingLib.c - UefiHandleParsingLib.h - UefiHandleParsingLib.uni - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - MemoryAllocationLib - DevicePathLib - BaseLib - BaseMemoryLib - DebugLib - FileHandleLib - PrintLib - UefiLib - HiiLib - SortLib - PeCoffGetEntryPointLib - -[Protocols] - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - - # shell 2.0 - gEfiShellProtocolGuid ## SOMETIMES_CONSUMES - gEfiShellParametersProtocolGuid ## SOMETIMES_CONSUMES - - # 'old' shell - gEfiShellEnvironment2Guid ## SOMETIMES_CONSUMES - gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES - - gEfiUnicodeCollation2ProtocolGuid ## UNDEFINED - gEfiDevicePathToTextProtocolGuid ## UNDEFINED - gEfiBusSpecificDriverOverrideProtocolGuid ## UNDEFINED - gEfiDevicePathUtilitiesProtocolGuid ## UNDEFINED - gEfiDevicePathFromTextProtocolGuid ## UNDEFINED - gEfiPlatformDriverOverrideProtocolGuid ## UNDEFINED - gEfiSimpleTextInProtocolGuid ## UNDEFINED - gEfiPlatformToDriverConfigurationProtocolGuid ## UNDEFINED - gEfiDriverSupportedEfiVersionProtocolGuid ## UNDEFINED - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiDevicePathProtocolGuid ## CONSUMES - gEfiLoadedImageDevicePathProtocolGuid ## UNDEFINED - gEfiSimpleTextOutProtocolGuid ## UNDEFINED - gEfiSimplePointerProtocolGuid ## UNDEFINED - gEfiAbsolutePointerProtocolGuid ## UNDEFINED - gEfiSerialIoProtocolGuid ## UNDEFINED - gEfiEdidDiscoveredProtocolGuid ## UNDEFINED - gEfiEdidActiveProtocolGuid ## UNDEFINED - gEfiEdidOverrideProtocolGuid ## UNDEFINED - gEfiLoadFileProtocolGuid ## UNDEFINED - gEfiLoadFile2ProtocolGuid ## UNDEFINED - gEfiTapeIoProtocolGuid ## UNDEFINED - gEfiDiskIoProtocolGuid ## UNDEFINED - gEfiBlockIoProtocolGuid ## UNDEFINED - gEfiUnicodeCollationProtocolGuid ## UNDEFINED - gEfiPciRootBridgeIoProtocolGuid ## UNDEFINED - gEfiPciIoProtocolGuid ## UNDEFINED - gEfiScsiPassThruProtocolGuid ## UNDEFINED - gEfiScsiIoProtocolGuid ## UNDEFINED - gEfiExtScsiPassThruProtocolGuid ## UNDEFINED - gEfiIScsiInitiatorNameProtocolGuid ## UNDEFINED - gEfiUsbIoProtocolGuid ## UNDEFINED - gEfiUsbHcProtocolGuid ## UNDEFINED - gEfiUsb2HcProtocolGuid ## UNDEFINED - gEfiDebugSupportProtocolGuid ## UNDEFINED - gEfiDebugPortProtocolGuid ## UNDEFINED - gEfiDecompressProtocolGuid ## UNDEFINED - gEfiAcpiTableProtocolGuid ## UNDEFINED - gEfiEbcProtocolGuid ## UNDEFINED - gEfiSimpleNetworkProtocolGuid ## UNDEFINED - gEfiNetworkInterfaceIdentifierProtocolGuid ## UNDEFINED - gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## UNDEFINED - gEfiPxeBaseCodeProtocolGuid ## UNDEFINED - gEfiPxeBaseCodeCallbackProtocolGuid ## UNDEFINED - gEfiBisProtocolGuid ## UNDEFINED - gEfiManagedNetworkServiceBindingProtocolGuid ## UNDEFINED - gEfiManagedNetworkProtocolGuid ## UNDEFINED - gEfiArpServiceBindingProtocolGuid ## UNDEFINED - gEfiArpProtocolGuid ## UNDEFINED - gEfiDhcp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiDhcp4ProtocolGuid ## UNDEFINED - gEfiTcp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiTcp4ProtocolGuid ## UNDEFINED - gEfiIp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiIp4ProtocolGuid ## UNDEFINED - gEfiIp4ConfigProtocolGuid ## UNDEFINED - gEfiIp4Config2ProtocolGuid ## UNDEFINED - gEfiUdp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiUdp4ProtocolGuid ## UNDEFINED - gEfiMtftp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiMtftp4ProtocolGuid ## UNDEFINED - gEfiAuthenticationInfoProtocolGuid ## UNDEFINED - gEfiHashServiceBindingProtocolGuid ## UNDEFINED - gEfiHashProtocolGuid ## UNDEFINED - gEfiHiiFontProtocolGuid ## UNDEFINED - gEfiHiiStringProtocolGuid ## UNDEFINED - gEfiHiiImageProtocolGuid ## UNDEFINED - gEfiHiiConfigRoutingProtocolGuid ## UNDEFINED - gEfiHiiConfigAccessProtocolGuid ## UNDEFINED - gEfiFormBrowser2ProtocolGuid ## UNDEFINED - gEfiDeviceIoProtocolGuid ## UNDEFINED - gEfiUgaDrawProtocolGuid ## UNDEFINED - gEfiUgaIoProtocolGuid ## UNDEFINED - gEfiDriverConfigurationProtocolGuid ## UNDEFINED - gEfiDriverConfiguration2ProtocolGuid ## UNDEFINED - gEfiSimpleTextInputExProtocolGuid ## UNDEFINED - gEfiIp6ServiceBindingProtocolGuid ## UNDEFINED - gEfiIp6ProtocolGuid ## UNDEFINED - gEfiIp6ConfigProtocolGuid ## UNDEFINED - gEfiMtftp6ServiceBindingProtocolGuid ## UNDEFINED - gEfiMtftp6ProtocolGuid ## UNDEFINED - gEfiDhcp6ServiceBindingProtocolGuid ## UNDEFINED - gEfiDhcp6ProtocolGuid ## UNDEFINED - gEfiUdp6ServiceBindingProtocolGuid ## UNDEFINED - gEfiUdp6ProtocolGuid ## UNDEFINED - gEfiTcp6ServiceBindingProtocolGuid ## UNDEFINED - gEfiTcp6ProtocolGuid ## UNDEFINED - gEfiVlanConfigProtocolGuid ## UNDEFINED - gEfiEapProtocolGuid ## UNDEFINED - gEfiEapManagementProtocolGuid ## UNDEFINED - gEfiFtp4ServiceBindingProtocolGuid ## UNDEFINED - gEfiFtp4ProtocolGuid ## UNDEFINED - gEfiIpSecConfigProtocolGuid ## UNDEFINED - gEfiDriverHealthProtocolGuid ## UNDEFINED - gEfiDeferredImageLoadProtocolGuid ## UNDEFINED - gEfiUserCredentialProtocolGuid ## UNDEFINED - gEfiUserManagerProtocolGuid ## UNDEFINED - gEfiAtaPassThruProtocolGuid ## UNDEFINED - gEfiFirmwareManagementProtocolGuid ## UNDEFINED - gEfiIpSecProtocolGuid ## UNDEFINED - gEfiIpSec2ProtocolGuid ## UNDEFINED - gEfiKmsProtocolGuid ## UNDEFINED - gEfiBlockIo2ProtocolGuid ## UNDEFINED - gEfiStorageSecurityCommandProtocolGuid ## UNDEFINED - gEfiUserCredential2ProtocolGuid ## UNDEFINED - gPcdProtocolGuid ## UNDEFINED - gEfiTcgProtocolGuid ## UNDEFINED - gEfiHiiPackageListProtocolGuid ## UNDEFINED - gEfiDriverFamilyOverrideProtocolGuid ## UNDEFINED - gEfiIdeControllerInitProtocolGuid ## UNDEFINED - gEfiDiskIo2ProtocolGuid ## UNDEFINED - gEfiAdapterInformationProtocolGuid ## UNDEFINED - gEfiShellDynamicCommandProtocolGuid ## UNDEFINED - gEfiDiskInfoProtocolGuid ## UNDEFINED - gGetPcdInfoProtocolGuid ## UNDEFINED - gEfiBdsArchProtocolGuid ## UNDEFINED - gEfiCpuArchProtocolGuid ## UNDEFINED - gEfiMetronomeArchProtocolGuid ## UNDEFINED - gEfiMonotonicCounterArchProtocolGuid ## UNDEFINED - gEfiRealTimeClockArchProtocolGuid ## UNDEFINED - gEfiResetArchProtocolGuid ## UNDEFINED - gEfiRuntimeArchProtocolGuid ## UNDEFINED - gEfiSecurityArchProtocolGuid ## UNDEFINED - gEfiTimerArchProtocolGuid ## UNDEFINED - gEfiVariableWriteArchProtocolGuid ## UNDEFINED - gEfiVariableArchProtocolGuid ## UNDEFINED - gEfiSecurityPolicyProtocolGuid ## UNDEFINED - gEfiWatchdogTimerArchProtocolGuid ## UNDEFINED - gEfiStatusCodeRuntimeProtocolGuid ## UNDEFINED - gEfiSmbusHcProtocolGuid ## UNDEFINED - gEfiFirmwareVolume2ProtocolGuid ## UNDEFINED - gEfiFirmwareVolumeBlockProtocolGuid ## UNDEFINED - gEfiCapsuleArchProtocolGuid ## UNDEFINED - gEfiMpServiceProtocolGuid ## UNDEFINED - gEfiPciHostBridgeResourceAllocationProtocolGuid ## UNDEFINED - gEfiPciPlatformProtocolGuid ## UNDEFINED - gEfiPciOverrideProtocolGuid ## UNDEFINED - gEfiPciEnumerationCompleteProtocolGuid ## UNDEFINED - gEfiIncompatiblePciDeviceSupportProtocolGuid ## UNDEFINED - gEfiPciHotPlugInitProtocolGuid ## UNDEFINED - gEfiPciHotPlugRequestProtocolGuid ## UNDEFINED - gEfiSmbiosProtocolGuid ## UNDEFINED - gEfiS3SaveStateProtocolGuid ## UNDEFINED - gEfiS3SmmSaveStateProtocolGuid ## UNDEFINED - gEfiRscHandlerProtocolGuid ## UNDEFINED - gEfiSmmRscHandlerProtocolGuid ## UNDEFINED - gEfiAcpiSdtProtocolGuid ## UNDEFINED - gEfiSioProtocolGuid ## UNDEFINED - gEfiSmmCpuIo2ProtocolGuid ## UNDEFINED - gEfiSmmBase2ProtocolGuid ## UNDEFINED - gEfiSmmAccess2ProtocolGuid ## UNDEFINED - gEfiSmmControl2ProtocolGuid ## UNDEFINED - gEfiSmmConfigurationProtocolGuid ## UNDEFINED - gEfiSmmReadyToLockProtocolGuid ## UNDEFINED - gEfiDxeSmmReadyToLockProtocolGuid ## UNDEFINED - gEfiSmmCommunicationProtocolGuid ## UNDEFINED - gEfiSmmStatusCodeProtocolGuid ## UNDEFINED - gEfiSmmCpuProtocolGuid ## UNDEFINED - gEfiSmmPciRootBridgeIoProtocolGuid ## UNDEFINED - gEfiSmmSwDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmSxDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmPeriodicTimerDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmUsbDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmGpiDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmStandbyButtonDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmPowerButtonDispatch2ProtocolGuid ## UNDEFINED - gEfiSmmIoTrapDispatch2ProtocolGuid ## UNDEFINED - gEfiPcdProtocolGuid ## UNDEFINED - gEfiFirmwareVolumeBlock2ProtocolGuid ## UNDEFINED - gEfiCpuIo2ProtocolGuid ## UNDEFINED - gEfiLegacyRegion2ProtocolGuid ## UNDEFINED - gEfiSalMcaInitPmiProtocolGuid ## UNDEFINED - gEfiExtendedSalBootServiceProtocolGuid ## UNDEFINED - gEfiExtendedSalBaseIoServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalStallServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalRtcServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalVariableServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalMtcServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalResetServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalStatusCodeServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalFvBlockServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalMpServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalPalServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalBaseServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalMcaServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalPciServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalCacheServicesProtocolGuid ## UNDEFINED - gEfiExtendedSalMcaLogServicesProtocolGuid ## UNDEFINED - gEfiSecurity2ArchProtocolGuid ## UNDEFINED - gEfiSmmEndOfDxeProtocolGuid ## UNDEFINED - gEfiIsaHcProtocolGuid ## UNDEFINED - gEfiIsaHcServiceBindingProtocolGuid ## UNDEFINED - gEfiSioControlProtocolGuid ## UNDEFINED - gEfiGetPcdInfoProtocolGuid ## UNDEFINED - gEfiI2cMasterProtocolGuid ## UNDEFINED - gEfiI2cIoProtocolGuid ## UNDEFINED - gEfiI2cEnumerateProtocolGuid ## UNDEFINED - gEfiI2cHostProtocolGuid ## UNDEFINED - gEfiI2cBusConfigurationManagementProtocolGuid ## UNDEFINED - gEfiTcg2ProtocolGuid ## UNDEFINED - gEfiTimestampProtocolGuid ## UNDEFINED - gEfiRngProtocolGuid ## UNDEFINED - gEfiNvmExpressPassThruProtocolGuid ## UNDEFINED - gEfiHash2ServiceBindingProtocolGuid ## UNDEFINED - gEfiHash2ProtocolGuid ## UNDEFINED - gEfiBlockIoCryptoProtocolGuid ## UNDEFINED - gEfiSmartCardReaderProtocolGuid ## UNDEFINED - gEfiSmartCardEdgeProtocolGuid ## UNDEFINED - gEfiUsbFunctionIoProtocolGuid ## UNDEFINED - gEfiBluetoothHcProtocolGuid ## UNDEFINED - gEfiBluetoothIoServiceBindingProtocolGuid ## UNDEFINED - gEfiBluetoothIoProtocolGuid ## UNDEFINED - gEfiBluetoothConfigProtocolGuid ## UNDEFINED - gEfiRegularExpressionProtocolGuid ## UNDEFINED - gEfiBootManagerPolicyProtocolGuid ## UNDEFINED - gEfiConfigKeywordHandlerProtocolGuid ## UNDEFINED - gEfiWiFiProtocolGuid ## UNDEFINED - gEfiEapManagement2ProtocolGuid ## UNDEFINED - gEfiEapConfigurationProtocolGuid ## UNDEFINED - gEfiPkcs7VerifyProtocolGuid ## UNDEFINED - gEfiDns4ServiceBindingProtocolGuid ## UNDEFINED - gEfiDns4ProtocolGuid ## UNDEFINED - gEfiDns6ServiceBindingProtocolGuid ## UNDEFINED - gEfiDns6ProtocolGuid ## UNDEFINED - gEfiHttpServiceBindingProtocolGuid ## UNDEFINED - gEfiHttpProtocolGuid ## UNDEFINED - gEfiHttpUtilitiesProtocolGuid ## UNDEFINED - gEfiRestProtocolGuid ## UNDEFINED - gEfiMmEndOfDxeProtocolGuid ## UNDEFINED - gEfiMmIoTrapDispatchProtocolGuid ## UNDEFINED - gEfiMmPowerButtonDispatchProtocolGuid ## UNDEFINED - gEfiMmStandbyButtonDispatchProtocolGuid ## UNDEFINED - gEfiMmGpiDispatchProtocolGuid ## UNDEFINED - gEfiMmUsbDispatchProtocolGuid ## UNDEFINED - gEfiMmPeriodicTimerDispatchProtocolGuid ## UNDEFINED - gEfiMmSxDispatchProtocolGuid ## UNDEFINED - gEfiMmSwDispatchProtocolGuid ## UNDEFINED - gEfiMmPciRootBridgeIoProtocolGuid ## UNDEFINED - gEfiMmCpuProtocolGuid ## UNDEFINED - gEfiMmStatusCodeProtocolGuid ## UNDEFINED - gEfiDxeMmReadyToLockProtocolGuid ## UNDEFINED - gEfiMmConfigurationProtocolGuid ## UNDEFINED - gEfiMmReadyToLockProtocolGuid ## UNDEFINED - gEfiMmControlProtocolGuid ## UNDEFINED - gEfiMmAccessProtocolGuid ## UNDEFINED - gEfiMmBaseProtocolGuid ## UNDEFINED - gEfiMmCpuIoProtocolGuid ## UNDEFINED - gEfiMmRscHandlerProtocolGuid ## UNDEFINED - gEfiMmCommunicationProtocolGuid ## UNDEFINED - gEfiTlsServiceBindingProtocolGuid ## UNDEFINED - gEfiTlsProtocolGuid ## UNDEFINED - gEfiTlsConfigurationProtocolGuid ## UNDEFINED - gEfiSupplicantServiceBindingProtocolGuid ## UNDEFINED - gEfiSupplicantProtocolGuid ## UNDEFINED - gEfiWiFi2ProtocolGuid ## UNDEFINED - gEfiRamDiskProtocolGuid ## UNDEFINED - gEfiHiiImageDecoderProtocolGuid ## UNDEFINED - gEfiHiiImageExProtocolGuid ## UNDEFINED - gEfiSdMmcPassThruProtocolGuid ## UNDEFINED - gEfiEraseBlockProtocolGuid ## UNDEFINED - gEfiBluetoothAttributeProtocolGuid ## UNDEFINED - gEfiBluetoothAttributeServiceBindingProtocolGuid ## UNDEFINED - gEfiBluetoothLeConfigProtocolGuid ## UNDEFINED - gEfiUfsDeviceConfigProtocolGuid ## UNDEFINED - gEfiHttpBootCallbackProtocolGuid ## UNDEFINED - gEfiResetNotificationProtocolGuid ## UNDEFINED - gEfiPartitionInfoProtocolGuid ## UNDEFINED - gEfiHiiPopupProtocolGuid ## UNDEFINED - -[Guids] - gEfiFileInfoGuid ## UNDEFINED - gEfiShellEnvironment2ExtGuid ## SOMETIMES_CONSUMES ## GUID - gEfiPcAnsiGuid ## UNDEFINED - gEfiVT100Guid ## UNDEFINED - gEfiVT100PlusGuid ## UNDEFINED - gEfiVTUTF8Guid ## UNDEFINED - gEfiStandardErrorDeviceGuid ## UNDEFINED - gEfiConsoleInDeviceGuid ## UNDEFINED - gEfiConsoleOutDeviceGuid ## UNDEFINED - gEfiFileSystemInfoGuid ## UNDEFINED - gEfiGlobalVariableGuid ## UNDEFINED - gEfiPartTypeSystemPartGuid ## UNDEFINED - gEfiPartTypeLegacyMbrGuid ## UNDEFINED - gHandleParsingHiiGuid ## UNDEFINED - gEfiAdapterInfoMediaStateGuid ## SOMETIMES_CONSUMES ## GUID - gEfiAdapterInfoNetworkBootGuid ## SOMETIMES_CONSUMES ## GUID - gEfiAdapterInfoSanMacAddressGuid ## SOMETIMES_CONSUMES ## GUID - gEfiAdapterInfoUndiIpv6SupportGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellIncludeNtGuids ## CONSUMES diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni deleted file mode 100644 index 8e1f48c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ /dev/null @@ -1,529 +0,0 @@ -// /** -// -// Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiHandleParsingLib.uni -// -// Abstract: -// -// -// -// **/ - -/=# - -#langdef en-US "english" - -// -// Protocol names used making the GUID <-> Name bi-directional list -// - -// basics Images & Device Path -#string STR_LOADED_IMAGE #language en-US "LoadedImage" -#string STR_DEVICE_PATH #language en-US "DevicePath" -#string STR_IMAGE_PATH #language en-US "ImageDevicePath" -#string STR_DEVICE_PATH_UTIL #language en-US "DevicePathUtilities" -#string STR_DEVICE_PATH_TXT #language en-US "DevicePathToText" -#string STR_DEVICE_PATH_FTXT #language en-US "DevicePathFromText" -#string STR_DEVICE_PATH_PC #language en-US "DevicePathPCAnsi" -#string STR_DEVICE_PATH_VT100 #language en-US "DevicePathVT100" -#string STR_DEVICE_PATH_VT100P #language en-US "DevicePathVT100+" -#string STR_DEVICE_PATH_VTUTF8 #language en-US "DevicePathVTUTF8" - -// Drivers -#string STR_DRIVER_BINDING #language en-US "DriverBinding" -#string STR_PLATFORM_OVERRIDE #language en-US "PlatformOverride" -#string STR_BUS_OVERRIDE #language en-US "BusSpecificDriverOverride" -#string STR_DRIVER_DIAG #language en-US "DriverDiagnostics" -#string STR_DRIVER_DIAG2 #language en-US "DriverDiagnostics2" -#string STR_DRIVER_CN #language en-US "ComponentName" -#string STR_DRIVER_CN2 #language en-US "ComponentName2" -#string STR_PLAT_DRV_CFG #language en-US "PlatformtoDriverConfiguration" -#string STR_DRIVER_VERSION #language en-US "SupportedEfiSpecVersion" - -// Console -#string STR_TXT_IN #language en-US "SimpleTextIn" -#string STR_TXT_IN_EX #language en-US "SimpleTextInEx" -#string STR_TXT_OUT #language en-US "SimpleTextOut" -#string STR_SIM_POINTER #language en-US "SimplePointer" -#string STR_ABS_POINTER #language en-US "AbsolutePointer" -#string STR_SERIAL_IO #language en-US "SerialIO" -#string STR_GRAPHICS_OUTPUT #language en-US "GraphicsOutput" -#string STR_EDID_DISCOVERED #language en-US "EDIDDiscovered" -#string STR_EDID_ACTIVE #language en-US "EDIDActive" -#string STR_EDID_OVERRIDE #language en-US "EDIDOverride" -#string STR_CON_IN #language en-US "ConsoleIn" -#string STR_CON_OUT #language en-US "ConsoleOut" -#string STR_STD_ERR #language en-US "StdErr" - -// Media -#string STR_LOAD_FILE #language en-US "LoadFile" -#string STR_LOAD_FILE2 #language en-US "LoadFile2" -#string STR_SIMPLE_FILE_SYS #language en-US "SimpleFileSystem" -#string STR_FILE_INFO #language en-US "FileInfo" -#string STR_FILE_SYS_INFO #language en-US "FileSystemInfo" -#string STR_TAPE_IO #language en-US "TapeIO" -#string STR_DISK_IO #language en-US "DiskIO" -#string STR_DISK_IO2 #language en-US "DiskIO2" -#string STR_BLK_IO #language en-US "BlockIO" -#string STR_UC #language en-US "UnicodeCollation" -#string STR_UC2 #language en-US "UnicodeCollation2" -#string STR_ADAPTER_INFO #language en-US "AdapterInfo" - -// PCI -#string STR_PCIRB_IO #language en-US "PCIRootBridgeIO" -#string STR_PCI_IO #language en-US "PCIIO" - -// SCSI -#string STR_SCSI_PT #language en-US "SCSIPassThru" -#string STR_SCSI_IO #language en-US "SCSIIO" -#string STR_SCSI_PT_EXT #language en-US "ExtendedSCSIPassThru" - -// iSCSI -#string STR_ISCSI #language en-US "iSCSIInitiatorName" - -// USB -#string STR_USB_IO #language en-US "USBIO" -#string STR_USB_HC #language en-US "USBHostControler" -#string STR_USB_HC2 #language en-US "USBHostController2" - -// Debug -#string STR_DEBUG_SUPPORT #language en-US "DebugSupport" -#string STR_DEBUG_PORT #language en-US "DebugPort" - -#string STR_DECOMPRESS #language en-US "Decompress" - -#string STR_ACPI_TABLE #language en-US "AcpiTable" - -#string STR_EBC_INTERPRETER #language en-US "EBCInterpreter" - -// Network -#string STR_SNP #language en-US "SimpleNetwork" -#string STR_NII #language en-US "NetworkInterfaceIdentifier" -#string STR_NII_31 #language en-US "NetworkInterfaceIdentifier31" -#string STR_PXE_BC #language en-US "PXEBaseCode" -#string STR_PXE_CB #language en-US "PXECallback" -#string STR_BIS #language en-US "BIS" -#string STR_MNP_SB #language en-US "ManagedNetworkServiceBinding" -#string STR_MNP #language en-US "ManagedNetwork" - -#string STR_ARP_SB #language en-US "ARPServiceBinding" -#string STR_ARP #language en-US "ARP" -#string STR_DHCPV4_SB #language en-US "DHCPv4ServiceBinding" -#string STR_DHCPV4 #language en-US "DHCPv4" -#string STR_TCPV4_SB #language en-US "TCPv4ServiceBinding" -#string STR_TCPV4 #language en-US "TCPv4" -#string STR_IPV4_SB #language en-US "IPv4ServiceBinding" -#string STR_IPV4 #language en-US "IPv4" -#string STR_IPV4_CFG #language en-US "IPv4Config" -#string STR_IPV4_CFG2 #language en-US "IPv4Config2" -#string STR_UDPV4_SB #language en-US "UDPv4ServiceBinding" -#string STR_UDPV4 #language en-US "UDPv4" -#string STR_MTFTPV4_SB #language en-US "MTFTPv4ServiceBinding" -#string STR_MTFTPV4 #language en-US "MTFTPv4" - -// Security -#string STR_HASH_SB #language en-US "HashServiceBinding" -#string STR_HASH #language en-US "Hash" -#string STR_AUTH_INFO #language en-US "AuthenticationInfo" - -// HII -#string STR_HII_FONT #language en-US "HIIFont" -#string STR_HII_STRING #language en-US "HIIString" -#string STR_HII_IMAGE #language en-US "HIIImage" -#string STR_HII_DATABASE #language en-US "HIIDatabase" -#string STR_HII_CONFIG_ROUT #language en-US "HIIConfigRouting" -#string STR_HII_CONFIG_ACC #language en-US "HIIConfigAccess" -#string STR_HII_FORM_BROWSER2 #language en-US "HIIFormBrowser2" - -// Shell -#string STR_SHELL_PARAMETERS #language en-US "ShellParameters" -#string STR_SHELL #language en-US "Shell" -#string STR_SHELL_DYNAMIC #language en-US "ShellDynamicCommand" - -#string STR_EFI_GLOBAL_VARIABLE #language en-US "EFIGlobalVariable" - -// NT32 emulation -#string STR_WINNT_THUNK #language en-US "WinNTThunk" -#string STR_WINNT_DRIVER_IO #language en-US "WinNTDriverIO" -#string STR_WINNT_SERIAL_PORT #language en-US "WinNTSerialPort" - -// deprecated protocols -#string STR_SHELL_INTERFACE #language en-US "ShellInterface" -#string STR_SHELL_ENV #language en-US "ShellEnvironment" -#string STR_SHELL_ENV2 #language en-US "ShellEnvironment2" -#string STR_SHELL_DP_MAP #language en-US "ShellDevicePathMap" -#string STR_SHELL_ALIAS #language en-US "ShellAlias" -#string STR_DEVICE_IO #language en-US "DeviceIO" -#string STR_TCP #language en-US "TCP" -#string STR_UGA_DRAW #language en-US "UGADraw" -#string STR_UGA_IO #language en-US "UGAIO" -#string STR_ESP #language en-US "EFISystemPartition" -#string STR_GPT_NBR #language en-US "LegacyMBR" -#string STR_DRIVER_CONFIG #language en-US "DriverConfiguration" -#string STR_DRIVER_CONFIG2 #language en-US "DriverConfiguration2" -#string STR_ISA_IO #language en-US "ISAIO" -#string STR_ISA_ACPI #language en-US "ISAACPI" -#string STR_HII_FORM_BROWSER #language en-US "HIIFormBrowser" -#string STR_HII #language en-US "HII" -#string STR_HII_FORM_CALLBACK #language en-US "HIICallback" - -#string STR_TXT_OUT_DUMP_HEADER #language en-US " Address: %%H%X%%N Attrib %02x" -#string STR_TXT_OUT_DUMP_LINE #language en-US "\r\n %c mode %d: Col %d Row %d" - -#string STR_DRIVER_FAM_OVERRIDE #language en-US "DriverFamilyOverride" -#string STR_PCD #language en-US "Pcd" -#string STR_TCG #language en-US "Tcg" -#string STR_HII_PACKAGE_LIST #language en-US "HiiPackageList" - -#string STR_IP6_SB #language en-US "Ip6ServiceBinding" -#string STR_IP6 #language en-US "Ip6" -#string STR_IP6_CONFIG #language en-US "Ip6Config" -#string STR_MTFTP6_SB #language en-US "Mtftp6ServiceBinding" -#string STR_MTFTP6 #language en-US "Mtftp6" -#string STR_DHCP6_SB #language en-US "Dhcp6ServiceBinding" -#string STR_DHCP6 #language en-US "Dhcp6" -#string STR_UDP6_SB #language en-US "Udp6ServiceBinding" -#string STR_UDP6 #language en-US "Udp6" -#string STR_TCP6_SB #language en-US "Tcp6ServiceBinding" -#string STR_TCP6 #language en-US "Tcp6" -#string STR_VLAN_CONFIG #language en-US "VlanConfig" -#string STR_EAP #language en-US "Eap" -#string STR_EAP_MGMT #language en-US "EapManagement" -#string STR_FTP4_SB #language en-US "Ftp4ServiceBinding" -#string STR_FTP4 #language en-US "Ftp4" -#string STR_IP_SEC_CONFIG #language en-US "IpSecConfig" -#string STR_DH #language en-US "DriverHealth" -#string STR_DEF_IMG_LOAD #language en-US "DeferredImageLoad" -#string STR_USER_CRED #language en-US "UserCredential" -#string STR_USER_MNGR #language en-US "UserManager" -#string STR_ATA_PASS_THRU #language en-US "AtaPassThru" -#string STR_FW_MGMT #language en-US "FirmwareManagement" -#string STR_IP_SEC #language en-US "IpSec" -#string STR_IP_SEC2 #language en-US "IpSec2" -#string STR_KMS #language en-US "Kms" -#string STR_BLK_IO2 #language en-US "BlockIo2" -#string STR_SSC #language en-US "StorageSecurityCommand" -#string STR_UCRED2 #language en-US "UserCredential2" - -#string STR_PCDINFOPROT #language en-US "GetPcdInfoProtocol" -#string STR_BDS_ARCH #language en-US "BdsArch" -#string STR_CPU_ARCH #language en-US "CpuArch" -#string STR_MET_ARCH #language en-US "MetronomeArch" -#string STR_MON_ARCH #language en-US "MonotonicCounterArch" -#string STR_RTC_ARCH #language en-US "RealTimeClockArch" -#string STR_RESET_ARCH #language en-US "ResetArch" -#string STR_RT_ARCH #language en-US "RuntimeArch" -#string STR_SEC_ARCH #language en-US "SecurityArch" -#string STR_TIMER_ARCH #language en-US "TimerArch" -#string STR_VAR_ARCH #language en-US "VariableWriteArch" -#string STR_V_ARCH #language en-US "VariableArch" -#string STR_SECP #language en-US "SecurityPolicy" -#string STR_WDT_ARCH #language en-US "WatchdogTimerArch" -#string STR_SCR #language en-US "StatusCodeRuntime" -#string STR_SMB_HC #language en-US "SmbusHc" -#string STR_FV_2 #language en-US "FirmwareVolume2" -#string STR_FV_BLOCK #language en-US "FirmwareVolumeBlock" -#string STR_CAP_ARCH #language en-US "CapsuleArch" -#string STR_MP_SERVICE #language en-US "MpService" -#string STR_HBRAP #language en-US "PciHostBridgeResourceAllocation" -#string STR_PCIP #language en-US "PciPlatform" -#string STR_PCIO #language en-US "PciOverride" -#string STR_PCIE #language en-US "PciEnumerationComplete" -#string STR_IPCID #language en-US "IncompatiblePciDeviceSupport" -#string STR_PCIHPI #language en-US "PciHotPlugInit" -#string STR_PCIHPR #language en-US "PciHotPlugRequest" -#string STR_SMBIOS #language en-US "Smbios" -#string STR_S3_SAVE #language en-US "S3SaveState" -#string STR_S3_S_SMM #language en-US "S3SmmSaveState" -#string STR_RSC #language en-US "RscHandler" -#string STR_S_RSC #language en-US "SmmRscHandler" -#string STR_ACPI_SDT #language en-US "AcpiSdt" -#string STR_SIO #language en-US "Sio" -#string STR_S_CPU2 #language en-US "SmmCpuIo2" -#string STR_S_BASE2 #language en-US "SmmBase2" -#string STR_S_ACC_2 #language en-US "SmmAccess2" -#string STR_S_CON_2 #language en-US "SmmControl2" -#string STR_S_CONFIG #language en-US "SmmConfig" -#string STR_S_RTL #language en-US "SmmReadyToLock" -#string STR_DS_RTL #language en-US "DxeSmmReadyToLock" -#string STR_S_COMM #language en-US "SmmCommunication" -#string STR_S_STAT #language en-US "SmmStatusCode" -#string STR_S_CPU #language en-US "SmmCpu" -#string STR_S_PCIRBIO #language en-US "SmmPCIRootBridgeIO" -#string STR_S_SWD #language en-US "SmmSwDispatch2" -#string STR_S_SXD #language en-US "SmmSxDispatch2" -#string STR_S_PTD2 #language en-US "SmmPeriodicTimerDispatch2" -#string STR_S_UD2 #language en-US "SmmUsbDispatch2" -#string STR_S_GD2 #language en-US "SmmGpiDispatch2" -#string STR_S_SBD2 #language en-US "SmmStandbyButtonDispatch2" -#string STR_S_PBD2 #language en-US "SmmPowerButtonDispatch2" -#string STR_S_ITD2 #language en-US "SmmIoTrapDispatch2" -#string STR_PCD #language en-US "Pcd" -#string STR_FVB2 #language en-US "FirmwareVolumeBlock2" -#string STR_CPUIO2 #language en-US "CpuIo2" -#string STR_LEGACY_R2 #language en-US "LegacyRegion2" -#string STR_SAL_MIP #language en-US "SalMcaInitPmi" -#string STR_ES_BS #language en-US "ExtendedSalBootService" -#string STR_ES_BIO #language en-US "ExtendedSalBaseIoServices" -#string STR_ES_STALL #language en-US "ExtendedSalStallServices" -#string STR_ES_RTC #language en-US "ExtendedSalRtcServices" -#string STR_ES_VS #language en-US "ExtendedSalVariableServices" -#string STR_ES_MTC #language en-US "ExtendedSalMtcServices" -#string STR_ES_RESET #language en-US "ExtendedSalResetServices" -#string STR_ES_SC #language en-US "ExtendedSalStatusCodeServices" -#string STR_ES_FBS #language en-US "ExtendedSalFvBlockServices" -#string STR_ES_MP #language en-US "ExtendedSalMpServices" -#string STR_ES_PAL #language en-US "ExtendedSalPalServices" -#string STR_ES_BASE #language en-US "ExtendedSalBaseServices" -#string STR_ES_MCA #language en-US "ExtendedSalMcaServices" -#string STR_ES_PCI #language en-US "ExtendedSalPciServices" -#string STR_ES_CACHE #language en-US "ExtendedSalCacheServices" -#string STR_ES_MCA_LOG #language en-US "ExtendedSalMcaLogServices" -#string STR_S2ARCH #language en-US "Security2Arch" -#string STR_EODXE #language en-US "SmmEndOfDxe" -#string STR_ISAHC #language en-US "IsaHc" -#string STR_ISAHC_B #language en-US "IsaHcServiceBinding" -#string STR_SIO_C #language en-US "SioControl" -#string STR_GET_PCD #language en-US "GetPcdInfo" -#string STR_I2C_M #language en-US "I2cMaster" -#string STR_I2CIO #language en-US "I2cIo" -#string STR_I2CEN #language en-US "I2cEnumerate" -#string STR_I2C_H #language en-US "I2cHost" -#string STR_I2C_BCM #language en-US "I2cBusConfigurationManagement" -#string STR_TCG2 #language en-US "Tcg2" -#string STR_TIMESTAMP #language en-US "Timestamp" -#string STR_RNG #language en-US "Rng" -#string STR_NVMEPT #language en-US "NvmExpressPassThru" -#string STR_H2_SB #language en-US "Hash2ServiceBinding" -#string STR_HASH2 #language en-US "Hash2" -#string STR_BIO_C #language en-US "BlockIoCrypto" -#string STR_SCR #language en-US "SmartCardReader" -#string STR_SCE #language en-US "SmartCardEdge" -#string STR_USB_FIO #language en-US "UsbFunctionIo" -#string STR_BC_HC #language en-US "BluetoothHc" -#string STR_BC_IO_SB #language en-US "BluetoothIoServiceBinding" -#string STR_BC_IO #language en-US "BluetoothIo" -#string STR_BC_C #language en-US "BluetoothConfig" -#string STR_REG_EXP #language en-US "RegularExpression" -#string STR_B_MGR_P #language en-US "BootManagerPolicy" -#string STR_CKH #language en-US "ConfigKeywordHandler" -#string STR_WIFI #language en-US "WiFi" -#string STR_EAP_M #language en-US "EapManagement2" -#string STR_EAP_C #language en-US "EapConfiguration" -#string STR_PKCS7 #language en-US "Pkcs7Verify" -#string STR_NET_DNS4_SB #language en-US "Dns4ServiceBinding" -#string STR_NET_DNS4 #language en-US "Dns4" -#string STR_NET_DNS6_SB #language en-US "Dns6ServiceBinding" -#string STR_NET_DNS6 #language en-US "Dns6" -#string STR_NET_HTTP_SB #language en-US "HttpServiceBinding" -#string STR_NET_HTTP #language en-US "Http" -#string STR_NET_HTTP_U #language en-US "HttpUtilities" -#string STR_REST #language en-US "Rest" - -#string STR_MM_EOD #language en-US "MmEndOfDxe" -#string STR_MM_ITD #language en-US "MmIoTrapDispatch" -#string STR_MM_PBD #language en-US "MmPowerButtonDispatch" -#string STR_MM_SBD #language en-US "MmStandbyButtonDispatch" -#string STR_MM_GD #language en-US "MmGpiDispatch" -#string STR_MM_UD #language en-US "MmUsbDispatch" -#string STR_MM_PTD #language en-US "MmPeriodicTimerDispatch" -#string STR_MM_SXD #language en-US "MmSxDispatch" -#string STR_MM_SWD #language en-US "MmSwDispatch" -#string STR_MM_PRBI #language en-US "MmPciRootBridgeIo" -#string STR_MM_CPU #language en-US "MmCpu" -#string STR_MM_STACODE #language en-US "MmStatusCode" -#string STR_DXEMM_RTL #language en-US "DxeMmReadyToLock" -#string STR_MM_CONFIG #language en-US "MmConfiguration" -#string STR_MM_RTL #language en-US "MmReadyToLock" -#string STR_MM_CONTROL #language en-US "MmControl" -#string STR_MM_ACCESS #language en-US "MmAccess" -#string STR_MM_BASE #language en-US "MmBase" -#string STR_MM_CPUIO #language en-US "MmCpuIo" -#string STR_MM_RH #language en-US "MmRscHandler" -#string STR_MM_COM #language en-US "MmCommunication" - -#string STR_TLS_SB #language en-US "TlsServiceBinding" -#string STR_TLS #language en-US "Tls" -#string STR_TLS_CONFIG #language en-US "TlsConfiguration" -#string STR_SUPPLICANT_SB #language en-US "SupplicantServiceBinding" -#string STR_SUPPLICANT #language en-US "Supplicant" - -#string STR_WIFI2 #language en-US "WiFi2" -#string STR_RAMDISK #language en-US "RamDisk" -#string STR_HII_ID #language en-US "HiiImageDecoder" -#string STR_HII_IE #language en-US "HiiImageEx" -#string STR_SD_MPT #language en-US "SdMmcPassThru" -#string STR_ERASE_BLOCK #language en-US "EraseBlock" - -#string STR_BLUETOOTH_ATTR #language en-US "BluetoothAttribute" -#string STR_BLUETOOTH_ATTR_SB #language en-US "BluetoothAttributeServiceBinding" -#string STR_BLUETOOTH_LE_CONFIG #language en-US "BluetoothLeConfig" -#string STR_UFS_DEV_CONFIG #language en-US "UfsDeviceConfig" -#string STR_HTTP_BOOT_CALL #language en-US "HttpBootCallback" -#string STR_RESET_NOTI #language en-US "ResetNotification" -#string STR_PARTITION_INFO #language en-US "PartitionInfo" -#string STR_HII_POPUP #language en-US "HiiPopup" - -#string STR_IDE_CONT_INIT #language en-US "IdeControllerInit" -#string STR_DISK_INFO #language en-US "DiskInfo" -#string STR_BLOCKIO_INFO #language en-US " %s%sMId:%%H%x%%N bsize %%H%x%%N, lblock %lx (%,ld), %s %s %s" -#string STR_DEBUGSUPPORT_INFO #language en-US " Isa = %s" -#string STR_DEBUGSUPPORT_UNKNOWN #language en-US " Unknown (%%H%s%%N)" - -#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %%H%x%%N\r\n" -#string STR_PCIRB_DUMP_SEG #language en-US " Segment #.....: %%H%x%%N\r\n" -#string STR_PCIRB_DUMP_ATT #language en-US " Attributes....: %%H%x%%N\r\n" -#string STR_PCIRB_DUMP_SUPPORTS #language en-US " Supports......: %%H%x%%N\r\n" -#string STR_PCIRB_DUMP_BUS #language en-US " BUS : " -#string STR_PCIRB_DUMP_MEM #language en-US " MEM : " -#string STR_PCIRB_DUMP_IO #language en-US " IO : " -#string STR_PCIRB_DUMP_TITLE #language en-US " Type Flag Base Limit Gran\r\n" - " ==== ==== ================ ================ ====" -#string STR_PCIIO_DUMP_MAIN #language en-US " Segment #.....: %02x\r\n" - " Bus #.........: %02x\r\n" - " Device #......: %02x\r\n" - " Function #....: %02x\r\n" - " ROM Size......: %lx\r\n" - " ROM Location..: %08x\r\n" - " Vendor ID.....: %04x\r\n" - " Device ID.....: %04x\r\n" - " Class Code....: %02x %02x %02x\r\n" - " Configuration Header :" -#string STR_USBIO_DUMP_MAIN #language en-US " Interface Number #.....: %02x\r\n" - " Interface Class #......: %02x\r\n" - " Interface Subclass #...: %02x\r\n" - " Interface Protocol #...: %02x" - -#string STR_LI_DUMP_NAME #language en-US " Name..........: %%H%s%%N\r\n" - -#string STR_LI_DUMP_MAIN #language en-US " Revision......: %%H0x%08x%%N\r\n" - " ParentHandle..: %%H%x%%N\r\n" - " SystemTable...: %%H%x%%N\r\n" - " DeviceHandle..: %%H%x%%N\r\n" - " FilePath......: %%H%s%%N\r\n" - " PdbFileName...: %%H%a%%N\r\n" - " OptionsSize...: %%H%x%%N\r\n" - " LoadOptions...: %%H%x%%N\r\n" - " ImageBase.....: %%H%x%%N\r\n" - " ImageSize.....: %%H%Lx%%N\r\n" - " CodeType......: %%H%s%%N\r\n" - " DataType......: %%H%s%%N\r\n" - " Unload........: %%H%x%%N" - -#string STR_GOP_DUMP_MAIN #language en-US " Max Mode..............: %%H0x%08x%%N\r\n" - " Current Mode..........: %%H0x%08x%%N\r\n" - " Frame Buffer Base.....: %%H0x%L016x%%N\r\n" - " Frame Buffer Size.....: %%H0x%L016x%%N\r\n" - " Mode Info Size........: %%H0x%L016x%%N\r\n" - " Information\r\n" - " Version.............: %%H0x%08x%%N\r\n" - " HorizontalResolution: %%H%d%%N\r\n" - " VerticalResolution..: %%H%d%%N\r\n" - " Pixel Format........: %%H%s%%N\r\n" - " Pixels / Scan Line..: %%H%d%%N\r\n" - " Pixel Info\r\n" - " RedMask...........: %%H0x%08x%%N\r\n" - " GreenMask.........: %%H0x%08x%%N\r\n" - " BlueMask..........: %%H0x%08x%%N\r\n" - -#string STR_GOP_RES_LIST_MAIN #language en-US " Supported Resolution List" -#string STR_GOP_RES_LIST_ENTRY #language en-US "\r\n" - " Resolution[%%H%d%%N]:\r\n" - " Horizontal........: %%H%d%%N\r\n" - " Vertical..........: %%H%d%%N" -#string STR_BSDO_DUMP_MAIN #language en-US " Drv[%02x] File:%%H%s%%N" -#string STR_EDID_DISCOVERED_MAIN #language en-US " EDID Discovered Size : %%H0x%08x%%N\r\n" -#string STR_EDID_DISCOVERED_DATA #language en-US " EDID Discovered Data :\r\n" -#string STR_EDID_ACTIVE_MAIN #language en-US " EDID Active Size : %%H0x%08x%%N\r\n" -#string STR_EDID_ACTIVE_DATA #language en-US " EDID Active Data :\r\n" - -#string STR_GET_SUPP_TYPES_FAILED #language en-US "Unable to get supported types - %%H%r%%N\r\n" -#string STR_SUPP_TYPE_HEADER #language en-US " Supported Information Types: \r\n" -#string STR_GUID_NUMBER #language en-US " Guid[%%H%d%%N] : %g" -#string STR_GUID_STRING #language en-US " - %%B%s%%N\r\n" -#string STR_GETINFO_FAILED #language en-US " Unable to get information - %%H%r%%N\r\n" -#string STR_MEDIA_STATE #language en-US " MediaState: %%H0x%08x - %r%%N\r\n" -#string STR_NETWORK_BOOT_INFO #language en-US "" - " iSsciIpv4BootCapablity : %%H%d%%N\r\n" - " iScsiIpv6BootCapablity : %%H%d%%N\r\n" - " FCoeBootCapablity : %%H%d%%N\r\n" - " OffloadCapability : %%H%d%%N\r\n" - " iScsiMpioCapability : %%H%d%%N\r\n" - " iScsiIpv4Boot : %%H%d%%N\r\n" - " iScsiIpv6Boot : %%H%d%%N\r\n" - " FCoeBoot : %%H%d%%N\r\n" -#string STR_SAN_MAC_ADDRESS_INFO #language en-US " SanMacAddress: %%H%02x-%02x-%02x-%02x-%02x-%02x%%N \r\n" -#string STR_UNDI_IPV6_INFO #language en-US " UNDI IPv6 Supported: %%H%d%%N \r\n" -#string STR_UNKNOWN_INFO_TYPE #language en-US " The 'InformationType' - %%H%g%%N can't be recongnized\r\n" - -#string STR_FMP_IMAGEID_NON_UNIQUE #language en-US " The ImageId value for each Firmware Image is not unique.\r\n" -#string STR_FMP_IMAGE_INFO_SIZE #language en-US " ImageInfoSize: %%H0x%L016x%%N\r\n" -#string STR_FMP_DESCRIPTOR_VERSION #language en-US " DescriptorVersion: %%H%d%%N\r\n" -#string STR_FMP_DESCRIPTOR_COUNT #language en-US " DescriptorCount : %%H%d%%N\r\n" -#string STR_FMP_DESCRIPTOR_SIZE #language en-US " DescriptorSize : %%H0x%Lx%%N\r\n" -#string STR_FMP_PACKAGE_VERSION #language en-US " PackageVersion : %%H0x%08x%%N\r\n" -#string STR_FMP_PACKAGE_VERSION_NAME #language en-US " PackageVersionName : %%H%s%%N\r\n" -#string STR_FMP_IMAGE_DESCRIPTOR_INFO #language en-US "" - " ImageInfo[%%H%d%%N]:\r\n" - " =============\r\n" - " ImageIndex : %%H%d%%N\r\n" - " ImageTypeId : %%H%g%%N\r\n" - " ImageId : %%H%L016x%%N\r\n" - " ImageIdName : %%H%s%%N\r\n" - " Version : %%H0x%08x%%N\r\n" - " VersionName : %%H%s%%N\r\n" - " Size : %%H0x%L016x%%N\r\n" - " AttributesSupported : %%H0x%L016x%%N\r\n" - " AttributesSetting : %%H%s%%N\r\n" - " Compatibilities : %%H0x%L016x%%N\r\n" - " LowestSupportedImageVersion : %%H0x%08x%%N\r\n" - " LastAttemptVersion : %%H0x%08x%%N\r\n" - " LastAttemptStatus : %%H0x%08x%%N\r\n" - " HardwareInstance : %%H0x%08x%%N\r\n" - -#string STR_FMP_IMAGE_DESCRIPTOR_INFO_V1 #language en-US "" - " ImageInfo[%%H%d%%N]:\r\n" - " =============\r\n" - " ImageIndex : %%H%d%%N\r\n" - " ImageTypeId : %%H%g%%N\r\n" - " ImageId : %%H%L016x%%N\r\n" - " ImageIdName : %%H%s%%N\r\n" - " Version : %%H0x%08x%%N\r\n" - " VersionName : %%H%s%%N\r\n" - " Size : %%H0x%L016x%%N\r\n" - " AttributesSupported : %%H0x%L016x%%N\r\n" - " AttributesSetting : %%H%s%%N\r\n" - " Compatibilities : %%H0x%L016x%%N\r\n" - -#string STR_FMP_IMAGE_DESCRIPTOR_INFO_V2 #language en-US "" - " ImageInfo[%%H%d%%N]:\r\n" - " =============\r\n" - " ImageIndex : %%H%d%%N\r\n" - " ImageTypeId : %%H%g%%N\r\n" - " ImageId : %%H%L016x%%N\r\n" - " ImageIdName : %%H%s%%N\r\n" - " Version : %%H0x%08x%%N\r\n" - " VersionName : %%H%s%%N\r\n" - " Size : %%H0x%L016x%%N\r\n" - " AttributesSupported : %%H0x%L016x%%N\r\n" - " AttributesSetting : %%H%s%%N\r\n" - " Compatibilities : %%H0x%L016x%%N\r\n" - " LowestSupportedImageVersion : %%H0x%08x%%N\r\n" - -#string STR_PARTINFO_DUMP_TYPE_OTHER #language en-US " Partition Type : Other" -#string STR_PARTINFO_DUMP_TYPE_MBR #language en-US " Partition Type : MBR" -#string STR_PARTINFO_DUMP_TYPE_GPT #language en-US " Partition Type : GPT" -#string STR_PARTINFO_DUMP_EFI_SYS_PART #language en-US " EFI System Partition : Yes" -#string STR_PARTINFO_DUMP_NOT_EFI_SYS_PART #language en-US " EFI System Partition : No" diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c deleted file mode 100644 index 1e504e7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ /dev/null @@ -1,692 +0,0 @@ -/** @file - ACPI parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiView.h" - -STATIC UINT32 gIndent; -STATIC UINT32 mTableErrorCount; -STATIC UINT32 mTableWarningCount; - -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - An ACPI_PARSER array describing the ACPI header. -**/ -STATIC CONST ACPI_PARSER AcpiHeaderParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) -}; - -/** - This function resets the ACPI table error counter to Zero. -**/ -VOID -ResetErrorCount ( - VOID - ) -{ - mTableErrorCount = 0; -} - -/** - This function returns the ACPI table error count. - - @retval Returns the count of errors detected in the ACPI tables. -**/ -UINT32 -GetErrorCount ( - VOID - ) -{ - return mTableErrorCount; -} - -/** - This function resets the ACPI table warning counter to Zero. -**/ -VOID -ResetWarningCount ( - VOID - ) -{ - mTableWarningCount = 0; -} - -/** - This function returns the ACPI table warning count. - - @retval Returns the count of warning detected in the ACPI tables. -**/ -UINT32 -GetWarningCount ( - VOID - ) -{ - return mTableWarningCount; -} - -/** - This function increments the ACPI table error counter. -**/ -VOID -EFIAPI -IncrementErrorCount ( - VOID - ) -{ - mTableErrorCount++; -} - -/** - This function increments the ACPI table warning counter. -**/ -VOID -EFIAPI -IncrementWarningCount ( - VOID - ) -{ - mTableWarningCount++; -} - -/** - This function verifies the ACPI table checksum. - - This function verifies the checksum for the ACPI table and optionally - prints the status. - - @param [in] Log If TRUE log the status of the checksum. - @param [in] Ptr Pointer to the start of the table buffer. - @param [in] Length The length of the buffer. - - @retval TRUE The checksum is OK. - @retval FALSE The checksum failed. -**/ -BOOLEAN -EFIAPI -VerifyChecksum ( - IN BOOLEAN Log, - IN UINT8* Ptr, - IN UINT32 Length - ) -{ - UINTN ByteCount; - UINT8 Checksum; - UINTN OriginalAttribute; - - ByteCount = 0; - Checksum = 0; - - while (ByteCount < Length) { - Checksum += *(Ptr++); - ByteCount++; - } - - if (Log) { - OriginalAttribute = gST->ConOut->Mode->Attribute; - if (Checksum == 0) { - if (GetColourHighlighting ()) { - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR (EFI_GREEN, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)) - ); - } - Print (L"\n\nTable Checksum : OK\n\n"); - } else { - IncrementErrorCount (); - if (GetColourHighlighting ()) { - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR (EFI_RED, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)) - ); - } - Print (L"\n\nTable Checksum : FAILED (0x%X)\n\n", Checksum); - } - if (GetColourHighlighting ()) { - gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); - } - } - - return (Checksum == 0); -} - -/** - This function performs a raw data dump of the ACPI table. - - @param [in] Ptr Pointer to the start of the table buffer. - @param [in] Length The length of the buffer. -**/ -VOID -EFIAPI -DumpRaw ( - IN UINT8* Ptr, - IN UINT32 Length - ) -{ - UINTN ByteCount; - UINTN PartLineChars; - UINTN AsciiBufferIndex; - CHAR8 AsciiBuffer[17]; - - ByteCount = 0; - AsciiBufferIndex = 0; - - Print (L"Address : 0x%p\n", Ptr); - Print (L"Length : %d\n", Length); - - while (ByteCount < Length) { - if ((ByteCount & 0x0F) == 0) { - AsciiBuffer[AsciiBufferIndex] = '\0'; - Print (L" %a\n%08X : ", AsciiBuffer, ByteCount); - AsciiBufferIndex = 0; - } else if ((ByteCount & 0x07) == 0) { - Print (L"- "); - } - - if ((*Ptr >= ' ') && (*Ptr < 0x7F)) { - AsciiBuffer[AsciiBufferIndex++] = *Ptr; - } else { - AsciiBuffer[AsciiBufferIndex++] = '.'; - } - - Print (L"%02X ", *Ptr++); - - ByteCount++; - } - - // Justify the final line using spaces before printing - // the ASCII data. - PartLineChars = (Length & 0x0F); - if (PartLineChars != 0) { - PartLineChars = 48 - (PartLineChars * 3); - if ((Length & 0x0F) <= 8) { - PartLineChars += 2; - } - while (PartLineChars > 0) { - Print (L" "); - PartLineChars--; - } - } - - // Print ASCII data for the final line. - AsciiBuffer[AsciiBufferIndex] = '\0'; - Print (L" %a", AsciiBuffer); -} - -/** - This function traces 1 byte of data as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint8 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ) -{ - Print (Format, *Ptr); -} - -/** - This function traces 2 bytes of data as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint16 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ) -{ - Print (Format, *(UINT16*)Ptr); -} - -/** - This function traces 4 bytes of data as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint32 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ) -{ - Print (Format, *(UINT32*)Ptr); -} - -/** - This function traces 8 bytes of data as specified by the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint64 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ) -{ - // Some fields are not aligned and this causes alignment faults - // on ARM platforms if the compiler generates LDRD instructions. - // Perform word access so that LDRD instructions are not generated. - UINT64 Val; - - Val = *(UINT32*)(Ptr + sizeof (UINT32)); - - Val <<= 32; - Val |= (UINT64)*(UINT32*)Ptr; - - Print (Format, Val); -} - -/** - This function traces 3 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump3Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ) -{ - Print ( - (Format != NULL) ? Format : L"%c%c%c", - Ptr[0], - Ptr[1], - Ptr[2] - ); -} - -/** - This function traces 4 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump4Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ) -{ - Print ( - (Format != NULL) ? Format : L"%c%c%c%c", - Ptr[0], - Ptr[1], - Ptr[2], - Ptr[3] - ); -} - -/** - This function traces 6 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump6Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ) -{ - Print ( - (Format != NULL) ? Format : L"%c%c%c%c%c%c", - Ptr[0], - Ptr[1], - Ptr[2], - Ptr[3], - Ptr[4], - Ptr[5] - ); -} - -/** - This function traces 8 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump8Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ) -{ - Print ( - (Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c", - Ptr[0], - Ptr[1], - Ptr[2], - Ptr[3], - Ptr[4], - Ptr[5], - Ptr[6], - Ptr[7] - ); -} - -/** - This function indents and prints the ACPI table Field Name. - - @param [in] Indent Number of spaces to add to the global table indent. - The global table indent is 0 by default; however - this value is updated on entry to the ParseAcpi() - by adding the indent value provided to ParseAcpi() - and restored back on exit. - Therefore the total indent in the output is - dependent on from where this function is called. - @param [in] FieldName Pointer to the Field Name. -**/ -VOID -EFIAPI -PrintFieldName ( - IN UINT32 Indent, - IN CONST CHAR16* FieldName -) -{ - Print ( - L"%*a%-*s : ", - gIndent + Indent, - "", - (OUTPUT_FIELD_COLUMN_WIDTH - gIndent - Indent), - FieldName - ); -} - -/** - This function is used to parse an ACPI table buffer. - - The ACPI table buffer is parsed using the ACPI table parser information - specified by a pointer to an array of ACPI_PARSER elements. This parser - function iterates through each item on the ACPI_PARSER array and logs the - ACPI table fields. - - This function can optionally be used to parse ACPI tables and fetch specific - field values. The ItemPtr member of the ACPI_PARSER structure (where used) - is updated by this parser function to point to the selected field data - (e.g. useful for variable length nested fields). - - @param [in] Trace Trace the ACPI fields TRUE else only parse the - table. - @param [in] Indent Number of spaces to indent the output. - @param [in] AsciiName Optional pointer to an ASCII string that describes - the table being parsed. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer pointed by Ptr. - @param [in] Parser Pointer to an array of ACPI_PARSER structure that - describes the table being parsed. - @param [in] ParserItems Number of items in the ACPI_PARSER array. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -ParseAcpi ( - IN BOOLEAN Trace, - IN UINT32 Indent, - IN CONST CHAR8* AsciiName OPTIONAL, - IN UINT8* Ptr, - IN UINT32 Length, - IN CONST ACPI_PARSER* Parser, - IN UINT32 ParserItems -) -{ - UINT32 Index; - UINT32 Offset; - BOOLEAN HighLight; - UINTN OriginalAttribute; - - Offset = 0; - - // Increment the Indent - gIndent += Indent; - - if (Trace && (AsciiName != NULL)){ - HighLight = GetColourHighlighting (); - - if (HighLight) { - OriginalAttribute = gST->ConOut->Mode->Attribute; - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR(EFI_YELLOW, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)) - ); - } - Print ( - L"%*a%-*a :\n", - gIndent, - "", - (OUTPUT_FIELD_COLUMN_WIDTH - gIndent), - AsciiName - ); - if (HighLight) { - gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); - } - } - - for (Index = 0; Index < ParserItems; Index++) { - if ((Offset + Parser[Index].Length) > Length) { - // We don't parse past the end of the max length specified - break; - } - - if (Offset != Parser[Index].Offset) { - IncrementErrorCount (); - Print ( - L"\nERROR: %a: Offset Mismatch for %s\n" - L"CurrentOffset = %d FieldOffset = %d\n", - AsciiName, - Parser[Index].NameStr, - Offset, - Parser[Index].Offset - ); - } - - if (Trace) { - // if there is a Formatter function let the function handle - // the printing else if a Format is specified in the table use - // the Format for printing - PrintFieldName (2, Parser[Index].NameStr); - if (Parser[Index].PrintFormatter != NULL) { - Parser[Index].PrintFormatter (Parser[Index].Format, Ptr); - } else if (Parser[Index].Format != NULL) { - switch (Parser[Index].Length) { - case 1: - DumpUint8 (Parser[Index].Format, Ptr); - break; - case 2: - DumpUint16 (Parser[Index].Format, Ptr); - break; - case 4: - DumpUint32 (Parser[Index].Format, Ptr); - break; - case 8: - DumpUint64 (Parser[Index].Format, Ptr); - break; - default: - Print ( - L"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n", - AsciiName, - Parser[Index].Length - ); - } // switch - - // Validating only makes sense if we are tracing - // the parsed table entries, to report by table name. - if (Parser[Index].FieldValidator != NULL) { - Parser[Index].FieldValidator (Ptr, Parser[Index].Context); - } - } - Print (L"\n"); - } // if (Trace) - - if (Parser[Index].ItemPtr != NULL) { - *Parser[Index].ItemPtr = (VOID*)Ptr; - } - - Ptr += Parser[Index].Length; - Offset += Parser[Index].Length; - } // for - - // Decrement the Indent - gIndent -= Indent; - return Offset; -} - -/** - An array describing the ACPI Generic Address Structure. - The GasParser array is used by the ParseAcpi function to parse and/or trace - the GAS structure. -**/ -STATIC CONST ACPI_PARSER GasParser[] = { - {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Address Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL} -}; - -/** - This function indents and traces the GAS structure as described by the GasParser. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Indent Number of spaces to indent the output. -**/ -VOID -EFIAPI -DumpGasStruct ( - IN UINT8* Ptr, - IN UINT32 Indent - ) -{ - Print (L"\n"); - ParseAcpi ( - TRUE, - Indent, - NULL, - Ptr, - GAS_LENGTH, - PARSER_PARAMS (GasParser) - ); -} - -/** - This function traces the GAS structure as described by the GasParser. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpGas ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ) -{ - DumpGasStruct (Ptr, 2); -} - -/** - This function traces the ACPI header as described by the AcpiHeaderParser. - - @param [in] Ptr Pointer to the start of the buffer. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -DumpAcpiHeader ( - IN UINT8* Ptr - ) -{ - return ParseAcpi ( - TRUE, - 0, - "ACPI Table Header", - Ptr, - ACPI_DESCRIPTION_HEADER_LENGTH, - PARSER_PARAMS (AcpiHeaderParser) - ); -} - -/** - This function parses the ACPI header as described by the AcpiHeaderParser. - - This function optionally returns the signature, length and revision of the - ACPI table. - - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Signature Gets location of the ACPI table signature. - @param [out] Length Gets location of the length of the ACPI table. - @param [out] Revision Gets location of the revision of the ACPI table. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -ParseAcpiHeader ( - IN UINT8* Ptr, - OUT CONST UINT32** Signature, - OUT CONST UINT32** Length, - OUT CONST UINT8** Revision - ) -{ - UINT32 BytesParsed; - - BytesParsed = ParseAcpi ( - FALSE, - 0, - NULL, - Ptr, - ACPI_DESCRIPTION_HEADER_LENGTH, - PARSER_PARAMS (AcpiHeaderParser) - ); - - *Signature = AcpiHdrInfo.Signature; - *Length = AcpiHdrInfo.Length; - *Revision = AcpiHdrInfo.Revision; - - return BytesParsed; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h deleted file mode 100644 index ea17c54..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ /dev/null @@ -1,815 +0,0 @@ -/** @file - Header file for ACPI parser - - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef ACPIPARSER_H_ -#define ACPIPARSER_H_ - -#define OUTPUT_FIELD_COLUMN_WIDTH 36 - -/// The RSDP table signature is "RSD PTR " (8 bytes) -/// However The signature for ACPI tables is 4 bytes. -/// To work around this oddity define a signature type -/// that allows us to process the log options. -#define RSDP_TABLE_INFO SIGNATURE_32('R', 'S', 'D', 'P') - -/** - This function increments the ACPI table error counter. -**/ -VOID -EFIAPI -IncrementErrorCount ( - VOID - ); - -/** - This function increments the ACPI table warning counter. -**/ -VOID -EFIAPI -IncrementWarningCount ( - VOID - ); - -/** - This function verifies the ACPI table checksum. - - This function verifies the checksum for the ACPI table and optionally - prints the status. - - @param [in] Log If TRUE log the status of the checksum. - @param [in] Ptr Pointer to the start of the table buffer. - @param [in] Length The length of the buffer. - - @retval TRUE The checksum is OK. - @retval FALSE The checksum failed. -**/ -BOOLEAN -EFIAPI -VerifyChecksum ( - IN BOOLEAN Log, - IN UINT8* Ptr, - IN UINT32 Length - ); - -/** - This function performs a raw data dump of the ACPI table. - - @param [in] Ptr Pointer to the start of the table buffer. - @param [in] Length The length of the buffer. -**/ -VOID -EFIAPI -DumpRaw ( - IN UINT8* Ptr, - IN UINT32 Length - ); - -/** - This function traces 1 byte of datum as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint8 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); - -/** - This function traces 2 bytes of data as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint16 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); - -/** - This function traces 4 bytes of data as specified in the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint32 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); - -/** - This function traces 8 bytes of data as specified by the format string. - - @param [in] Format The format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpUint64 ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); - -/** - This function traces 3 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump3Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ); - -/** - This function traces 4 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump4Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ); - -/** - This function traces 6 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump6Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ); - -/** - This function traces 8 characters which can be optionally - formated using the format string if specified. - - If no format string is specified the Format must be NULL. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -Dump8Chars ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ); - -/** - This function indents and prints the ACPI table Field Name. - - @param [in] Indent Number of spaces to add to the global table - indent. The global table indent is 0 by default; - however this value is updated on entry to the - ParseAcpi() by adding the indent value provided to - ParseAcpi() and restored back on exit. Therefore - the total indent in the output is dependent on from - where this function is called. - @param [in] FieldName Pointer to the Field Name. -**/ -VOID -EFIAPI -PrintFieldName ( - IN UINT32 Indent, - IN CONST CHAR16* FieldName - ); - -/** - This function pointer is the template for customizing the trace output - - @param [in] Format Format string for tracing the data as specified by - the 'Format' member of ACPI_PARSER. - @param [in] Ptr Pointer to the start of the buffer. -**/ -typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr); - -/** - This function pointer is the template for validating an ACPI table field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information as specified by - the 'Context' member of the ACPI_PARSER. - e.g. this could be a pointer to the ACPI table header. -**/ -typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context); - -/** - The ACPI_PARSER structure describes the fields of an ACPI table and - provides means for the parser to interpret and trace appropriately. - - The first three members are populated based on information present in - in the ACPI table specifications. The remaining members describe how - the parser should report the field information, validate the field data - and/or update an external pointer to the field (ItemPtr). - - ParseAcpi() uses the format string specified by 'Format' for tracing - the field data. If the field is more complex and requires additional - processing for formatting and representation a print formatter function - can be specified in 'PrintFormatter'. - The PrintFormatter function may choose to use the format string - specified by 'Format' or use its own internal format string. - - The 'Format' and 'PrintFormatter' members allow flexibility for - representing the field data. -**/ -typedef struct AcpiParser { - - /// String describing the ACPI table field - /// (Field column from ACPI table spec) - CONST CHAR16* NameStr; - - /// The length of the field. - /// (Byte Length column from ACPI table spec) - UINT32 Length; - - /// The offset of the field from the start of the table. - /// (Byte Offset column from ACPI table spec) - UINT32 Offset; - - /// Optional Print() style format string for tracing the data. If not - /// used this must be set to NULL. - CONST CHAR16* Format; - - /// Optional pointer to a print formatter function which - /// is typically used to trace complex field information. - /// If not used this must be set to NULL. - /// The Format string is passed to the PrintFormatter function - /// but may be ignored by the implementation code. - FNPTR_PRINT_FORMATTER PrintFormatter; - - /// Optional pointer which may be set to request the parser to update - /// a pointer to the field data. If unused this must be set to NULL. - VOID** ItemPtr; - - /// Optional pointer to a field validator function. - /// The function should directly report any appropriate error or warning - /// and invoke the appropriate counter update function. - /// If not used this parameter must be set to NULL. - FNPTR_FIELD_VALIDATOR FieldValidator; - - /// Optional pointer to context specific information, - /// which the Field Validator function can use to determine - /// additional information about the ACPI table and make - /// decisions about the field being validated. - /// e.g. this could be a pointer to the ACPI table header - VOID* Context; -} ACPI_PARSER; - -/** - A structure used to store the pointers to the members of the - ACPI description header structure that was parsed. -**/ -typedef struct AcpiDescriptionHeaderInfo { - /// ACPI table signature - UINT32* Signature; - /// Length of the ACPI table - UINT32* Length; - /// Revision - UINT8* Revision; - /// Checksum - UINT8* Checksum; - /// OEM Id - length is 6 bytes - UINT8* OemId; - /// OEM table Id - UINT64* OemTableId; - /// OEM revision Id - UINT32* OemRevision; - /// Creator Id - UINT32* CreatorId; - /// Creator revision - UINT32* CreatorRevision; -} ACPI_DESCRIPTION_HEADER_INFO; - -/** - This function is used to parse an ACPI table buffer. - - The ACPI table buffer is parsed using the ACPI table parser information - specified by a pointer to an array of ACPI_PARSER elements. This parser - function iterates through each item on the ACPI_PARSER array and logs the - ACPI table fields. - - This function can optionally be used to parse ACPI tables and fetch specific - field values. The ItemPtr member of the ACPI_PARSER structure (where used) - is updated by this parser function to point to the selected field data - (e.g. useful for variable length nested fields). - - @param [in] Trace Trace the ACPI fields TRUE else only parse the - table. - @param [in] Indent Number of spaces to indent the output. - @param [in] AsciiName Optional pointer to an ASCII string that describes - the table being parsed. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer pointed by Ptr. - @param [in] Parser Pointer to an array of ACPI_PARSER structure that - describes the table being parsed. - @param [in] ParserItems Number of items in the ACPI_PARSER array. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -ParseAcpi ( - IN BOOLEAN Trace, - IN UINT32 Indent, - IN CONST CHAR8* AsciiName OPTIONAL, - IN UINT8* Ptr, - IN UINT32 Length, - IN CONST ACPI_PARSER* Parser, - IN UINT32 ParserItems - ); - -/** - This is a helper macro to pass parameters to the Parser functions. - - @param [in] Parser The name of the ACPI_PARSER array describing the - ACPI table fields. -**/ -#define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0]) - -/** - This is a helper macro for describing the ACPI header fields. - - @param [out] Info Pointer to retrieve the ACPI table header information. -**/ -#define PARSE_ACPI_HEADER(Info) \ - { L"Signature", 4, 0, NULL, Dump4Chars, \ - (VOID**)&(Info)->Signature , NULL, NULL }, \ - { L"Length", 4, 4, L"%d", NULL, \ - (VOID**)&(Info)->Length, NULL, NULL }, \ - { L"Revision", 1, 8, L"%d", NULL, \ - (VOID**)&(Info)->Revision, NULL, NULL }, \ - { L"Checksum", 1, 9, L"0x%X", NULL, \ - (VOID**)&(Info)->Checksum, NULL, NULL }, \ - { L"Oem ID", 6, 10, NULL, Dump6Chars, \ - (VOID**)&(Info)->OemId, NULL, NULL }, \ - { L"Oem Table ID", 8, 16, NULL, Dump8Chars, \ - (VOID**)&(Info)->OemTableId, NULL, NULL }, \ - { L"Oem Revision", 4, 24, L"0x%X", NULL, \ - (VOID**)&(Info)->OemRevision, NULL, NULL }, \ - { L"Creator ID", 4, 28, NULL, Dump4Chars, \ - (VOID**)&(Info)->CreatorId, NULL, NULL }, \ - { L"Creator Revision", 4, 32, L"0x%X", NULL, \ - (VOID**)&(Info)->CreatorRevision, NULL, NULL } - -/** - Length of the ACPI GAS structure. - - NOTE: This might normally be defined as - sizeof (EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE). - However, we deliberately minimise any reference to the EDK2 ACPI - headers in an attempt to provide cross checking. -**/ -#define GAS_LENGTH 12 - -/** - Length of the ACPI Header structure. - - NOTE: This might normally be defined as - sizeof (EFI_ACPI_DESCRIPTION_HEADER). - However, we deliberately minimise any reference to the EDK2 ACPI - headers in an attempt to provide cross checking. -**/ -#define ACPI_DESCRIPTION_HEADER_LENGTH 36 - -/** - This function indents and traces the GAS structure as described by the GasParser. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Indent Number of spaces to indent the output. -**/ -VOID -EFIAPI -DumpGasStruct ( - IN UINT8* Ptr, - IN UINT32 Indent - ); - -/** - This function traces the GAS structure as described by the GasParser. - - @param [in] Format Optional format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -VOID -EFIAPI -DumpGas ( - IN CONST CHAR16* Format OPTIONAL, - IN UINT8* Ptr - ); - -/** - This function traces the ACPI header as described by the AcpiHeaderParser. - - @param [in] Ptr Pointer to the start of the buffer. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -DumpAcpiHeader ( - IN UINT8* Ptr - ); - -/** - This function parses the ACPI header as described by the AcpiHeaderParser. - - This function optionally returns the Signature, Length and revision of the - ACPI table. - - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Signature Gets location of the ACPI table signature. - @param [out] Length Gets location of the length of the ACPI table. - @param [out] Revision Gets location of the revision of the ACPI table. - - @retval Number of bytes parsed. -**/ -UINT32 -EFIAPI -ParseAcpiHeader ( - IN UINT8* Ptr, - OUT CONST UINT32** Signature, - OUT CONST UINT32** Length, - OUT CONST UINT8** Revision - ); - -/** - This function parses the ACPI BGRT table. - When trace is enabled this function parses the BGRT table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiBgrt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI DBG2 table. - When trace is enabled this function parses the DBG2 table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiDbg2 ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI DSDT table. - When trace is enabled this function parses the DSDT table and - traces the ACPI table fields. - For the DSDT table only the ACPI header fields are parsed and - traced. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiDsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI FADT table. - This function parses the FADT table and optionally traces the ACPI - table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiFadt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI GTDT table. - When trace is enabled this function parses the GTDT table and - traces the ACPI table fields. - - This function also parses the following platform timer structures: - - GT Block timer - - Watchdog timer - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiGtdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI IORT table. - When trace is enabled this function parses the IORT table and - traces the ACPI fields. - - This function also parses the following nodes: - - ITS Group - - Named Component - - Root Complex - - SMMUv1/2 - - SMMUv3 - - PMCG - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiIort ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI MADT table. - When trace is enabled this function parses the MADT table and - traces the ACPI table fields. - - This function currently parses the following Interrupt Controller - Structures: - - GICC - - GICD - - GIC MSI Frame - - GICR - - GIC ITS - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiMadt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI MCFG table. - When trace is enabled this function parses the MCFG table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiMcfg ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI PPTT table. - When trace is enabled this function parses the PPTT table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiPptt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI RSDP table. - - This function invokes the parser for the XSDT table. - * Note - This function does not support parsing of RSDT table. - - This function also performs a RAW dump of the ACPI table and - validates the checksum. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiRsdp ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI SLIT table. - When trace is enabled this function parses the SLIT table and - traces the ACPI table fields. - - This function also validates System Localities for the following: - - Diagonal elements have a normalized value of 10 - - Relative distance from System Locality at i*N+j is same as - j*N+i - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSlit ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI SPCR table. - When trace is enabled this function parses the SPCR table and - traces the ACPI table fields. - - This function also performs validations of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSpcr ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI SRAT table. - When trace is enabled this function parses the SRAT table and - traces the ACPI table fields. - - This function parses the following Resource Allocation Structures: - - Processor Local APIC/SAPIC Affinity Structure - - Memory Affinity Structure - - Processor Local x2APIC Affinity Structure - - GICC Affinity Structure - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSrat ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI SSDT table. - When trace is enabled this function parses the SSDT table and - traces the ACPI table fields. - For the SSDT table only the ACPI header fields are - parsed and traced. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - This function parses the ACPI XSDT table - and optionally traces the ACPI table fields. - - This function also performs validation of the XSDT table. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiXsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -#endif // ACPIPARSER_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c deleted file mode 100644 index 934fda3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ /dev/null @@ -1,220 +0,0 @@ -/** @file - ACPI table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" -#include "AcpiView.h" - -/** - A list of registered ACPI table parsers. -**/ -STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; - -/** - Register the ACPI table Parser - - This function registers the ACPI table parser. - - @param [in] Signature The ACPI table signature. - @param [in] ParserProc The ACPI table parser. - - @retval EFI_SUCCESS The parser is registered. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_ALREADY_STARTED The parser for the Table - was already registered. - @retval EFI_OUT_OF_RESOURCES No space to register the - parser. -**/ -EFI_STATUS -EFIAPI -RegisterParser ( - IN UINT32 Signature, - IN PARSE_ACPI_TABLE_PROC ParserProc - ) -{ - UINT32 Index; - - if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { - return EFI_INVALID_PARAMETER; - } - - // Search if a parser is already installed - for (Index = 0; - Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - Index++) - { - if (Signature == mTableParserList[Index].Signature) { - if (mTableParserList[Index].Parser != NULL) { - return EFI_ALREADY_STARTED; - } - } - } - - // Find the first free slot and register the parser - for (Index = 0; - Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - Index++) - { - if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) { - mTableParserList[Index].Signature = Signature; - mTableParserList[Index].Parser = ParserProc; - return EFI_SUCCESS; - } - } - - // No free slot found - return EFI_OUT_OF_RESOURCES; -} - -/** - Deregister the ACPI table Parser - - This function deregisters the ACPI table parser. - - @param [in] Signature The ACPI table signature. - - @retval EFI_SUCCESS The parser was deregistered. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_NOT_FOUND A registered parser was not found. -**/ -EFI_STATUS -EFIAPI -DeregisterParser ( - IN UINT32 Signature - ) -{ - UINT32 Index; - - if (Signature == ACPI_PARSER_SIGNATURE_NULL) { - return EFI_INVALID_PARAMETER; - } - - for (Index = 0; - Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - Index++) - { - if (Signature == mTableParserList[Index].Signature) { - mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL; - mTableParserList[Index].Parser = NULL; - return EFI_SUCCESS; - } - } - - // No matching registered parser found. - return EFI_NOT_FOUND; -} - -/** - Get the ACPI table Parser - - This function returns the ACPI table parser proc from the list of - registered parsers. - - @param [in] Signature The ACPI table signature. - @param [out] ParserProc Pointer to a ACPI table parser proc. - - @retval EFI_SUCCESS The parser was returned successfully. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_NOT_FOUND A registered parser was not found. -**/ -EFI_STATUS -EFIAPI -GetParser ( - IN UINT32 Signature, - OUT PARSE_ACPI_TABLE_PROC * ParserProc - ) -{ - UINT32 Index; - - if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { - return EFI_INVALID_PARAMETER; - } - - for (Index = 0; - Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - Index++) - { - if (Signature == mTableParserList[Index].Signature) { - *ParserProc = mTableParserList[Index].Parser; - return EFI_SUCCESS; - } - } - - // No matching registered parser found. - return EFI_NOT_FOUND; -} - -/** - This function processes the ACPI tables. - This function calls ProcessTableReportOptions() to list the ACPI - tables, perform binary dump of the tables and determine if the - ACPI fields should be traced. - - This function also invokes the parser for the ACPI tables. - - This function also performs a RAW dump of the ACPI table including - the unknown/unparsed ACPI tables and validates the checksum. - - @param [in] Ptr Pointer to the start of the ACPI - table data buffer. -**/ -VOID -EFIAPI -ProcessAcpiTable ( - IN UINT8* Ptr - ) -{ - EFI_STATUS Status; - BOOLEAN Trace; - CONST UINT32* AcpiTableSignature; - CONST UINT32* AcpiTableLength; - CONST UINT8* AcpiTableRevision; - PARSE_ACPI_TABLE_PROC ParserProc; - - ParseAcpiHeader ( - Ptr, - &AcpiTableSignature, - &AcpiTableLength, - &AcpiTableRevision - ); - - Trace = ProcessTableReportOptions ( - *AcpiTableSignature, - Ptr, - *AcpiTableLength - ); - - if (Trace) { - DumpRaw (Ptr, *AcpiTableLength); - VerifyChecksum (TRUE, Ptr, *AcpiTableLength); - } - - Status = GetParser (*AcpiTableSignature, &ParserProc); - if (EFI_ERROR (Status)) { - // No registered parser found, do default handling. - if (Trace) { - DumpAcpiHeader (Ptr); - } - return; - } - - ParserProc ( - Trace, - Ptr, - *AcpiTableLength, - *AcpiTableRevision - ); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h deleted file mode 100644 index 0d9d78c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ /dev/null @@ -1,133 +0,0 @@ -/** @file - Header file for ACPI table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef ACPITABLEPARSER_H_ -#define ACPITABLEPARSER_H_ - -/** - The maximum number of ACPI table parsers. -*/ -#define MAX_ACPI_TABLE_PARSERS 16 - -/** An invalid/NULL signature value. -*/ -#define ACPI_PARSER_SIGNATURE_NULL 0 - -/** - A function that parses the ACPI table. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -typedef -VOID -(EFIAPI * PARSE_ACPI_TABLE_PROC) ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ); - -/** - The ACPI table parser information -**/ -typedef struct AcpiTableParser { - /// ACPI table signature - UINT32 Signature; - - /// The ACPI table parser function. - PARSE_ACPI_TABLE_PROC Parser; -} ACPI_TABLE_PARSER; - -/** - Register the ACPI table Parser - - This function registers the ACPI table parser. - - @param [in] Signature The ACPI table signature. - @param [in] ParserProc The ACPI table parser. - - @retval EFI_SUCCESS The parser is registered. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_ALREADY_STARTED The parser for the Table - was already registered. - @retval EFI_OUT_OF_RESOURCES No space to register the - parser. -**/ -EFI_STATUS -EFIAPI -RegisterParser ( - IN UINT32 Signature, - IN PARSE_ACPI_TABLE_PROC ParserProc - ); - -/** - Deregister the ACPI table Parser - - This function deregisters the ACPI table parser. - - @param [in] Signature The ACPI table signature. - - @retval EFI_SUCCESS The parser was deregistered. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_NOT_FOUND A registered parser was not found. -**/ -EFI_STATUS -EFIAPI -DeregisterParser ( - IN UINT32 Signature - ); - -/** - This function processes the ACPI tables. - This function calls ProcessTableReportOptions() to list the ACPI - tables, perform binary dump of the tables and determine if the - ACPI fields should be traced. - - This function also invokes the parser for the ACPI tables. - - This function also performs a RAW dump of the ACPI table including - the unknown/unparsed ACPI tables and validates the checksum. - - @param [in] Ptr Pointer to the start of the ACPI - table data buffer. -**/ -VOID -EFIAPI -ProcessAcpiTable ( - IN UINT8* Ptr - ); - -/** - Get the ACPI table Parser - - This function returns the ACPI table parser proc from the list of - registered parsers. - - @param [in] Signature The ACPI table signature. - @param [out] ParserProc Pointer to a ACPI table parser proc. - - @retval EFI_SUCCESS The parser was returned successfully. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_NOT_FOUND A registered parser was not found. -**/ -EFI_STATUS -EFIAPI -GetParser ( - IN UINT32 Signature, - OUT PARSE_ACPI_TABLE_PROC * ParserProc - ); - -#endif // ACPITABLEPARSER_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c deleted file mode 100644 index ad65e6b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ /dev/null @@ -1,627 +0,0 @@ -/** @file - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" -#include "AcpiView.h" -#include "UefiShellAcpiViewCommandLib.h" - -EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL; - -// Report variables -STATIC UINT32 mSelectedAcpiTable; -STATIC CONST CHAR16* mSelectedAcpiTableName; -STATIC BOOLEAN mSelectedAcpiTableFound; -STATIC EREPORT_OPTION mReportType; -STATIC UINT32 mTableCount; -STATIC UINT32 mBinTableCount; -STATIC BOOLEAN mVerbose; -STATIC BOOLEAN mConsistencyCheck; -STATIC BOOLEAN mColourHighlighting; - -/** - An array of acpiview command line parameters. -**/ -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"/?", TypeFlag}, - {L"-c", TypeFlag}, - {L"-d", TypeFlag}, - {L"-h", TypeValue}, - {L"-l", TypeFlag}, - {L"-s", TypeValue}, - {L"-v", TypeFlag}, - {NULL, TypeMax} -}; - -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ) -{ - return mColourHighlighting; -} - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ) -{ - mColourHighlighting = Highlight; -} - -/** - This function returns the report options. - - @retval Returns the report option. -**/ -STATIC -EREPORT_OPTION -GetReportOption ( - VOID - ) -{ - return mReportType; -} - -/** - This function returns the selected ACPI table. - - @retval Returns signature of the selected ACPI table. -**/ -STATIC -UINT32 -GetSelectedAcpiTable ( - VOID - ) -{ - return mSelectedAcpiTable; -} - -/** - This function dumps the ACPI table to a file. - - @param [in] Ptr Pointer to the ACPI table data. - @param [in] Length The length of the ACPI table. - - @retval TRUE Success. - @retval FALSE Failure. -**/ -STATIC -BOOLEAN -DumpAcpiTableToFile ( - IN CONST UINT8* Ptr, - IN CONST UINTN Length - ) -{ - EFI_STATUS Status; - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle; - UINTN TransferBytes; - - DumpFileHandle = NULL; - TransferBytes = Length; - - UnicodeSPrint ( - FileNameBuffer, - sizeof (FileNameBuffer), - L".\\%s%04d.bin", - mSelectedAcpiTableName, - mBinTableCount++ - ); - - Status = ShellOpenFileByName ( - FileNameBuffer, - &DumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, - 0 - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - return FALSE; - } - - Print (L"Dumping ACPI table to : %s ... ", FileNameBuffer); - - Status = ShellWriteFile ( - DumpFileHandle, - &TransferBytes, - (VOID*)Ptr - ); - if (EFI_ERROR (Status)) { - Print (L"ERROR: Failed to dump table to binary file.\n"); - TransferBytes = 0; - } else { - Print (L"DONE.\n"); - } - - ShellCloseFile (&DumpFileHandle); - return (Length == TransferBytes); -} - -/** - This function processes the table reporting options for the ACPI table. - - @param [in] Signature The ACPI table Signature. - @param [in] TablePtr Pointer to the ACPI table data. - @param [in] Length The length fo the ACPI table. - - @retval Returns TRUE if the ACPI table should be traced. -**/ -BOOLEAN -ProcessTableReportOptions ( - IN CONST UINT32 Signature, - IN CONST UINT8* TablePtr, - IN CONST UINT32 Length - ) -{ - UINTN OriginalAttribute; - UINT8* SignaturePtr; - BOOLEAN Log; - BOOLEAN HighLight; - - SignaturePtr = (UINT8*)(UINTN)&Signature; - Log = FALSE; - HighLight = GetColourHighlighting (); - - switch (GetReportOption ()) { - case ReportAll: - Log = TRUE; - break; - case ReportSelected: - if (Signature == GetSelectedAcpiTable ()) { - Log = TRUE; - mSelectedAcpiTableFound = TRUE; - } - break; - case ReportTableList: - if (mTableCount == 0) { - if (HighLight) { - OriginalAttribute = gST->ConOut->Mode->Attribute; - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR(EFI_CYAN, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)) - ); - } - Print (L"\nInstalled Table(s):\n"); - if (HighLight) { - gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); - } - } - Print ( - L"\t%4d. %c%c%c%c\n", - ++mTableCount, - SignaturePtr[0], - SignaturePtr[1], - SignaturePtr[2], - SignaturePtr[3] - ); - break; - case ReportDumpBinFile: - if (Signature == GetSelectedAcpiTable ()) { - mSelectedAcpiTableFound = TRUE; - DumpAcpiTableToFile (TablePtr, Length); - } - break; - case ReportMax: - // We should never be here. - // This case is only present to prevent compiler warning. - break; - } // switch - - if (Log) { - if (HighLight) { - OriginalAttribute = gST->ConOut->Mode->Attribute; - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR(EFI_LIGHTBLUE, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)) - ); - } - Print ( - L"\n\n --------------- %c%c%c%c Table --------------- \n\n", - SignaturePtr[0], - SignaturePtr[1], - SignaturePtr[2], - SignaturePtr[3] - ); - if (HighLight) { - gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); - } - } - - return Log; -} - -/** - This function converts a string to ACPI table signature. - - @param [in] Str Pointer to the string to be converted to the - ACPI table signature. - - @retval The ACPI table signature. -**/ -STATIC -UINT32 -ConvertStrToAcpiSignature ( - IN CONST CHAR16* Str - ) -{ - UINT8 Index; - CHAR8 Ptr[4]; - - ZeroMem (Ptr, sizeof (Ptr)); - Index = 0; - - // Convert to Upper case and convert to ASCII - while ((Index < 4) && (Str[Index] != 0)) { - if (Str[Index] >= L'a' && Str[Index] <= L'z') { - Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A')); - } else { - Ptr[Index] = (CHAR8)Str[Index]; - } - Index++; - } - return *(UINT32*)Ptr; -} - -/** - This function iterates the configuration table entries in the - system table, retrieves the RSDP pointer and starts parsing the ACPI tables. - - @param [in] SystemTable Pointer to the EFI system table. - - @retval Returns EFI_NOT_FOUND if the RSDP pointer is not found. - Returns EFI_UNSUPPORTED if the RSDP version is less than 2. - Returns EFI_SUCCESS if successful. -**/ -STATIC -EFI_STATUS -EFIAPI -AcpiView ( - IN EFI_SYSTEM_TABLE* SystemTable - ) -{ - EFI_STATUS Status; - UINTN Index; - EFI_CONFIGURATION_TABLE* EfiConfigurationTable; - BOOLEAN FoundAcpiTable; - UINTN OriginalAttribute; - UINTN PrintAttribute; - EREPORT_OPTION ReportOption; - UINT8* RsdpPtr; - UINT32 RsdpLength; - UINT8 RsdpRevision; - PARSE_ACPI_TABLE_PROC RsdpParserProc; - BOOLEAN Trace; - - // Search the table for an entry that matches the ACPI Table Guid - FoundAcpiTable = FALSE; - for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) { - if (CompareGuid (&gEfiAcpiTableGuid, - &(SystemTable->ConfigurationTable[Index].VendorGuid))) { - EfiConfigurationTable = &SystemTable->ConfigurationTable[Index]; - FoundAcpiTable = TRUE; - break; - } - } - - if (FoundAcpiTable) { - RsdpPtr = (UINT8*)EfiConfigurationTable->VendorTable; - - // The RSDP revision is 1 byte starting at offset 15 - RsdpRevision = *(RsdpPtr + RSDP_REVISION_OFFSET); - - if (RsdpRevision < 2) { - Print ( - L"ERROR: RSDP version less than 2 is not supported.\n" - ); - return EFI_UNSUPPORTED; - } - - // The RSDP length is 4 bytes starting at offset 20 - RsdpLength = *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET); - - Trace = ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLength); - - Status = GetParser (RSDP_TABLE_INFO, &RsdpParserProc); - if (EFI_ERROR (Status)) { - Print ( - L"ERROR: No registered parser found for RSDP.\n" - ); - return Status; - } - - RsdpParserProc ( - Trace, - RsdpPtr, - RsdpLength, - RsdpRevision - ); - - } else { - IncrementErrorCount (); - Print ( - L"ERROR: Failed to find ACPI Table Guid in System Configuration Table.\n" - ); - return EFI_NOT_FOUND; - } - - ReportOption = GetReportOption (); - if (ReportTableList != ReportOption) { - if (((ReportSelected == ReportOption) || - (ReportDumpBinFile == ReportOption)) && - (!mSelectedAcpiTableFound)) { - Print (L"\nRequested ACPI Table not found.\n"); - } else if (ReportDumpBinFile != ReportOption) { - OriginalAttribute = gST->ConOut->Mode->Attribute; - - Print (L"\nTable Statistics:\n"); - - if (GetColourHighlighting ()) { - PrintAttribute = (GetErrorCount () > 0) ? - EFI_TEXT_ATTR ( - EFI_RED, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4) - ) : - OriginalAttribute; - gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute); - } - Print (L"\t%d Error(s)\n", GetErrorCount ()); - - if (GetColourHighlighting ()) { - PrintAttribute = (GetWarningCount () > 0) ? - EFI_TEXT_ATTR ( - EFI_RED, - ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4) - ) : - OriginalAttribute; - - gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute); - } - Print (L"\t%d Warning(s)\n", GetWarningCount ()); - - if (GetColourHighlighting ()) { - gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); - } - } - } - return EFI_SUCCESS; -} - -/** - Function for 'acpiview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAcpiView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE* SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - LIST_ENTRY* Package; - CHAR16* ProblemParam; - CONST CHAR16* Temp; - CHAR8 ColourOption[8]; - SHELL_FILE_HANDLE TmpDumpFileHandle; - - // Set Defaults - mReportType = ReportAll; - mTableCount = 0; - mBinTableCount = 0; - mSelectedAcpiTable = 0; - mSelectedAcpiTableName = NULL; - mSelectedAcpiTableFound = FALSE; - mVerbose = TRUE; - mConsistencyCheck = TRUE; - - ShellStatus = SHELL_SUCCESS; - Package = NULL; - TmpDumpFileHandle = NULL; - - // Reset The error/warning counters - ResetErrorCount (); - ResetWarningCount (); - - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR (Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM), - gShellAcpiViewHiiHandle, - L"acpiview", - ProblemParam - ); - FreePool (ProblemParam); - } else { - Print (L"acpiview: Error processing input parameter(s)\n"); - } - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetCount (Package) > 1) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-?")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GET_HELP_ACPIVIEW), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - } else if (ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetValue (Package, L"-s") == NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetFlag (Package, L"-l"))) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-h") && - ShellCommandLineGetValue (Package, L"-h") == NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-h" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-d") && - !ShellCommandLineGetFlag (Package, L"-s")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_MISSING_OPTION), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s", - L"-d" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // Check if the colour option is set - Temp = ShellCommandLineGetValue (Package, L"-h"); - if (Temp != NULL) { - UnicodeStrToAsciiStrS (Temp, ColourOption, sizeof (ColourOption)); - if ((AsciiStriCmp (ColourOption, "ON") == 0) || - (AsciiStriCmp (ColourOption, "TRUE") == 0)) { - SetColourHighlighting (TRUE); - } else if ((AsciiStriCmp (ColourOption, "OFF") == 0) || - (AsciiStriCmp (ColourOption, "FALSE") == 0)) { - SetColourHighlighting (FALSE); - } - } - - if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType = ReportTableList; - } else { - mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s"); - if (mSelectedAcpiTableName != NULL) { - mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature ( - mSelectedAcpiTableName - ); - mReportType = ReportSelected; - - if (ShellCommandLineGetFlag (Package, L"-d")) { - // Create a temporary file to check if the media is writable. - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType = ReportDumpBinFile; - - UnicodeSPrint ( - FileNameBuffer, - sizeof (FileNameBuffer), - L".\\%s%04d.tmp", - mSelectedAcpiTableName, - mBinTableCount - ); - - Status = ShellOpenFileByName ( - FileNameBuffer, - &TmpDumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | - EFI_FILE_MODE_CREATE, - 0 - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_INVALID_PARAMETER; - TmpDumpFileHandle = NULL; - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - goto Done; - } - // Delete Temporary file. - ShellDeleteFile (&TmpDumpFileHandle); - } // -d - } // -s - } - - // Parse ACPI Table information - Status = AcpiView (SystemTable); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - } - } - -Done: - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h deleted file mode 100644 index f32c903..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ /dev/null @@ -1,116 +0,0 @@ -/** @file - Header file for AcpiView - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef ACPIVIEW_H_ -#define ACPIVIEW_H_ - -/** - A macro to define the max file name length -**/ -#define MAX_FILE_NAME_LEN 128 - -/** - Offset to the RSDP revision from the start of the RSDP -**/ -#define RSDP_REVISION_OFFSET 15 - -/** - Offset to the RSDP length from the start of the RSDP -**/ -#define RSDP_LENGTH_OFFSET 20 - -/** - The EREPORT_OPTION enum describes ACPI table Reporting options. -**/ -typedef enum ReportOption { - ReportAll, ///< Report All tables. - ReportSelected, ///< Report Selected table. - ReportTableList, ///< Report List of tables. - ReportDumpBinFile, ///< Dump selected table to a file. - ReportMax, -} EREPORT_OPTION; - -/** - This function resets the ACPI table error counter to Zero. -**/ -VOID -ResetErrorCount ( - VOID - ); - -/** - This function returns the ACPI table error count. - - @retval Returns the count of errors detected in the ACPI tables. -**/ -UINT32 -GetErrorCount ( - VOID - ); - -/** - This function resets the ACPI table warning counter to Zero. -**/ -VOID -ResetWarningCount ( - VOID - ); - -/** - This function returns the ACPI table warning count. - - @retval Returns the count of warning detected in the ACPI tables. -**/ -UINT32 -GetWarningCount ( - VOID - ); - -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ); - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ); - -/** - This function processes the table reporting options for the ACPI table. - - @param [in] Signature The ACPI table Signature. - @param [in] TablePtr Pointer to the ACPI table data. - @param [in] Length The length fo the ACPI table. - - @retval Returns TRUE if the ACPI table should be traced. -**/ -BOOLEAN -ProcessTableReportOptions ( - IN CONST UINT32 Signature, - IN CONST UINT8* TablePtr, - IN CONST UINT32 Length - ); - -#endif // ACPIVIEW_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c deleted file mode 100644 index c9c8a6e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - BGRT table parser - - Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - An ACPI_PARSER array describing the ACPI BDRT Table. -**/ -STATIC CONST ACPI_PARSER BgrtParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL}, - {L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL} -}; - -/** - This function parses the ACPI BGRT table. - When trace is enabled this function parses the BGRT table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiBgrt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - if (!Trace) { - return; - } - - ParseAcpi ( - Trace, - 0, - "BGRT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (BgrtParser) - ); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c deleted file mode 100644 index e6ad8e9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ /dev/null @@ -1,250 +0,0 @@ -/** @file - DBG2 table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015. -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables pointing to the table fields -STATIC CONST UINT32* OffsetDbgDeviceInfo; -STATIC CONST UINT32* NumberDbgDeviceInfo; -STATIC CONST UINT16* DbgDevInfoLen; -STATIC CONST UINT8* GasCount; -STATIC CONST UINT16* NameSpaceStringLength; -STATIC CONST UINT16* NameSpaceStringOffset; -STATIC CONST UINT16* OEMDataLength; -STATIC CONST UINT16* OEMDataOffset; -STATIC CONST UINT16* BaseAddrRegOffset; -STATIC CONST UINT16* AddrSizeOffset; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - This function Validates the NameSpace string length. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateNameSpaceStrLen ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function parses the debug device information structure. - - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Length Pointer in which the length of the debug - device information is returned. -**/ -STATIC -VOID -EFIAPI -DumpDbgDeviceInfo ( - IN UINT8* Ptr, - OUT UINT32* Length - ); - -/// An ACPI_PARSER array describing the ACPI DBG2 table. -STATIC CONST ACPI_PARSER Dbg2Parser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL, - (VOID**)&OffsetDbgDeviceInfo, NULL, NULL}, - {L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL, - (VOID**)&NumberDbgDeviceInfo, NULL, NULL} -}; - -/// An ACPI_PARSER array describing the debug device information. -STATIC CONST ACPI_PARSER DbgDevInfoParser[] = { - {L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}, - - {L"Generic Address Registers Count", 1, 3, L"0x%x", NULL, - (VOID**)&GasCount, NULL, NULL}, - {L"NameSpace String Length", 2, 4, L"%d", NULL, - (VOID**)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL}, - {L"NameSpace String Offset", 2, 6, L"0x%x", NULL, - (VOID**)&NameSpaceStringOffset, NULL, NULL}, - {L"OEM Data Length", 2, 8, L"%d", NULL, (VOID**)&OEMDataLength, - NULL, NULL}, - {L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID**)&OEMDataOffset, - NULL, NULL}, - - {L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL}, - - {L"Base Address Register Offset", 2, 18, L"0x%x", NULL, - (VOID**)&BaseAddrRegOffset, NULL, NULL}, - {L"Address Size Offset", 2, 20, L"0x%x", NULL, - (VOID**)&AddrSizeOffset, NULL, NULL} -}; - -/** - This function validates the NameSpace string length. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateNameSpaceStrLen ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT16 NameSpaceStrLen; - - NameSpaceStrLen = *(UINT16*)Ptr; - - if (NameSpaceStrLen < 2) { - IncrementErrorCount (); - Print ( - L"\nERROR: NamespaceString Length = %d. If no Namespace device exists,\n" - L" then NamespaceString[] must contain a period '.'", - NameSpaceStrLen - ); - } -} - -/** - This function parses the debug device information structure. - - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Length Pointer in which the length of the debug - device information is returned. -**/ -STATIC -VOID -EFIAPI -DumpDbgDeviceInfo ( - IN UINT8* Ptr, - OUT UINT32* Length - ) -{ - UINT16 Index; - UINT8* DataPtr; - UINT32* AddrSize; - - // Parse the debug device info to get the Length - ParseAcpi ( - FALSE, - 0, - "Debug Device Info", - Ptr, - 3, // Length is 2 bytes starting at offset 1 - PARSER_PARAMS (DbgDevInfoParser) - ); - - ParseAcpi ( - TRUE, - 2, - "Debug Device Info", - Ptr, - *DbgDevInfoLen, - PARSER_PARAMS (DbgDevInfoParser) - ); - - // GAS and Address Size - Index = 0; - DataPtr = Ptr + (*BaseAddrRegOffset); - AddrSize = (UINT32*)(Ptr + (*AddrSizeOffset)); - while (Index < (*GasCount)) { - PrintFieldName (4, L"BaseAddressRegister"); - DumpGasStruct (DataPtr, 4); - PrintFieldName (4, L"Address Size"); - Print (L"0x%x\n", AddrSize[Index]); - DataPtr += GAS_LENGTH; - Index++; - } - - // NameSpace String - Index = 0; - DataPtr = Ptr + (*NameSpaceStringOffset); - PrintFieldName (4, L"NameSpace String"); - while (Index < (*NameSpaceStringLength)) { - Print (L"%c", DataPtr[Index++]); - } - Print (L"\n"); - - // OEM Data - Index = 0; - DataPtr = Ptr + (*OEMDataOffset); - PrintFieldName (4, L"OEM Data"); - while (Index < (*OEMDataLength)) { - Print (L"%x ", DataPtr[Index++]); - if ((Index & 7) == 0) { - Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L""); - } - } - - *Length = *DbgDevInfoLen; -} - -/** - This function parses the ACPI DBG2 table. - When trace is enabled this function parses the DBG2 table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiDbg2 ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT32 DbgDeviceInfoLength; - UINT8* DevInfoPtr; - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "DBG2", - Ptr, - AcpiTableLength, - PARSER_PARAMS (Dbg2Parser) - ); - DevInfoPtr = Ptr + Offset; - - while (Offset < AcpiTableLength) { - DumpDbgDeviceInfo ( - DevInfoPtr, - &DbgDeviceInfoLength - ); - Offset += DbgDeviceInfoLength; - DevInfoPtr += DbgDeviceInfoLength; - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c deleted file mode 100644 index 59ea63e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - DSDT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -/** - This function parses the ACPI DSDT table. - When trace is enabled this function parses the DSDT table and - traces the ACPI table fields. - For the DSDT table only the ACPI header fields are parsed and - traced. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiDsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - if (!Trace) { - return; - } - - DumpAcpiHeader (Ptr); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c deleted file mode 100644 index ee843ec..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ /dev/null @@ -1,289 +0,0 @@ -/** @file - FADT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC CONST UINT32* DsdtAddress; -STATIC CONST UINT64* X_DsdtAddress; -STATIC CONST UINT8* FadtMinorRevision; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - A macro defining the Hardware reduced ACPI flag -**/ -#define HW_REDUCED_ACPI BIT20 - -/** - Get the ACPI XSDT header info. -**/ -CONST ACPI_DESCRIPTION_HEADER_INFO * -EFIAPI -GetAcpiXsdtHeaderInfo ( - VOID - ); - -/** - This function validates the Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function validates the X_Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function validates the flags. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFlags ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - An ACPI_PARSER array describing the ACPI FADT Table. -**/ -STATIC CONST ACPI_PARSER FadtParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, NULL, ValidateFirmwareCtrl, NULL}, - {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL}, - {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL}, - {L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL}, - {L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL}, - {L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL}, - {L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL}, - {L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL}, - {L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL}, - {L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL}, - {L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL}, - {L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL}, - {L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL}, - {L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL}, - {L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL}, - {L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 112, L"0x%x", NULL, NULL, ValidateFlags, NULL}, - {L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL}, - {L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL}, - {L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision, - NULL, NULL}, - {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, NULL, - ValidateXFirmwareCtrl, NULL}, - {L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL}, - {L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL}, - {L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL}, - {L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL}, - {L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL}, - {L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL} -}; - -/** - This function validates the Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (*(UINT32*)Ptr != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: Firmware Control must be zero for ARM platforms." - ); - } -#endif -} - -/** - This function validates the X_Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (*(UINT64*)Ptr != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: X Firmware Control must be zero for ARM platforms." - ); - } -#endif -} - -/** - This function validates the flags. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFlags ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms." - ); - } -#endif -} - -/** - This function parses the ACPI FADT table. - This function parses the FADT table and optionally traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiFadt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT8* DsdtPtr; - - ParseAcpi ( - Trace, - 0, - "FADT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (FadtParser) - ); - - if (Trace) { - Print (L"\nSummary:\n"); - PrintFieldName (2, L"FADT Version"); - Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision); - - if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) { - IncrementErrorCount (); - Print (L"ERROR: OEM Table Id does not match with RSDT/XSDT.\n"); - } - } - - // If X_DSDT is not zero then use X_DSDT and ignore DSDT, - // else use DSDT. - if (*X_DsdtAddress != 0) { - DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress); - } else if (*DsdtAddress != 0) { - DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress); - } else { - // Both DSDT and X_DSDT cannot be zero. -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (Trace) { - // The DSDT Table is mandatory for ARM systems - // as the CPU information MUST be presented in - // the DSDT. - IncrementErrorCount (); - Print (L"ERROR: Both X_DSDT and DSDT are NULL.\n"); - } -#endif - return; - } - - ProcessAcpiTable (DsdtPtr); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c deleted file mode 100644 index 3e92ec6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ /dev/null @@ -1,306 +0,0 @@ -/** @file - GTDT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 - **/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC CONST UINT32* GtdtPlatformTimerCount; -STATIC CONST UINT32* GtdtPlatformTimerOffset; -STATIC CONST UINT8* PlatformTimerType; -STATIC CONST UINT16* PlatformTimerLength; -STATIC CONST UINT32* GtBlockTimerCount; -STATIC CONST UINT32* GtBlockTimerOffset; -STATIC CONST UINT16* GtBlockLength; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - This function validates the GT Block timer count. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtBlockTimerCount ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - An ACPI_PARSER array describing the ACPI GTDT Table. -**/ -STATIC CONST ACPI_PARSER GtdtParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL, - NULL, NULL}, - {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Platform Timer Count", 4, 88, L"%d", NULL, - (VOID**)&GtdtPlatformTimerCount, NULL, NULL}, - {L"Platform Timer Offset", 4, 92, L"0x%x", NULL, - (VOID**)&GtdtPlatformTimerOffset, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Platform timer header. -**/ -STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = { - {L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL}, - {L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL}, - {L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Platform GT Block. -**/ -STATIC CONST ACPI_PARSER GtBlockParser[] = { - {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, - {L"Length", 2, 1, L"%d", NULL, (VOID**)&GtBlockLength, NULL, NULL}, - {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, - {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount, - ValidateGtBlockTimerCount, NULL}, - {L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL, - NULL} -}; - -/** - An ACPI_PARSER array describing the GT Block timer. -**/ -STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { - {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, - {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, - NULL}, - {L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Platform Watchdog. -**/ -STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = { - {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, - {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, - {L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - This function validates the GT Block timer count. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtBlockTimerCount ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT32 BlockTimerCount; - - BlockTimerCount = *(UINT32*)Ptr; - - if (BlockTimerCount > 8) { - IncrementErrorCount (); - Print ( - L"\nERROR: Timer Count = %d. Max Timer Count is 8.", - BlockTimerCount - ); - } -} - -/** - This function parses the Platform GT Block. - - @param [in] Ptr Pointer to the start of the GT Block data. - @param [in] Length Length of the GT Block structure. -**/ -STATIC -VOID -DumpGTBlock ( - IN UINT8* Ptr, - IN UINT32 Length - ) -{ - UINT32 Index; - UINT32 Offset; - UINT32 GTBlockTimerLength; - - Offset = ParseAcpi ( - TRUE, - 2, - "GT Block", - Ptr, - Length, - PARSER_PARAMS (GtBlockParser) - ); - GTBlockTimerLength = (*GtBlockLength - Offset) / (*GtBlockTimerCount); - Length -= Offset; - - if (*GtBlockTimerCount != 0) { - Ptr += (*GtBlockTimerOffset); - Index = 0; - while ((Index < (*GtBlockTimerCount)) && (Length >= GTBlockTimerLength)) { - Offset = ParseAcpi ( - TRUE, - 2, - "GT Block Timer", - Ptr, - GTBlockTimerLength, - PARSER_PARAMS (GtBlockTimerParser) - ); - // Increment by GT Block Timer structure size - Ptr += Offset; - Length -= Offset; - Index++; - } - - if (Length != 0) { - IncrementErrorCount (); - Print ( - L"ERROR:GT Block Timer length mismatch. Unparsed %d bytes.\n", - Length - ); - } - } -} - -/** - This function parses the Platform Watchdog timer. - - @param [in] Ptr Pointer to the start of the watchdog timer data. - @param [in] Length Length of the watchdog timer structure. -**/ -STATIC -VOID -DumpWatchdogTimer ( - IN UINT8* Ptr, - IN UINT16 Length - ) -{ - ParseAcpi ( - TRUE, - 2, - "SBSA Generic Watchdog", - Ptr, - Length, - PARSER_PARAMS (SBSAGenericWatchdogParser) - ); -} - -/** - This function parses the ACPI GTDT table. - When trace is enabled this function parses the GTDT table and - traces the ACPI table fields. - - This function also parses the following platform timer structures: - - GT Block timer - - Watchdog timer - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiGtdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Index; - UINT8* TimerPtr; - - if (!Trace) { - return; - } - - ParseAcpi ( - TRUE, - 0, - "GTDT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (GtdtParser) - ); - - if (*GtdtPlatformTimerCount != 0) { - TimerPtr = Ptr + (*GtdtPlatformTimerOffset); - Index = 0; - do { - // Parse the Platform Timer Header - ParseAcpi ( - FALSE, - 0, - NULL, - TimerPtr, - 4, // GT Platform Timer structure header length. - PARSER_PARAMS (GtPlatformTimerHeaderParser) - ); - switch (*PlatformTimerType) { - case EFI_ACPI_6_2_GTDT_GT_BLOCK: - DumpGTBlock (TimerPtr, *PlatformTimerLength); - break; - case EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG: - DumpWatchdogTimer (TimerPtr, *PlatformTimerLength); - break; - default: - IncrementErrorCount (); - Print ( - L"ERROR: INVALID Platform Timer Type = %d\n", - *PlatformTimerType - ); - break; - } // switch - TimerPtr += (*PlatformTimerLength); - Index++; - } while (Index < *GtdtPlatformTimerCount); - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c deleted file mode 100644 index 43ea1df..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ /dev/null @@ -1,723 +0,0 @@ -/** @file - IORT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - IO Remapping Table, Platform Design Document, Revision C, 15 May 2017 -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - The EIORT_NODE enum describes the IORT Node types. -**/ -typedef enum IortNode { - Iort_Node_ITS_Group, ///< ITS Group node - Iort_Node_Named_Component, ///< Named Component node - Iort_Node_Root_Complex, ///< Root Complex node - Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node - Iort_Node_SMMUV3, ///< SMMU v3 node - Iort_Node_PMCG, ///< PMC group node - Iort_Node_Max -} EIORT_NODE; - -// Local Variables -STATIC CONST UINT32* IortNodeCount; -STATIC CONST UINT32* IortNodeOffset; - -STATIC CONST UINT8* IortNodeType; -STATIC CONST UINT16* IortNodeLength; -STATIC CONST UINT32* IortIdMappingCount; -STATIC CONST UINT32* IortIdMappingOffset; - -STATIC CONST UINT32* InterruptContextCount; -STATIC CONST UINT32* InterruptContextOffset; -STATIC CONST UINT32* PmuInterruptCount; -STATIC CONST UINT32* PmuInterruptOffset; - -STATIC CONST UINT32* ItsCount; - -/** - This function validates the ID Mapping array count for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdMappingCount ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function validates the ID Mapping array offset for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdArrayReference ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - Helper Macro for populating the IORT Node header in the ACPI_PARSER array. - - @param [out] ValidateIdMappingCount Optional pointer to a function for - validating the ID Mapping count. - @param [out] ValidateIdArrayReference Optional pointer to a function for - validating the ID Array reference. -**/ -#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ - ValidateIdArrayReference) \ - { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ - { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ - { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL }, \ - { L"Reserved", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, \ - { L"Number of ID mappings", 4, 8, L"%d", NULL, \ - (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ - { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ - (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } - -/** - An ACPI_PARSER array describing the ACPI IORT Table -**/ -STATIC CONST ACPI_PARSER IortParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Number of IORT Nodes", 4, 36, L"%d", NULL, - (VOID**)&IortNodeCount, NULL, NULL}, - {L"Offset to Array of IORT Nodes", 4, 40, L"0x%x", NULL, - (VOID**)&IortNodeOffset, NULL, NULL}, - {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT node header structure. -**/ -STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL) -}; - -/** - An ACPI_PARSER array describing the IORT SMMUv1/2 node. -**/ -STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), - {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reference to Global Interrupt Array", 4, 40, L"0x%x", NULL, NULL, NULL, - NULL}, - {L"Number of context interrupts", 4, 44, L"%d", NULL, - (VOID**)&InterruptContextCount, NULL, NULL}, - {L"Reference to Context Interrupt Array", 4, 48, L"0x%x", NULL, - (VOID**)&InterruptContextOffset, NULL, NULL}, - {L"Number of PMU Interrupts", 4, 52, L"%d", NULL, - (VOID**)&PmuInterruptCount, NULL, NULL}, - {L"Reference to PMU Interrupt Array", 4, 56, L"0x%x", NULL, - (VOID**)&PmuInterruptOffset, NULL, NULL}, - - // Interrupt Array - {L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. -**/ -STATIC CONST ACPI_PARSER InterruptArrayParser[] = { - {L" Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L" Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT ID Mapping. -**/ -STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = { - {L" Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L" Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L" Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L" Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L" Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT SMMUv3 node. -**/ -STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), - {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, - {L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL}, - {L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT ITS node. -**/ -STATIC CONST ACPI_PARSER IortNodeItsParser[] = { - PARSE_IORT_NODE_HEADER ( - ValidateItsIdMappingCount, - ValidateItsIdArrayReference - ), - {L" Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL} -}; - -/** - An ACPI_PARSER array describing the ITS ID. -**/ -STATIC CONST ACPI_PARSER ItsIdParser[] = { - { L" GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL } -}; - -/** - An ACPI_PARSER array describing the IORT Names Component node. -**/ -STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), - {L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL}, - {L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT Root Complex node. -**/ -STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), - {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the IORT PMCG node. -**/ -STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), - {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, -}; - -/** - This function validates the ID Mapping array count for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdMappingCount ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 0) { - IncrementErrorCount (); - Print (L"\nERROR: IORT ID Mapping count must be zero."); - } -} - -/** - This function validates the ID Mapping array offset for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdArrayReference ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 0) { - IncrementErrorCount (); - Print (L"\nERROR: IORT ID Mapping offset must be zero."); - } -} - -/** - This function parses the IORT Node Id Mapping array. - - @param [in] Ptr Pointer to the start of the IORT Table. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodeIdMappings ( - IN UINT8* Ptr, - IN UINT32 MappingCount, - IN UINT32 MappingOffset - ) -{ - UINT8* IdMappingPtr; - UINT32 Index; - UINT32 Offset; - CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi - - IdMappingPtr = Ptr + MappingOffset; - Index = 0; - while (Index < MappingCount) { - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "ID Mapping [%d]", - Index - ); - Offset = ParseAcpi ( - TRUE, - 4, - Buffer, - IdMappingPtr, - 20, - PARSER_PARAMS (IortNodeIdMappingParser) - ); - IdMappingPtr += Offset; - Index++; - } -} - -/** - This function parses the IORT SMMUv1/2 node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodeSmmuV1V2 ( - IN UINT8* Ptr, - IN UINT16 Length, - IN UINT32 MappingCount, - IN UINT32 MappingOffset - ) -{ - UINT32 Index; - UINT32 Offset; - CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi - - UINT8* ArrayPtr; - - ParseAcpi ( - TRUE, - 2, - "SMMUv1 or SMMUv2 Node", - Ptr, - Length, - PARSER_PARAMS (IortNodeSmmuV1V2Parser) - ); - - ArrayPtr = Ptr + *InterruptContextOffset; - Index = 0; - while (Index < *InterruptContextCount) { - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "Context Interrupts Array [%d]", - Index - ); - Offset = ParseAcpi ( - TRUE, - 4, - Buffer, - ArrayPtr, - 8, - PARSER_PARAMS (InterruptArrayParser) - ); - ArrayPtr += Offset; - Index++; - } - - ArrayPtr = Ptr + *PmuInterruptOffset; - Index = 0; - while (Index < *PmuInterruptCount) { - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "PMU Interrupts Array [%d]", - Index - ); - Offset = ParseAcpi ( - TRUE, - 4, - Buffer, - ArrayPtr, - 8, - PARSER_PARAMS (InterruptArrayParser) - ); - ArrayPtr += Offset; - Index++; - } - - if (*IortIdMappingCount != 0) { - DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); - } -} - -/** - This function parses the IORT SMMUv3 node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodeSmmuV3 ( - IN UINT8* Ptr, - IN UINT16 Length, - IN UINT32 MappingCount, - IN UINT32 MappingOffset - ) -{ - ParseAcpi ( - TRUE, - 2, - "SMMUV3 Node", - Ptr, - Length, - PARSER_PARAMS (IortNodeSmmuV3Parser) - ); - - if (*IortIdMappingCount != 0) { - DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); - } -} - -/** - This function parses the IORT ITS node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. -**/ -STATIC -VOID -DumpIortNodeIts ( - IN UINT8* Ptr, - IN UINT16 Length - ) -{ - UINT32 Offset; - UINT32 Index; - UINT8* ItsIdPtr; - CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi - - Offset = ParseAcpi ( - TRUE, - 2, - "ITS Node", - Ptr, - Length, - PARSER_PARAMS (IortNodeItsParser) - ); - - ItsIdPtr = Ptr + Offset; - Index = 0; - while (Index < *ItsCount) { - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "GIC ITS Identifier Array [%d]", - Index - ); - Offset = ParseAcpi ( - TRUE, - 4, - Buffer, - ItsIdPtr, - 4, - PARSER_PARAMS (ItsIdParser) - ); - ItsIdPtr += Offset; - Index++; - } - - // Note: ITS does not have the ID Mappings Array -} - -/** - This function parses the IORT Named Component node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodeNamedComponent ( - IN UINT8* Ptr, - IN UINT16 Length, - IN UINT32 MappingCount, - IN UINT32 MappingOffset - ) -{ - UINT32 Offset; - UINT32 Index; - UINT8* DeviceNamePtr; - UINT32 DeviceNameLength; - - Offset = ParseAcpi ( - TRUE, - 2, - "Named Component Node", - Ptr, - Length, - PARSER_PARAMS (IortNodeNamedComponentParser) - ); - - DeviceNamePtr = Ptr + Offset; - // Estimate the Device Name length - DeviceNameLength = Length - Offset - (MappingCount * 20); - PrintFieldName (2, L"Device Object Name"); - Index = 0; - while ((Index < DeviceNameLength) && (DeviceNamePtr[Index] != 0)) { - Print (L"%c", DeviceNamePtr[Index++]); - } - Print (L"\n"); - - if (*IortIdMappingCount != 0) { - DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); - } -} - -/** - This function parses the IORT Root Complex node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodeRootComplex ( - IN UINT8* Ptr, - IN UINT16 Length, - IN UINT32 MappingCount, - IN UINT32 MappingOffset - ) -{ - ParseAcpi ( - TRUE, - 2, - "Root Complex Node", - Ptr, - Length, - PARSER_PARAMS (IortNodeRootComplexParser) - ); - - if (*IortIdMappingCount != 0) { - DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); - } -} - -/** - This function parses the IORT PMCG node. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Length Length of the buffer. - @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. -**/ -STATIC -VOID -DumpIortNodePmcg ( - IN UINT8* Ptr, - IN UINT16 Length, - IN UINT32 MappingCount, - IN UINT32 MappingOffset -) -{ - ParseAcpi ( - TRUE, - 2, - "PMCG Node", - Ptr, - Length, - PARSER_PARAMS (IortNodePmcgParser) - ); - - if (*IortIdMappingCount != 0) { - DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); - } - - if (*IortIdMappingCount > 1) { - IncrementErrorCount (); - Print ( - L"ERROR: ID mapping must not be greater than 1. Id Mapping Count =%d\n", - *IortIdMappingCount - ); - } -} - -/** - This function parses the ACPI IORT table. - When trace is enabled this function parses the IORT table and traces the ACPI fields. - - This function also parses the following nodes: - - ITS Group - - Named Component - - Root Complex - - SMMUv1/2 - - SMMUv3 - - PMCG - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiIort ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT32 Index; - UINT8* NodePtr; - - if (!Trace) { - return; - } - - ParseAcpi ( - TRUE, - 0, - "IORT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (IortParser) - ); - Offset = *IortNodeOffset; - NodePtr = Ptr + Offset; - Index = 0; - - while ((Index < *IortNodeCount) && (Offset < AcpiTableLength)) { - // Parse the IORT Node Header - ParseAcpi ( - FALSE, - 0, - "IORT Node Header", - NodePtr, - 16, - PARSER_PARAMS (IortNodeHeaderParser) - ); - if (*IortNodeLength == 0) { - IncrementErrorCount (); - Print (L"ERROR: Parser error. Invalid table data.\n"); - return; - } - - PrintFieldName (2, L"* Node Offset *"); - Print (L"0x%x\n", Offset); - - switch (*IortNodeType) { - case Iort_Node_ITS_Group: - DumpIortNodeIts ( - NodePtr, - *IortNodeLength - ); - break; - case Iort_Node_Named_Component: - DumpIortNodeNamedComponent ( - NodePtr, - *IortNodeLength, - *IortIdMappingCount, - *IortIdMappingOffset - ); - break; - case Iort_Node_Root_Complex: - DumpIortNodeRootComplex ( - NodePtr, - *IortNodeLength, - *IortIdMappingCount, - *IortIdMappingOffset - ); - break; - case Iort_Node_SMMUV1_V2: - DumpIortNodeSmmuV1V2 ( - NodePtr, - *IortNodeLength, - *IortIdMappingCount, - *IortIdMappingOffset - ); - break; - case Iort_Node_SMMUV3: - DumpIortNodeSmmuV3 ( - NodePtr, - *IortNodeLength, - *IortIdMappingCount, - *IortIdMappingOffset - ); - break; - case Iort_Node_PMCG: - DumpIortNodePmcg ( - NodePtr, - *IortNodeLength, - *IortIdMappingCount, - *IortIdMappingOffset - ); - break; - - default: - IncrementErrorCount (); - Print (L"ERROR: Unsupported IORT Node type = %d\n", *IortNodeType); - } // switch - - NodePtr += (*IortNodeLength); - Offset += (*IortNodeLength); - } // while -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c deleted file mode 100644 index 3aa775f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ /dev/null @@ -1,324 +0,0 @@ -/** @file - MADT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local Variables -STATIC CONST UINT8* MadtInterruptControllerType; -STATIC CONST UINT8* MadtInterruptControllerLength; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - This function validates the System Vector Base in the GICD. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGICDSystemVectorBase ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - An ACPI_PARSER array describing the GICC Interrupt Controller Structure. -**/ -STATIC CONST ACPI_PARSER GicCParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL}, - {L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL, - NULL}, - {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the GICD Interrupt Controller Structure. -**/ -STATIC CONST ACPI_PARSER GicDParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"System Vector Base", 4, 16, L"0x%x", NULL, NULL, - ValidateGICDSystemVectorBase, NULL}, - {L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure. -**/ -STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL}, - {L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the GICR Interrupt Controller Structure. -**/ -STATIC CONST ACPI_PARSER GicRParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, - NULL}, - {L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure. -**/ -STATIC CONST ACPI_PARSER GicITSParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the ACPI MADT Table. -**/ -STATIC CONST ACPI_PARSER MadtParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Local Interrupt Controller Address", 4, 36, L"0x%x", NULL, NULL, NULL, - NULL}, - {L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure. -**/ -STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { - {NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL}, - {L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL, - NULL}, - {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL} -}; - -/** - This function validates the System Vector Base in the GICD. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGICDSystemVectorBase ( - IN UINT8* Ptr, - IN VOID* Context -) -{ - if (*(UINT32*)Ptr != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: System Vector Base must be zero." - ); - } -} - -/** - This function parses the ACPI MADT table. - When trace is enabled this function parses the MADT table and - traces the ACPI table fields. - - This function currently parses the following Interrupt Controller - Structures: - - GICC - - GICD - - GIC MSI Frame - - GICR - - GIC ITS - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiMadt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT8* InterruptContollerPtr; - UINT32 GICDCount; - - GICDCount = 0; - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "MADT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (MadtParser) - ); - InterruptContollerPtr = Ptr + Offset; - - while (Offset < AcpiTableLength) { - // Parse Interrupt Controller Structure to obtain Length. - ParseAcpi ( - FALSE, - 0, - NULL, - InterruptContollerPtr, - 2, // Length is 1 byte at offset 1 - PARSER_PARAMS (MadtInterruptControllerHeaderParser) - ); - - if (((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength) || - (*MadtInterruptControllerLength < 4)) { - IncrementErrorCount (); - Print ( - L"ERROR: Invalid Interrupt Controller Length," - L" Type = %d, Length = %d\n", - *MadtInterruptControllerType, - *MadtInterruptControllerLength - ); - break; - } - - switch (*MadtInterruptControllerType) { - case EFI_ACPI_6_2_GIC: { - ParseAcpi ( - TRUE, - 2, - "GICC", - InterruptContollerPtr, - *MadtInterruptControllerLength, - PARSER_PARAMS (GicCParser) - ); - break; - } - - case EFI_ACPI_6_2_GICD: { - if (++GICDCount > 1) { - IncrementErrorCount (); - Print ( - L"ERROR: Only one GICD must be present," - L" GICDCount = %d\n", - GICDCount - ); - } - ParseAcpi ( - TRUE, - 2, - "GICD", - InterruptContollerPtr, - *MadtInterruptControllerLength, - PARSER_PARAMS (GicDParser) - ); - break; - } - - case EFI_ACPI_6_2_GIC_MSI_FRAME: { - ParseAcpi ( - TRUE, - 2, - "GIC MSI Frame", - InterruptContollerPtr, - *MadtInterruptControllerLength, - PARSER_PARAMS (GicMSIFrameParser) - ); - break; - } - - case EFI_ACPI_6_2_GICR: { - ParseAcpi ( - TRUE, - 2, - "GICR", - InterruptContollerPtr, - *MadtInterruptControllerLength, - PARSER_PARAMS (GicRParser) - ); - break; - } - - case EFI_ACPI_6_2_GIC_ITS: { - ParseAcpi ( - TRUE, - 2, - "GIC ITS", - InterruptContollerPtr, - *MadtInterruptControllerLength, - PARSER_PARAMS (GicITSParser) - ); - break; - } - - default: { - IncrementErrorCount (); - Print ( - L"ERROR: Unknown Interrupt Controller Structure," - L" Type = %d, Length = %d\n", - *MadtInterruptControllerType, - *MadtInterruptControllerLength - ); - } - } // switch - - InterruptContollerPtr += *MadtInterruptControllerLength; - Offset += *MadtInterruptControllerLength; - } // while -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c deleted file mode 100644 index c41e122..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c +++ /dev/null @@ -1,96 +0,0 @@ -/** @file - MCFG table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - PCI Firmware Specification - Revision 3.2, January 26, 2015. -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - An ACPI_PARSER array describing the ACPI MCFG Table. -**/ -STATIC CONST ACPI_PARSER McfgParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, -}; - -/** - An ACPI_PARSER array describing the PCI configuration Space Base Address structure. -**/ -STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = { - {L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL}, - {L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL}, - {L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - This function parses the ACPI MCFG table. - When trace is enabled this function parses the MCFG table and - traces the ACPI table fields. - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiMcfg ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT32 PciCfgOffset; - UINT8* PciCfgSpacePtr; - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "MCFG", - Ptr, - AcpiTableLength, - PARSER_PARAMS (McfgParser) - ); - - PciCfgSpacePtr = Ptr + Offset; - - while (Offset < AcpiTableLength) { - PciCfgOffset = ParseAcpi ( - TRUE, - 2, - "PCI Configuration Space", - PciCfgSpacePtr, - (AcpiTableLength - Offset), - PARSER_PARAMS (PciCfgSpaceBaseAddrParser) - ); - PciCfgSpacePtr += PciCfgOffset; - Offset += PciCfgOffset; - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c deleted file mode 100644 index e009d68..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ /dev/null @@ -1,362 +0,0 @@ -/** @file - PPTT table parser - - Copyright (c) 2019, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" - -// Local variables -STATIC CONST UINT8* ProcessorTopologyStructureType; -STATIC CONST UINT8* ProcessorTopologyStructureLength; -STATIC CONST UINT32* NumberOfPrivateResources; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - An ACPI_PARSER array describing the ACPI PPTT Table. -**/ -STATIC CONST ACPI_PARSER PpttParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) -}; - -/** - This function validates the Cache Type Structure (Type 1) Line size field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateCacheLineSize ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: ARM Architecture Reference Manual ARMv8 (D.a) - // Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register - // LineSize, bits [2:0] - // (Log2(Number of bytes in cache line)) - 4. - - UINT16 LineSize; - LineSize = *(UINT16*)Ptr; - - if ((LineSize < 16) || (LineSize > 2048)) { - IncrementErrorCount (); - Print ( - L"\nERROR: The cache line size must be between 16 and 2048 bytes" - L" on ARM Platforms." - ); - return; - } - - if ((LineSize & (LineSize - 1)) != 0) { - IncrementErrorCount (); - Print (L"\nERROR: The cache line size is not a power of 2."); - } -#endif -} - -/** - This function validates the Cache Type Structure (Type 1) Attributes field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateCacheAttributes ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: Advanced Configuration and Power Interface (ACPI) Specification - // Version 6.2 Errata A, September 2017 - // Table 5-153: Cache Type Structure - - UINT8 Attributes; - Attributes = *(UINT8*)Ptr; - - if ((Attributes & 0xE0) != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: Attributes bits [7:5] are reserved and must be zero.", - Attributes - ); - return; - } -#endif -} - -/** - An ACPI_PARSER array describing the processor topology structure header. -**/ -STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = { - {L"Type", 1, 0, NULL, NULL, (VOID**)&ProcessorTopologyStructureType, - NULL, NULL}, - {L"Length", 1, 1, NULL, NULL, (VOID**)&ProcessorTopologyStructureLength, - NULL, NULL}, - {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0. -**/ -STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Number of private resources", 4, 16, L"%d", NULL, - (VOID**)&NumberOfPrivateResources, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Cache Type Structure - Type 1. -**/ -STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Number of sets", 4, 16, L"%d", NULL, NULL, NULL, NULL}, - {L"Associativity", 1, 20, L"%d", NULL, NULL, NULL, NULL}, - {L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL}, - {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL} -}; - -/** - An ACPI_PARSER array describing the ID Type Structure - Type 2. -**/ -STATIC CONST ACPI_PARSER IdStructureParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"VENDOR_ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL}, - {L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL}, - {L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL}, -}; - -/** - This function parses the Processor Hierarchy Node Structure (Type 0). - - @param [in] Ptr Pointer to the start of the Processor Hierarchy Node - Structure data. - @param [in] Length Length of the Processor Hierarchy Node Structure. -**/ -STATIC -VOID -DumpProcessorHierarchyNodeStructure ( - IN UINT8* Ptr, - IN UINT8 Length - ) -{ - UINT32 Offset; - UINT8* PrivateResourcePtr; - UINT32 Index; - CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; - - Offset = ParseAcpi ( - TRUE, - 2, - "Processor Hierarchy Node Structure", - Ptr, - Length, - PARSER_PARAMS (ProcessorHierarchyNodeStructureParser) - ); - - PrivateResourcePtr = Ptr + Offset; - Index = 0; - while (Index < *NumberOfPrivateResources) { - UnicodeSPrint ( - Buffer, - sizeof (Buffer), - L"Private resources [%d]", - Index - ); - - PrintFieldName (4, Buffer); - Print ( - L"0x%x\n", - *((UINT32*) PrivateResourcePtr) - ); - - PrivateResourcePtr += sizeof(UINT32); - Index++; - } -} - -/** - This function parses the Cache Type Structure (Type 1). - - @param [in] Ptr Pointer to the start of the Cache Type Structure data. - @param [in] Length Length of the Cache Type Structure. -**/ -STATIC -VOID -DumpCacheTypeStructure ( - IN UINT8* Ptr, - IN UINT8 Length - ) -{ - ParseAcpi ( - TRUE, - 2, - "Cache Type Structure", - Ptr, - Length, - PARSER_PARAMS (CacheTypeStructureParser) - ); -} - -/** - This function parses the ID Structure (Type 2). - - @param [in] Ptr Pointer to the start of the ID Structure data. - @param [in] Length Length of the ID Structure. -**/ -STATIC -VOID -DumpIDStructure ( - IN UINT8* Ptr, - IN UINT8 Length - ) -{ - ParseAcpi ( - TRUE, - 2, - "ID Structure", - Ptr, - Length, - PARSER_PARAMS (IdStructureParser) - ); -} - -/** - This function parses the ACPI PPTT table. - When trace is enabled this function parses the PPTT table and - traces the ACPI table fields. - - This function parses the following processor topology structures: - - Processor hierarchy node structure (Type 0) - - Cache Type Structure (Type 1) - - ID structure (Type 2) - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiPptt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT8* ProcessorTopologyStructurePtr; - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "PPTT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (PpttParser) - ); - ProcessorTopologyStructurePtr = Ptr + Offset; - - while (Offset < AcpiTableLength) { - // Parse Processor Hierarchy Node Structure to obtain Type and Length. - ParseAcpi ( - FALSE, - 0, - NULL, - ProcessorTopologyStructurePtr, - 4, // Length of the processor topology structure header is 4 bytes - PARSER_PARAMS (ProcessorTopologyStructureHeaderParser) - ); - - if ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength) { - IncrementErrorCount (); - Print ( - L"ERROR: Invalid processor topology structure length:" - L" Type = %d, Length = %d\n", - *ProcessorTopologyStructureType, - *ProcessorTopologyStructureLength - ); - break; - } - - PrintFieldName (2, L"* Structure Offset *"); - Print (L"0x%x\n", Offset); - - switch (*ProcessorTopologyStructureType) { - case EFI_ACPI_6_2_PPTT_TYPE_PROCESSOR: - DumpProcessorHierarchyNodeStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - case EFI_ACPI_6_2_PPTT_TYPE_CACHE: - DumpCacheTypeStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - case EFI_ACPI_6_2_PPTT_TYPE_ID: - DumpIDStructure ( - ProcessorTopologyStructurePtr, - *ProcessorTopologyStructureLength - ); - break; - default: - IncrementErrorCount (); - Print ( - L"ERROR: Unknown processor topology structure:" - L" Type = %d, Length = %d\n", - *ProcessorTopologyStructureType, - *ProcessorTopologyStructureLength - ); - } - - ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength; - Offset += *ProcessorTopologyStructureLength; - } // while -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c deleted file mode 100644 index c73e5b7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ /dev/null @@ -1,181 +0,0 @@ -/** @file - RSDP table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local Variables -STATIC CONST UINT64* XsdtAddress; - -/** - This function validates the RSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateRsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function validates the XSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - An array describing the ACPI RSDP Table. -**/ -STATIC CONST ACPI_PARSER RsdpParser[] = { - {L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL}, - {L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL}, - {L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL}, - {L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL}, - {L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL}, - {L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID**)&XsdtAddress, - ValidateXsdtAddress, NULL}, - {L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} -}; - -/** - This function validates the RSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateRsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: Server Base Boot Requirements System Software on ARM Platforms - // Section: 4.2.1.1 RSDP - // Root System Description Pointer (RSDP), ACPI ? 5.2.5. - // - Within the RSDP, the RsdtAddress field must be null (zero) and the - // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT32 RsdtAddr; - - RsdtAddr = *(UINT32*)Ptr; - - if (RsdtAddr != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.", - RsdtAddr - ); - } -#endif -} - -/** - This function validates the XSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: Server Base Boot Requirements System Software on ARM Platforms - // Section: 4.2.1.1 RSDP - // Root System Description Pointer (RSDP), ACPI ? 5.2.5. - // - Within the RSDP, the RsdtAddress field must be null (zero) and the - // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT64 XsdtAddr; - - XsdtAddr = *(UINT64*)Ptr; - - if (XsdtAddr == 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.", - XsdtAddr - ); - } -#endif -} - -/** - This function parses the ACPI RSDP table. - - This function invokes the parser for the XSDT table. - * Note - This function does not support parsing of RSDT table. - - This function also performs a RAW dump of the ACPI table and - validates the checksum. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiRsdp ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - if (Trace) { - DumpRaw (Ptr, AcpiTableLength); - VerifyChecksum (TRUE, Ptr, AcpiTableLength); - } - - ParseAcpi (Trace, 0, "RSDP", Ptr, AcpiTableLength, PARSER_PARAMS (RsdpParser)); - - // This code currently supports parsing of XSDT table only - // and does not parse the RSDT table. Platforms provide the - // RSDT to enable compatibility with ACPI 1.0 operating systems. - // Therefore the RSDT should not be used on ARM platforms. - if ((*XsdtAddress) == 0) { - IncrementErrorCount (); - Print (L"ERROR: XSDT Pointer is not set.\n"); - return; - } - - ProcessAcpiTable ((UINT8*)(UINTN)(*XsdtAddress)); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c deleted file mode 100644 index 908ad82..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ /dev/null @@ -1,145 +0,0 @@ -/** @file - SLIT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local Variables -STATIC CONST UINT64* SlitSystemLocalityCount; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - An ACPI_PARSER array describing the ACPI SLIT table. -**/ -STATIC CONST ACPI_PARSER SlitParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Number of System Localities", 8, 36, L"0x%lx", NULL, - (VOID**)&SlitSystemLocalityCount, NULL, NULL} -}; - -/** - Macro to get the value of a System Locality -**/ -#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j) - -/** - This function parses the ACPI SLIT table. - When trace is enabled this function parses the SLIT table and - traces the ACPI table fields. - - This function also validates System Localities for the following: - - Diagonal elements have a normalized value of 10 - - Relative distance from System Locality at i*N+j is same as - j*N+i - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSlit ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT64 Count; - UINT64 Index; - UINT64 LocalityCount; - UINT8* LocalityPtr; - CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "SLIT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (SlitParser) - ); - LocalityPtr = Ptr + Offset; - - LocalityCount = *SlitSystemLocalityCount; - // We only print the Localities if the count is less than 16 - // If the locality count is more than 16 then refer to the - // raw data dump. - if (LocalityCount < 16) { - UnicodeSPrint ( - Buffer, - sizeof (Buffer), - L"Entry[0x%lx][0x%lx]", - LocalityCount, - LocalityCount - ); - PrintFieldName (0, Buffer); - Print (L"\n"); - Print (L" "); - for (Index = 0; Index < LocalityCount; Index++) { - Print (L" (%3d) ", Index); - } - Print (L"\n"); - for (Count = 0; Count< LocalityCount; Count++) { - Print (L" (%3d) ", Count); - for (Index = 0; Index < LocalityCount; Index++) { - Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); - } - Print (L"\n"); - } - } - - // Validate - for (Count = 0; Count < LocalityCount; Count++) { - for (Index = 0; Index < LocalityCount; Index++) { - // Element[x][x] must be equal to 10 - if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) { - IncrementErrorCount (); - Print ( - L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." - L" Normalized Value is not 10\n", - Count, - Index, - SLIT_ELEMENT (LocalityPtr, Count, Index) - ); - } - // Element[i][j] must be equal to Element[j][i] - if (SLIT_ELEMENT (LocalityPtr, Count, Index) != - SLIT_ELEMENT (LocalityPtr, Index, Count)) { - IncrementErrorCount (); - Print ( - L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n" - L"Element[0x%lx][0x%lx] (%3d) do not match.\n", - Count, - Index, - SLIT_ELEMENT (LocalityPtr, Count, Index), - Index, - Count, - SLIT_ELEMENT (LocalityPtr, Index, Count) - ); - } - } - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c deleted file mode 100644 index 9dc1b15..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ /dev/null @@ -1,180 +0,0 @@ -/** @file - SPCR table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - Microsoft Serial Port Console Redirection Table - Specification - Version 1.03 - August 10, 2015. -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - This function validates the Interrupt Type. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateInterruptType ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function validates the Irq. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateIrq ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - An ACPI_PARSER array describing the ACPI SPCR Table. -**/ -STATIC CONST ACPI_PARSER SpcrParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, - {L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL}, - {L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL}, - {L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL}, - {L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL}, - {L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL}, - {L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL}, - {L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL}, - {L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL}, - - {L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL}, - {L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL} -}; - -/** - This function validates the Interrupt Type. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateInterruptType ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 InterruptType; - - InterruptType = *Ptr; - - if (InterruptType != - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { - IncrementErrorCount (); - Print ( - L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms", - InterruptType - ); - } -#endif -} - -/** - This function validates the Irq. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateIrq ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 Irq; - - Irq = *Ptr; - - if (Irq != 0) { - IncrementErrorCount (); - Print ( - L"\nERROR: Irq = %d. This must be zero on ARM Platforms\n", - Irq - ); - } -#endif -} - -/** - This function parses the ACPI SPCR table. - When trace is enabled this function parses the SPCR table and - traces the ACPI table fields. - - This function also performs validations of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSpcr ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - if (!Trace) { - return; - } - - // Dump the SPCR - ParseAcpi ( - TRUE, - 0, - "SPCR", - Ptr, - AcpiTableLength, - PARSER_PARAMS (SpcrParser) - ); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c deleted file mode 100644 index c7858ee..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ /dev/null @@ -1,350 +0,0 @@ -/** @file - SRAT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local Variables -STATIC CONST UINT8* SratRAType; -STATIC CONST UINT8* SratRALength; -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** - This function validates the Reserved field in the SRAT table header. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateSratReserved ( - IN UINT8* Ptr, - IN VOID* Context - ); - -/** - This function traces the APIC Proximity Domain field. - - @param [in] Format Format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -STATIC -VOID -EFIAPI -DumpSratApicProximity ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); - -/** - An ACPI_PARSER array describing the SRAT Table. -**/ -STATIC CONST ACPI_PARSER SratParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL}, - {L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Resource Allocation structure header. -**/ -STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = { - {L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL}, - {L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the GICC Affinity structure. -**/ -STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the GIC ITS Affinity structure. -**/ -STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL}, - {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, -}; - -/** - An ACPI_PARSER array describing the Memory Affinity structure. -**/ -STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. -**/ -STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity, - NULL, NULL, NULL}, - {L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** - An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure. -**/ -STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { - {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, - - {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL} -}; - -/** This function validates the Reserved field in the SRAT table header. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateSratReserved ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 1) { - IncrementErrorCount (); - Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); - } -} - -/** - This function traces the APIC Proximity Domain field. - - @param [in] Format Format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -STATIC -VOID -EFIAPI -DumpSratApicProximity ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ) -{ - UINT32 ProximityDomain; - - ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); - - Print (Format, ProximityDomain); -} - -/** - This function parses the ACPI SRAT table. - When trace is enabled this function parses the SRAT table and - traces the ACPI table fields. - - This function parses the following Resource Allocation Structures: - - Processor Local APIC/SAPIC Affinity Structure - - Memory Affinity Structure - - Processor Local x2APIC Affinity Structure - - GICC Affinity Structure - - This function also performs validation of the ACPI table fields. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSrat ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT8* ResourcePtr; - UINT32 GicCAffinityIndex; - UINT32 GicITSAffinityIndex; - UINT32 MemoryAffinityIndex; - UINT32 ApicSapicAffinityIndex; - UINT32 X2ApicAffinityIndex; - CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi - - GicCAffinityIndex = 0; - GicITSAffinityIndex = 0; - MemoryAffinityIndex = 0; - ApicSapicAffinityIndex = 0; - X2ApicAffinityIndex = 0; - - if (!Trace) { - return; - } - - Offset = ParseAcpi ( - TRUE, - 0, - "SRAT", - Ptr, - AcpiTableLength, - PARSER_PARAMS (SratParser) - ); - ResourcePtr = Ptr + Offset; - - while (Offset < AcpiTableLength) { - ParseAcpi ( - FALSE, - 0, - NULL, - ResourcePtr, - 2, // The length is 1 byte at offset 1 - PARSER_PARAMS (SratResourceAllocationParser) - ); - - switch (*SratRAType) { - case EFI_ACPI_6_2_GICC_AFFINITY: - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "GICC Affinity Structure [%d]", - GicCAffinityIndex++ - ); - ParseAcpi ( - TRUE, - 2, - Buffer, - ResourcePtr, - *SratRALength, - PARSER_PARAMS (SratGicCAffinityParser) - ); - break; - - case EFI_ACPI_6_2_GIC_ITS_AFFINITY: - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "GIC ITS Affinity Structure [%d]", - GicITSAffinityIndex++ - ); - ParseAcpi ( - TRUE, - 2, - Buffer, - ResourcePtr, - *SratRALength, - PARSER_PARAMS (SratGicITSAffinityParser) - ); - break; - - case EFI_ACPI_6_2_MEMORY_AFFINITY: - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "Memory Affinity Structure [%d]", - MemoryAffinityIndex++ - ); - ParseAcpi ( - TRUE, - 2, - Buffer, - ResourcePtr, - *SratRALength, - PARSER_PARAMS (SratMemAffinityParser) - ); - break; - - case EFI_ACPI_6_2_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY: - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "APIC/SAPIC Affinity Structure [%d]", - ApicSapicAffinityIndex++ - ); - ParseAcpi ( - TRUE, - 2, - Buffer, - ResourcePtr, - *SratRALength, - PARSER_PARAMS (SratApciSapicAffinityParser) - ); - break; - - case EFI_ACPI_6_2_PROCESSOR_LOCAL_X2APIC_AFFINITY: - AsciiSPrint ( - Buffer, - sizeof (Buffer), - "X2APIC Affinity Structure [%d]", - X2ApicAffinityIndex++ - ); - ParseAcpi ( - TRUE, - 2, - Buffer, - ResourcePtr, - *SratRALength, - PARSER_PARAMS (SratX2ApciAffinityParser) - ); - break; - - default: - IncrementErrorCount (); - Print (L"ERROR: Unknown SRAT Affinity type = 0x%x\n", *SratRAType); - break; - } - - ResourcePtr += (*SratRALength); - Offset += (*SratRALength); - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c deleted file mode 100644 index fa8868e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - SSDT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -/** - This function parses the ACPI SSDT table. - When trace is enabled this function parses the SSDT table and - traces the ACPI table fields. - For the SSDT table only the ACPI header fields are - parsed and traced. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiSsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - if (!Trace) { - return; - } - - DumpAcpiHeader (Ptr); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c deleted file mode 100644 index d10c6a6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ /dev/null @@ -1,156 +0,0 @@ -/** @file - XSDT table parser - - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 -**/ - -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" - -// Local variables -STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - -/** An ACPI_PARSER array describing the ACPI XSDT table. -*/ -STATIC CONST ACPI_PARSER XsdtParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) -}; - -/** - Get the ACPI XSDT header info. -**/ -CONST ACPI_DESCRIPTION_HEADER_INFO * -EFIAPI -GetAcpiXsdtHeaderInfo ( - VOID -) -{ - return &AcpiHdrInfo; -} - -/** - This function parses the ACPI XSDT table and optionally traces the ACPI table fields. - - This function also performs validation of the XSDT table. - - @param [in] Trace If TRUE, trace the ACPI fields. - @param [in] Ptr Pointer to the start of the buffer. - @param [in] AcpiTableLength Length of the ACPI table. - @param [in] AcpiTableRevision Revision of the ACPI table. -**/ -VOID -EFIAPI -ParseAcpiXsdt ( - IN BOOLEAN Trace, - IN UINT8* Ptr, - IN UINT32 AcpiTableLength, - IN UINT8 AcpiTableRevision - ) -{ - UINT32 Offset; - UINT32 TableOffset; - UINT64* TablePointer; - UINTN EntryIndex; - CHAR16 Buffer[32]; - - // Parse the ACPI header to get the length - ParseAcpi ( - FALSE, - 0, - "XSDT", - Ptr, - ACPI_DESCRIPTION_HEADER_LENGTH, - PARSER_PARAMS (XsdtParser) - ); - - Offset = ParseAcpi ( - Trace, - 0, - "XSDT", - Ptr, - *AcpiHdrInfo.Length, - PARSER_PARAMS (XsdtParser) - ); - - TableOffset = Offset; - - if (Trace) { - EntryIndex = 0; - TablePointer = (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { - CONST UINT32* Signature; - CONST UINT32* Length; - CONST UINT8* Revision; - - if ((UINT64*)(UINTN)(*TablePointer) != NULL) { - UINT8* SignaturePtr; - - ParseAcpiHeader ( - (UINT8*)(UINTN)(*TablePointer), - &Signature, - &Length, - &Revision - ); - - SignaturePtr = (UINT8*)Signature; - - UnicodeSPrint ( - Buffer, - sizeof (Buffer), - L"Entry[%d] - %c%c%c%c", - EntryIndex++, - SignaturePtr[0], - SignaturePtr[1], - SignaturePtr[2], - SignaturePtr[3] - ); - } else { - UnicodeSPrint ( - Buffer, - sizeof (Buffer), - L"Entry[%d]", - EntryIndex++ - ); - } - - PrintFieldName (2, Buffer); - Print (L"0x%lx\n", *TablePointer); - - // Validate the table pointers are not NULL - if ((UINT64*)(UINTN)(*TablePointer) == NULL) { - IncrementErrorCount (); - Print ( - L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n", - TablePointer, - *TablePointer - ); - } - Offset += sizeof (UINT64); - TablePointer++; - } // while - } - - // Process the tables - Offset = TableOffset; - TablePointer = (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { - if ((UINT64*)(UINTN)(*TablePointer) != NULL) { - ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer)); - } - Offset += sizeof (UINT64); - TablePointer++; - } // while -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c deleted file mode 100644 index 43a9003..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ /dev/null @@ -1,174 +0,0 @@ -/** @file - Main file for 'acpiview' Shell command function. - - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include -#include -#include -#include -#include "AcpiParser.h" -#include "AcpiTableParser.h" -#include "AcpiView.h" -#include "UefiShellAcpiViewCommandLib.h" - -CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand"; - -/** - A list of available table parsers. -*/ -STATIC -CONST -ACPI_TABLE_PARSER ParserList[] = { - {EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt}, - {EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2}, - {EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, - ParseAcpiDsdt}, - {EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt}, - {EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt}, - {EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort}, - {EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt}, - {EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, - ParseAcpiMcfg}, - {EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, - ParseAcpiPptt}, - {RSDP_TABLE_INFO, ParseAcpiRsdp}, - {EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit}, - {EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr}, - {EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat}, - {EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt}, - {EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt} -}; - -/** - This function registers all the available table parsers. - - @retval EFI_SUCCESS The parser is registered. - @retval EFI_ALREADY_STARTED The parser for the ACPI Table - was already registered. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_OUT_OF_RESOURCES No space to register the - parser. -**/ -EFI_STATUS -RegisterAllParsers ( - ) -{ - EFI_STATUS Status; - UINTN Count; - - Status = EFI_SUCCESS; - Count = sizeof (ParserList) / sizeof (ParserList[0]); - - while (Count-- != 0) { - Status = RegisterParser ( - ParserList[Count].Signature, - ParserList[Count].Parser - ); - if (EFI_ERROR (Status)) { - return Status; - } - } - return Status; -} - -/** - Return the file name of the help text file if not using HII. - - @return The string pointer to the file name. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameAcpiView ( - VOID - ) -{ - return gShellAcpiViewFileName; -} - -/** - Constructor for the Shell AcpiView Command library. - - Install the handlers for acpiview UEFI Shell command. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS The Shell command handlers were installed - successfully. - @retval EFI_DEVICE_ERROR Hii package failed to install. -**/ -EFI_STATUS -EFIAPI -UefiShellAcpiViewCommandLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - gShellAcpiViewHiiHandle = NULL; - - // Check Shell Profile Debug1 bit of the profiles mask - if ((PcdGet8 (PcdShellProfileMask) & BIT1) == 0) { - return EFI_SUCCESS; - } - - Status = RegisterAllParsers (); - if (EFI_ERROR (Status)) { - Print (L"acpiview: Error failed to register parser.\n"); - return Status; - } - - gShellAcpiViewHiiHandle = HiiAddPackages ( - &gShellAcpiViewHiiGuid, - gImageHandle, - UefiShellAcpiViewCommandLibStrings, - NULL - ); - if (gShellAcpiViewHiiHandle == NULL) { - return EFI_DEVICE_ERROR; - } - // Install our Shell command handler - ShellCommandRegisterCommandName ( - L"acpiview", - ShellCommandRunAcpiView, - ShellCommandGetManFileNameAcpiView, - 0, - L"acpiview", - TRUE, - gShellAcpiViewHiiHandle, - STRING_TOKEN (STR_GET_HELP_ACPIVIEW) - ); - - return EFI_SUCCESS; -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -UefiShellAcpiViewCommandLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellAcpiViewHiiHandle != NULL) { - HiiRemovePackages (gShellAcpiViewHiiHandle); - } - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h deleted file mode 100644 index b8d4639..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - Header file for 'acpiview' Shell command functions. - - Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ -#define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ - -extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; - -/** - Function for 'acpiview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAcpiView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -#endif // UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf deleted file mode 100644 index 84dfd58..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ /dev/null @@ -1,78 +0,0 @@ -## @file -# Provides Shell 'acpiview' command functions -# -# Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010019 - BASE_NAME = UefiShellAcpiViewCommandLib - FILE_GUID = FB5B305E-84F5-461F-940D-82D345757AFA - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = UefiShellAcpiViewCommandLibConstructor - DESTRUCTOR = UefiShellAcpiViewCommandLibDestructor - -[Sources.common] - UefiShellAcpiViewCommandLib.uni - UefiShellAcpiViewCommandLib.c - UefiShellAcpiViewCommandLib.h - AcpiParser.h - AcpiTableParser.h - AcpiView.h - AcpiParser.c - AcpiTableParser.c - AcpiView.c - Parsers/Bgrt/BgrtParser.c - Parsers/Dbg2/Dbg2Parser.c - Parsers/Dsdt/DsdtParser.c - Parsers/Fadt/FadtParser.c - Parsers/Gtdt/GtdtParser.c - Parsers/Iort/IortParser.c - Parsers/Madt/MadtParser.c - Parsers/Mcfg/McfgParser.c - Parsers/Pptt/PpttParser.c - Parsers/Rsdp/RsdpParser.c - Parsers/Slit/SlitParser.c - Parsers/Spcr/SpcrParser.c - Parsers/Srat/SratParser.c - Parsers/Ssdt/SsdtParser.c - Parsers/Xsdt/XsdtParser.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - PrintLib - FileHandleLib - - -[FixedPcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Guids] - gShellAcpiViewHiiGuid ## CONSUMES ## HII - gEfiAcpiTableGuid ## SOMETIMES_CONSUMES ## SystemTable diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni deleted file mode 100644 index 6b1e1e3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni +++ /dev/null @@ -1,134 +0,0 @@ -// /** -// -// Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellAcpiViewCommandLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell acpiview command -// -// -// */ - -/=# - -#langdef en-US "english" - -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments.\r\n" -#string STR_GEN_MISSING_OPTION #language en-US "%H%s%N: Missing option '%H%s%N' required by flag - '%H%s%N'\r\n" -#string STR_GEN_READONLY_MEDIA #language en-US "%H%s%N: Unable to write to the current directory, check if media is writable.\r\n" - -#string STR_GET_HELP_ACPIVIEW #language en-US "" -".TH acpiview 0 "Display ACPI information."\r\n" -".SH NAME\r\n" -"Display ACPI Table information.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-c] [-v] [-h Highlight]]\r\n" -" \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -l - Display list of installed ACPI Tables.\r\n" -" -s - Display only the specified AcpiTable type.\r\n" -" AcpiTable : The required ACPI Table type.\r\n" -" -d - Generate a binary file dump of the specified AcpiTable.\r\n" -" -c - Consistency checking (enabled by default).\r\n" -" -v - Display verbose data (enabled by default).\r\n" -" -h - Enable/Disable Colour Highlighting.\r\n" -" Highlight : TRUE/ON enables highlighting;\r\n" -" FALSE/OFF (default) disables highlighting.\r\n" -" -? - Show help.\r\n" -" \r\n" -".SH DESCRIPTION\r\n" -" \r\n" -" This program is provided to allow examination of ACPI table values from the\r\n" -" UEFI Shell. This can help with investigations, especially at that stage where\r\n" -" the tables are not enabling an OS to boot.\r\n" -" The program is not exhaustive, and only encapsulates detailed knowledge of a\r\n" -" limited number of table types.\r\n" -" \r\n" -" Default behaviour is to display the content of all tables installed.\r\n" -" 'Known' table types (listed in NOTES below) will be parsed and displayed\r\n" -" with descriptions and field values. Where appropriate a degree of consistency\r\n" -" checking is done and errors may be reported in the output.\r\n" -" Other table types will be displayed as an array of Hexadecimal bytes.\r\n" -" \r\n" -" To facilitate debugging, the -s and -d options can be used to generate a\r\n" -" binary file image of a table that can be copied elsewhere for investigation\r\n" -" using tools such as those provided by acpica.org. This is especially relevant\r\n" -" for AML type tables like DSDT and SSDT.\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The AcpiTable parameter can match any installed table type.\r\n" -" Tables without specific handling will be displayed as a raw hex dump (or\r\n" -" dumped to a file if -d is used).\r\n" -" 2. -s option supports to display the specified AcpiTable type that is present\r\n" -" in the system. For normal type AcpiTable, it would display the data of the\r\n" -" AcpiTable and AcpiTable header. The following type may contain header type\r\n" -" other than AcpiTable header. The actual header can refer to the ACPI spec 6.2\r\n" -" Extra A. Particular types:\r\n" -" APIC - Multiple APIC Description Table (MADT)\r\n" -" BGRT - Boot Graphics Resource Table\r\n" -" DBG2 - Debug Port Table 2\r\n" -" DSDT - Differentiated System Description Table\r\n" -" FACP - Fixed ACPI Description Table (FADT)\r\n" -" GTDT - Generic Timer Description Table\r\n" -" IORT - IO Remapping Table\r\n" -" MCFG - Memory Mapped Config Space Base Address Description Table\r\n" -" PPTT - Processor Properties Topology Table\r\n" -" RSDP - Root System Description Pointer\r\n" -" SLIT - System Locality Information Table\r\n" -" SPCR - Serial Port Console Redirection Table\r\n" -" SRAT - System Resource Affinity Table\r\n" -" SSDT - Secondary SystemDescription Table\r\n" -" XSDT - Extended System Description Table\r\n" -" \r\n" -".SH STANDARDS\r\n" -" \r\n" -" Table details correspond to those in 'Advanced Configuration and Power\r\n" -" Interface Specification' Version 6.2 Errata A, [September 2017]\r\n" -" (http://www.uefi.org/sites/default/files/resources/ACPI%206_2_A_Sept29.pdf)\r\n" -" \r\n" -" NOTE: The nature of the ACPI standard means that almost all tables in 6.1 will\r\n" -" be 'backwards compatible' with prior version of the specification in\r\n" -" terms of structure, so formatted output should be correct. The main\r\n" -" exception will be that previously 'reserved' fields will be reported\r\n" -" with new names, where they have been added in later versions of the\r\n" -" specification.\r\n" -" \r\n" -".SH EXAMPLES\r\n" -" \r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display a list of the installed table types:\r\n" -" fs0:\> acpiview -l\r\n" -" \r\n" -" * To parse and display a specific table type:\r\n" -" fs0:\> acpiview -s GTDT\r\n" -" \r\n" -" * To save a binary dump of the contents of a table to a file\r\n" -" in the current working directory:\r\n" -" fs0:\> acpiview -s DSDT -d\r\n" -" \r\n" -" * To display contents of all ACPI tables:\r\n" -" fs0:\> acpiview\r\n" -" \r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS Data was displayed as requested.\r\n" -" SHELL_INVALID_PARAMETER ACPI Table parsing failed.\r\n" -" \r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c deleted file mode 100644 index f6a3d97..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ /dev/null @@ -1,1906 +0,0 @@ -/** @file - Main file for BCFG command. - - (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; -STATIC EFI_HANDLE gShellBcfgHiiHandle = NULL; - -typedef enum { - BcfgTargetBootOrder = 0, - BcfgTargetDriverOrder = 1, - BcfgTargetMax = 2 -} BCFG_OPERATION_TARGET; - -typedef enum { - BcfgTypeDump = 0, - BcfgTypeAdd = 1, - BcfgTypeAddp = 2, - BcfgTypeAddh = 3, - BcfgTypeRm = 4, - BcfgTypeMv = 5, - BcfgTypeOpt = 6, - BcfgTypeMod = 7, - BcfgTypeModf = 8, - BcfgTypeModp = 9, - BcfgTypeModh = 10, - BcfgTypeMax = 11 -} BCFG_OPERATION_TYPE; - -typedef struct { - BCFG_OPERATION_TARGET Target; - BCFG_OPERATION_TYPE Type; - UINT16 Number1; - UINT16 Number2; - UINTN HandleIndex; - CHAR16 *FileName; - CHAR16 *Description; - UINT16 *Order; - CONST CHAR16 *OptData; -} BGFG_OPERATION; - -/** - Update the optional data for a boot or driver option. - - If optional data exists it will be changed. - - @param[in] Index The boot or driver option index update. - @param[in] DataSize The size in bytes of Data. - @param[in] Data The buffer for the optioanl data. - @param[in] Target The target of the operation. - - @retval EFI_SUCCESS The data was sucessfully updated. - @retval other A error occured. -**/ -EFI_STATUS -UpdateOptionalData( - UINT16 Index, - UINTN DataSize, - UINT8 *Data, - IN CONST BCFG_OPERATION_TARGET Target - ) -{ - EFI_STATUS Status; - CHAR16 VariableName[12]; - UINTN OriginalSize; - UINT8 *OriginalData; - UINTN NewSize; - UINT8 *NewData; - UINTN OriginalOptionDataSize; - - UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", Index); - - OriginalSize = 0; - OriginalData = NULL; - NewData = NULL; - NewSize = 0; - - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &OriginalSize, - OriginalData); - if (Status == EFI_BUFFER_TOO_SMALL) { - OriginalData = AllocateZeroPool(OriginalSize); - if (OriginalData == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &OriginalSize, - OriginalData); - } - - if (!EFI_ERROR(Status)) { - // - // Allocate new struct and discard old optional data. - // - ASSERT (OriginalData != NULL); - OriginalOptionDataSize = sizeof(UINT32) + sizeof(UINT16) + StrSize(((CHAR16*)(OriginalData + sizeof(UINT32) + sizeof(UINT16)))); - OriginalOptionDataSize += (*(UINT16*)(OriginalData + sizeof(UINT32))); - OriginalOptionDataSize -= OriginalSize; - NewSize = OriginalSize - OriginalOptionDataSize + DataSize; - NewData = AllocatePool(NewSize); - if (NewData == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - CopyMem (NewData, OriginalData, OriginalSize - OriginalOptionDataSize); - CopyMem(NewData + OriginalSize - OriginalOptionDataSize, Data, DataSize); - } - } - - if (!EFI_ERROR(Status)) { - // - // put the data back under the variable - // - Status = gRT->SetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - NewSize, - NewData); - } - - SHELL_FREE_NON_NULL(OriginalData); - SHELL_FREE_NON_NULL(NewData); - return (Status); -} - -/** - This function will get a CRC for a boot option. - - @param[in, out] Crc The CRC value to return. - @param[in] BootIndex The boot option index to CRC. - - @retval EFI_SUCCESS The CRC was sucessfully returned. - @retval other A error occured. -**/ -EFI_STATUS -GetBootOptionCrc( - UINT32 *Crc, - UINT16 BootIndex - ) -{ - CHAR16 VariableName[12]; - EFI_STATUS Status; - UINT8 *Buffer; - UINTN BufferSize; - - Buffer = NULL; - BufferSize = 0; - - // - // Get the data Buffer - // - UnicodeSPrint(VariableName, sizeof(VariableName), L"%Boot%04x", BootIndex); - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &BufferSize, - NULL); - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = AllocateZeroPool(BufferSize); - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &BufferSize, - Buffer); - } - - // - // Get the CRC computed - // - if (!EFI_ERROR(Status)) { - Status = gBS->CalculateCrc32 (Buffer, BufferSize, Crc); - } - - SHELL_FREE_NON_NULL(Buffer); - return EFI_SUCCESS; -} - -/** - This function will populate the device path protocol parameter based on TheHandle. - - @param[in] TheHandle Driver handle. - @param[in, out] FilePath On a sucessful return the device path to the handle. - - @retval EFI_SUCCESS The device path was sucessfully returned. - @retval other A error from gBS->HandleProtocol. - - @sa HandleProtocol -**/ -EFI_STATUS -GetDevicePathForDriverHandle ( - IN EFI_HANDLE TheHandle, - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&ImageDevicePath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { -// *DevPath = DuplicateDevicePath (ImageDevicePath); -// *FilePath = DuplicateDevicePath (LoadedImage->FilePath); - *FilePath = AppendDevicePath(ImageDevicePath,LoadedImage->FilePath); - gBS->CloseProtocol( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - gImageHandle, - NULL); - } - gBS->CloseProtocol( - TheHandle, - &gEfiLoadedImageProtocolGuid, - gImageHandle, - NULL); - } - return (Status); -} - -/** - Functino to get Device Path by a handle. - - @param[in] TheHandle Use it to get DevicePath. - @param[in] Target Boot option target. - @param[in, out] DevicePath On a sucessful return the device path to the handle. - - @retval SHELL_INVALID_PARAMETER The handle was NULL. - @retval SHELL_NOT_FOUND Not found device path by handle. - @retval SHELL_SUCCESS Get device path successfully. -**/ -SHELL_STATUS -GetDevicePathByHandle( - IN EFI_HANDLE TheHandle, - IN BCFG_OPERATION_TARGET Target, - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - - UINTN DriverBindingHandleCount; - UINTN ParentControllerHandleCount; - UINTN ChildControllerHandleCount; - - ShellStatus = SHELL_SUCCESS; - - if (TheHandle == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number"); - return SHELL_INVALID_PARAMETER; - } - - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (TheHandle, &DriverBindingHandleCount, NULL); - if (EFI_ERROR(Status)) { - DriverBindingHandleCount = 0; - } - - Status = PARSE_HANDLE_DATABASE_PARENTS (TheHandle, &ParentControllerHandleCount, NULL); - if (EFI_ERROR (Status)) { - ParentControllerHandleCount = 0; - } - - Status = ParseHandleDatabaseForChildControllers (TheHandle, &ChildControllerHandleCount, NULL); - if (EFI_ERROR (Status)) { - ChildControllerHandleCount = 0; - } - - Status = gBS->HandleProtocol (TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)DevicePath); - - if ( DriverBindingHandleCount > 0 || - ParentControllerHandleCount > 0 || - ChildControllerHandleCount > 0 || - !EFI_ERROR(Status) - ) { - // - // The handle points to a real controller which has a device path. - // - if (Target == BcfgTargetDriverOrder) { - ShellPrintHiiEx ( - -1, - -1, - NULL,STRING_TOKEN (STR_GEN_PARAM_INV), - gShellBcfgHiiHandle, - L"bcfg", - L"Handle should point to driver image." - ); - ShellStatus = SHELL_NOT_FOUND; - } - } else { - // - // The handle points to a driver image. - // - if (Target == BcfgTargetBootOrder) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PARAM_INV), - gShellBcfgHiiHandle, - L"bcfg", - L"Handle should point to controller." - ); - ShellStatus = SHELL_NOT_FOUND; - } else { - if (EFI_ERROR (GetDevicePathForDriverHandle (TheHandle, DevicePath))) { - ShellStatus = SHELL_NOT_FOUND; - } - } - } - - return (ShellStatus); -} - -/** - Function to modify an option. - - @param[in] BcfgOperation Pointer to BCFG operation. - @param[in] OrderCount The number if items in CurrentOrder. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_INVALID_PARAMETER A parameter was invalid. - @retval SHELL_OUT_OF_RESOUCES A memory allocation failed. -**/ -SHELL_STATUS -BcfgMod ( - IN CONST BGFG_OPERATION *BcfgOperation, - IN CONST UINTN OrderCount - ) -{ - EFI_STATUS Status; - EFI_HANDLE CurHandle; - SHELL_STATUS ShellStatus; - CHAR16 OptionStr[40]; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *Arg; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePathBuffer; - EFI_DEVICE_PATH_PROTOCOL *DevicePathWalker; - EFI_BOOT_MANAGER_LOAD_OPTION LoadOption; - - ShellStatus = SHELL_SUCCESS; - FileList = NULL; - DevicePath = NULL; - DevicePathBuffer = NULL; - - ZeroMem (&LoadOption, sizeof(EFI_BOOT_MANAGER_LOAD_OPTION)); - - if ( (BcfgOperation->Type == BcfgTypeMod && BcfgOperation->Description == NULL) || - (BcfgOperation->Type == BcfgTypeModf && BcfgOperation->FileName == NULL) || - (BcfgOperation->Type == BcfgTypeModp && BcfgOperation->FileName == NULL) || - (BcfgOperation->Type == BcfgTypeModh && BcfgOperation->HandleIndex == 0) || - (BcfgOperation->Number1 > OrderCount) - ) { - return (SHELL_INVALID_PARAMETER); - } - - if (BcfgOperation->Type == BcfgTypeModh) { - CurHandle = ConvertHandleIndexToHandle (BcfgOperation->HandleIndex); - ShellStatus = GetDevicePathByHandle (CurHandle, BcfgOperation->Target, &DevicePathBuffer); - if (ShellStatus == SHELL_SUCCESS) { - DevicePath = DuplicateDevicePath (DevicePathBuffer); - } - } else if (BcfgOperation->Type == BcfgTypeModf || BcfgOperation->Type == BcfgTypeModp) { - // - // Get Device Path by FileName. - // - ShellOpenFileMetaArg ((CHAR16 *)BcfgOperation->FileName, EFI_FILE_MODE_READ, &FileList); - if (FileList == NULL) { - // - // The name of file matched nothing. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - else if (FileList->Link.ForwardLink != FileList->Link.BackLink) { - // - // If the name of file expanded to multiple names, it's fail. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Arg = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link); - if (EFI_ERROR (Arg->Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_OPEN), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - DevicePathBuffer = gEfiShellProtocol->GetDevicePathFromFilePath (Arg->FullName); - if (DevicePathBuffer == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellBcfgHiiHandle, L"bcfg", Arg->FullName); - ShellStatus = SHELL_UNSUPPORTED; - } - } - } - - if (ShellStatus == SHELL_SUCCESS) { - if (BcfgOperation->Type == BcfgTypeModp) { - ShellStatus = SHELL_INVALID_PARAMETER; - DevicePathWalker = DevicePathBuffer; - while (!IsDevicePathEnd (DevicePathWalker)) { - if ( DevicePathType (DevicePathWalker) == MEDIA_DEVICE_PATH && - DevicePathSubType (DevicePathWalker) == MEDIA_HARDDRIVE_DP - ) { - // - // We found the portion of device path starting with the hard driver partition. - // - ShellStatus = SHELL_SUCCESS; - DevicePath = DuplicateDevicePath (DevicePathWalker); - break; - } else { - DevicePathWalker = NextDevicePathNode (DevicePathWalker); - } - } - } else { - DevicePath = DuplicateDevicePath (DevicePathBuffer); - } - - FreePool (DevicePathBuffer); - } - } - - if (ShellStatus == SHELL_SUCCESS) { - if (BcfgOperation->Target == BcfgTargetBootOrder) { - UnicodeSPrint (OptionStr, sizeof (OptionStr), L"Boot%04x", BcfgOperation->Order[BcfgOperation->Number1]); - } else { - UnicodeSPrint (OptionStr, sizeof (OptionStr), L"Driver%04x", BcfgOperation->Order[BcfgOperation->Number1]); - } - Status = EfiBootManagerVariableToLoadOption (OptionStr, &LoadOption); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NONE), gShellBcfgHiiHandle); - ShellStatus = SHELL_NOT_FOUND; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - if (BcfgOperation->Type == BcfgTypeMod) { - SHELL_FREE_NON_NULL (LoadOption.Description); - LoadOption.Description = AllocateCopyPool (StrSize (BcfgOperation->Description), BcfgOperation->Description); - } else { - SHELL_FREE_NON_NULL (LoadOption.FilePath); - LoadOption.FilePath = DuplicateDevicePath (DevicePath); - } - - Status = EfiBootManagerLoadOptionToVariable (&LoadOption); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", OptionStr); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - EfiBootManagerFreeLoadOption (&LoadOption); - - if (DevicePath != NULL) { - FreePool (DevicePath); - } - - if (FileList != NULL) { - ShellCloseFileMetaArg (&FileList); - } - - return (ShellStatus); -} - -/** - Function to add a option. - - @param[in] Position The position to add Target at. - @param[in] File The file to make the target. - @param[in] Desc The description text. - @param[in] CurrentOrder The pointer to the current order of items. - @param[in] OrderCount The number if items in CurrentOrder. - @param[in] Target The info on the option to add. - @param[in] UseHandle TRUE to use HandleNumber, FALSE to use File and Desc. - @param[in] UsePath TRUE to convert to devicepath. - @param[in] HandleNumber The handle number to add. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_INVALID_PARAMETER A parameter was invalid. -**/ -SHELL_STATUS -BcfgAdd( - IN UINTN Position, - IN CONST CHAR16 *File, - IN CONST CHAR16 *Desc, - IN CONST UINT16 *CurrentOrder, - IN CONST UINTN OrderCount, - IN CONST BCFG_OPERATION_TARGET Target, - IN CONST BOOLEAN UseHandle, - IN CONST BOOLEAN UsePath, - IN CONST UINTN HandleNumber - ) -{ - EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *FilePath; - CHAR16 *Str; - UINT8 *TempByteBuffer; - UINT8 *TempByteStart; - EFI_SHELL_FILE_INFO *Arg; - EFI_SHELL_FILE_INFO *FileList; - CHAR16 OptionStr[40]; - UINTN DescSize, FilePathSize; - BOOLEAN Found; - UINTN TargetLocation; - UINTN Index; - EFI_HANDLE *Handles; - EFI_HANDLE CurHandle; - UINTN DriverBindingHandleCount; - UINTN ParentControllerHandleCount; - UINTN ChildControllerHandleCount; - SHELL_STATUS ShellStatus; - UINT16 *NewOrder; - - if (!UseHandle) { - if (File == NULL || Desc == NULL) { - return (SHELL_INVALID_PARAMETER); - } - } else { - if (HandleNumber == 0) { - return (SHELL_INVALID_PARAMETER); - } - } - - if (Position > OrderCount) { - Position = OrderCount; - } - - Str = NULL; - FilePath = NULL; - FileList = NULL; - Handles = NULL; - ShellStatus = SHELL_SUCCESS; - TargetLocation = 0xFFFF; - - if (UseHandle) { - CurHandle = ConvertHandleIndexToHandle(HandleNumber); - if (CurHandle == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (Target == BcfgTargetBootOrder) { - // - //Make sure that the handle should point to a real controller - // - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS ( - CurHandle, - &DriverBindingHandleCount, - NULL); - - Status = PARSE_HANDLE_DATABASE_PARENTS ( - CurHandle, - &ParentControllerHandleCount, - NULL); - - Status = ParseHandleDatabaseForChildControllers ( - CurHandle, - &ChildControllerHandleCount, - NULL); - - if (DriverBindingHandleCount > 0 - || ParentControllerHandleCount > 0 - || ChildControllerHandleCount > 0) { - FilePath = NULL; - Status = gBS->HandleProtocol ( - CurHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&FilePath); - } - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellBcfgHiiHandle, L"bcfg", HandleNumber); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - // - //Make sure that the handle should point to driver, not a controller. - // - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS ( - CurHandle, - &DriverBindingHandleCount, - NULL); - - Status = PARSE_HANDLE_DATABASE_PARENTS ( - CurHandle, - &ParentControllerHandleCount, - NULL); - - Status = ParseHandleDatabaseForChildControllers ( - CurHandle, - &ChildControllerHandleCount, - NULL); - - Status = gBS->HandleProtocol ( - CurHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&FilePath); - - if (DriverBindingHandleCount > 0 - || ParentControllerHandleCount > 0 - || ChildControllerHandleCount > 0 - || !EFI_ERROR(Status) ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Get the DevicePath from the loaded image information. - // - Status = GetDevicePathForDriverHandle(CurHandle, &FilePath); - } - } - } - } else { - // - // Get file info - // - ShellOpenFileMetaArg ((CHAR16*)File, EFI_FILE_MODE_READ, &FileList); - - if (FileList == NULL) { - // - // If filename matched nothing fail - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", File); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (FileList->Link.ForwardLink != FileList->Link.BackLink) { - // - // If filename expanded to multiple names, fail - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE), gShellBcfgHiiHandle, L"bcfg", File); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Arg = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link); - if (EFI_ERROR(Arg->Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_OPEN), gShellBcfgHiiHandle, L"bcfg", File); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Build FilePath to the filename - // - - // - // get the device path - // - DevicePath = gEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName); - if (DevicePath == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellBcfgHiiHandle, L"bcfg", Arg->FullName); - ShellStatus = SHELL_UNSUPPORTED; - } else { - if (UsePath) { - DevPath = DevicePath; - ShellStatus = SHELL_INVALID_PARAMETER; - while (!IsDevicePathEnd(DevPath)) { - if ((DevicePathType(DevPath) == MEDIA_DEVICE_PATH) && - (DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) { - - // - // If we find it use it instead - // - ShellStatus = SHELL_SUCCESS; - FilePath = DuplicateDevicePath (DevPath); - break; - } - DevPath = NextDevicePathNode(DevPath); - } - } else { - FilePath = DuplicateDevicePath(DevicePath); - } - FreePool(DevicePath); - } - } - } - } - - - if (ShellStatus == SHELL_SUCCESS) { - // - // Find a free target ,a brute force implementation - // - Found = FALSE; - for (TargetLocation=0; TargetLocation < 0xFFFF; TargetLocation++) { - Found = TRUE; - for (Index=0; Index < OrderCount; Index++) { - if (CurrentOrder[Index] == TargetLocation) { - Found = FALSE; - break; - } - } - - if (Found) { - break; - } - } - - if (TargetLocation == 0xFFFF) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET_NF), gShellBcfgHiiHandle, L"bcfg"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET), gShellBcfgHiiHandle, TargetLocation); - } - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // Add the option - // - DescSize = StrSize(Desc); - FilePathSize = GetDevicePathSize (FilePath); - - TempByteBuffer = AllocateZeroPool(sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize); - if (TempByteBuffer != NULL) { - TempByteStart = TempByteBuffer; - *((UINT32 *) TempByteBuffer) = LOAD_OPTION_ACTIVE; // Attributes - TempByteBuffer += sizeof (UINT32); - - *((UINT16 *) TempByteBuffer) = (UINT16)FilePathSize; // FilePathListLength - TempByteBuffer += sizeof (UINT16); - - CopyMem (TempByteBuffer, Desc, DescSize); - TempByteBuffer += DescSize; - ASSERT (FilePath != NULL); - CopyMem (TempByteBuffer, FilePath, FilePathSize); - - UnicodeSPrint (OptionStr, sizeof(OptionStr), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", TargetLocation); - Status = gRT->SetVariable ( - OptionStr, - &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize, - TempByteStart - ); - - FreePool(TempByteStart); - } else { - Status = EFI_OUT_OF_RESOURCES; - } - - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", OptionStr); - } else { - NewOrder = AllocateZeroPool ((OrderCount + 1) * sizeof (NewOrder[0])); - if (NewOrder != NULL) { - CopyMem (NewOrder, CurrentOrder, (OrderCount) * sizeof (NewOrder[0])); - - // - // Insert target into order list - // - for (Index = OrderCount; Index > Position; Index--) { - NewOrder[Index] = NewOrder[Index - 1]; - } - - NewOrder[Position] = (UINT16) TargetLocation; - Status = gRT->SetVariable ( - Target == BcfgTargetBootOrder ? L"BootOrder" : L"DriverOrder", - &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - (OrderCount + 1) * sizeof (UINT16), - NewOrder - ); - - FreePool (NewOrder); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? L"BootOrder" : L"DriverOrder"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Print (L"bcfg: Add %s as %x\n", OptionStr, Position); - } - } - } - } - -// -//If always Free FilePath, will free devicepath in system when use "addh" -// - if (FilePath!=NULL && !UseHandle) { - FreePool (FilePath); - } - - if (Str != NULL) { - FreePool(Str); - } - - if (Handles != NULL) { - FreePool (Handles); - } - - if (FileList != NULL) { - ShellCloseFileMetaArg (&FileList); - } - - return (ShellStatus); -} - -/** - Funciton to remove an item. - - @param[in] Target The target item to move. - @param[in] CurrentOrder The pointer to the current order of items. - @param[in] OrderCount The number if items in CurrentOrder. - @param[in] Location The current location of the Target. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_INVALID_PARAMETER A parameter was invalid. -**/ -SHELL_STATUS -BcfgRemove( - IN CONST BCFG_OPERATION_TARGET Target, - IN CONST UINT16 *CurrentOrder, - IN CONST UINTN OrderCount, - IN CONST UINT16 Location - ) -{ - CHAR16 VariableName[12]; - UINT16 *NewOrder; - EFI_STATUS Status; - UINTN NewCount; - - UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", CurrentOrder[Location]); - Status = gRT->SetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - 0, - NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - return (SHELL_INVALID_PARAMETER); - } - NewOrder = AllocateZeroPool(OrderCount*sizeof(CurrentOrder[0])); - if (NewOrder != NULL) { - NewCount = OrderCount; - CopyMem(NewOrder, CurrentOrder, OrderCount*sizeof(CurrentOrder[0])); - CopyMem(NewOrder+Location, NewOrder+Location+1, (OrderCount - Location - 1)*sizeof(CurrentOrder[0])); - NewCount--; - - Status = gRT->SetVariable( - Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", - (EFI_GUID*)&gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - NewCount*sizeof(NewOrder[0]), - NewOrder); - FreePool(NewOrder); - } else { - Status = EFI_OUT_OF_RESOURCES; - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder"); - return (SHELL_INVALID_PARAMETER); - } - return (SHELL_SUCCESS); -} - -/** - Funciton to move a item to another location. - - @param[in] Target The target item to move. - @param[in] CurrentOrder The pointer to the current order of items. - @param[in] OrderCount The number if items in CurrentOrder. - @param[in] OldLocation The current location of the Target. - @param[in] NewLocation The desired location of the Target. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_INVALID_PARAMETER A parameter was invalid. -**/ -SHELL_STATUS -BcfgMove( - IN CONST BCFG_OPERATION_TARGET Target, - IN CONST UINT16 *CurrentOrder, - IN CONST UINTN OrderCount, - IN CONST UINT16 OldLocation, - IN UINT16 NewLocation - ) -{ - UINT16 *NewOrder; - EFI_STATUS Status; - UINT16 Temp; - - NewOrder = AllocateCopyPool(OrderCount*sizeof(CurrentOrder[0]), CurrentOrder); - if (NewOrder == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - - // - // correct the new location - // - if (NewLocation >= OrderCount) { - if (OrderCount > 0) { - NewLocation = (UINT16)OrderCount - 1; - } else { - NewLocation = 0; - } - } - - Temp = CurrentOrder[OldLocation]; - CopyMem(NewOrder+OldLocation, NewOrder+OldLocation+1, (OrderCount - OldLocation - 1)*sizeof(CurrentOrder[0])); - CopyMem(NewOrder+NewLocation+1, NewOrder+NewLocation, (OrderCount - NewLocation - 1)*sizeof(CurrentOrder[0])); - NewOrder[NewLocation] = Temp; - - Status = gRT->SetVariable( - Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", - (EFI_GUID*)&gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - OrderCount*sizeof(CurrentOrder[0]), - NewOrder); - - FreePool(NewOrder); - - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder"); - return (SHELL_INVALID_PARAMETER); - } - return (SHELL_SUCCESS); -} - -/** - Function to add optional data to an option. - - @param[in] OptData The optional data to add. - @param[in] CurrentOrder The pointer to the current order of items. - @param[in] OrderCount The number if items in CurrentOrder. - @param[in] Target The target of the operation. - - @retval SHELL_SUCCESS The operation was succesful. -**/ -SHELL_STATUS -BcfgAddOpt( - IN CONST CHAR16 *OptData, - IN CONST UINT16 *CurrentOrder, - IN CONST UINTN OrderCount, - IN CONST BCFG_OPERATION_TARGET Target - ) -{ - EFI_KEY_OPTION NewKeyOption; - EFI_KEY_OPTION *KeyOptionBuffer; - SHELL_STATUS ShellStatus; - EFI_STATUS Status; - UINT16 OptionIndex; - UINT16 LoopCounter; - UINT64 Intermediate; - CONST CHAR16 *Temp; - CONST CHAR16 *Walker; - CHAR16 *FileName; - CHAR16 *Temp2; - CHAR16 *Data; - UINT32 KeyIndex; - CHAR16 VariableName[12]; - VOID *VariableData; - - SHELL_FILE_HANDLE FileHandle; - - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - Walker = OptData; - FileName = NULL; - Data = NULL; - KeyOptionBuffer = NULL; - VariableData = NULL; - - ZeroMem(&NewKeyOption, sizeof(EFI_KEY_OPTION)); - ZeroMem(VariableName, sizeof(VariableName)); - - while(Walker[0] == L' ') { - Walker++; - } - - // - // Get the index of the variable we are changing. - // - Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE); - if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL || ((UINT16)Intermediate) > ((UINT16)OrderCount)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index"); - ShellStatus = SHELL_INVALID_PARAMETER; - return (ShellStatus); - } - OptionIndex = (UINT16)Intermediate; - - Temp = StrStr(Walker, L" "); - if (Temp != NULL) { - Walker = Temp; - } - while(Walker[0] == L' ') { - Walker++; - } - - // - // determine whether we have file with data, quote delimited information, or a hot-key - // - if (Walker[0] == L'\"') { - // - // quoted filename or quoted information. - // - Temp = StrStr(Walker+1, L"\""); - if (Temp == NULL || StrLen(Temp) != 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - FileName = StrnCatGrow(&FileName, NULL, Walker+1, 0); - if (FileName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - return (ShellStatus); - } - Temp2 = StrStr(FileName, L"\""); - ASSERT(Temp2 != NULL); - Temp2[0] = CHAR_NULL; - Temp2++; - if (StrLen(Temp2)>0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } - if (EFI_ERROR(ShellFileExists(Walker))) { - // - // Not a file. must be misc information. - // - Data = FileName; - FileName = NULL; - } else { - FileName = StrnCatGrow(&FileName, NULL, Walker, 0); - } - } - } else { - // - // filename or hot key information. - // - if (StrStr(Walker, L" ") == NULL) { - // - // filename - // - if (EFI_ERROR(ShellFileExists(Walker))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - FileName = StrnCatGrow(&FileName, NULL, Walker, 0); - } - } else { - if (Target != BcfgTargetBootOrder) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_BOOT_ONLY), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // Get hot key information - // - Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE); - if (EFI_ERROR(Status) || (((UINT32)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } - NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate; - Temp = StrStr(Walker, L" "); - if (Temp != NULL) { - Walker = Temp; - } - while(Walker[0] == L' ') { - Walker++; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // Now we know how many EFI_INPUT_KEY structs we need to attach to the end of the EFI_KEY_OPTION struct. - // Re-allocate with the added information. - // - KeyOptionBuffer = AllocatePool (sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount)); - if (KeyOptionBuffer == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - return ShellStatus; - } - CopyMem (KeyOptionBuffer, &NewKeyOption, sizeof(EFI_KEY_OPTION)); - } - for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) { - // - // ScanCode - // - Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE); - if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ((EFI_INPUT_KEY*)(((UINT8*)KeyOptionBuffer) + sizeof(EFI_KEY_OPTION)))[LoopCounter].ScanCode = (UINT16)Intermediate; - Temp = StrStr(Walker, L" "); - if (Temp != NULL) { - Walker = Temp; - } - while(Walker[0] == L' ') { - Walker++; - } - - // - // UnicodeChar - // - Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE); - if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ((EFI_INPUT_KEY*)(((UINT8*)KeyOptionBuffer) + sizeof(EFI_KEY_OPTION)))[LoopCounter].UnicodeChar = (UINT16)Intermediate; - Temp = StrStr(Walker, L" "); - if (Temp != NULL) { - Walker = Temp; - } - while(Walker[0] == L' ') { - Walker++; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // Now do the BootOption / BootOptionCrc - // - ASSERT (OptionIndex <= OrderCount); - KeyOptionBuffer->BootOption = CurrentOrder[OptionIndex]; - Status = GetBootOptionCrc(&(KeyOptionBuffer->BootOptionCrc), KeyOptionBuffer->BootOption); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - for (Temp2 = NULL, KeyIndex = 0 ; KeyIndex <= 0xFFFF ; KeyIndex++) { - UnicodeSPrint(VariableName, sizeof(VariableName), L"Key%04x", KeyIndex); - Status = GetEfiGlobalVariable2 (VariableName, &VariableData, NULL); - if (Status == EFI_NOT_FOUND) { - break; - } - if (!EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(VariableData); - } - } - if (KeyIndex <= 0xFFFF) { - Status = gRT->SetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS, - sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount), - KeyOptionBuffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ASSERT(FileName == NULL && Data == NULL); - } - } - } - - // - // Shouldn't be possible to have have both. Neither is ok though. - // - ASSERT(FileName == NULL || Data == NULL); - - if (ShellStatus == SHELL_SUCCESS && (FileName != NULL || Data != NULL)) { - if (FileName != NULL) { - // - // Open the file and populate the data buffer. - // - Status = ShellOpenFileByName( - FileName, - &FileHandle, - EFI_FILE_MODE_READ, - 0); - if (!EFI_ERROR(Status)) { - Status = ShellGetFileSize(FileHandle, &Intermediate); - } - Data = AllocateZeroPool((UINTN)Intermediate); - if (Data == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - } - if (!EFI_ERROR(Status)) { - Status = ShellReadFile(FileHandle, (UINTN *)&Intermediate, Data); - } - } else { - Intermediate = StrSize(Data); - } - - if (!EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS && Data != NULL) { - Status = UpdateOptionalData(CurrentOrder[OptionIndex], (UINTN)Intermediate, (UINT8*)Data, Target); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - SHELL_FREE_NON_NULL(Data); - SHELL_FREE_NON_NULL(KeyOptionBuffer); - SHELL_FREE_NON_NULL(FileName); - return ShellStatus; -} - -/** - Function to dump the Bcfg information. - - @param[in] Op The operation. - @param[in] OrderCount How many to dump. - @param[in] CurrentOrder The pointer to the current order of items. - @param[in] VerboseOutput TRUE for extra output. FALSE otherwise. - - @retval SHELL_SUCCESS The dump was successful. - @retval SHELL_INVALID_PARAMETER A parameter was invalid. -**/ -SHELL_STATUS -BcfgDisplayDump( - IN CONST CHAR16 *Op, - IN CONST UINTN OrderCount, - IN CONST UINT16 *CurrentOrder, - IN CONST BOOLEAN VerboseOutput - ) -{ - EFI_STATUS Status; - UINT8 *Buffer; - UINTN BufferSize; - CHAR16 VariableName[12]; - UINTN LoopVar; - CHAR16 *DevPathString; - VOID *FilePathList; - UINTN Errors; - EFI_LOAD_OPTION *LoadOption; - CHAR16 *Description; - UINTN DescriptionSize; - UINTN OptionalDataOffset; - - if (OrderCount == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg"); - return (SHELL_SUCCESS); - } - - Errors = 0; - - for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) { - Buffer = NULL; - BufferSize = 0; - DevPathString = NULL; - - UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]); - - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &BufferSize, - Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = AllocateZeroPool(BufferSize); - Status = gRT->GetVariable( - VariableName, - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &BufferSize, - Buffer); - } - - if (EFI_ERROR(Status) || Buffer == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName); - ++Errors; - goto Cleanup; - } - - // - // We expect the Attributes, FilePathListLength, and L'\0'-terminated - // Description fields to be present. - // - if (BufferSize < sizeof *LoadOption + sizeof (CHAR16)) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_BCFG_VAR_CORRUPT), - gShellBcfgHiiHandle, - L"bcfg", - VariableName - ); - ++Errors; - goto Cleanup; - } - - LoadOption = (EFI_LOAD_OPTION *)Buffer; - Description = (CHAR16*)(Buffer + sizeof (EFI_LOAD_OPTION)); - DescriptionSize = StrSize (Description); - - if (LoadOption->FilePathListLength != 0) { - FilePathList = (UINT8 *)Description + DescriptionSize; - DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE); - } - - OptionalDataOffset = sizeof *LoadOption + DescriptionSize + - LoadOption->FilePathListLength; - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_BCFG_LOAD_OPTIONS), - gShellBcfgHiiHandle, - LoopVar, - VariableName, - Description, - DevPathString, - OptionalDataOffset >= BufferSize ? L'N' : L'Y' - ); - if (VerboseOutput && (OptionalDataOffset < BufferSize)) { - DumpHex ( - 2, // Indent - 0, // Offset (displayed) - BufferSize - OptionalDataOffset, // DataSize - Buffer + OptionalDataOffset // UserData - ); - } - -Cleanup: - if (Buffer != NULL) { - FreePool(Buffer); - } - if (DevPathString != NULL) { - FreePool(DevPathString); - } - } - return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS; -} - -/** - Function to initialize the BCFG operation structure. - - @param[in] Struct The stuct to initialize. -**/ -VOID -InitBcfgStruct( - IN BGFG_OPERATION *Struct - ) -{ - ASSERT(Struct != NULL); - Struct->Target = BcfgTargetMax; - Struct->Type = BcfgTypeMax; - Struct->Number1 = 0; - Struct->Number2 = 0; - Struct->HandleIndex = 0; - Struct->FileName = NULL; - Struct->Description = NULL; - Struct->Order = NULL; - Struct->OptData = NULL; -} - - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-v", TypeFlag}, - {L"-opt", TypeMaxValue}, - {NULL, TypeMax} - }; - -/** - Function for 'bcfg' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunBcfg ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN ParamNumber; - CONST CHAR16 *CurrentParam; - BGFG_OPERATION CurrentOperation; - UINTN Length; - UINT64 Intermediate; - UINT16 Count; - - Length = 0; - ProblemParam = NULL; - Package = NULL; - ShellStatus = SHELL_SUCCESS; - - InitBcfgStruct(&CurrentOperation); - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellBcfgHiiHandle, L"bcfg", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // Read in if we are doing -OPT - // - if (ShellCommandLineGetFlag(Package, L"-opt")) { - CurrentOperation.OptData = ShellCommandLineGetValue(Package, L"-opt"); - if (CurrentOperation.OptData == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellBcfgHiiHandle, L"bcfg", L"-opt"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeOpt; - } - - // - // small block to read the target of the operation - // - if ((ShellCommandLineGetCount(Package) < 3 && CurrentOperation.Type != BcfgTypeOpt) || - (ShellCommandLineGetCount(Package) < 2 && CurrentOperation.Type == BcfgTypeOpt) - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"driver") == 0) { - CurrentOperation.Target = BcfgTargetDriverOrder; - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"boot") == 0) { - CurrentOperation.Target = BcfgTargetBootOrder; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_DRIVER_BOOT), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - - - // - // Read in the boot or driver order environment variable (not needed for opt) - // - if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) { - Length = 0; - Status = gRT->GetVariable( - CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &Length, - CurrentOperation.Order); - if (Status == EFI_BUFFER_TOO_SMALL) { - CurrentOperation.Order = AllocateZeroPool(Length+(4*sizeof(CurrentOperation.Order[0]))); - if (CurrentOperation.Order == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - Status = gRT->GetVariable( - CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", - (EFI_GUID*)&gEfiGlobalVariableGuid, - NULL, - &Length, - CurrentOperation.Order); - } - } - } - - Count = (UINT16) (Length / sizeof(CurrentOperation.Order[0])); - - // - // large block to read the type of operation and verify parameter types for the info. - // - if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) { - for (ParamNumber = 2 ; ParamNumber < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) { - CurrentParam = ShellCommandLineGetRawValue(Package, ParamNumber); - if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"dump") == 0) { - CurrentOperation.Type = BcfgTypeDump; - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else if (ShellCommandLineGetFlag(Package, L"-v")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"-v (without dump)"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"add") == 0) { - if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeAdd; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - ASSERT(CurrentOperation.FileName == NULL); - CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0); - ASSERT(CurrentOperation.Description == NULL); - CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0); - } - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addp") == 0) { - if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeAddp; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - ASSERT(CurrentOperation.FileName == NULL); - CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0); - ASSERT(CurrentOperation.Description == NULL); - CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0); - } - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addh") == 0) { - if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeAddh; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.HandleIndex = (UINT16)Intermediate; - ASSERT(CurrentOperation.Description == NULL); - CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0); - } - } - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"rm") == 0) { - if ((ParamNumber + 1) >= ShellCommandLineGetCount(Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeRm; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"mv") == 0) { - if ((ParamNumber + 2) >= ShellCommandLineGetCount(Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - CurrentOperation.Type = BcfgTypeMv; - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number2 = (UINT16)Intermediate; - } - if (CurrentOperation.Number2 == CurrentOperation.Number1 - ||CurrentOperation.Number2 >= Count - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } - else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"mod") == 0) { - if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentOperation.Type = BcfgTypeMod; - CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT (CurrentOperation.Description == NULL); - CurrentOperation.Description = StrnCatGrow (&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0); - } - } - } - } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modf") == 0) { - if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentOperation.Type = BcfgTypeModf; - CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT (CurrentOperation.FileName == NULL); - CurrentOperation.FileName = StrnCatGrow (&CurrentOperation.FileName, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0); - } - } - } - } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modp") == 0) { - if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentOperation.Type = BcfgTypeModp; - CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT (CurrentOperation.FileName == NULL); - CurrentOperation.FileName = StrnCatGrow (&CurrentOperation.FileName, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0); - } - } - } - } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modh") == 0) { - if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentOperation.Type = BcfgTypeModh; - CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } - else { - Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.Number1 = (UINT16)Intermediate; - if (CurrentOperation.Number1 >= Count) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber); - if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE); - CurrentOperation.HandleIndex = (UINT16)Intermediate; - } - } - } - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax && CurrentOperation.Type < BcfgTypeMax) { - // - // we have all the info. Do the work - // - switch (CurrentOperation.Type) { - case BcfgTypeDump: - ShellStatus = BcfgDisplayDump( - CurrentOperation.Target == BcfgTargetBootOrder?L"Boot":L"Driver", - Count, - CurrentOperation.Order, - ShellCommandLineGetFlag(Package, L"-v")); - break; - case BcfgTypeMv: - ShellStatus = BcfgMove( - CurrentOperation.Target, - CurrentOperation.Order, - Count, - CurrentOperation.Number1, - CurrentOperation.Number2); - break; - case BcfgTypeRm: - ShellStatus = BcfgRemove( - CurrentOperation.Target, - CurrentOperation.Order, - Count, - CurrentOperation.Number1); - break; - case BcfgTypeAdd: - case BcfgTypeAddp: - case BcfgTypeAddh: - ShellStatus = BcfgAdd( - CurrentOperation.Number1, - CurrentOperation.FileName, - CurrentOperation.Description==NULL?L"":CurrentOperation.Description, - CurrentOperation.Order, - Count, - CurrentOperation.Target, - (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddh), - (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddp), - CurrentOperation.HandleIndex); - break; - case BcfgTypeMod: - case BcfgTypeModf: - case BcfgTypeModp: - case BcfgTypeModh: - ShellStatus = BcfgMod (&CurrentOperation, Count); - break; - case BcfgTypeOpt: - ShellStatus = BcfgAddOpt( - CurrentOperation.OptData, - CurrentOperation.Order, - Count, - CurrentOperation.Target); - break; - default: - ASSERT(FALSE); - } - } - } - - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - if (CurrentOperation.FileName != NULL) { - FreePool(CurrentOperation.FileName); - } - if (CurrentOperation.Description != NULL) { - FreePool(CurrentOperation.Description); - } - if (CurrentOperation.Order != NULL) { - FreePool(CurrentOperation.Order); - } - - return (ShellStatus); -} - - -/** - Function to get the filename with help context if HII will not be used. - - @return The filename with help text in it. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameBcfg ( - VOID - ) -{ - return (mFileName); -} - -/** - "Constructor" for the library. - - This will register the handler for the bcfg command. - - @param[in] ImageHandle the image handle of the process - @param[in] SystemTable the EFI System Table pointer - @param[in] Name the profile name to use - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -BcfgLibraryRegisterBcfgCommand ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable, - IN CONST CHAR16 *Name - ) -{ - if (gShellBcfgHiiHandle != NULL) { - return (EFI_SUCCESS); - } - - gShellBcfgHiiHandle = HiiAddPackages (&gShellBcfgHiiGuid, gImageHandle, UefiShellBcfgCommandLibStrings, NULL); - if (gShellBcfgHiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handler - // - ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameBcfg, 0, Name, FALSE, gShellBcfgHiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG)); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -BcfgLibraryUnregisterBcfgCommand ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellBcfgHiiHandle != NULL) { - HiiRemovePackages(gShellBcfgHiiHandle); - } - gShellBcfgHiiHandle = NULL; - return (EFI_SUCCESS); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf deleted file mode 100644 index 20d67ac..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf +++ /dev/null @@ -1,47 +0,0 @@ -## @file -# Provides shell install1 functions -# -# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellBcfgCommandLib - FILE_GUID = F6A3BF5D-4095-4E4F-9670-408770C2DBDF - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.1 - LIBRARY_CLASS = BcfgCommandLib|UEFI_APPLICATION UEFI_DRIVER - -[Sources.common] - UefiShellBcfgCommandLib.c - UefiShellBcfgCommandLib.uni - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - SortLib - PrintLib - UefiBootManagerLib - -[Guids] - gShellBcfgHiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni deleted file mode 100644 index 1e21d4f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni +++ /dev/null @@ -1,159 +0,0 @@ -// /** -// -// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiBcfgCommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 BCFG command -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_NO_MEM #language en-US "%H%s%N: Memory is not available.\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_NO_DRIVER_BOOT #language en-US "%H%s%N: Driver or Boot must be selected.\r\n" -#string STR_GEN_BOOT_ONLY #language en-US "%H%s%N: Boot must be selected for hot key options.\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments.\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_FIND_FAIL #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful.\r\n" -#string STR_BCFG_WRITE_FAIL #language en-US "%H%s%N: Unable to write to '%H%s%N'\r\n" -#string STR_BCFG_READ_FAIL #language en-US "%H%s%N: Unable to read from '%H%s%N'\r\n" -#string STR_BCFG_VAR_CORRUPT #language en-US "%H%s%N: Variable '%H%s%N' corrupt.\r\n" -#string STR_BCFG_HANDLE #language en-US "%H%s%N: The handle [%H%02x%N] does not have DevicePath.\r\n" -#string STR_BCFG_FILE #language en-US "%H%s%N: The file '%H%s%N' matches multiple files.\r\n" -#string STR_BCFG_FILE_OPEN #language en-US "%H%s%N: The file '%H%s%N' did not open.\r\n" -#string STR_BCFG_FILE_DP #language en-US "%H%s%N: The file '%H%s%N' could not convert to DevPath.\r\n" -#string STR_BCFG_TARGET_NF #language en-US "%H%s%N: Could not find unused target index.\r\n" -#string STR_BCFG_TARGET #language en-US "Target = %04x.\r\n" -#string STR_BCFG_SET_VAR_FAIL #language en-US "%H%s%N: Unable to set %H%s%N\r\n" -#string STR_BCFG_VAR_NO_NUM #language en-US "%H%s%N: Cannot create Key#### variable: All the numbers from 0x0000 - 0xFFFF have been used.\r\n" -#string STR_BCFG_NUMB_RANGE #language en-US "%H%s%N: Numbers must be under %d.\r\n" -#string STR_BCFG_NONE #language en-US "No options found.\r\n" - -#string STR_BCFG_LOAD_OPTIONS #language en-US "Option: %B%02x%N. Variable: %B%-11s%N\r\n" - " Desc - %s\r\n" - " DevPath - %s\r\n" - " Optional- %c\r\n" -#string STR_GET_HELP_BCFG #language en-US "" -".TH bcfg 0 "configure boot and driver"\r\n" -".SH NAME\r\n" -"Manages the boot and driver options that are stored in NVRAM.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"BCFG driver|boot [dump [-v]] [add # file "desc"] [addp # file "desc"] \r\n" -" [addh # handle "desc"] [rm #] [mv # #] \r\n" -" [-opt # [[filename]|["data"]] | \r\n" -" [KeyData ]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -v - Displays verbose information about options, including the optional\r\n" -" data.\r\n" -" -opt - Displays or modifies the optional data associated with a \r\n" -" driver or boot option. This parameter is followed by the file name of the\r\n" -" file that contains the binary data to be associated with the\r\n" -" driver or boot option optional data, or the quote\r\n" -" delimited data to be associated with the driver or\r\n" -" boot option optional data.\r\n" -" driver - Displays or modifies the driver option list.\r\n" -" boot - Displays or modifies the boot option list.\r\n" -" dump - Displays the option list.\r\n" -" add - Adds an option. The # is the number of options to add in\r\n" -" hexadecimal format. The file name is the name of the UEFI application/driver for\r\n" -" the option. The quoted parameter is the description of the\r\n" -" option to be added.\r\n" -" addh - Adds an option that refers to the driver specified by a handle.\r\n" -" The # is the number of options to add, in hexadecimal format. The\r\n" -" handle is the driver handle, in hexadecimal format. The device path\r\n" -" for the option is retrieved from the handle. The quoted\r\n" -" parameter is the description of the option to be added.\r\n" -" addp - Adds an option that refers to a specific file. Only the portion\r\n" -" of the device path starting with the hard drive partition is\r\n" -" placed in the option. The # is the number of options to add,\r\n" -" in hexadecimal format. The quoted parameter is the description of the\r\n" -" option being added.\r\n" -" rm - Removes an option. The parameter lists the number of the options\r\n" -" to remove in hexadecimal format.\r\n" -" mv - Moves an option. The first numeric parameter is the number of\r\n" -" the option to move in hexadecimal format. The second numeric parameter\r\n" -" is the new number of the option to be moved.\r\n" -" KeyData - Specifies the packed value associated with a hot-key.\r\n" -" ScanCode - Specifies the UEFI-defined scan code portion of the\r\n" -" EFI_INPUT_KEY instruction. This value is directly associated\r\n" -" with the preceding KeyData value. When one instance of this\r\n" -" parameter has a non-zero value, the paired UnicodeChar value\r\n" -" will have a zero-based value.\r\n" -" UnicodeChar - Specifies the Unicode value for the character associated with\r\n" -" the preceding KeyData value. When one instance of this\r\n" -" parameter has a non-zero value, the paired ScanCode value\r\n" -" will have a zero-based value.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command manages the boot and driver options stored in NVRAM.\r\n" -" 2. Use the dump option to display Boot#### or Driver#### environment variables.\r\n" -" 3. Use the add option to add a new Boot#### or Driver#### \r\n" -" environment variable.\r\n" -" 4. Use the rm option to delete a Boot#### or Driver#### \r\n" -" environment variable, and then the mv option to reorder\r\n" -" the Boot#### and Driver#### environment variables.\r\n" -" 5. The add, rm, and mv options also update the BootOrder or DriverOrder\r\n" -" environment variables, as appropriate.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display driver options:\r\n" -" Shell> bcfg driver dump\r\n" -" \r\n" -" * To display boot options:\r\n" -" Shell> bcfg boot dump\r\n" -" \r\n" -" * To display verbose information about boot options:\r\n" -" Shell> bcfg boot dump -v\r\n" -" \r\n" -" * To add a driver option #5:\r\n" -" Shell> bcfg driver add 5 mydriver.efi "My Driver"\r\n" -" \r\n" -" * To add a boot option #3:\r\n" -" Shell> bcfg boot add 3 osloader.efi "My OS"\r\n" -" \r\n" -" * To remove boot option #3:\r\n" -" Shell> bcfg boot rm 3\r\n" -" \r\n" -" * To move boot option #3 to boot option #7:\r\n" -" Shell> bcfg boot mv 3 7\r\n" -" \r\n" -" * To assign a CTRL-B hot-key to boot option #3:\r\n" -" Shell> bcfg boot -opt 3 0x40000200 0 0x42\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_NOT_FOUND The requested option was not found.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_UNSUPPORTED The action as requested was unsupported.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_OUT_OF_RESOURCES There was insufficient free space for the request\r\n" -" to be completed.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c deleted file mode 100644 index f8828e4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - Provides application point extension for "C" style main function - - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -#include -#include -#include -#include - -#include -#include - -/** - UEFI entry point for an application that will in turn call the - ShellAppMain function which has parameters similar to a standard C - main function. - - An application that uses UefiShellCEntryLib must have a ShellAppMain - function as prototyped in Include/Library/ShellCEntryLib.h. - - Note that the Shell uses POSITIVE integers for error values, while UEFI - uses NEGATIVE values. If the application is to be used within a script, - it needs to return one of the SHELL_STATUS values defined in Protocol/Shell.h. - - @param ImageHandle The image handle of the UEFI Application. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The application exited normally. - @retval Other An error occurred. - -**/ -EFI_STATUS -EFIAPI -ShellCEntryLib ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - INTN ReturnFromMain; - EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol; - EFI_SHELL_INTERFACE *EfiShellInterface; - EFI_STATUS Status; - - ReturnFromMain = -1; - EfiShellParametersProtocol = NULL; - EfiShellInterface = NULL; - - Status = SystemTable->BootServices->OpenProtocol(ImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID **)&EfiShellParametersProtocol, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR(Status)) { - // - // use shell 2.0 interface - // - ReturnFromMain = ShellAppMain ( - EfiShellParametersProtocol->Argc, - EfiShellParametersProtocol->Argv - ); - } else { - // - // try to get shell 1.0 interface instead. - // - Status = SystemTable->BootServices->OpenProtocol(ImageHandle, - &gEfiShellInterfaceGuid, - (VOID **)&EfiShellInterface, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR(Status)) { - // - // use shell 1.0 interface - // - ReturnFromMain = ShellAppMain ( - EfiShellInterface->Argc, - EfiShellInterface->Argv - ); - } else { - ASSERT(FALSE); - } - } - return ReturnFromMain; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf deleted file mode 100644 index 99b88ad..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf +++ /dev/null @@ -1,44 +0,0 @@ -## @file -# Provides interface to shell functionality for shell commands and applications. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellCEntryLib - FILE_GUID = 0e205c8a-8586-4dec-9f5c-4f9e394aefe8 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = ShellCEntryLib|UEFI_APPLICATION UEFI_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiShellCEntryLib.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - UefiApplicationEntryPoint - DebugLib - - -[Protocols] - gEfiShellParametersProtocolGuid ## CONSUMES - gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c deleted file mode 100644 index 3032c83..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c +++ /dev/null @@ -1,1698 +0,0 @@ -/** @file - Main file for support of shell consist mapping. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "UefiShellCommandLib.h" -#include -#include -#include -#include -#include -#include - - - -typedef enum { - MTDTypeUnknown, - MTDTypeFloppy, - MTDTypeHardDisk, - MTDTypeCDRom, - MTDTypeEnd -} MTD_TYPE; - -typedef struct { - CHAR16 *Str; - UINTN Len; -} POOL_PRINT; - -typedef struct { - UINTN Hi; - MTD_TYPE Mtd; - POOL_PRINT Csd; - BOOLEAN Digital; -} DEVICE_CONSIST_MAPPING_INFO; - -typedef struct { - MTD_TYPE MTDType; - CHAR16 *Name; -} MTD_NAME; - -/** - Serial Decode function. - - @param DevPath The Device path info. - @param MapInfo The map info. - @param OrigDevPath The original device path protocol. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -typedef -EFI_STATUS -(*SERIAL_DECODE_FUNCTION) ( - EFI_DEVICE_PATH_PROTOCOL *DevPath, - DEVICE_CONSIST_MAPPING_INFO *MapInfo, - EFI_DEVICE_PATH_PROTOCOL *OrigDevPath - ); - -typedef struct { - UINT8 Type; - UINT8 SubType; - SERIAL_DECODE_FUNCTION SerialFun; - INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2); -} DEV_PATH_CONSIST_MAPPING_TABLE; - - -/** - Concatenates a formatted unicode string to allocated pool. - The caller must free the resulting buffer. - - @param Str Tracks the allocated pool, size in use, and amount of pool allocated. - @param Fmt The format string - @param ... The data will be printed. - - @retval EFI_SUCCESS The string is concatenated successfully. - @retval EFI_OUT_OF_RESOURCES Out of resources. - -**/ -EFI_STATUS -EFIAPI -CatPrint ( - IN OUT POOL_PRINT *Str, - IN CHAR16 *Fmt, - ... - ) -{ - UINT16 *AppendStr; - VA_LIST Args; - UINTN StringSize; - CHAR16 *NewStr; - - AppendStr = AllocateZeroPool (0x1000); - if (AppendStr == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - VA_START (Args, Fmt); - UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args); - VA_END (Args); - if (NULL == Str->Str) { - StringSize = StrSize (AppendStr); - NewStr = AllocateZeroPool (StringSize); - } else { - StringSize = StrSize (AppendStr); - StringSize += (StrSize (Str->Str) - sizeof (UINT16)); - - NewStr = ReallocatePool ( - StrSize (Str->Str), - StringSize, - Str->Str - ); - } - if (NewStr == NULL) { - FreePool (AppendStr); - return EFI_OUT_OF_RESOURCES; - } - - Str->Str = NewStr; - StrCatS (Str->Str, StringSize/sizeof(CHAR16), AppendStr); - Str->Len = StringSize; - - FreePool (AppendStr); - return EFI_SUCCESS; -} - -MTD_NAME mMTDName[] = { - { - MTDTypeUnknown, - L"F" - }, - { - MTDTypeFloppy, - L"FP" - }, - { - MTDTypeHardDisk, - L"HD" - }, - { - MTDTypeCDRom, - L"CD" - }, - { - MTDTypeEnd, - NULL - } -}; - -/** - Function to append a 64 bit number / 25 onto the string. - - @param[in, out] Str The string so append onto. - @param[in] Num The number to divide and append. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -AppendCSDNum2 ( - IN OUT POOL_PRINT *Str, - IN UINT64 Num - ) -{ - EFI_STATUS Status; - UINT64 Result; - UINT32 Rem; - - ASSERT (Str != NULL); - - Result = DivU64x32Remainder (Num, 25, &Rem); - if (Result > 0) { - Status = AppendCSDNum2 (Str, Result); - if (EFI_ERROR (Status)) { - return Status; - } - } - - return CatPrint (Str, L"%c", Rem + 'a'); -} - -/** - Function to append a 64 bit number onto the mapping info. - - @param[in, out] MappingItem The mapping info object to append onto. - @param[in] Num The info to append. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. - -**/ -EFI_STATUS -AppendCSDNum ( - IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN UINT64 Num - ) -{ - EFI_STATUS Status; - ASSERT (MappingItem != NULL); - - if (MappingItem->Digital) { - Status = CatPrint (&MappingItem->Csd, L"%ld", Num); - } else { - Status = AppendCSDNum2 (&MappingItem->Csd, Num); - } - - if (!EFI_ERROR (Status)) { - MappingItem->Digital = (BOOLEAN) !(MappingItem->Digital); - } - - return Status; -} - -/** - Function to append string into the mapping info. - - @param[in, out] MappingItem The mapping info object to append onto. - @param[in] Str The info to append. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -AppendCSDStr ( - IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN CHAR16 *Str - ) -{ - CHAR16 *Index; - EFI_STATUS Status; - - ASSERT (Str != NULL && MappingItem != NULL); - - Status = EFI_SUCCESS; - - if (MappingItem->Digital) { - // - // To aVOID mult-meaning, the mapping is: - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - // 0 16 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - // - for (Index = Str; *Index != 0; Index++) { - switch (*Index) { - case '0': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - Status = CatPrint (&MappingItem->Csd, L"%c", *Index); - break; - - case '1': - Status = CatPrint (&MappingItem->Csd, L"16"); - break; - - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'a' + '0'); - break; - - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'A' + '0'); - break; - } - - if (EFI_ERROR (Status)) { - return Status; - } - } - } else { - for (Index = Str; *Index != 0; Index++) { - // - // The mapping is: - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - // a b c d e f g h i j k l m n o p - // - if (*Index >= '0' && *Index <= '9') { - Status = CatPrint (&MappingItem->Csd, L"%c", *Index - '0' + 'a'); - } else if (*Index >= 'a' && *Index <= 'f') { - Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'a' + 'k'); - } else if (*Index >= 'A' && *Index <= 'F') { - Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k'); - } - - if (EFI_ERROR (Status)) { - return Status; - } - } - } - - MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital); - - return (EFI_SUCCESS); -} - -/** - Function to append a Guid to the mapping item. - - @param[in, out] MappingItem The item to append onto. - @param[in] Guid The guid to append. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -AppendCSDGuid ( - DEVICE_CONSIST_MAPPING_INFO *MappingItem, - EFI_GUID *Guid - ) -{ - CHAR16 Buffer[64]; - - ASSERT (Guid != NULL && MappingItem != NULL); - - UnicodeSPrint ( - Buffer, - 0, - L"%g", - Guid - ); - - return AppendCSDStr (MappingItem, Buffer); -} - -/** - Function to compare 2 APCI device paths. - - @param[in] DevicePath1 The first device path to compare. - @param[in] DevicePath2 The second device path to compare. - - @retval 0 The device paths represent the same device. - @return Non zero if the devices are different, zero otherwise. -**/ -INTN -EFIAPI -DevPathCompareAcpi ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 - ) -{ - ACPI_HID_DEVICE_PATH *Acpi1; - ACPI_HID_DEVICE_PATH *Acpi2; - - if (DevicePath1 == NULL || DevicePath2 == NULL) { - return (-2); - } - - Acpi1 = (ACPI_HID_DEVICE_PATH *) DevicePath1; - Acpi2 = (ACPI_HID_DEVICE_PATH *) DevicePath2; - if (Acpi1->HID > Acpi2->HID || (Acpi1->HID == Acpi2->HID && Acpi1->UID > Acpi2->UID)) { - return 1; - } - - if (Acpi1->HID == Acpi2->HID && Acpi1->UID == Acpi2->UID) { - return 0; - } - - return -1; -} - -/** - Function to compare 2 PCI device paths. - - @param[in] DevicePath1 The first device path to compare. - @param[in] DevicePath2 The second device path to compare. - - @retval 0 The device paths represent the same device. - @return Non zero if the devices are different, zero otherwise. -**/ -INTN -EFIAPI -DevPathComparePci ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 - ) -{ - PCI_DEVICE_PATH *Pci1; - PCI_DEVICE_PATH *Pci2; - - ASSERT(DevicePath1 != NULL); - ASSERT(DevicePath2 != NULL); - - Pci1 = (PCI_DEVICE_PATH *) DevicePath1; - Pci2 = (PCI_DEVICE_PATH *) DevicePath2; - if (Pci1->Device > Pci2->Device || (Pci1->Device == Pci2->Device && Pci1->Function > Pci2->Function)) { - return 1; - } - - if (Pci1->Device == Pci2->Device && Pci1->Function == Pci2->Function) { - return 0; - } - - return -1; -} - -/** - Do a comparison on 2 device paths. - - @param[in] DevicePath1 The first device path. - @param[in] DevicePath2 The second device path. - - @retval 0 The 2 device paths are the same. - @retval <0 DevicePath2 is greater than DevicePath1. - @retval >0 DevicePath1 is greater than DevicePath2. -**/ -INTN -EFIAPI -DevPathCompareDefault ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 - ) -{ - UINTN DevPathSize1; - UINTN DevPathSize2; - - ASSERT(DevicePath1 != NULL); - ASSERT(DevicePath2 != NULL); - - DevPathSize1 = DevicePathNodeLength (DevicePath1); - DevPathSize2 = DevicePathNodeLength (DevicePath2); - if (DevPathSize1 > DevPathSize2) { - return 1; - } else if (DevPathSize1 < DevPathSize2) { - return -1; - } else { - return CompareMem (DevicePath1, DevicePath2, DevPathSize1); - } -} - -/** - DevicePathNode must be SerialHDD Channel type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialHardDrive ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - HARDDRIVE_DEVICE_PATH *Hd; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Hd = (HARDDRIVE_DEVICE_PATH *) DevicePathNode; - if (MappingItem->Mtd == MTDTypeUnknown) { - MappingItem->Mtd = MTDTypeHardDisk; - } - - return AppendCSDNum (MappingItem, Hd->PartitionNumber); -} - -/** - DevicePathNode must be SerialAtapi Channel type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialAtapi ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - ATAPI_DEVICE_PATH *Atapi; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Atapi = (ATAPI_DEVICE_PATH *) DevicePathNode; - return AppendCSDNum (MappingItem, (Atapi->PrimarySecondary * 2 + Atapi->SlaveMaster)); -} - -/** - DevicePathNode must be SerialCDROM Channel type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialCdRom ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - CDROM_DEVICE_PATH *Cd; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Cd = (CDROM_DEVICE_PATH *) DevicePathNode; - MappingItem->Mtd = MTDTypeCDRom; - return AppendCSDNum (MappingItem, Cd->BootEntry); -} - -/** - DevicePathNode must be SerialFibre Channel type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialFibre ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - FIBRECHANNEL_DEVICE_PATH *Fibre; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Fibre = (FIBRECHANNEL_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, Fibre->WWN); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Fibre->Lun); - } - return Status; -} - -/** - DevicePathNode must be SerialUart type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialUart ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - UART_DEVICE_PATH *Uart; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Uart = (UART_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, Uart->BaudRate); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Uart->DataBits); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Uart->Parity); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Uart->StopBits); - } - return Status; -} - -/** - DevicePathNode must be SerialUSB type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialUsb ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - USB_DEVICE_PATH *Usb; - EFI_USB_IO_PROTOCOL *UsbIo; - EFI_HANDLE TempHandle; - EFI_STATUS Status; - USB_INTERFACE_DESCRIPTOR InterfaceDesc; - - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Usb = (USB_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, Usb->ParentPortNumber); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Usb->InterfaceNumber); - } - - if (EFI_ERROR (Status)) { - return Status; - } - - if (PcdGetBool(PcdUsbExtendedDecode)) { - Status = gBS->LocateDevicePath( &gEfiUsbIoProtocolGuid, &DevicePath, &TempHandle ); - UsbIo = NULL; - if (!EFI_ERROR(Status)) { - Status = gBS->OpenProtocol(TempHandle, &gEfiUsbIoProtocolGuid, (VOID**)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - } - - if (!EFI_ERROR(Status)) { - ASSERT(UsbIo != NULL); - Status = UsbIo->UsbGetInterfaceDescriptor(UsbIo, &InterfaceDesc); - if (!EFI_ERROR(Status)) { - if (InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS && MappingItem->Mtd == MTDTypeUnknown) { - switch (InterfaceDesc.InterfaceSubClass){ - case USB_MASS_STORE_SCSI: - MappingItem->Mtd = MTDTypeHardDisk; - break; - case USB_MASS_STORE_8070I: - case USB_MASS_STORE_UFI: - MappingItem->Mtd = MTDTypeFloppy; - break; - case USB_MASS_STORE_8020I: - MappingItem->Mtd = MTDTypeCDRom; - break; - } - } - } - } - } - return Status; -} - -/** - DevicePathNode must be SerialVendor type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialVendor ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - VENDOR_DEVICE_PATH *Vendor; - SAS_DEVICE_PATH *Sas; - UINTN TargetNameLength; - UINTN Index; - CHAR16 *Buffer; - CHAR16 *NewBuffer; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Vendor = (VENDOR_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDGuid (MappingItem, &Vendor->Guid); - if (EFI_ERROR (Status)) { - return Status; - } - - if (CompareGuid (&gEfiSasDevicePathGuid, &Vendor->Guid)) { - Sas = (SAS_DEVICE_PATH *) Vendor; - Status = AppendCSDNum (MappingItem, Sas->SasAddress); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Sas->Lun); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Sas->DeviceTopology); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Sas->RelativeTargetPort); - } - } else { - TargetNameLength = MIN(DevicePathNodeLength (DevicePathNode) - sizeof (VENDOR_DEVICE_PATH), PcdGet32(PcdShellVendorExtendedDecode)); - if (TargetNameLength != 0) { - // - // String is 2 chars per data byte, plus NULL terminator - // - Buffer = AllocateZeroPool (((TargetNameLength * 2) + 1) * sizeof(CHAR16)); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Build the string data - // - for (Index = 0; Index < TargetNameLength; Index++) { - NewBuffer = CatSPrint (Buffer, L"%02x", *((UINT8*)Vendor + sizeof (VENDOR_DEVICE_PATH) + Index)); - if (NewBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - break; - } - Buffer = NewBuffer; - } - - // - // Append the new data block - // - if (!EFI_ERROR (Status)) { - Status = AppendCSDStr (MappingItem, Buffer); - } - - FreePool(Buffer); - } - } - return Status; -} - -/** - DevicePathNode must be SerialLun type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialLun ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - DEVICE_LOGICAL_UNIT_DEVICE_PATH *Lun; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Lun = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) DevicePathNode; - return AppendCSDNum (MappingItem, Lun->Lun); -} - -/** - DevicePathNode must be SerialSata type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialSata ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - SATA_DEVICE_PATH *Sata; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Sata = (SATA_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, Sata->HBAPortNumber); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Sata->PortMultiplierPortNumber); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Sata->Lun); - } - return Status; -} - -/** - DevicePathNode must be SerialSCSI type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialIScsi ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - ISCSI_DEVICE_PATH *IScsi; - UINT8 *IScsiTargetName; - CHAR16 *TargetName; - UINTN TargetNameLength; - UINTN Index; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Status = EFI_SUCCESS; - - if (PcdGetBool(PcdShellDecodeIScsiMapNames)) { - IScsi = (ISCSI_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, IScsi->NetworkProtocol); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, IScsi->LoginOption); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, IScsi->Lun); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag); - } - if (EFI_ERROR (Status)) { - return Status; - } - TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH); - if (TargetNameLength > 0) { - TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16)); - if (TargetName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - IScsiTargetName = (UINT8 *) (IScsi + 1); - for (Index = 0; Index < TargetNameLength; Index++) { - TargetName[Index] = (CHAR16) IScsiTargetName[Index]; - } - Status = AppendCSDStr (MappingItem, TargetName); - FreePool (TargetName); - } - } - } - return Status; -} - -/** - DevicePathNode must be SerialI20 type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialI2O ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - I2O_DEVICE_PATH *DevicePath_I20; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - DevicePath_I20 = (I2O_DEVICE_PATH *) DevicePathNode; - return AppendCSDNum (MappingItem, DevicePath_I20->Tid); -} - -/** - DevicePathNode must be Mac Address type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialMacAddr ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - MAC_ADDR_DEVICE_PATH *Mac; - UINTN HwAddressSize; - UINTN Index; - CHAR16 Buffer[64]; - CHAR16 *PBuffer; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Mac = (MAC_ADDR_DEVICE_PATH *) DevicePathNode; - - HwAddressSize = sizeof (EFI_MAC_ADDRESS); - if (Mac->IfType == 0x01 || Mac->IfType == 0x00) { - HwAddressSize = 6; - } - - for (Index = 0, PBuffer = Buffer; Index < HwAddressSize; Index++, PBuffer += 2) { - UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) Mac->MacAddress.Addr[Index]); - } - - return AppendCSDStr (MappingItem, Buffer); -} - -/** - DevicePathNode must be InfiniBand type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialInfiniBand ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - INFINIBAND_DEVICE_PATH *InfiniBand; - UINTN Index; - CHAR16 Buffer[64]; - CHAR16 *PBuffer; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - InfiniBand = (INFINIBAND_DEVICE_PATH *) DevicePathNode; - for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) { - UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) InfiniBand->PortGid[Index]); - } - - Status = AppendCSDStr (MappingItem, Buffer); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, InfiniBand->ServiceId); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, InfiniBand->TargetPortId); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, InfiniBand->DeviceId); - } - return Status; -} - -/** - DevicePathNode must be IPv4 type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialIPv4 ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - IPv4_DEVICE_PATH *Ip; - CHAR16 Buffer[10]; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Ip = (IPv4_DEVICE_PATH *) DevicePathNode; - UnicodeSPrint ( - Buffer, - 0, - L"%02x%02x%02x%02x", - (UINTN) Ip->LocalIpAddress.Addr[0], - (UINTN) Ip->LocalIpAddress.Addr[1], - (UINTN) Ip->LocalIpAddress.Addr[2], - (UINTN) Ip->LocalIpAddress.Addr[3] - ); - Status = AppendCSDStr (MappingItem, Buffer); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Ip->LocalPort); - } - if (!EFI_ERROR (Status)) { - UnicodeSPrint ( - Buffer, - 0, - L"%02x%02x%02x%02x", - (UINTN) Ip->RemoteIpAddress.Addr[0], - (UINTN) Ip->RemoteIpAddress.Addr[1], - (UINTN) Ip->RemoteIpAddress.Addr[2], - (UINTN) Ip->RemoteIpAddress.Addr[3] - ); - Status = AppendCSDStr (MappingItem, Buffer); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Ip->RemotePort); - } - return Status; -} - -/** - DevicePathNode must be IPv6 type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialIPv6 ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - IPv6_DEVICE_PATH *Ip; - UINTN Index; - CHAR16 Buffer[64]; - CHAR16 *PBuffer; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Ip = (IPv6_DEVICE_PATH *) DevicePathNode; - for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) { - UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) Ip->LocalIpAddress.Addr[Index]); - } - - Status = AppendCSDStr (MappingItem, Buffer); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Ip->LocalPort); - } - if (!EFI_ERROR (Status)) { - for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) { - UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) Ip->RemoteIpAddress.Addr[Index]); - } - - Status = AppendCSDStr (MappingItem, Buffer); - } - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Ip->RemotePort); - } - return Status; -} - -/** - DevicePathNode must be SCSI type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialScsi ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - SCSI_DEVICE_PATH *Scsi; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Scsi = (SCSI_DEVICE_PATH *) DevicePathNode; - Status = AppendCSDNum (MappingItem, Scsi->Pun); - if (!EFI_ERROR (Status)) { - Status = AppendCSDNum (MappingItem, Scsi->Lun); - } - return Status; -} - -/** - DevicePathNode must be 1394 type and this will populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerial1394 ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - F1394_DEVICE_PATH *DevicePath_F1394; - CHAR16 Buffer[20]; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - DevicePath_F1394 = (F1394_DEVICE_PATH *) DevicePathNode; - UnicodeSPrint (Buffer, 0, L"%lx", DevicePath_F1394->Guid); - return AppendCSDStr (MappingItem, Buffer); -} - -/** - If the node is floppy type then populate the MappingItem. - - @param[in] DevicePathNode The node to get info on. - @param[in] MappingItem The info item to populate. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialAcpi ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - ACPI_HID_DEVICE_PATH *Acpi; - - ASSERT(DevicePathNode != NULL); - ASSERT(MappingItem != NULL); - - Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode; - if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { - if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) { - MappingItem->Mtd = MTDTypeFloppy; - return AppendCSDNum (MappingItem, Acpi->UID); - } - } - return EFI_SUCCESS; -} - -/** - Empty function used for unknown devices. - - @param[in] DevicePathNode Ignored. - @param[in] MappingItem Ignored. - @param[in] DevicePath Ignored. - - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_SUCCESS The appending was successful. -**/ -EFI_STATUS -DevPathSerialDefault ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - return EFI_SUCCESS; -} - -DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = { - { - HARDWARE_DEVICE_PATH, - HW_PCI_DP, - DevPathSerialDefault, - DevPathComparePci - }, - { - ACPI_DEVICE_PATH, - ACPI_DP, - DevPathSerialAcpi, - DevPathCompareAcpi - }, - { - MESSAGING_DEVICE_PATH, - MSG_ATAPI_DP, - DevPathSerialAtapi, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_SCSI_DP, - DevPathSerialScsi, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_FIBRECHANNEL_DP, - DevPathSerialFibre, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_1394_DP, - DevPathSerial1394, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_USB_DP, - DevPathSerialUsb, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_I2O_DP, - DevPathSerialI2O, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_MAC_ADDR_DP, - DevPathSerialMacAddr, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_IPv4_DP, - DevPathSerialIPv4, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_IPv6_DP, - DevPathSerialIPv6, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_INFINIBAND_DP, - DevPathSerialInfiniBand, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_UART_DP, - DevPathSerialUart, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_VENDOR_DP, - DevPathSerialVendor, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_DEVICE_LOGICAL_UNIT_DP, - DevPathSerialLun, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_SATA_DP, - DevPathSerialSata, - DevPathCompareDefault - }, - { - MESSAGING_DEVICE_PATH, - MSG_ISCSI_DP, - DevPathSerialIScsi, - DevPathCompareDefault - }, - { - MEDIA_DEVICE_PATH, - MEDIA_HARDDRIVE_DP, - DevPathSerialHardDrive, - DevPathCompareDefault - }, - { - MEDIA_DEVICE_PATH, - MEDIA_CDROM_DP, - DevPathSerialCdRom, - DevPathCompareDefault - }, - { - MEDIA_DEVICE_PATH, - MEDIA_VENDOR_DP, - DevPathSerialVendor, - DevPathCompareDefault - }, - { - 0, - 0, - NULL, - NULL - } -}; - -/** - Function to determine if a device path node is Hi or not. - - @param[in] DevicePathNode The node to check. - - @retval TRUE The node is Hi. - @retval FALSE The node is not Hi. -**/ -BOOLEAN -IsHIDevicePathNode ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode - ) -{ - ACPI_HID_DEVICE_PATH *Acpi; - - ASSERT(DevicePathNode != NULL); - - if (DevicePathNode->Type == HARDWARE_DEVICE_PATH) { - return TRUE; - } - - if (DevicePathNode->Type == ACPI_DEVICE_PATH) { - Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode; - switch (EISA_ID_TO_NUM (Acpi->HID)) { - case 0x0301: - case 0x0401: - case 0x0501: - case 0x0604: - return FALSE; - } - - return TRUE; - } - - return FALSE; -} - -/** - Function to convert a standard device path structure into a Hi version. - - @param[in] DevicePath The device path to convert. - - @return the device path portion that is Hi. -**/ -EFI_DEVICE_PATH_PROTOCOL * -GetHIDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - UINTN NonHIDevicePathNodeCount; - UINTN Index; - EFI_DEV_PATH Node; - EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; - EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; - - ASSERT(DevicePath != NULL); - - NonHIDevicePathNodeCount = 0; - - HIDevicePath = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL)); - SetDevicePathEndNode (HIDevicePath); - - Node.DevPath.Type = END_DEVICE_PATH_TYPE; - Node.DevPath.SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; - Node.DevPath.Length[0] = (UINT8)sizeof (EFI_DEVICE_PATH_PROTOCOL); - Node.DevPath.Length[1] = 0; - - while (!IsDevicePathEnd (DevicePath)) { - if (IsHIDevicePathNode (DevicePath)) { - for (Index = 0; Index < NonHIDevicePathNodeCount; Index++) { - TempDevicePath = AppendDevicePathNode (HIDevicePath, &Node.DevPath); - FreePool (HIDevicePath); - HIDevicePath = TempDevicePath; - } - - TempDevicePath = AppendDevicePathNode (HIDevicePath, DevicePath); - FreePool (HIDevicePath); - HIDevicePath = TempDevicePath; - } else { - NonHIDevicePathNodeCount++; - } - // - // Next device path node - // - DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath); - } - - return HIDevicePath; -} - -/** - Function to walk the device path looking for a dumpable node. - - @param[in] MappingItem The Item to fill with data. - @param[in] DevicePath The path of the item to get data on. - - @return EFI_SUCCESS Always returns success. -**/ -EFI_STATUS -GetDeviceConsistMappingInfo ( - IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - SERIAL_DECODE_FUNCTION SerialFun; - UINTN Index; - EFI_DEVICE_PATH_PROTOCOL *OriginalDevicePath; - - ASSERT(DevicePath != NULL); - ASSERT(MappingItem != NULL); - - SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0); - OriginalDevicePath = DevicePath; - - while (!IsDevicePathEnd (DevicePath)) { - // - // Find the handler to dump this device path node and - // initialize with generic function in case nothing is found - // - for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) { - - if (DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type && - DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType - ) { - SerialFun = DevPathConsistMappingTable[Index].SerialFun; - break; - } - } - - Status = SerialFun (DevicePath, MappingItem, OriginalDevicePath); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (MappingItem->Csd.Str); - return Status; - } - - // - // Next device path node - // - DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath); - } - - return EFI_SUCCESS; -} - -/** - Function to initialize the table for creating consistent map names. - - @param[out] Table The pointer to pointer to pointer to DevicePathProtocol object. - - @retval EFI_SUCCESS The table was created successfully. -**/ -EFI_STATUS -EFIAPI -ShellCommandConsistMappingInitialize ( - OUT EFI_DEVICE_PATH_PROTOCOL ***Table - ) -{ - EFI_HANDLE *HandleBuffer; - UINTN HandleNum; - UINTN HandleLoop; - EFI_DEVICE_PATH_PROTOCOL **TempTable; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; - EFI_BLOCK_IO_PROTOCOL *BlockIo; - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem; - UINTN Index; - EFI_STATUS Status; - - HandleBuffer = NULL; - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiDevicePathProtocolGuid, - NULL, - &HandleNum, - &HandleBuffer - ); - ASSERT_EFI_ERROR(Status); - - TempTable = AllocateZeroPool ((HandleNum + 1) * sizeof (EFI_DEVICE_PATH_PROTOCOL *)); - if (TempTable == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (HandleLoop = 0 ; HandleLoop < HandleNum ; HandleLoop++) { - DevicePath = DevicePathFromHandle (HandleBuffer[HandleLoop]); - if (DevicePath == NULL) { - continue; - } - - HIDevicePath = GetHIDevicePath (DevicePath); - if (HIDevicePath == NULL) { - continue; - } - - Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], - &gEfiBlockIoProtocolGuid, - (VOID **)&BlockIo - ); - if (EFI_ERROR(Status)) { - Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], - &gEfiSimpleFileSystemProtocolGuid, - (VOID **)&SimpleFileSystem - ); - if (EFI_ERROR(Status)) { - FreePool (HIDevicePath); - continue; - } - } - - for (Index = 0; TempTable[Index] != NULL; Index++) { - if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) { - FreePool (HIDevicePath); - break; - } - } - - if (TempTable[Index] == NULL) { - TempTable[Index] = HIDevicePath; - } - } - - for (Index = 0; TempTable[Index] != NULL; Index++); - PerformQuickSort(TempTable, Index, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare); - *Table = TempTable; - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return EFI_SUCCESS; -} - -/** - Function to uninitialize the table for creating consistent map names. - - The parameter must have been received from ShellCommandConsistMappingInitialize. - - @param[out] Table The pointer to pointer to DevicePathProtocol object. - - @retval EFI_SUCCESS The table was deleted successfully. -**/ -EFI_STATUS -EFIAPI -ShellCommandConsistMappingUnInitialize ( - EFI_DEVICE_PATH_PROTOCOL **Table - ) -{ - UINTN Index; - - ASSERT(Table != NULL); - - for (Index = 0; Table[Index] != NULL; Index++) { - FreePool (Table[Index]); - } - - FreePool (Table); - return EFI_SUCCESS; -} - -/** - Create a consistent mapped name for the device specified by DevicePath - based on the Table. - - This must be called after ShellCommandConsistMappingInitialize() and - before ShellCommandConsistMappingUnInitialize() is called. - - @param[in] DevicePath The pointer to the dev path for the device. - @param[in] Table The Table of mapping information. - - @retval NULL A consistent mapped name could not be created. - @return A pointer to a string allocated from pool with the device name. -**/ -CHAR16 * -EFIAPI -ShellCommandConsistMappingGenMappingName ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN EFI_DEVICE_PATH_PROTOCOL **Table - ) -{ - EFI_STATUS Status; - POOL_PRINT Str; - DEVICE_CONSIST_MAPPING_INFO MappingInfo; - EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; - UINTN Index; - - ASSERT(DevicePath != NULL); - ASSERT(Table != NULL); - - HIDevicePath = GetHIDevicePath (DevicePath); - if (HIDevicePath == NULL) { - return NULL; - } - - for (Index = 0; Table[Index] != NULL; Index++) { - if (DevicePathCompare (&Table[Index], &HIDevicePath) == 0) { - break; - } - } - - FreePool (HIDevicePath); - if (Table[Index] == NULL) { - return NULL; - } - - MappingInfo.Hi = Index; - MappingInfo.Mtd = MTDTypeUnknown; - MappingInfo.Digital = FALSE; - - Status = GetDeviceConsistMappingInfo (&MappingInfo, DevicePath); - if (EFI_ERROR (Status)) { - return NULL; - } - - SetMem (&Str, sizeof (Str), 0); - for (Index = 0; mMTDName[Index].MTDType != MTDTypeEnd; Index++) { - if (MappingInfo.Mtd == mMTDName[Index].MTDType) { - break; - } - } - - if (mMTDName[Index].MTDType != MTDTypeEnd) { - Status = CatPrint (&Str, L"%s", mMTDName[Index].Name); - } - - if (!EFI_ERROR (Status)) { - Status = CatPrint (&Str, L"%d", (UINTN) MappingInfo.Hi); - } - if (!EFI_ERROR (Status) && MappingInfo.Csd.Str != NULL) { - Status = CatPrint (&Str, L"%s", MappingInfo.Csd.Str); - FreePool (MappingInfo.Csd.Str); - } - - if (!EFI_ERROR (Status) && Str.Str != NULL) { - Status = CatPrint (&Str, L":"); - } - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (Str.Str); - return NULL; - } - - return Str.Str; -} - -/** - Function to search the list of mappings for the node on the list based on the key. - - @param[in] MapKey String Key to search for on the map - - @return the node on the list. -**/ -SHELL_MAP_LIST * -EFIAPI -ShellCommandFindMapItem ( - IN CONST CHAR16 *MapKey - ) -{ - SHELL_MAP_LIST *MapListItem; - - for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsNull(&gShellMapList.Link, &MapListItem->Link) - ; MapListItem = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListItem->Link) - ){ - if (gUnicodeCollation->StriColl(gUnicodeCollation,MapListItem->MapName,(CHAR16*)MapKey) == 0) { - return (MapListItem); - } - } - return (NULL); -} - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c deleted file mode 100644 index 5ad1ac7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ /dev/null @@ -1,1905 +0,0 @@ -/** @file - Provides interface to shell internal functions for shell commands. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellCommandLib.h" - -// STATIC local variables -STATIC SHELL_COMMAND_INTERNAL_LIST_ENTRY mCommandList; -STATIC SCRIPT_FILE_LIST mScriptList; -STATIC ALIAS_LIST mAliasList; -STATIC BOOLEAN mEchoState; -STATIC BOOLEAN mExitRequested; -STATIC UINT64 mExitCode; -STATIC BOOLEAN mExitScript; -STATIC CHAR16 *mProfileList; -STATIC UINTN mProfileListSize; -STATIC UINTN mFsMaxCount = 0; -STATIC UINTN mBlkMaxCount = 0; -STATIC BUFFER_LIST mFileHandleList; - -STATIC CONST CHAR8 Hex[] = { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F' -}; - -// global variables required by library class. -EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL; -SHELL_MAP_LIST gShellMapList; -SHELL_MAP_LIST *gShellCurMapping = NULL; - -CONST CHAR16* SupportLevel[] = { - L"Minimal", - L"Scripting", - L"Basic", - L"Interactive" -}; - -/** - Function to make sure that the global protocol pointers are valid. - must be called after constructor before accessing the pointers. -**/ -EFI_STATUS -EFIAPI -CommandInit( - VOID - ) -{ - UINTN NumHandles; - EFI_HANDLE *Handles; - EFI_UNICODE_COLLATION_PROTOCOL *Uc; - CHAR8 *BestLanguage; - UINTN Index; - EFI_STATUS Status; - CHAR8 *PlatformLang; - - GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**)&PlatformLang, NULL); - if (PlatformLang == NULL) { - return EFI_UNSUPPORTED; - } - - if (gUnicodeCollation == NULL) { - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiUnicodeCollation2ProtocolGuid, - NULL, - &NumHandles, - &Handles - ); - if (EFI_ERROR (Status)) { - NumHandles = 0; - Handles = NULL; - } - for (Index = 0; Index < NumHandles; Index++) { - // - // Open Unicode Collation Protocol - // - Status = gBS->OpenProtocol ( - Handles[Index], - &gEfiUnicodeCollation2ProtocolGuid, - (VOID **) &Uc, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Find the best matching matching language from the supported languages - // of Unicode Collation2 protocol. - // - BestLanguage = GetBestLanguage ( - Uc->SupportedLanguages, - FALSE, - PlatformLang, - NULL - ); - if (BestLanguage != NULL) { - FreePool (BestLanguage); - gUnicodeCollation = Uc; - break; - } - } - if (Handles != NULL) { - FreePool (Handles); - } - FreePool (PlatformLang); - } - - return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS; -} - -/** - Constructor for the Shell Command library. - - Initialize the library and determine if the underlying is a UEFI Shell 2.0 or an EFI shell. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the initialization was complete sucessfully -**/ -RETURN_STATUS -EFIAPI -ShellCommandLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - InitializeListHead(&gShellMapList.Link); - InitializeListHead(&mCommandList.Link); - InitializeListHead(&mAliasList.Link); - InitializeListHead(&mScriptList.Link); - InitializeListHead(&mFileHandleList.Link); - mEchoState = TRUE; - - mExitRequested = FALSE; - mExitScript = FALSE; - mProfileListSize = 0; - mProfileList = NULL; - - Status = CommandInit (); - if (EFI_ERROR (Status)) { - return EFI_DEVICE_ERROR; - } - - return (RETURN_SUCCESS); -} - -/** - Frees list of file handles. - - @param[in] List The list to free. -**/ -VOID -FreeFileHandleList ( - IN BUFFER_LIST *List - ) -{ - BUFFER_LIST *BufferListEntry; - - if (List == NULL){ - return; - } - // - // enumerate through the buffer list and free all memory - // - for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link) - ; !IsListEmpty (&List->Link) - ; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link) - ){ - RemoveEntryList(&BufferListEntry->Link); - ASSERT(BufferListEntry->Buffer != NULL); - SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE*)(BufferListEntry->Buffer))->Path); - SHELL_FREE_NON_NULL(BufferListEntry->Buffer); - SHELL_FREE_NON_NULL(BufferListEntry); - } -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval RETURN_SUCCESS this function always returns success -**/ -RETURN_STATUS -EFIAPI -ShellCommandLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - ALIAS_LIST *Node2; - SCRIPT_FILE_LIST *Node3; - SHELL_MAP_LIST *MapNode; - // - // enumerate throught the list and free all the memory - // - while (!IsListEmpty (&mCommandList.Link)) { - Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link); - RemoveEntryList(&Node->Link); - SHELL_FREE_NON_NULL(Node->CommandString); - FreePool(Node); - DEBUG_CODE(Node = NULL;); - } - - // - // enumerate through the alias list and free all memory - // - while (!IsListEmpty (&mAliasList.Link)) { - Node2 = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link); - RemoveEntryList(&Node2->Link); - SHELL_FREE_NON_NULL(Node2->CommandString); - SHELL_FREE_NON_NULL(Node2->Alias); - SHELL_FREE_NON_NULL(Node2); - DEBUG_CODE(Node2 = NULL;); - } - - // - // enumerate throught the list and free all the memory - // - while (!IsListEmpty (&mScriptList.Link)) { - Node3 = (SCRIPT_FILE_LIST *)GetFirstNode(&mScriptList.Link); - RemoveEntryList(&Node3->Link); - DeleteScriptFileStruct(Node3->Data); - FreePool(Node3); - } - - // - // enumerate throught the mappings list and free all the memory - // - if (!IsListEmpty(&gShellMapList.Link)) { - for (MapNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsListEmpty (&gShellMapList.Link) - ; MapNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ){ - ASSERT(MapNode != NULL); - RemoveEntryList(&MapNode->Link); - SHELL_FREE_NON_NULL(MapNode->DevicePath); - SHELL_FREE_NON_NULL(MapNode->MapName); - SHELL_FREE_NON_NULL(MapNode->CurrentDirectoryPath); - FreePool(MapNode); - } - } - if (!IsListEmpty(&mFileHandleList.Link)){ - FreeFileHandleList(&mFileHandleList); - } - - if (mProfileList != NULL) { - FreePool(mProfileList); - } - - gUnicodeCollation = NULL; - gShellCurMapping = NULL; - - return (RETURN_SUCCESS); -} - -/** - Find a dynamic command protocol instance given a command name string. - - @param CommandString the command name string - - @return instance the command protocol instance, if dynamic command instance found - @retval NULL no dynamic command protocol instance found for name -**/ -CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL * -ShellCommandFindDynamicCommand ( - IN CONST CHAR16 *CommandString - ) -{ - EFI_STATUS Status; - EFI_HANDLE *CommandHandleList; - EFI_HANDLE *NextCommand; - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; - - CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid); - if (CommandHandleList == NULL) { - // - // not found or out of resources - // - return NULL; - } - - for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) { - Status = gBS->HandleProtocol( - *NextCommand, - &gEfiShellDynamicCommandProtocolGuid, - (VOID **)&DynamicCommand - ); - - if (EFI_ERROR(Status)) { - continue; - } - - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandString, - (CHAR16*)DynamicCommand->CommandName) == 0 - ){ - FreePool(CommandHandleList); - return (DynamicCommand); - } - } - - FreePool(CommandHandleList); - return (NULL); -} - -/** - Checks if a command exists as a dynamic command protocol instance - - @param[in] CommandString The command string to check for on the list. -**/ -BOOLEAN -ShellCommandDynamicCommandExists ( - IN CONST CHAR16 *CommandString - ) -{ - return (BOOLEAN) ((ShellCommandFindDynamicCommand(CommandString) != NULL)); -} - -/** - Checks if a command is already on the internal command list. - - @param[in] CommandString The command string to check for on the list. -**/ -BOOLEAN -ShellCommandIsCommandOnInternalList( - IN CONST CHAR16 *CommandString - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - - // - // assert for NULL parameter - // - ASSERT(CommandString != NULL); - - // - // check for the command - // - for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link) - ; !IsNull(&mCommandList.Link, &Node->Link) - ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandString, - Node->CommandString) == 0 - ){ - return (TRUE); - } - } - return (FALSE); -} - -/** - Checks if a command exists, either internally or through the dynamic command protocol. - - @param[in] CommandString The command string to check for on the list. -**/ -BOOLEAN -EFIAPI -ShellCommandIsCommandOnList( - IN CONST CHAR16 *CommandString - ) -{ - if (ShellCommandIsCommandOnInternalList(CommandString)) { - return TRUE; - } - - return ShellCommandDynamicCommandExists(CommandString); -} - -/** - Get the help text for a dynamic command. - - @param[in] CommandString The command name. - - @retval NULL No help text was found. - @return String of help text. Caller required to free. -**/ -CHAR16* -ShellCommandGetDynamicCommandHelp( - IN CONST CHAR16 *CommandString - ) -{ - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; - - DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString); - if (DynamicCommand == NULL) { - return (NULL); - } - - // - // TODO: how to get proper language? - // - return DynamicCommand->GetHelp(DynamicCommand, "en"); -} - -/** - Get the help text for an internal command. - - @param[in] CommandString The command name. - - @retval NULL No help text was found. - @return String of help text. Caller reuiqred to free. -**/ -CHAR16* -ShellCommandGetInternalCommandHelp( - IN CONST CHAR16 *CommandString - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - - // - // assert for NULL parameter - // - ASSERT(CommandString != NULL); - - // - // check for the command - // - for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link) - ; !IsNull(&mCommandList.Link, &Node->Link) - ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandString, - Node->CommandString) == 0 - ){ - return (HiiGetString(Node->HiiHandle, Node->ManFormatHelp, NULL)); - } - } - return (NULL); -} - -/** - Get the help text for a command. - - @param[in] CommandString The command name. - - @retval NULL No help text was found. - @return String of help text.Caller reuiqred to free. -**/ -CHAR16* -EFIAPI -ShellCommandGetCommandHelp ( - IN CONST CHAR16 *CommandString - ) -{ - CHAR16 *HelpStr; - HelpStr = ShellCommandGetInternalCommandHelp(CommandString); - - if (HelpStr == NULL) { - HelpStr = ShellCommandGetDynamicCommandHelp(CommandString); - } - - return HelpStr; -} - - -/** - Registers handlers of type SHELL_RUN_COMMAND and - SHELL_GET_MAN_FILENAME for each shell command. - - If the ShellSupportLevel is greater than the value of the - PcdShellSupportLevel then return RETURN_UNSUPPORTED. - - Registers the handlers specified by GetHelpInfoHandler and CommandHandler - with the command specified by CommandString. If the command named by - CommandString has already been registered, then return - RETURN_ALREADY_STARTED. - - If there are not enough resources available to register the handlers then - RETURN_OUT_OF_RESOURCES is returned. - - If CommandString is NULL, then ASSERT(). - If GetHelpInfoHandler is NULL, then ASSERT(). - If CommandHandler is NULL, then ASSERT(). - If ProfileName is NULL, then ASSERT(). - - @param[in] CommandString Pointer to the command name. This is the - name to look for on the command line in - the shell. - @param[in] CommandHandler Pointer to a function that runs the - specified command. - @param[in] GetManFileName Pointer to a function that provides man - filename. - @param[in] ShellMinSupportLevel minimum Shell Support Level which has this - function. - @param[in] ProfileName profile name to require for support of this - function. - @param[in] CanAffectLE indicates whether this command's return value - can change the LASTERROR environment variable. - @param[in] HiiHandle Handle of this command's HII entry. - @param[in] ManFormatHelp HII locator for the help text. - - @retval RETURN_SUCCESS The handlers were registered. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - register the shell command. - @retval RETURN_UNSUPPORTED the ShellMinSupportLevel was higher than the - currently allowed support level. - @retval RETURN_ALREADY_STARTED The CommandString represents a command that - is already registered. Only 1 handler set for - a given command is allowed. - @sa SHELL_GET_MAN_FILENAME - @sa SHELL_RUN_COMMAND -**/ -RETURN_STATUS -EFIAPI -ShellCommandRegisterCommandName ( - IN CONST CHAR16 *CommandString, - IN SHELL_RUN_COMMAND CommandHandler, - IN SHELL_GET_MAN_FILENAME GetManFileName, - IN UINT32 ShellMinSupportLevel, - IN CONST CHAR16 *ProfileName, - IN CONST BOOLEAN CanAffectLE, - IN CONST EFI_HANDLE HiiHandle, - IN CONST EFI_STRING_ID ManFormatHelp - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Command; - SHELL_COMMAND_INTERNAL_LIST_ENTRY *PrevCommand; - INTN LexicalMatchValue; - - // - // Initialize local variables. - // - Command = NULL; - PrevCommand = NULL; - LexicalMatchValue = 0; - - // - // ASSERTs for NULL parameters - // - ASSERT(CommandString != NULL); - ASSERT(GetManFileName != NULL); - ASSERT(CommandHandler != NULL); - ASSERT(ProfileName != NULL); - - // - // check for shell support level - // - if (PcdGet8(PcdShellSupportLevel) < ShellMinSupportLevel) { - return (RETURN_UNSUPPORTED); - } - - // - // check for already on the list - // - if (ShellCommandIsCommandOnList(CommandString)) { - return (RETURN_ALREADY_STARTED); - } - - // - // allocate memory for new struct - // - Node = AllocateZeroPool(sizeof(SHELL_COMMAND_INTERNAL_LIST_ENTRY)); - if (Node == NULL) { - return RETURN_OUT_OF_RESOURCES; - } - Node->CommandString = AllocateCopyPool(StrSize(CommandString), CommandString); - if (Node->CommandString == NULL) { - FreePool (Node); - return RETURN_OUT_OF_RESOURCES; - } - - Node->GetManFileName = GetManFileName; - Node->CommandHandler = CommandHandler; - Node->LastError = CanAffectLE; - Node->HiiHandle = HiiHandle; - Node->ManFormatHelp = ManFormatHelp; - - if ( StrLen(ProfileName)>0 - && ((mProfileList != NULL - && StrStr(mProfileList, ProfileName) == NULL) || mProfileList == NULL) - ){ - ASSERT((mProfileList == NULL && mProfileListSize == 0) || (mProfileList != NULL)); - if (mProfileList == NULL) { - // - // If this is the first make a leading ';' - // - StrnCatGrow(&mProfileList, &mProfileListSize, L";", 0); - } - StrnCatGrow(&mProfileList, &mProfileListSize, ProfileName, 0); - StrnCatGrow(&mProfileList, &mProfileListSize, L";", 0); - } - - // - // Insert a new entry on top of the list - // - InsertHeadList (&mCommandList.Link, &Node->Link); - - // - // Move a new registered command to its sorted ordered location in the list - // - for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link), - PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link) - ; !IsNull (&mCommandList.Link, &Command->Link) - ; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link)) { - - // - // Get Lexical Comparison Value between PrevCommand and Command list entry - // - LexicalMatchValue = gUnicodeCollation->StriColl ( - gUnicodeCollation, - PrevCommand->CommandString, - Command->CommandString - ); - - // - // Swap PrevCommand and Command list entry if PrevCommand list entry - // is alphabetically greater than Command list entry - // - if (LexicalMatchValue > 0){ - Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *) SwapListEntries (&PrevCommand->Link, &Command->Link); - } else if (LexicalMatchValue < 0) { - // - // PrevCommand entry is lexically lower than Command entry - // - break; - } - } - - return (RETURN_SUCCESS); -} - -/** - Function to get the current Profile string. - - @retval NULL There are no installed profiles. - @return A semi-colon delimited list of profiles. -**/ -CONST CHAR16 * -EFIAPI -ShellCommandGetProfileList ( - VOID - ) -{ - return (mProfileList); -} - -/** - Checks if a command string has been registered for CommandString and if so it runs - the previously registered handler for that command with the command line. - - If CommandString is NULL, then ASSERT(). - - If Sections is specified, then each section name listed will be compared in a casesensitive - manner, to the section names described in Appendix B UEFI Shell 2.0 spec. If the section exists, - it will be appended to the returned help text. If the section does not exist, no - information will be returned. If Sections is NULL, then all help text information - available will be returned. - - @param[in] CommandString Pointer to the command name. This is the name - found on the command line in the shell. - @param[in, out] RetVal Pointer to the return vaule from the command handler. - - @param[in, out] CanAffectLE indicates whether this command's return value - needs to be placed into LASTERROR environment variable. - - @retval RETURN_SUCCESS The handler was run. - @retval RETURN_NOT_FOUND The CommandString did not match a registered - command name. - @sa SHELL_RUN_COMMAND -**/ -RETURN_STATUS -EFIAPI -ShellCommandRunCommandHandler ( - IN CONST CHAR16 *CommandString, - IN OUT SHELL_STATUS *RetVal, - IN OUT BOOLEAN *CanAffectLE OPTIONAL - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; - - // - // assert for NULL parameters - // - ASSERT(CommandString != NULL); - - // - // check for the command - // - for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link) - ; !IsNull(&mCommandList.Link, &Node->Link) - ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandString, - Node->CommandString) == 0 - ){ - if (CanAffectLE != NULL) { - *CanAffectLE = Node->LastError; - } - if (RetVal != NULL) { - *RetVal = Node->CommandHandler(NULL, gST); - } else { - Node->CommandHandler(NULL, gST); - } - return (RETURN_SUCCESS); - } - } - - // - // An internal command was not found, try to find a dynamic command - // - DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString); - if (DynamicCommand != NULL) { - if (RetVal != NULL) { - *RetVal = DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol); - } else { - DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol); - } - return (RETURN_SUCCESS); - } - - return (RETURN_NOT_FOUND); -} - -/** - Checks if a command string has been registered for CommandString and if so it - returns the MAN filename specified for that command. - - If CommandString is NULL, then ASSERT(). - - @param[in] CommandString Pointer to the command name. This is the name - found on the command line in the shell.\ - - @retval NULL the commandString was not a registered command. - @return other the name of the MAN file. - @sa SHELL_GET_MAN_FILENAME -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameHandler ( - IN CONST CHAR16 *CommandString - ) -{ - SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; - - // - // assert for NULL parameters - // - ASSERT(CommandString != NULL); - - // - // check for the command - // - for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link) - ; !IsNull(&mCommandList.Link, &Node->Link) - ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandString, - Node->CommandString) == 0 - ){ - return (Node->GetManFileName()); - } - } - return (NULL); -} - -/** - Get the list of all available shell internal commands. This is a linked list - (via LIST_ENTRY structure). enumerate through it using the BaseLib linked - list functions. do not modify the values. - - @param[in] Sort TRUE to alphabetically sort the values first. FALSE otherwise. - - @return a Linked list of all available shell commands. -**/ -CONST COMMAND_LIST* -EFIAPI -ShellCommandGetCommandList ( - IN CONST BOOLEAN Sort - ) -{ -// if (!Sort) { -// return ((COMMAND_LIST*)(&mCommandList)); -// } - return ((COMMAND_LIST*)(&mCommandList)); -} - -/** - Registers aliases to be set as part of the initialization of the shell application. - - If Command is NULL, then ASSERT(). - If Alias is NULL, then ASSERT(). - - @param[in] Command Pointer to the Command - @param[in] Alias Pointer to Alias - - @retval RETURN_SUCCESS The handlers were registered. - @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to - register the shell command. -**/ -RETURN_STATUS -EFIAPI -ShellCommandRegisterAlias ( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias - ) -{ - ALIAS_LIST *Node; - ALIAS_LIST *CommandAlias; - ALIAS_LIST *PrevCommandAlias; - INTN LexicalMatchValue; - - // - // Asserts for NULL - // - ASSERT(Command != NULL); - ASSERT(Alias != NULL); - - // - // allocate memory for new struct - // - Node = AllocateZeroPool(sizeof(ALIAS_LIST)); - if (Node == NULL) { - return RETURN_OUT_OF_RESOURCES; - } - Node->CommandString = AllocateCopyPool(StrSize(Command), Command); - if (Node->CommandString == NULL) { - FreePool (Node); - return RETURN_OUT_OF_RESOURCES; - } - Node->Alias = AllocateCopyPool(StrSize(Alias), Alias); - if (Node->Alias == NULL) { - FreePool (Node->CommandString); - FreePool (Node); - return RETURN_OUT_OF_RESOURCES; - } - - InsertHeadList (&mAliasList.Link, &Node->Link); - - // - // Move a new pre-defined registered alias to its sorted ordered location in the list - // - for ( CommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link), - PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link) - ; !IsNull (&mAliasList.Link, &CommandAlias->Link) - ; CommandAlias = (ALIAS_LIST *) GetNextNode (&mAliasList.Link, &CommandAlias->Link) ) { - // - // Get Lexical comparison value between PrevCommandAlias and CommandAlias List Entry - // - LexicalMatchValue = gUnicodeCollation->StriColl ( - gUnicodeCollation, - PrevCommandAlias->Alias, - CommandAlias->Alias - ); - - // - // Swap PrevCommandAlias and CommandAlias list entry if PrevCommandAlias list entry - // is alphabetically greater than CommandAlias list entry - // - if (LexicalMatchValue > 0) { - CommandAlias = (ALIAS_LIST *) SwapListEntries (&PrevCommandAlias->Link, &CommandAlias->Link); - } else if (LexicalMatchValue < 0) { - // - // PrevCommandAlias entry is lexically lower than CommandAlias entry - // - break; - } - } - - return (RETURN_SUCCESS); -} - -/** - Get the list of all shell alias commands. This is a linked list - (via LIST_ENTRY structure). enumerate through it using the BaseLib linked - list functions. do not modify the values. - - @return a Linked list of all requested shell alias'. -**/ -CONST ALIAS_LIST* -EFIAPI -ShellCommandGetInitAliasList ( - VOID - ) -{ - return (&mAliasList); -} - -/** - Determine if a given alias is on the list of built in alias'. - - @param[in] Alias The alias to test for - - @retval TRUE The alias is a built in alias - @retval FALSE The alias is not a built in alias -**/ -BOOLEAN -EFIAPI -ShellCommandIsOnAliasList( - IN CONST CHAR16 *Alias - ) -{ - ALIAS_LIST *Node; - - // - // assert for NULL parameter - // - ASSERT(Alias != NULL); - - // - // check for the Alias - // - for ( Node = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link) - ; !IsNull(&mAliasList.Link, &Node->Link) - ; Node = (ALIAS_LIST *)GetNextNode(&mAliasList.Link, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - ASSERT(Node->Alias != NULL); - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Alias, - Node->CommandString) == 0 - ){ - return (TRUE); - } - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Alias, - Node->Alias) == 0 - ){ - return (TRUE); - } - } - return (FALSE); -} - -/** - Function to determine current state of ECHO. Echo determines if lines from scripts - and ECHO commands are enabled. - - @retval TRUE Echo is currently enabled - @retval FALSE Echo is currently disabled -**/ -BOOLEAN -EFIAPI -ShellCommandGetEchoState( - VOID - ) -{ - return (mEchoState); -} - -/** - Function to set current state of ECHO. Echo determines if lines from scripts - and ECHO commands are enabled. - - If State is TRUE, Echo will be enabled. - If State is FALSE, Echo will be disabled. - - @param[in] State How to set echo. -**/ -VOID -EFIAPI -ShellCommandSetEchoState( - IN BOOLEAN State - ) -{ - mEchoState = State; -} - -/** - Indicate that the current shell or script should exit. - - @param[in] ScriptOnly TRUE if exiting a script; FALSE otherwise. - @param[in] ErrorCode The 64 bit error code to return. -**/ -VOID -EFIAPI -ShellCommandRegisterExit ( - IN BOOLEAN ScriptOnly, - IN CONST UINT64 ErrorCode - ) -{ - mExitRequested = (BOOLEAN)(!mExitRequested); - if (mExitRequested) { - mExitScript = ScriptOnly; - } else { - mExitScript = FALSE; - } - mExitCode = ErrorCode; -} - -/** - Retrieve the Exit indicator. - - @retval TRUE Exit was indicated. - @retval FALSE Exis was not indicated. -**/ -BOOLEAN -EFIAPI -ShellCommandGetExit ( - VOID - ) -{ - return (mExitRequested); -} - -/** - Retrieve the Exit code. - - If ShellCommandGetExit returns FALSE than the return from this is undefined. - - @return the value passed into RegisterExit. -**/ -UINT64 -EFIAPI -ShellCommandGetExitCode ( - VOID - ) -{ - return (mExitCode); -} -/** - Retrieve the Exit script indicator. - - If ShellCommandGetExit returns FALSE than the return from this is undefined. - - @retval TRUE ScriptOnly was indicated. - @retval FALSE ScriptOnly was not indicated. -**/ -BOOLEAN -EFIAPI -ShellCommandGetScriptExit ( - VOID - ) -{ - return (mExitScript); -} - -/** - Function to cleanup all memory from a SCRIPT_FILE structure. - - @param[in] Script The pointer to the structure to cleanup. -**/ -VOID -EFIAPI -DeleteScriptFileStruct ( - IN SCRIPT_FILE *Script - ) -{ - UINT8 LoopVar; - - if (Script == NULL) { - return; - } - - for (LoopVar = 0 ; LoopVar < Script->Argc ; LoopVar++) { - SHELL_FREE_NON_NULL(Script->Argv[LoopVar]); - } - if (Script->Argv != NULL) { - SHELL_FREE_NON_NULL(Script->Argv); - } - Script->CurrentCommand = NULL; - while (!IsListEmpty (&Script->CommandList)) { - Script->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode(&Script->CommandList); - if (Script->CurrentCommand != NULL) { - RemoveEntryList(&Script->CurrentCommand->Link); - if (Script->CurrentCommand->Cl != NULL) { - SHELL_FREE_NON_NULL(Script->CurrentCommand->Cl); - } - if (Script->CurrentCommand->Data != NULL) { - SHELL_FREE_NON_NULL(Script->CurrentCommand->Data); - } - SHELL_FREE_NON_NULL(Script->CurrentCommand); - } - } - SHELL_FREE_NON_NULL(Script->ScriptName); - SHELL_FREE_NON_NULL(Script); -} - -/** - Function to return a pointer to the currently running script file object. - - @retval NULL A script file is not currently running. - @return A pointer to the current script file object. -**/ -SCRIPT_FILE* -EFIAPI -ShellCommandGetCurrentScriptFile ( - VOID - ) -{ - SCRIPT_FILE_LIST *List; - if (IsListEmpty (&mScriptList.Link)) { - return (NULL); - } - List = ((SCRIPT_FILE_LIST*)GetFirstNode(&mScriptList.Link)); - return (List->Data); -} - -/** - Function to set a new script as the currently running one. - - This function will correctly stack and unstack nested scripts. - - @param[in] Script Pointer to new script information structure. if NULL - will remove and de-allocate the top-most Script structure. - - @return A pointer to the current running script file after this - change. NULL if removing the final script. -**/ -SCRIPT_FILE* -EFIAPI -ShellCommandSetNewScript ( - IN SCRIPT_FILE *Script OPTIONAL - ) -{ - SCRIPT_FILE_LIST *Node; - if (Script == NULL) { - if (IsListEmpty (&mScriptList.Link)) { - return (NULL); - } - Node = (SCRIPT_FILE_LIST *)GetFirstNode(&mScriptList.Link); - RemoveEntryList(&Node->Link); - DeleteScriptFileStruct(Node->Data); - FreePool(Node); - } else { - Node = AllocateZeroPool(sizeof(SCRIPT_FILE_LIST)); - if (Node == NULL) { - return (NULL); - } - Node->Data = Script; - InsertHeadList(&mScriptList.Link, &Node->Link); - } - return (ShellCommandGetCurrentScriptFile()); -} - -/** - Function to generate the next default mapping name. - - If the return value is not NULL then it must be callee freed. - - @param Type What kind of mapping name to make. - - @retval NULL a memory allocation failed. - @return a new map name string -**/ -CHAR16* -EFIAPI -ShellCommandCreateNewMappingName( - IN CONST SHELL_MAPPING_TYPE Type - ) -{ - CHAR16 *String; - ASSERT(Type < MappingTypeMax); - - String = NULL; - - String = AllocateZeroPool(PcdGet8(PcdShellMapNameLength) * sizeof(String[0])); - UnicodeSPrint( - String, - PcdGet8(PcdShellMapNameLength) * sizeof(String[0]), - Type == MappingTypeFileSystem?L"FS%d:":L"BLK%d:", - Type == MappingTypeFileSystem?mFsMaxCount++:mBlkMaxCount++); - - return (String); -} - -/** - Function to add a map node to the list of map items and update the "path" environment variable (optionally). - - If Path is TRUE (during initialization only), the path environment variable will also be updated to include - default paths on the new map name... - - Path should be FALSE when this function is called from the protocol SetMap function. - - @param[in] Name The human readable mapped name. - @param[in] DevicePath The Device Path for this map. - @param[in] Flags The Flags attribute for this map item. - @param[in] Path TRUE to update path, FALSE to skip this step (should only be TRUE during initialization). - - @retval EFI_SUCCESS The addition was sucessful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -EFIAPI -ShellCommandAddMapItemAndUpdatePath( - IN CONST CHAR16 *Name, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST UINT64 Flags, - IN CONST BOOLEAN Path - ) -{ - EFI_STATUS Status; - SHELL_MAP_LIST *MapListNode; - CONST CHAR16 *OriginalPath; - CHAR16 *NewPath; - UINTN NewPathSize; - - NewPathSize = 0; - NewPath = NULL; - OriginalPath = NULL; - Status = EFI_SUCCESS; - - MapListNode = AllocateZeroPool(sizeof(SHELL_MAP_LIST)); - if (MapListNode == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - MapListNode->Flags = Flags; - MapListNode->MapName = AllocateCopyPool(StrSize(Name), Name); - MapListNode->DevicePath = DuplicateDevicePath(DevicePath); - if ((MapListNode->MapName == NULL) || (MapListNode->DevicePath == NULL)){ - Status = EFI_OUT_OF_RESOURCES; - } else { - InsertTailList(&gShellMapList.Link, &MapListNode->Link); - } - } - if (EFI_ERROR(Status)) { - if (MapListNode != NULL) { - if (MapListNode->DevicePath != NULL) { - FreePool(MapListNode->DevicePath); - } - if (MapListNode->MapName != NULL) { - FreePool(MapListNode->MapName); - } - FreePool(MapListNode); - } - } else if (Path) { - // - // Since there was no error and Path was TRUE - // Now add the correct path for that mapping - // - OriginalPath = gEfiShellProtocol->GetEnv(L"path"); - ASSERT((NewPath == NULL && NewPathSize == 0) || (NewPath != NULL)); - if (OriginalPath != NULL) { - StrnCatGrow(&NewPath, &NewPathSize, OriginalPath, 0); - StrnCatGrow(&NewPath, &NewPathSize, L";", 0); - } - StrnCatGrow(&NewPath, &NewPathSize, Name, 0); - StrnCatGrow(&NewPath, &NewPathSize, L"\\efi\\tools\\;", 0); - StrnCatGrow(&NewPath, &NewPathSize, Name, 0); - StrnCatGrow(&NewPath, &NewPathSize, L"\\efi\\boot\\;", 0); - StrnCatGrow(&NewPath, &NewPathSize, Name, 0); - StrnCatGrow(&NewPath, &NewPathSize, L"\\", 0); - - Status = gEfiShellProtocol->SetEnv(L"path", NewPath, TRUE); - ASSERT_EFI_ERROR(Status); - FreePool(NewPath); - } - return (Status); -} - -/** - Creates the default map names for each device path in the system with - a protocol depending on the Type. - - Creates the consistent map names for each device path in the system with - a protocol depending on the Type. - - Note: This will reset all mappings in the system("map -r"). - - Also sets up the default path environment variable if Type is FileSystem. - - @retval EFI_SUCCESS All map names were created sucessfully. - @retval EFI_NOT_FOUND No protocols were found in the system. - @return Error returned from gBS->LocateHandle(). - - @sa LocateHandle -**/ -EFI_STATUS -EFIAPI -ShellCommandCreateInitialMappingsAndPaths( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleList; - UINTN Count; - EFI_DEVICE_PATH_PROTOCOL **DevicePathList; - CHAR16 *NewDefaultName; - CHAR16 *NewConsistName; - EFI_DEVICE_PATH_PROTOCOL **ConsistMappingTable; - SHELL_MAP_LIST *MapListNode; - CONST CHAR16 *CurDir; - CHAR16 *SplitCurDir; - CHAR16 *MapName; - SHELL_MAP_LIST *MapListItem; - - SplitCurDir = NULL; - MapName = NULL; - MapListItem = NULL; - HandleList = NULL; - - // - // Reset the static members back to zero - // - mFsMaxCount = 0; - mBlkMaxCount = 0; - - gEfiShellProtocol->SetEnv(L"path", L"", TRUE); - - // - // First empty out the existing list. - // - if (!IsListEmpty(&gShellMapList.Link)) { - for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ; !IsListEmpty(&gShellMapList.Link) - ; MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link) - ){ - RemoveEntryList(&MapListNode->Link); - SHELL_FREE_NON_NULL(MapListNode->DevicePath); - SHELL_FREE_NON_NULL(MapListNode->MapName); - SHELL_FREE_NON_NULL(MapListNode->CurrentDirectoryPath); - FreePool(MapListNode); - } // for loop - } - - // - // Find each handle with Simple File System - // - HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid); - if (HandleList != NULL) { - // - // Do a count of the handles - // - for (Count = 0 ; HandleList[Count] != NULL ; Count++); - - // - // Get all Device Paths - // - DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count); - if (DevicePathList == NULL) { - SHELL_FREE_NON_NULL (HandleList); - return EFI_OUT_OF_RESOURCES; - } - - for (Count = 0 ; HandleList[Count] != NULL ; Count++) { - DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]); - } - - // - // Sort all DevicePaths - // - PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare); - - ShellCommandConsistMappingInitialize(&ConsistMappingTable); - // - // Assign new Mappings to all... - // - for (Count = 0 ; HandleList[Count] != NULL ; Count++) { - // - // Get default name first - // - NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem); - ASSERT(NewDefaultName != NULL); - Status = ShellCommandAddMapItemAndUpdatePath(NewDefaultName, DevicePathList[Count], 0, TRUE); - ASSERT_EFI_ERROR(Status); - FreePool(NewDefaultName); - - // - // Now do consistent name - // - NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable); - if (NewConsistName != NULL) { - Status = ShellCommandAddMapItemAndUpdatePath(NewConsistName, DevicePathList[Count], 0, FALSE); - ASSERT_EFI_ERROR(Status); - FreePool(NewConsistName); - } - } - - ShellCommandConsistMappingUnInitialize(ConsistMappingTable); - - SHELL_FREE_NON_NULL(HandleList); - SHELL_FREE_NON_NULL(DevicePathList); - - HandleList = NULL; - - // - //gShellCurMapping point to node of current file system in the gShellMapList. When reset all mappings, - //all nodes in the gShellMapList will be free. Then gShellCurMapping will be a dangling pointer, So, - //after created new mappings, we should reset the gShellCurMapping pointer back to node of current file system. - // - if (gShellCurMapping != NULL) { - gShellCurMapping = NULL; - CurDir = gEfiShellProtocol->GetEnv(L"cwd"); - if (CurDir != NULL) { - MapName = AllocateCopyPool (StrSize(CurDir), CurDir); - if (MapName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - SplitCurDir = StrStr (MapName, L":"); - if (SplitCurDir == NULL) { - SHELL_FREE_NON_NULL (MapName); - return EFI_UNSUPPORTED; - } - *(SplitCurDir + 1) = CHAR_NULL; - MapListItem = ShellCommandFindMapItem (MapName); - if (MapListItem != NULL) { - gShellCurMapping = MapListItem; - } - SHELL_FREE_NON_NULL (MapName); - } - } - } else { - Count = (UINTN)-1; - } - - // - // Find each handle with Block Io - // - HandleList = GetHandleListByProtocol(&gEfiBlockIoProtocolGuid); - if (HandleList != NULL) { - for (Count = 0 ; HandleList[Count] != NULL ; Count++); - - // - // Get all Device Paths - // - DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count); - if (DevicePathList == NULL) { - SHELL_FREE_NON_NULL (HandleList); - return EFI_OUT_OF_RESOURCES; - } - - for (Count = 0 ; HandleList[Count] != NULL ; Count++) { - DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]); - } - - // - // Sort all DevicePaths - // - PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare); - - // - // Assign new Mappings to all... - // - for (Count = 0 ; HandleList[Count] != NULL ; Count++) { - // - // Get default name first - // - NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeBlockIo); - ASSERT(NewDefaultName != NULL); - Status = ShellCommandAddMapItemAndUpdatePath(NewDefaultName, DevicePathList[Count], 0, FALSE); - ASSERT_EFI_ERROR(Status); - FreePool(NewDefaultName); - } - - SHELL_FREE_NON_NULL(HandleList); - SHELL_FREE_NON_NULL(DevicePathList); - } else if (Count == (UINTN)-1) { - return (EFI_NOT_FOUND); - } - - return (EFI_SUCCESS); -} - -/** - Add mappings for any devices without one. Do not change any existing maps. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -ShellCommandUpdateMapping ( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleList; - UINTN Count; - EFI_DEVICE_PATH_PROTOCOL **DevicePathList; - CHAR16 *NewDefaultName; - CHAR16 *NewConsistName; - EFI_DEVICE_PATH_PROTOCOL **ConsistMappingTable; - - HandleList = NULL; - Status = EFI_SUCCESS; - - // - // remove mappings that represent removed devices. - // - - // - // Find each handle with Simple File System - // - HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid); - if (HandleList != NULL) { - // - // Do a count of the handles - // - for (Count = 0 ; HandleList[Count] != NULL ; Count++); - - // - // Get all Device Paths - // - DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count); - if (DevicePathList == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - for (Count = 0 ; HandleList[Count] != NULL ; Count++) { - DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]); - } - - // - // Sort all DevicePaths - // - PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare); - - ShellCommandConsistMappingInitialize(&ConsistMappingTable); - - // - // Assign new Mappings to remainders - // - for (Count = 0 ; !EFI_ERROR(Status) && HandleList[Count] != NULL && !EFI_ERROR(Status); Count++) { - // - // Skip ones that already have - // - if (gEfiShellProtocol->GetMapFromDevicePath(&DevicePathList[Count]) != NULL) { - continue; - } - // - // Get default name - // - NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem); - if (NewDefaultName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - break; - } - - // - // Call shell protocol SetMap function now... - // - Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewDefaultName); - - if (!EFI_ERROR(Status)) { - // - // Now do consistent name - // - NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable); - if (NewConsistName != NULL) { - Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewConsistName); - FreePool(NewConsistName); - } - } - - FreePool(NewDefaultName); - } - ShellCommandConsistMappingUnInitialize(ConsistMappingTable); - SHELL_FREE_NON_NULL(HandleList); - SHELL_FREE_NON_NULL(DevicePathList); - - HandleList = NULL; - } else { - Count = (UINTN)-1; - } - // - // Do it all over again for gEfiBlockIoProtocolGuid - // - - return (Status); -} - -/** - Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*. - - @param[in] Handle The SHELL_FILE_HANDLE to convert. - - @return a EFI_FILE_PROTOCOL* representing the same file. -**/ -EFI_FILE_PROTOCOL* -EFIAPI -ConvertShellHandleToEfiFileProtocol( - IN CONST SHELL_FILE_HANDLE Handle - ) -{ - return ((EFI_FILE_PROTOCOL*)(Handle)); -} - -/** - Converts a EFI_FILE_PROTOCOL* to an SHELL_FILE_HANDLE. - - @param[in] Handle The pointer to EFI_FILE_PROTOCOL to convert. - @param[in] Path The path to the file for verification. - - @return A SHELL_FILE_HANDLE representing the same file. - @retval NULL There was not enough memory. -**/ -SHELL_FILE_HANDLE -EFIAPI -ConvertEfiFileProtocolToShellHandle( - IN CONST EFI_FILE_PROTOCOL *Handle, - IN CONST CHAR16 *Path - ) -{ - SHELL_COMMAND_FILE_HANDLE *Buffer; - BUFFER_LIST *NewNode; - - if (Path != NULL) { - Buffer = AllocateZeroPool(sizeof(SHELL_COMMAND_FILE_HANDLE)); - if (Buffer == NULL) { - return (NULL); - } - NewNode = AllocateZeroPool(sizeof(BUFFER_LIST)); - if (NewNode == NULL) { - SHELL_FREE_NON_NULL(Buffer); - return (NULL); - } - Buffer->FileHandle = (EFI_FILE_PROTOCOL*)Handle; - Buffer->Path = StrnCatGrow(&Buffer->Path, NULL, Path, 0); - if (Buffer->Path == NULL) { - SHELL_FREE_NON_NULL(NewNode); - SHELL_FREE_NON_NULL(Buffer); - return (NULL); - } - NewNode->Buffer = Buffer; - - InsertHeadList(&mFileHandleList.Link, &NewNode->Link); - } - return ((SHELL_FILE_HANDLE)(Handle)); -} - -/** - Find the path that was logged with the specified SHELL_FILE_HANDLE. - - @param[in] Handle The SHELL_FILE_HANDLE to query on. - - @return A pointer to the path for the file. -**/ -CONST CHAR16* -EFIAPI -ShellFileHandleGetPath( - IN CONST SHELL_FILE_HANDLE Handle - ) -{ - BUFFER_LIST *Node; - - for (Node = (BUFFER_LIST*)GetFirstNode(&mFileHandleList.Link) - ; !IsNull(&mFileHandleList.Link, &Node->Link) - ; Node = (BUFFER_LIST*)GetNextNode(&mFileHandleList.Link, &Node->Link) - ){ - if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)){ - return (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path); - } - } - return (NULL); -} - -/** - Remove a SHELL_FILE_HANDLE from the list of SHELL_FILE_HANDLES. - - @param[in] Handle The SHELL_FILE_HANDLE to remove. - - @retval TRUE The item was removed. - @retval FALSE The item was not found. -**/ -BOOLEAN -EFIAPI -ShellFileHandleRemove( - IN CONST SHELL_FILE_HANDLE Handle - ) -{ - BUFFER_LIST *Node; - - for (Node = (BUFFER_LIST*)GetFirstNode(&mFileHandleList.Link) - ; !IsNull(&mFileHandleList.Link, &Node->Link) - ; Node = (BUFFER_LIST*)GetNextNode(&mFileHandleList.Link, &Node->Link) - ){ - if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)){ - RemoveEntryList(&Node->Link); - SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path); - SHELL_FREE_NON_NULL(Node->Buffer); - SHELL_FREE_NON_NULL(Node); - return (TRUE); - } - } - return (FALSE); -} - -/** - Function to determine if a SHELL_FILE_HANDLE is at the end of the file. - - This will NOT work on directories. - - If Handle is NULL, then ASSERT. - - @param[in] Handle the file handle - - @retval TRUE the position is at the end of the file - @retval FALSE the position is not at the end of the file -**/ -BOOLEAN -EFIAPI -ShellFileHandleEof( - IN SHELL_FILE_HANDLE Handle - ) -{ - EFI_FILE_INFO *Info; - UINT64 Pos; - BOOLEAN RetVal; - - // - // ASSERT if Handle is NULL - // - ASSERT(Handle != NULL); - - gEfiShellProtocol->GetFilePosition(Handle, &Pos); - Info = gEfiShellProtocol->GetFileInfo (Handle); - gEfiShellProtocol->SetFilePosition(Handle, Pos); - - if (Info == NULL) { - return (FALSE); - } - - if (Pos == Info->FileSize) { - RetVal = TRUE; - } else { - RetVal = FALSE; - } - - FreePool (Info); - - return (RetVal); -} - -/** - Frees any BUFFER_LIST defined type. - - @param[in] List The BUFFER_LIST object to free. -**/ -VOID -EFIAPI -FreeBufferList ( - IN BUFFER_LIST *List - ) -{ - BUFFER_LIST *BufferListEntry; - - if (List == NULL){ - return; - } - // - // enumerate through the buffer list and free all memory - // - for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link) - ; !IsListEmpty (&List->Link) - ; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link) - ){ - RemoveEntryList(&BufferListEntry->Link); - if (BufferListEntry->Buffer != NULL) { - FreePool(BufferListEntry->Buffer); - } - FreePool(BufferListEntry); - } -} - -/** - Dump some hexadecimal data to the screen. - - @param[in] Indent How many spaces to indent the output. - @param[in] Offset The offset of the printing. - @param[in] DataSize The size in bytes of UserData. - @param[in] UserData The data to print out. -**/ -VOID -EFIAPI -DumpHex ( - IN UINTN Indent, - IN UINTN Offset, - IN UINTN DataSize, - IN VOID *UserData - ) -{ - UINT8 *Data; - - CHAR8 Val[50]; - - CHAR8 Str[20]; - - UINT8 TempByte; - UINTN Size; - UINTN Index; - - Data = UserData; - while (DataSize != 0) { - Size = 16; - if (Size > DataSize) { - Size = DataSize; - } - - for (Index = 0; Index < Size; Index += 1) { - TempByte = Data[Index]; - Val[Index * 3 + 0] = Hex[TempByte >> 4]; - Val[Index * 3 + 1] = Hex[TempByte & 0xF]; - Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' '); - Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > '~') ? '.' : TempByte); - } - - Val[Index * 3] = 0; - Str[Index] = 0; - ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str); - - Data += Size; - Offset += Size; - DataSize -= Size; - } -} - -/** - Dump HEX data into buffer. - - @param[in] Buffer HEX data to be dumped in Buffer. - @param[in] Indent How many spaces to indent the output. - @param[in] Offset The offset of the printing. - @param[in] DataSize The size in bytes of UserData. - @param[in] UserData The data to print out. -**/ -CHAR16* -EFIAPI -CatSDumpHex ( - IN CHAR16 *Buffer, - IN UINTN Indent, - IN UINTN Offset, - IN UINTN DataSize, - IN VOID *UserData - ) -{ - UINT8 *Data; - UINT8 TempByte; - UINTN Size; - UINTN Index; - CHAR8 Val[50]; - CHAR8 Str[20]; - CHAR16 *RetVal; - CHAR16 *TempRetVal; - - Data = UserData; - RetVal = Buffer; - while (DataSize != 0) { - Size = 16; - if (Size > DataSize) { - Size = DataSize; - } - - for (Index = 0; Index < Size; Index += 1) { - TempByte = Data[Index]; - Val[Index * 3 + 0] = Hex[TempByte >> 4]; - Val[Index * 3 + 1] = Hex[TempByte & 0xF]; - Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' '); - Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte); - } - - Val[Index * 3] = 0; - Str[Index] = 0; - TempRetVal = CatSPrint (RetVal, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str); - SHELL_FREE_NON_NULL (RetVal); - RetVal = TempRetVal; - - Data += Size; - Offset += Size; - DataSize -= Size; - } - - return RetVal; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h deleted file mode 100644 index 7fb769f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - Provides interface to shell internal functions for shell commands. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_COMMAND_LIB_INTERNAL_HEADER_ -#define _UEFI_COMMAND_LIB_INTERNAL_HEADER_ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef struct{ - LIST_ENTRY Link; - CHAR16 *CommandString; - SHELL_GET_MAN_FILENAME GetManFileName; - SHELL_RUN_COMMAND CommandHandler; - BOOLEAN LastError; - EFI_HANDLE HiiHandle; - EFI_STRING_ID ManFormatHelp; -} SHELL_COMMAND_INTERNAL_LIST_ENTRY; - -typedef struct { - LIST_ENTRY Link; - SCRIPT_FILE *Data; -} SCRIPT_FILE_LIST; - -typedef struct { - EFI_FILE_PROTOCOL *FileHandle; - CHAR16 *Path; -} SHELL_COMMAND_FILE_HANDLE; - - -#endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_ - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf deleted file mode 100644 index 961f4d0..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf +++ /dev/null @@ -1,69 +0,0 @@ -## @file -# Provides interface to shell internal functions for shell commands. -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellCommandLib - FILE_GUID = 5C12F31F-EBAC-466e-A400-FCA8C9EA3A05 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.1 - LIBRARY_CLASS = ShellCommandLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER - CONSTRUCTOR = ShellCommandLibConstructor - DESTRUCTOR = ShellCommandLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiShellCommandLib.c - UefiShellCommandLib.h - ConsistMapping.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - PrintLib - UefiBootServicesTableLib - ShellLib - HiiLib - HandleParsingLib - -[Protocols] - gEfiUnicodeCollation2ProtocolGuid ## CONSUMES - gEfiShellProtocolGuid ## CONSUMES - gEfiShellParametersProtocolGuid ## CONSUMES - gEfiShellDynamicCommandProtocolGuid ## SOMETIMES_CONSUMES - gEfiUsbIoProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gEfiSasDevicePathGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdUsbExtendedDecode ## SOMETIMES_CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames ## SOMETIMES_CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode ## SOMETIMES_CONSUMES - -[Depex] - gEfiUnicodeCollation2ProtocolGuid diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c deleted file mode 100644 index 34d645e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c +++ /dev/null @@ -1,378 +0,0 @@ -/** @file - Main file for Comp shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-n", TypeValue}, - {L"-s", TypeValue}, - {NULL, TypeMax} - }; - -typedef enum { - OutOfDiffPoint, - InDiffPoint, - InPrevDiffPoint -} READ_STATUS; - -/** - Function to print differnt point data. - - @param[in] FileName File name. - @param[in] FileTag File tag name. - @param[in] Buffer Data buffer to be printed. - @param[in] BufferSize Size of the data to be printed. - @param[in] Address Address of the differnt point. - @param[in] DifferentBytes Total size of the buffer. - -**/ -VOID -PrintDifferentPoint( - CONST CHAR16 *FileName, - CHAR16 *FileTag, - UINT8 *Buffer, - UINT64 BufferSize, - UINTN Address, - UINT64 DifferentBytes - ) -{ - UINTN Index; - - ShellPrintEx (-1, -1, L"%s: %s\r\n %08x:", FileTag, FileName, Address); - - // - // Print data in hex-format. - // - for (Index = 0; Index < BufferSize; Index++) { - ShellPrintEx (-1, -1, L" %02x", Buffer[Index]); - } - - if (BufferSize < DifferentBytes) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_END_OF_FILE), gShellDebug1HiiHandle); - } - - ShellPrintEx (-1, -1, L" *"); - - // - // Print data in char-format. - // - for (Index = 0; Index < BufferSize; Index++) { - if (Buffer[Index] >= 0x20 && Buffer[Index] <= 0x7E) { - ShellPrintEx (-1, -1, L"%c", Buffer[Index]); - } else { - // - // Print dots for control characters - // - ShellPrintEx (-1, -1, L"."); - } - } - - ShellPrintEx (-1, -1, L"*\r\n"); -} - -/** - Function for 'comp' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunComp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CHAR16 *FileName1; - CHAR16 *FileName2; - CONST CHAR16 *TempParam; - SHELL_STATUS ShellStatus; - SHELL_FILE_HANDLE FileHandle1; - SHELL_FILE_HANDLE FileHandle2; - UINT64 Size1; - UINT64 Size2; - UINT64 DifferentBytes; - UINT64 DifferentCount; - UINT8 DiffPointNumber; - UINT8 OneByteFromFile1; - UINT8 OneByteFromFile2; - UINT8 *DataFromFile1; - UINT8 *DataFromFile2; - UINTN InsertPosition1; - UINTN InsertPosition2; - UINTN DataSizeFromFile1; - UINTN DataSizeFromFile2; - UINTN TempAddress; - UINTN Index; - UINTN DiffPointAddress; - READ_STATUS ReadStatus; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - FileName1 = NULL; - FileName2 = NULL; - FileHandle1 = NULL; - FileHandle2 = NULL; - DataFromFile1 = NULL; - DataFromFile2 = NULL; - ReadStatus = OutOfDiffPoint; - DifferentCount = 10; - DifferentBytes = 4; - DiffPointNumber = 0; - InsertPosition1 = 0; - InsertPosition2 = 0; - TempAddress = 0; - DiffPointAddress = 0; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempParam = ShellCommandLineGetRawValue(Package, 1); - ASSERT(TempParam != NULL); - FileName1 = ShellFindFilePath(TempParam); - if (FileName1 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } else { - Status = ShellOpenFileByName(FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } - } - TempParam = ShellCommandLineGetRawValue(Package, 2); - ASSERT(TempParam != NULL); - FileName2 = ShellFindFilePath(TempParam); - if (FileName2 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } else { - Status = ShellOpenFileByName(FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } - } - if (ShellStatus == SHELL_SUCCESS) { - Status = gEfiShellProtocol->GetFileSize(FileHandle1, &Size1); - ASSERT_EFI_ERROR(Status); - Status = gEfiShellProtocol->GetFileSize(FileHandle2, &Size2); - ASSERT_EFI_ERROR(Status); - - if (ShellCommandLineGetFlag (Package, L"-n")) { - TempParam = ShellCommandLineGetValue (Package, L"-n"); - if (TempParam == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"comp", L"-n"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TempParam, L"all") == 0) { - DifferentCount = MAX_UINTN; - } else { - Status = ShellConvertStringToUint64 (TempParam, &DifferentCount, FALSE, TRUE); - if (EFI_ERROR(Status) || DifferentCount == 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-n"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } - - if (ShellCommandLineGetFlag (Package, L"-s")) { - TempParam = ShellCommandLineGetValue (Package, L"-s"); - if (TempParam == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"comp", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (TempParam, &DifferentBytes, FALSE, TRUE); - if (EFI_ERROR(Status) || DifferentBytes == 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (DifferentBytes > MAX (Size1, Size2)) { - DifferentBytes = MAX (Size1, Size2); - } - } - } - } - } - - if (ShellStatus == SHELL_SUCCESS) { - DataFromFile1 = AllocateZeroPool ((UINTN)DifferentBytes); - DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes); - if (DataFromFile1 == NULL || DataFromFile2 == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - SHELL_FREE_NON_NULL (DataFromFile1); - SHELL_FREE_NON_NULL (DataFromFile2); - } - } - - if (ShellStatus == SHELL_SUCCESS) { - while (DiffPointNumber < DifferentCount) { - DataSizeFromFile1 = 1; - DataSizeFromFile2 = 1; - OneByteFromFile1 = 0; - OneByteFromFile2 = 0; - Status = gEfiShellProtocol->ReadFile (FileHandle1, &DataSizeFromFile1, &OneByteFromFile1); - ASSERT_EFI_ERROR (Status); - Status = gEfiShellProtocol->ReadFile (FileHandle2, &DataSizeFromFile2, &OneByteFromFile2); - ASSERT_EFI_ERROR (Status); - - TempAddress++; - - // - // 1.When end of file and no chars in DataFromFile buffer, then break while. - // 2.If no more char in File1 or File2, The ReadStatus is InPrevDiffPoint forever. - // So the previous different point is the last one, then break the while block. - // - if ( (DataSizeFromFile1 == 0 && InsertPosition1 == 0 && DataSizeFromFile2 == 0 && InsertPosition2 == 0) || - (ReadStatus == InPrevDiffPoint && (DataSizeFromFile1 == 0 || DataSizeFromFile2 == 0)) - ) { - break; - } - - if (ReadStatus == OutOfDiffPoint) { - if (OneByteFromFile1 != OneByteFromFile2) { - ReadStatus = InDiffPoint; - DiffPointAddress = TempAddress; - if (DataSizeFromFile1 == 1) { - DataFromFile1[InsertPosition1++] = OneByteFromFile1; - } - if (DataSizeFromFile2 == 1) { - DataFromFile2[InsertPosition2++] = OneByteFromFile2; - } - } - } else if (ReadStatus == InDiffPoint) { - if (DataSizeFromFile1 == 1) { - DataFromFile1[InsertPosition1++] = OneByteFromFile1; - } - if (DataSizeFromFile2 == 1) { - DataFromFile2[InsertPosition2++] = OneByteFromFile2; - } - } else if (ReadStatus == InPrevDiffPoint) { - if (OneByteFromFile1 == OneByteFromFile2) { - ReadStatus = OutOfDiffPoint; - } - } - - // - // ReadStatus should be always equal InDiffPoint. - // - if ( InsertPosition1 == DifferentBytes || - InsertPosition2 == DifferentBytes || - (DataSizeFromFile1 == 0 && DataSizeFromFile2 == 0) - ) { - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber); - PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes); - PrintDifferentPoint (FileName2, L"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes); - - // - // One of two buffuers is empty, it means this is the last different point. - // - if (InsertPosition1 == 0 || InsertPosition2 == 0) { - break; - } - - for (Index = 1; Index < InsertPosition1 && Index < InsertPosition2; Index++) { - if (DataFromFile1[Index] == DataFromFile2[Index]) { - ReadStatus = OutOfDiffPoint; - break; - } - } - - if (ReadStatus == OutOfDiffPoint) { - // - // Try to find a new different point in the rest of DataFromFile. - // - for (; Index < MAX (InsertPosition1,InsertPosition2); Index++) { - if (DataFromFile1[Index] != DataFromFile2[Index]) { - ReadStatus = InDiffPoint; - DiffPointAddress += Index; - break; - } - } - } else { - // - // Doesn't find a new different point, still in the same different point. - // - ReadStatus = InPrevDiffPoint; - } - - CopyMem (DataFromFile1, DataFromFile1 + Index, InsertPosition1 - Index); - CopyMem (DataFromFile2, DataFromFile2 + Index, InsertPosition2 - Index); - - SetMem (DataFromFile1 + InsertPosition1 - Index, (UINTN)DifferentBytes - InsertPosition1 + Index, 0); - SetMem (DataFromFile2 + InsertPosition2 - Index, (UINTN)DifferentBytes - InsertPosition2 + Index, 0); - - InsertPosition1 -= Index; - InsertPosition2 -= Index; - } - } - - SHELL_FREE_NON_NULL (DataFromFile1); - SHELL_FREE_NON_NULL (DataFromFile2); - - if (DiffPointNumber == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle); - } else { - ShellStatus = SHELL_NOT_EQUAL; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle); - } - } - } - - ShellCommandLineFreeVarList (Package); - } - SHELL_FREE_NON_NULL(FileName1); - SHELL_FREE_NON_NULL(FileName2); - - if (FileHandle1 != NULL) { - gEfiShellProtocol->CloseFile(FileHandle1); - } - if (FileHandle2 != NULL) { - gEfiShellProtocol->CloseFile(FileHandle2); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c deleted file mode 100644 index c3d3ec6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c +++ /dev/null @@ -1,1388 +0,0 @@ -/** @file - Main file for compression routine. - - Compression routine. The compression algorithm is a mixture of - LZ77 and Huffman coding. LZ77 transforms the source data into a - sequence of Original Characters and Pointers to repeated strings. - This sequence is further divided into Blocks and Huffman codings - are applied to each Block. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include -#include -#include -#include -#include - -#include "Compress.h" - -// -// Macro Definitions -// -typedef INT16 NODE; -#define UINT8_MAX 0xff -#define UINT8_BIT 8 -#define THRESHOLD 3 -#define INIT_CRC 0 -#define WNDBIT 13 -#define WNDSIZ (1U << WNDBIT) -#define MAXMATCH 256 -#define BLKSIZ (1U << 14) // 16 * 1024U -#define PERC_FLAG 0x8000U -#define CODE_BIT 16 -#define NIL 0 -#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX) -#define HASH(LoopVar7, LoopVar5) ((LoopVar7) + ((LoopVar5) << (WNDBIT - 9)) + WNDSIZ * 2) -#define CRCPOLY 0xA001 -#define UPDATE_CRC(LoopVar5) mCrc = mCrcTable[(mCrc ^ (LoopVar5)) & 0xFF] ^ (mCrc >> UINT8_BIT) - -// -// C: the Char&Len Set; P: the Position Set; T: the exTra Set -// -#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD) -#define CBIT 9 -#define NP (WNDBIT + 1) -#define PBIT 4 -#define NT (CODE_BIT + 3) -#define TBIT 5 -#if NT > NP - #define NPT NT -#else - #define NPT NP -#endif -// -// Function Prototypes -// - -/** - Put a dword to output stream - - @param[in] Data The dword to put. -**/ -VOID -PutDword( - IN UINT32 Data - ); - -// -// Global Variables -// -STATIC UINT8 *mSrc; -STATIC UINT8 *mDst; -STATIC UINT8 *mSrcUpperLimit; -STATIC UINT8 *mDstUpperLimit; - -STATIC UINT8 *mLevel; -STATIC UINT8 *mText; -STATIC UINT8 *mChildCount; -STATIC UINT8 *mBuf; -STATIC UINT8 mCLen[NC]; -STATIC UINT8 mPTLen[NPT]; -STATIC UINT8 *mLen; -STATIC INT16 mHeap[NC + 1]; -STATIC INT32 mRemainder; -STATIC INT32 mMatchLen; -STATIC INT32 mBitCount; -STATIC INT32 mHeapSize; -STATIC INT32 mTempInt32; -STATIC UINT32 mBufSiz = 0; -STATIC UINT32 mOutputPos; -STATIC UINT32 mOutputMask; -STATIC UINT32 mSubBitBuf; -STATIC UINT32 mCrc; -STATIC UINT32 mCompSize; -STATIC UINT32 mOrigSize; - -STATIC UINT16 *mFreq; -STATIC UINT16 *mSortPtr; -STATIC UINT16 mLenCnt[17]; -STATIC UINT16 mLeft[2 * NC - 1]; -STATIC UINT16 mRight[2 * NC - 1]; -STATIC UINT16 mCrcTable[UINT8_MAX + 1]; -STATIC UINT16 mCFreq[2 * NC - 1]; -STATIC UINT16 mCCode[NC]; -STATIC UINT16 mPFreq[2 * NP - 1]; -STATIC UINT16 mPTCode[NPT]; -STATIC UINT16 mTFreq[2 * NT - 1]; - -STATIC NODE mPos; -STATIC NODE mMatchPos; -STATIC NODE mAvail; -STATIC NODE *mPosition; -STATIC NODE *mParent; -STATIC NODE *mPrev; -STATIC NODE *mNext = NULL; -INT32 mHuffmanDepth = 0; - -/** - Make a CRC table. - -**/ -VOID -MakeCrcTable ( - VOID - ) -{ - UINT32 LoopVar1; - - UINT32 LoopVar2; - - UINT32 LoopVar4; - - for (LoopVar1 = 0; LoopVar1 <= UINT8_MAX; LoopVar1++) { - LoopVar4 = LoopVar1; - for (LoopVar2 = 0; LoopVar2 < UINT8_BIT; LoopVar2++) { - if ((LoopVar4 & 1) != 0) { - LoopVar4 = (LoopVar4 >> 1) ^ CRCPOLY; - } else { - LoopVar4 >>= 1; - } - } - - mCrcTable[LoopVar1] = (UINT16) LoopVar4; - } -} - -/** - Put a dword to output stream - - @param[in] Data The dword to put. -**/ -VOID -PutDword ( - IN UINT32 Data - ) -{ - if (mDst < mDstUpperLimit) { - *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff); - } - - if (mDst < mDstUpperLimit) { - *mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff); - } - - if (mDst < mDstUpperLimit) { - *mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff); - } - - if (mDst < mDstUpperLimit) { - *mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff); - } -} - -/** - Allocate memory spaces for data structures used in compression process. - - @retval EFI_SUCCESS Memory was allocated successfully. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -AllocateMemory ( - VOID - ) -{ - mText = AllocateZeroPool (WNDSIZ * 2 + MAXMATCH); - mLevel = AllocateZeroPool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel)); - mChildCount = AllocateZeroPool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount)); - mPosition = AllocateZeroPool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition)); - mParent = AllocateZeroPool (WNDSIZ * 2 * sizeof (*mParent)); - mPrev = AllocateZeroPool (WNDSIZ * 2 * sizeof (*mPrev)); - mNext = AllocateZeroPool ((MAX_HASH_VAL + 1) * sizeof (*mNext)); - - mBufSiz = BLKSIZ; - mBuf = AllocateZeroPool (mBufSiz); - while (mBuf == NULL) { - mBufSiz = (mBufSiz / 10U) * 9U; - if (mBufSiz < 4 * 1024U) { - return EFI_OUT_OF_RESOURCES; - } - - mBuf = AllocateZeroPool (mBufSiz); - } - - mBuf[0] = 0; - - return EFI_SUCCESS; -} - -/** - Called when compression is completed to free memory previously allocated. - -**/ -VOID -FreeMemory ( - VOID - ) -{ - SHELL_FREE_NON_NULL (mText); - SHELL_FREE_NON_NULL (mLevel); - SHELL_FREE_NON_NULL (mChildCount); - SHELL_FREE_NON_NULL (mPosition); - SHELL_FREE_NON_NULL (mParent); - SHELL_FREE_NON_NULL (mPrev); - SHELL_FREE_NON_NULL (mNext); - SHELL_FREE_NON_NULL (mBuf); -} - -/** - Initialize String Info Log data structures. -**/ -VOID -InitSlide ( - VOID - ) -{ - NODE LoopVar1; - - SetMem (mLevel + WNDSIZ, (UINT8_MAX + 1) * sizeof (UINT8), 1); - SetMem (mPosition + WNDSIZ, (UINT8_MAX + 1) * sizeof (NODE), 0); - - SetMem (mParent + WNDSIZ, WNDSIZ * sizeof (NODE), 0); - - mAvail = 1; - for (LoopVar1 = 1; LoopVar1 < WNDSIZ - 1; LoopVar1++) { - mNext[LoopVar1] = (NODE) (LoopVar1 + 1); - } - - mNext[WNDSIZ - 1] = NIL; - SetMem (mNext + WNDSIZ * 2, (MAX_HASH_VAL - WNDSIZ * 2 + 1) * sizeof (NODE), 0); -} - -/** - Find child node given the parent node and the edge character - - @param[in] LoopVar6 The parent node. - @param[in] LoopVar5 The edge character. - - @return The child node. - @retval NIL(Zero) No child could be found. - -**/ -NODE -Child ( - IN NODE LoopVar6, - IN UINT8 LoopVar5 - ) -{ - NODE LoopVar4; - - LoopVar4 = mNext[HASH (LoopVar6, LoopVar5)]; - mParent[NIL] = LoopVar6; /* sentinel */ - while (mParent[LoopVar4] != LoopVar6) { - LoopVar4 = mNext[LoopVar4]; - } - - return LoopVar4; -} - -/** - Create a new child for a given parent node. - - @param[in] LoopVar6 The parent node. - @param[in] LoopVar5 The edge character. - @param[in] LoopVar4 The child node. -**/ -VOID -MakeChild ( - IN NODE LoopVar6, - IN UINT8 LoopVar5, - IN NODE LoopVar4 - ) -{ - NODE LoopVar12; - - NODE LoopVar10; - - LoopVar12 = (NODE) HASH (LoopVar6, LoopVar5); - LoopVar10 = mNext[LoopVar12]; - mNext[LoopVar12] = LoopVar4; - mNext[LoopVar4] = LoopVar10; - mPrev[LoopVar10] = LoopVar4; - mPrev[LoopVar4] = LoopVar12; - mParent[LoopVar4] = LoopVar6; - mChildCount[LoopVar6]++; -} - -/** - Split a node. - - @param[in] Old The node to split. -**/ -VOID -Split ( - IN NODE Old - ) -{ - NODE New; - - NODE LoopVar10; - - New = mAvail; - mAvail = mNext[New]; - mChildCount[New] = 0; - LoopVar10 = mPrev[Old]; - mPrev[New] = LoopVar10; - mNext[LoopVar10] = New; - LoopVar10 = mNext[Old]; - mNext[New] = LoopVar10; - mPrev[LoopVar10] = New; - mParent[New] = mParent[Old]; - mLevel[New] = (UINT8) mMatchLen; - mPosition[New] = mPos; - MakeChild (New, mText[mMatchPos + mMatchLen], Old); - MakeChild (New, mText[mPos + mMatchLen], mPos); -} - -/** - Insert string info for current position into the String Info Log. - -**/ -VOID -InsertNode ( - VOID - ) -{ - NODE LoopVar6; - - NODE LoopVar4; - - NODE LoopVar2; - - NODE LoopVar10; - UINT8 LoopVar5; - UINT8 *TempString3; - UINT8 *TempString2; - - if (mMatchLen >= 4) { - // - // We have just got a long match, the target tree - // can be located by MatchPos + 1. Travese the tree - // from bottom up to get to a proper starting point. - // The usage of PERC_FLAG ensures proper node deletion - // in DeleteNode() later. - // - mMatchLen--; - LoopVar4 = (NODE) ((mMatchPos + 1) | WNDSIZ); - LoopVar6 = mParent[LoopVar4]; - while (LoopVar6 == NIL) { - LoopVar4 = mNext[LoopVar4]; - LoopVar6 = mParent[LoopVar4]; - } - - while (mLevel[LoopVar6] >= mMatchLen) { - LoopVar4 = LoopVar6; - LoopVar6 = mParent[LoopVar6]; - } - - LoopVar10 = LoopVar6; - while (mPosition[LoopVar10] < 0) { - mPosition[LoopVar10] = mPos; - LoopVar10 = mParent[LoopVar10]; - } - - if (LoopVar10 < WNDSIZ) { - mPosition[LoopVar10] = (NODE) (mPos | PERC_FLAG); - } - } else { - // - // Locate the target tree - // - LoopVar6 = (NODE) (mText[mPos] + WNDSIZ); - LoopVar5 = mText[mPos + 1]; - LoopVar4 = Child (LoopVar6, LoopVar5); - if (LoopVar4 == NIL) { - MakeChild (LoopVar6, LoopVar5, mPos); - mMatchLen = 1; - return ; - } - - mMatchLen = 2; - } - // - // Traverse down the tree to find a match. - // Update Position value along the route. - // Node split or creation is involved. - // - for (;;) { - if (LoopVar4 >= WNDSIZ) { - LoopVar2 = MAXMATCH; - mMatchPos = LoopVar4; - } else { - LoopVar2 = mLevel[LoopVar4]; - mMatchPos = (NODE) (mPosition[LoopVar4] & ~PERC_FLAG); - } - - if (mMatchPos >= mPos) { - mMatchPos -= WNDSIZ; - } - - TempString3 = &mText[mPos + mMatchLen]; - TempString2 = &mText[mMatchPos + mMatchLen]; - while (mMatchLen < LoopVar2) { - if (*TempString3 != *TempString2) { - Split (LoopVar4); - return ; - } - - mMatchLen++; - TempString3++; - TempString2++; - } - - if (mMatchLen >= MAXMATCH) { - break; - } - - mPosition[LoopVar4] = mPos; - LoopVar6 = LoopVar4; - LoopVar4 = Child (LoopVar6, *TempString3); - if (LoopVar4 == NIL) { - MakeChild (LoopVar6, *TempString3, mPos); - return ; - } - - mMatchLen++; - } - - LoopVar10 = mPrev[LoopVar4]; - mPrev[mPos] = LoopVar10; - mNext[LoopVar10] = mPos; - LoopVar10 = mNext[LoopVar4]; - mNext[mPos] = LoopVar10; - mPrev[LoopVar10] = mPos; - mParent[mPos] = LoopVar6; - mParent[LoopVar4] = NIL; - - // - // Special usage of 'next' - // - mNext[LoopVar4] = mPos; - -} - -/** - Delete outdated string info. (The Usage of PERC_FLAG - ensures a clean deletion). - -**/ -VOID -DeleteNode ( - VOID - ) -{ - NODE LoopVar6; - - NODE LoopVar4; - - NODE LoopVar11; - - NODE LoopVar10; - - NODE LoopVar9; - - if (mParent[mPos] == NIL) { - return ; - } - - LoopVar4 = mPrev[mPos]; - LoopVar11 = mNext[mPos]; - mNext[LoopVar4] = LoopVar11; - mPrev[LoopVar11] = LoopVar4; - LoopVar4 = mParent[mPos]; - mParent[mPos] = NIL; - if (LoopVar4 >= WNDSIZ) { - return ; - } - - mChildCount[LoopVar4]--; - if (mChildCount[LoopVar4] > 1) { - return ; - } - - LoopVar10 = (NODE) (mPosition[LoopVar4] & ~PERC_FLAG); - if (LoopVar10 >= mPos) { - LoopVar10 -= WNDSIZ; - } - - LoopVar11 = LoopVar10; - LoopVar6 = mParent[LoopVar4]; - LoopVar9 = mPosition[LoopVar6]; - while ((LoopVar9 & PERC_FLAG) != 0){ - LoopVar9 &= ~PERC_FLAG; - if (LoopVar9 >= mPos) { - LoopVar9 -= WNDSIZ; - } - - if (LoopVar9 > LoopVar11) { - LoopVar11 = LoopVar9; - } - - mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ); - LoopVar6 = mParent[LoopVar6]; - LoopVar9 = mPosition[LoopVar6]; - } - - if (LoopVar6 < WNDSIZ) { - if (LoopVar9 >= mPos) { - LoopVar9 -= WNDSIZ; - } - - if (LoopVar9 > LoopVar11) { - LoopVar11 = LoopVar9; - } - - mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ | PERC_FLAG); - } - - LoopVar11 = Child (LoopVar4, mText[LoopVar10 + mLevel[LoopVar4]]); - LoopVar10 = mPrev[LoopVar11]; - LoopVar9 = mNext[LoopVar11]; - mNext[LoopVar10] = LoopVar9; - mPrev[LoopVar9] = LoopVar10; - LoopVar10 = mPrev[LoopVar4]; - mNext[LoopVar10] = LoopVar11; - mPrev[LoopVar11] = LoopVar10; - LoopVar10 = mNext[LoopVar4]; - mPrev[LoopVar10] = LoopVar11; - mNext[LoopVar11] = LoopVar10; - mParent[LoopVar11] = mParent[LoopVar4]; - mParent[LoopVar4] = NIL; - mNext[LoopVar4] = mAvail; - mAvail = LoopVar4; -} - -/** - Read in source data - - @param[out] LoopVar7 The buffer to hold the data. - @param[in] LoopVar8 The number of bytes to read. - - @return The number of bytes actually read. -**/ -INT32 -FreadCrc ( - OUT UINT8 *LoopVar7, - IN INT32 LoopVar8 - ) -{ - INT32 LoopVar1; - - for (LoopVar1 = 0; mSrc < mSrcUpperLimit && LoopVar1 < LoopVar8; LoopVar1++) { - *LoopVar7++ = *mSrc++; - } - - LoopVar8 = LoopVar1; - - LoopVar7 -= LoopVar8; - mOrigSize += LoopVar8; - LoopVar1--; - while (LoopVar1 >= 0) { - UPDATE_CRC (*LoopVar7++); - LoopVar1--; - } - - return LoopVar8; -} - -/** - Advance the current position (read in new data if needed). - Delete outdated string info. Find a match string for current position. - - @retval TRUE The operation was successful. - @retval FALSE The operation failed due to insufficient memory. -**/ -BOOLEAN -GetNextMatch ( - VOID - ) -{ - INT32 LoopVar8; - VOID *Temp; - - mRemainder--; - mPos++; - if (mPos == WNDSIZ * 2) { - Temp = AllocateZeroPool (WNDSIZ + MAXMATCH); - if (Temp == NULL) { - return (FALSE); - } - CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH); - CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH); - FreePool (Temp); - LoopVar8 = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ); - mRemainder += LoopVar8; - mPos = WNDSIZ; - } - - DeleteNode (); - InsertNode (); - - return (TRUE); -} - -/** - Send entry LoopVar1 down the queue. - - @param[in] LoopVar1 The index of the item to move. -**/ -VOID -DownHeap ( - IN INT32 i - ) -{ - INT32 LoopVar1; - - INT32 LoopVar2; - - // - // priority queue: send i-th entry down heap - // - LoopVar2 = mHeap[i]; - LoopVar1 = 2 * i; - while (LoopVar1 <= mHeapSize) { - if (LoopVar1 < mHeapSize && mFreq[mHeap[LoopVar1]] > mFreq[mHeap[LoopVar1 + 1]]) { - LoopVar1++; - } - - if (mFreq[LoopVar2] <= mFreq[mHeap[LoopVar1]]) { - break; - } - - mHeap[i] = mHeap[LoopVar1]; - i = LoopVar1; - LoopVar1 = 2 * i; - } - - mHeap[i] = (INT16) LoopVar2; -} - -/** - Count the number of each code length for a Huffman tree. - - @param[in] LoopVar1 The top node. -**/ -VOID -CountLen ( - IN INT32 LoopVar1 - ) -{ - if (LoopVar1 < mTempInt32) { - mLenCnt[(mHuffmanDepth < 16) ? mHuffmanDepth : 16]++; - } else { - mHuffmanDepth++; - CountLen (mLeft[LoopVar1]); - CountLen (mRight[LoopVar1]); - mHuffmanDepth--; - } -} - -/** - Create code length array for a Huffman tree. - - @param[in] Root The root of the tree. -**/ -VOID -MakeLen ( - IN INT32 Root - ) -{ - INT32 LoopVar1; - - INT32 LoopVar2; - UINT32 Cum; - - for (LoopVar1 = 0; LoopVar1 <= 16; LoopVar1++) { - mLenCnt[LoopVar1] = 0; - } - - CountLen (Root); - - // - // Adjust the length count array so that - // no code will be generated longer than its designated length - // - Cum = 0; - for (LoopVar1 = 16; LoopVar1 > 0; LoopVar1--) { - Cum += mLenCnt[LoopVar1] << (16 - LoopVar1); - } - - while (Cum != (1U << 16)) { - mLenCnt[16]--; - for (LoopVar1 = 15; LoopVar1 > 0; LoopVar1--) { - if (mLenCnt[LoopVar1] != 0) { - mLenCnt[LoopVar1]--; - mLenCnt[LoopVar1 + 1] += 2; - break; - } - } - - Cum--; - } - - for (LoopVar1 = 16; LoopVar1 > 0; LoopVar1--) { - LoopVar2 = mLenCnt[LoopVar1]; - LoopVar2--; - while (LoopVar2 >= 0) { - mLen[*mSortPtr++] = (UINT8) LoopVar1; - LoopVar2--; - } - } -} - -/** - Assign code to each symbol based on the code length array. - - @param[in] LoopVar8 The number of symbols. - @param[in] Len The code length array. - @param[out] Code The stores codes for each symbol. -**/ -VOID -MakeCode ( - IN INT32 LoopVar8, - IN UINT8 Len[ ], - OUT UINT16 Code[ ] - ) -{ - INT32 LoopVar1; - UINT16 Start[18]; - - Start[1] = 0; - for (LoopVar1 = 1; LoopVar1 <= 16; LoopVar1++) { - Start[LoopVar1 + 1] = (UINT16) ((Start[LoopVar1] + mLenCnt[LoopVar1]) << 1); - } - - for (LoopVar1 = 0; LoopVar1 < LoopVar8; LoopVar1++) { - Code[LoopVar1] = Start[Len[LoopVar1]]++; - } -} - -/** - Generates Huffman codes given a frequency distribution of symbols. - - @param[in] NParm The number of symbols. - @param[in] FreqParm The frequency of each symbol. - @param[out] LenParm The code length for each symbol. - @param[out] CodeParm The code for each symbol. - - @return The root of the Huffman tree. -**/ -INT32 -MakeTree ( - IN INT32 NParm, - IN UINT16 FreqParm[ ], - OUT UINT8 LenParm[ ], - OUT UINT16 CodeParm[ ] - ) -{ - INT32 LoopVar1; - - INT32 LoopVar2; - - INT32 LoopVar3; - - INT32 Avail; - - // - // make tree, calculate len[], return root - // - mTempInt32 = NParm; - mFreq = FreqParm; - mLen = LenParm; - Avail = mTempInt32; - mHeapSize = 0; - mHeap[1] = 0; - for (LoopVar1 = 0; LoopVar1 < mTempInt32; LoopVar1++) { - mLen[LoopVar1] = 0; - if ((mFreq[LoopVar1]) != 0) { - mHeapSize++; - mHeap[mHeapSize] = (INT16) LoopVar1; - } - } - - if (mHeapSize < 2) { - CodeParm[mHeap[1]] = 0; - return mHeap[1]; - } - - for (LoopVar1 = mHeapSize / 2; LoopVar1 >= 1; LoopVar1--) { - // - // make priority queue - // - DownHeap (LoopVar1); - } - - mSortPtr = CodeParm; - do { - LoopVar1 = mHeap[1]; - if (LoopVar1 < mTempInt32) { - *mSortPtr++ = (UINT16) LoopVar1; - } - - mHeap[1] = mHeap[mHeapSize--]; - DownHeap (1); - LoopVar2 = mHeap[1]; - if (LoopVar2 < mTempInt32) { - *mSortPtr++ = (UINT16) LoopVar2; - } - - LoopVar3 = Avail++; - mFreq[LoopVar3] = (UINT16) (mFreq[LoopVar1] + mFreq[LoopVar2]); - mHeap[1] = (INT16) LoopVar3; - DownHeap (1); - mLeft[LoopVar3] = (UINT16) LoopVar1; - mRight[LoopVar3] = (UINT16) LoopVar2; - } while (mHeapSize > 1); - - mSortPtr = CodeParm; - MakeLen (LoopVar3); - MakeCode (NParm, LenParm, CodeParm); - - // - // return root - // - return LoopVar3; -} - -/** - Outputs rightmost LoopVar8 bits of x - - @param[in] LoopVar8 The rightmost LoopVar8 bits of the data is used. - @param[in] x The data. -**/ -VOID -PutBits ( - IN INT32 LoopVar8, - IN UINT32 x - ) -{ - UINT8 Temp; - - if (LoopVar8 < mBitCount) { - mSubBitBuf |= x << (mBitCount -= LoopVar8); - } else { - - Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount))); - if (mDst < mDstUpperLimit) { - *mDst++ = Temp; - } - mCompSize++; - - if (LoopVar8 < UINT8_BIT) { - mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8); - } else { - - Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT)); - if (mDst < mDstUpperLimit) { - *mDst++ = Temp; - } - mCompSize++; - - mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - LoopVar8); - } - } -} - -/** - Encode a signed 32 bit number. - - @param[in] LoopVar5 The number to encode. -**/ -VOID -EncodeC ( - IN INT32 LoopVar5 - ) -{ - PutBits (mCLen[LoopVar5], mCCode[LoopVar5]); -} - -/** - Encode a unsigned 32 bit number. - - @param[in] LoopVar7 The number to encode. -**/ -VOID -EncodeP ( - IN UINT32 LoopVar7 - ) -{ - UINT32 LoopVar5; - - UINT32 LoopVar6; - - LoopVar5 = 0; - LoopVar6 = LoopVar7; - while (LoopVar6 != 0) { - LoopVar6 >>= 1; - LoopVar5++; - } - - PutBits (mPTLen[LoopVar5], mPTCode[LoopVar5]); - if (LoopVar5 > 1) { - PutBits(LoopVar5 - 1, LoopVar7 & (0xFFFFU >> (17 - LoopVar5))); - } -} - -/** - Count the frequencies for the Extra Set. - -**/ -VOID -CountTFreq ( - VOID - ) -{ - INT32 LoopVar1; - - INT32 LoopVar3; - - INT32 LoopVar8; - - INT32 Count; - - for (LoopVar1 = 0; LoopVar1 < NT; LoopVar1++) { - mTFreq[LoopVar1] = 0; - } - - LoopVar8 = NC; - while (LoopVar8 > 0 && mCLen[LoopVar8 - 1] == 0) { - LoopVar8--; - } - - LoopVar1 = 0; - while (LoopVar1 < LoopVar8) { - LoopVar3 = mCLen[LoopVar1++]; - if (LoopVar3 == 0) { - Count = 1; - while (LoopVar1 < LoopVar8 && mCLen[LoopVar1] == 0) { - LoopVar1++; - Count++; - } - - if (Count <= 2) { - mTFreq[0] = (UINT16) (mTFreq[0] + Count); - } else if (Count <= 18) { - mTFreq[1]++; - } else if (Count == 19) { - mTFreq[0]++; - mTFreq[1]++; - } else { - mTFreq[2]++; - } - } else { - ASSERT((LoopVar3+2)<(2 * NT - 1)); - mTFreq[LoopVar3 + 2]++; - } - } -} - -/** - Outputs the code length array for the Extra Set or the Position Set. - - @param[in] LoopVar8 The number of symbols. - @param[in] nbit The number of bits needed to represent 'LoopVar8'. - @param[in] Special The special symbol that needs to be take care of. - -**/ -VOID -WritePTLen ( - IN INT32 LoopVar8, - IN INT32 nbit, - IN INT32 Special - ) -{ - INT32 LoopVar1; - - INT32 LoopVar3; - - while (LoopVar8 > 0 && mPTLen[LoopVar8 - 1] == 0) { - LoopVar8--; - } - - PutBits (nbit, LoopVar8); - LoopVar1 = 0; - while (LoopVar1 < LoopVar8) { - LoopVar3 = mPTLen[LoopVar1++]; - if (LoopVar3 <= 6) { - PutBits (3, LoopVar3); - } else { - PutBits (LoopVar3 - 3, (1U << (LoopVar3 - 3)) - 2); - } - - if (LoopVar1 == Special) { - while (LoopVar1 < 6 && mPTLen[LoopVar1] == 0) { - LoopVar1++; - } - - PutBits (2, (LoopVar1 - 3) & 3); - } - } -} - -/** - Outputs the code length array for Char&Length Set. -**/ -VOID -WriteCLen ( - VOID - ) -{ - INT32 LoopVar1; - - INT32 LoopVar3; - - INT32 LoopVar8; - - INT32 Count; - - LoopVar8 = NC; - while (LoopVar8 > 0 && mCLen[LoopVar8 - 1] == 0) { - LoopVar8--; - } - - PutBits (CBIT, LoopVar8); - LoopVar1 = 0; - while (LoopVar1 < LoopVar8) { - LoopVar3 = mCLen[LoopVar1++]; - if (LoopVar3 == 0) { - Count = 1; - while (LoopVar1 < LoopVar8 && mCLen[LoopVar1] == 0) { - LoopVar1++; - Count++; - } - - if (Count <= 2) { - for (LoopVar3 = 0; LoopVar3 < Count; LoopVar3++) { - PutBits (mPTLen[0], mPTCode[0]); - } - } else if (Count <= 18) { - PutBits (mPTLen[1], mPTCode[1]); - PutBits (4, Count - 3); - } else if (Count == 19) { - PutBits (mPTLen[0], mPTCode[0]); - PutBits (mPTLen[1], mPTCode[1]); - PutBits (4, 15); - } else { - PutBits (mPTLen[2], mPTCode[2]); - PutBits (CBIT, Count - 20); - } - } else { - ASSERT((LoopVar3+2)= NC) { - CountTFreq (); - Root = MakeTree (NT, mTFreq, mPTLen, mPTCode); - if (Root >= NT) { - WritePTLen (NT, TBIT, 3); - } else { - PutBits (TBIT, 0); - PutBits (TBIT, Root); - } - - WriteCLen (); - } else { - PutBits (TBIT, 0); - PutBits (TBIT, 0); - PutBits (CBIT, 0); - PutBits (CBIT, Root); - } - - Root = MakeTree (NP, mPFreq, mPTLen, mPTCode); - if (Root >= NP) { - WritePTLen (NP, PBIT, -1); - } else { - PutBits (PBIT, 0); - PutBits (PBIT, Root); - } - - Pos = 0; - for (LoopVar1 = 0; LoopVar1 < Size; LoopVar1++) { - if (LoopVar1 % UINT8_BIT == 0) { - Flags = mBuf[Pos++]; - } else { - Flags <<= 1; - } - if ((Flags & (1U << (UINT8_BIT - 1))) != 0){ - EncodeC(mBuf[Pos++] + (1U << UINT8_BIT)); - LoopVar3 = mBuf[Pos++] << UINT8_BIT; - LoopVar3 += mBuf[Pos++]; - - EncodeP (LoopVar3); - } else { - EncodeC (mBuf[Pos++]); - } - } - - SetMem (mCFreq, NC * sizeof (UINT16), 0); - SetMem (mPFreq, NP * sizeof (UINT16), 0); -} - -/** - Start the huffman encoding. - -**/ -VOID -HufEncodeStart ( - VOID - ) -{ - SetMem (mCFreq, NC * sizeof (UINT16), 0); - SetMem (mPFreq, NP * sizeof (UINT16), 0); - - mOutputPos = mOutputMask = 0; - - mBitCount = UINT8_BIT; - mSubBitBuf = 0; -} - -/** - Outputs an Original Character or a Pointer. - - @param[in] LoopVar5 The original character or the 'String Length' element of - a Pointer. - @param[in] LoopVar7 The 'Position' field of a Pointer. -**/ -VOID -CompressOutput ( - IN UINT32 LoopVar5, - IN UINT32 LoopVar7 - ) -{ - STATIC UINT32 CPos; - - if ((mOutputMask >>= 1) == 0) { - mOutputMask = 1U << (UINT8_BIT - 1); - if (mOutputPos >= mBufSiz - 3 * UINT8_BIT) { - SendBlock (); - mOutputPos = 0; - } - - CPos = mOutputPos++; - mBuf[CPos] = 0; - } - mBuf[mOutputPos++] = (UINT8) LoopVar5; - mCFreq[LoopVar5]++; - if (LoopVar5 >= (1U << UINT8_BIT)) { - mBuf[CPos] = (UINT8)(mBuf[CPos]|mOutputMask); - mBuf[mOutputPos++] = (UINT8)(LoopVar7 >> UINT8_BIT); - mBuf[mOutputPos++] = (UINT8) LoopVar7; - LoopVar5 = 0; - while (LoopVar7!=0) { - LoopVar7 >>= 1; - LoopVar5++; - } - mPFreq[LoopVar5]++; - } -} - -/** - End the huffman encoding. - -**/ -VOID -HufEncodeEnd ( - VOID - ) -{ - SendBlock (); - - // - // Flush remaining bits - // - PutBits (UINT8_BIT - 1, 0); -} - -/** - The main controlling routine for compression process. - - @retval EFI_SUCCESS The compression is successful. - @retval EFI_OUT_0F_RESOURCES Not enough memory for compression process. -**/ -EFI_STATUS -Encode ( - VOID - ) -{ - EFI_STATUS Status; - INT32 LastMatchLen; - NODE LastMatchPos; - - Status = AllocateMemory (); - if (EFI_ERROR (Status)) { - FreeMemory (); - return Status; - } - - InitSlide (); - - HufEncodeStart (); - - mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH); - - mMatchLen = 0; - mPos = WNDSIZ; - InsertNode (); - if (mMatchLen > mRemainder) { - mMatchLen = mRemainder; - } - - while (mRemainder > 0) { - LastMatchLen = mMatchLen; - LastMatchPos = mMatchPos; - if (!GetNextMatch ()) { - Status = EFI_OUT_OF_RESOURCES; - } - if (mMatchLen > mRemainder) { - mMatchLen = mRemainder; - } - - if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) { - // - // Not enough benefits are gained by outputting a pointer, - // so just output the original character - // - CompressOutput(mText[mPos - 1], 0); - } else { - // - // Outputting a pointer is beneficial enough, do it. - // - - CompressOutput(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD), - (mPos - LastMatchPos - 2) & (WNDSIZ - 1)); - LastMatchLen--; - while (LastMatchLen > 0) { - if (!GetNextMatch ()) { - Status = EFI_OUT_OF_RESOURCES; - } - LastMatchLen--; - } - - if (mMatchLen > mRemainder) { - mMatchLen = mRemainder; - } - } - } - - HufEncodeEnd (); - FreeMemory (); - return (Status); -} - -/** - The compression routine. - - @param[in] SrcBuffer The buffer containing the source data. - @param[in] SrcSize Number of bytes in SrcBuffer. - @param[in] DstBuffer The buffer to put the compressed image in. - @param[in, out] DstSize On input the size (in bytes) of DstBuffer, on - return the number of bytes placed in DstBuffer. - - @retval EFI_SUCCESS The compression was sucessful. - @retval EFI_BUFFER_TOO_SMALL The buffer was too small. DstSize is required. -**/ -EFI_STATUS -Compress ( - IN VOID *SrcBuffer, - IN UINT64 SrcSize, - IN VOID *DstBuffer, - IN OUT UINT64 *DstSize - ) -{ - EFI_STATUS Status; - - // - // Initializations - // - mBufSiz = 0; - mBuf = NULL; - mText = NULL; - mLevel = NULL; - mChildCount = NULL; - mPosition = NULL; - mParent = NULL; - mPrev = NULL; - mNext = NULL; - - mSrc = SrcBuffer; - mSrcUpperLimit = mSrc + SrcSize; - mDst = DstBuffer; - mDstUpperLimit = mDst +*DstSize; - - PutDword (0L); - PutDword (0L); - - MakeCrcTable (); - - mOrigSize = mCompSize = 0; - mCrc = INIT_CRC; - - // - // Compress it - // - Status = Encode (); - if (EFI_ERROR (Status)) { - return EFI_OUT_OF_RESOURCES; - } - // - // Null terminate the compressed data - // - if (mDst < mDstUpperLimit) { - *mDst++ = 0; - } - // - // Fill in compressed size and original size - // - mDst = DstBuffer; - PutDword (mCompSize + 1); - PutDword (mOrigSize); - - // - // Return - // - if (mCompSize + 1 + 8 > *DstSize) { - *DstSize = mCompSize + 1 + 8; - return EFI_BUFFER_TOO_SMALL; - } else { - *DstSize = mCompSize + 1 + 8; - return EFI_SUCCESS; - } - -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h deleted file mode 100644 index b76a151..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h +++ /dev/null @@ -1,39 +0,0 @@ -/** @file - Header file for compression routine. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EFI_SHELL_COMPRESS_H_ -#define _EFI_SHELL_COMPRESS_H_ - -/** - The compression routine. - - @param[in] SrcBuffer The buffer containing the source data. - @param[in] SrcSize Number of bytes in SrcBuffer. - @param[in] DstBuffer The buffer to put the compressed image in. - @param[in, out] DstSize On input the size (in bytes) of DstBuffer, on - return the number of bytes placed in DstBuffer. - - @retval EFI_SUCCESS The compression was sucessful. - @retval EFI_BUFFER_TOO_SMALL The buffer was too small. DstSize is required. -**/ -EFI_STATUS -Compress ( - IN VOID *SrcBuffer, - IN UINT64 SrcSize, - IN VOID *DstBuffer, - IN OUT UINT64 *DstSize - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c deleted file mode 100644 index a79c9f9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c +++ /dev/null @@ -1,207 +0,0 @@ -/** @file - Main file for Dblk shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include - -/** - Display blocks to the screen. - - @param[in] DevPath The device path to get the blocks from. - @param[in] Lba The Lba number to start from. - @param[in] BlockCount How many blocks to display. - - @retval SHELL_SUCCESS The display was successful. -**/ -SHELL_STATUS -DisplayTheBlocks( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath, - IN CONST UINT64 Lba, - IN CONST UINT8 BlockCount - ) -{ - EFI_BLOCK_IO_PROTOCOL *BlockIo; - EFI_HANDLE BlockIoHandle; - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - UINT8 *Buffer; - UINT8 *OriginalBuffer; - UINTN BufferSize; - - ShellStatus = SHELL_SUCCESS; - - Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL **)&DevPath, &BlockIoHandle); - if (EFI_ERROR(Status)) { - return (SHELL_NOT_FOUND); - } - - Status = gBS->OpenProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID**)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - return (SHELL_NOT_FOUND); - } - - BufferSize = BlockIo->Media->BlockSize * BlockCount; - if(BlockIo->Media->IoAlign == 0) { - BlockIo->Media->IoAlign = 1; - } - - if (BufferSize > 0) { - OriginalBuffer = AllocateZeroPool(BufferSize + BlockIo->Media->IoAlign); - Buffer = ALIGN_POINTER (OriginalBuffer,BlockIo->Media->IoAlign); - } else { - ShellPrintEx(-1,-1,L" BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount); - OriginalBuffer = NULL; - Buffer = NULL; - } - - Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer); - if (!EFI_ERROR(Status) && Buffer != NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DBLK_HEADER), - gShellDebug1HiiHandle, - Lba, - BufferSize, - BlockIo - ); - - DumpHex(2,0,BufferSize,Buffer); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"dblk", L"BlockIo"); - ShellStatus = SHELL_DEVICE_ERROR; - } - - if (OriginalBuffer != NULL) { - FreePool (OriginalBuffer); - } - - gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL); - return (ShellStatus); -} - -/** - Function for 'dblk' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDblk ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *BlockName; - CONST CHAR16 *LbaString; - CONST CHAR16 *BlockCountString; - UINT64 Lba; - UINT64 BlockCount; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dblk"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"dblk"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Parse the params - // - BlockName = ShellCommandLineGetRawValue(Package, 1); - LbaString = ShellCommandLineGetRawValue(Package, 2); - BlockCountString = ShellCommandLineGetRawValue(Package, 3); - - if (LbaString == NULL) { - Lba = 0; - } else { - if (!ShellIsHexOrDecimalNumber(LbaString, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ShellConvertStringToUint64(LbaString, &Lba, TRUE, FALSE); - } - - if (BlockCountString == NULL) { - BlockCount = 1; - } else { - if (!ShellIsHexOrDecimalNumber(BlockCountString, TRUE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ShellConvertStringToUint64(BlockCountString, &BlockCount, TRUE, FALSE); - if (BlockCount > 0x10) { - BlockCount = 0x10; - } else if (BlockCount == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // do the work if we have a valid block identifier - // - if (gEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - DevPath = (EFI_DEVICE_PATH_PROTOCOL*)gEfiShellProtocol->GetDevicePathFromMap(BlockName); - if (gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, L"dblk", BlockName, L"BlockIo"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellStatus = DisplayTheBlocks(gEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, (UINT8)BlockCount); - } - } - } - } - - ShellCommandLineFreeVarList (Package); - } - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c deleted file mode 100644 index 93f6c03..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ /dev/null @@ -1,233 +0,0 @@ -/** @file - Main file for Dmem shell Debug1 function. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include -#include -#include -#include -#include - -/** - Make a printable character. - - If Char is printable then return it, otherwise return a question mark. - - @param[in] Char The character to make printable. - - @return A printable character representing Char. -**/ -CHAR16 -MakePrintable( - IN CONST CHAR16 Char - ) -{ - if ((Char < 0x20 && Char > 0)||(Char > 126)) { - return (L'?'); - } - return (Char); -} - -/** - Display some Memory-Mapped-IO memory. - - @param[in] Address The starting address to display. - @param[in] Size The length of memory to display. -**/ -SHELL_STATUS -DisplayMmioMemory( - IN CONST VOID *Address, - IN CONST UINTN Size - ) -{ - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo; - EFI_STATUS Status; - VOID *Buffer; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - - Status = gBS->LocateProtocol(&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**)&PciRbIo); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem"); - return (SHELL_NOT_FOUND); - } - Buffer = AllocateZeroPool(Size); - if (Buffer == NULL) { - return SHELL_OUT_OF_RESOURCES; - } - - Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem"); - ShellStatus = SHELL_NOT_FOUND; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size); - DumpHex(2, (UINTN)Address, Size, Buffer); - } - - FreePool(Buffer); - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-mmio", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'dmem' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDmem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - VOID *Address; - UINT64 Size; - CONST CHAR16 *Temp1; - UINT64 AcpiTableAddress; - UINT64 Acpi20TableAddress; - UINT64 SalTableAddress; - UINT64 SmbiosTableAddress; - UINT64 MpsTableAddress; - UINTN TableWalker; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Address = NULL; - Size = 0; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Temp1 = ShellCommandLineGetRawValue(Package, 1); - if (Temp1 == NULL) { - Address = gST; - Size = sizeof (*gST); - } else { - if (!ShellIsHexOrDecimalNumber(Temp1, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, (UINT64*)&Address, TRUE, FALSE))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1); - ShellStatus = SHELL_INVALID_PARAMETER; - } - Temp1 = ShellCommandLineGetRawValue(Package, 2); - if (Temp1 == NULL) { - Size = 512; - } else { - if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, &Size, TRUE, FALSE))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } - - if (ShellStatus == SHELL_SUCCESS) { - if (!ShellCommandLineGetFlag(Package, L"-mmio")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size); - DumpHex(2, (UINTN)Address, (UINTN)Size, Address); - if (Address == (VOID*)gST) { - Acpi20TableAddress = 0; - AcpiTableAddress = 0; - SalTableAddress = 0; - SmbiosTableAddress = 0; - MpsTableAddress = 0; - for (TableWalker = 0 ; TableWalker < gST->NumberOfTableEntries ; TableWalker++) { - if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) { - Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) { - AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSalSystemTableGuid)) { - SalTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) { - SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) { - SmbiosTableAddress = (UINT64) (UINTN) gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) { - MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable; - continue; - } - } - - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_SYSTEM_TABLE), gShellDebug1HiiHandle, - (UINT64)(UINTN)Address, - gST->Hdr.HeaderSize, - gST->Hdr.Revision, - (UINT64)(UINTN)gST->ConIn, - (UINT64)(UINTN)gST->ConOut, - (UINT64)(UINTN)gST->StdErr, - (UINT64)(UINTN)gST->RuntimeServices, - (UINT64)(UINTN)gST->BootServices, - SalTableAddress, - AcpiTableAddress, - Acpi20TableAddress, - MpsTableAddress, - SmbiosTableAddress - ); - } - } else { - ShellStatus = DisplayMmioMemory(Address, (UINTN)Size); - } - } - - - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c deleted file mode 100644 index acfc8a3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c +++ /dev/null @@ -1,865 +0,0 @@ -/** @file - Main file for DmpStore shell Debug1 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" - -typedef enum { - DmpStoreDisplay, - DmpStoreDelete, - DmpStoreSave, - DmpStoreLoad -} DMP_STORE_TYPE; - -typedef struct { - UINT32 Signature; - CHAR16 *Name; - EFI_GUID Guid; - UINT32 Attributes; - UINT32 DataSize; - UINT8 *Data; - LIST_ENTRY Link; -} DMP_STORE_VARIABLE; - -#define DMP_STORE_VARIABLE_SIGNATURE SIGNATURE_32 ('_', 'd', 's', 's') - -/** - Base on the input attribute value to return the attribute string. - - @param[in] Atts The input attribute value - - @retval The attribute string info. -**/ -CHAR16 * -GetAttrType ( - IN CONST UINT32 Atts - ) -{ - UINTN BufLen; - CHAR16 *RetString; - - BufLen = 0; - RetString = NULL; - - if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+NV", 0); - } - if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0); - } else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+BS", 0); - } - if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+HR", 0); - } - if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+AW", 0); - } - if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) { - StrnCatGrow (&RetString, &BufLen, L"+AT", 0); - } - - if (RetString == NULL) { - RetString = StrnCatGrow(&RetString, &BufLen, L"Invalid", 0); - } - - if ((RetString != NULL) && (RetString[0] == L'+')) { - CopyMem(RetString, RetString + 1, StrSize(RetString + 1)); - } - - return RetString; -} - -/** - Convert binary to hex format string. - - @param[in] Buffer The binary data. - @param[in] BufferSize The size in bytes of the binary data. - @param[in, out] HexString Hex format string. - @param[in] HexStringSize The size in bytes of the string. - - @return The hex format string. -**/ -CHAR16* -BinaryToHexString ( - IN VOID *Buffer, - IN UINTN BufferSize, - IN OUT CHAR16 *HexString, - IN UINTN HexStringSize - ) -{ - UINTN Index; - UINTN StringIndex; - - ASSERT (Buffer != NULL); - ASSERT ((BufferSize * 2 + 1) * sizeof (CHAR16) <= HexStringSize); - - for (Index = 0, StringIndex = 0; Index < BufferSize; Index += 1) { - StringIndex += - UnicodeSPrint ( - &HexString[StringIndex], - HexStringSize - StringIndex * sizeof (CHAR16), - L"%02x", - ((UINT8 *) Buffer)[Index] - ); - } - return HexString; -} - -/** - Load the variable data from file and set to variable data base. - - @param[in] FileHandle The file to be read. - @param[in] Name The name of the variables to be loaded. - @param[in] Guid The guid of the variables to be loaded. - @param[out] Found TRUE when at least one variable was loaded and set. - - @retval SHELL_DEVICE_ERROR Cannot access the file. - @retval SHELL_VOLUME_CORRUPTED The file is in bad format. - @retval SHELL_OUT_OF_RESOURCES There is not enough memory to perform the operation. - @retval SHELL_SUCCESS Successfully load and set the variables. -**/ -SHELL_STATUS -LoadVariablesFromFile ( - IN SHELL_FILE_HANDLE FileHandle, - IN CONST CHAR16 *Name, - IN CONST EFI_GUID *Guid, - OUT BOOLEAN *Found - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - UINT32 NameSize; - UINT32 DataSize; - UINTN BufferSize; - UINTN RemainingSize; - UINT64 Position; - UINT64 FileSize; - LIST_ENTRY List; - DMP_STORE_VARIABLE *Variable; - LIST_ENTRY *Link; - CHAR16 *Attributes; - UINT8 *Buffer; - UINT32 Crc32; - - Status = ShellGetFileSize (FileHandle, &FileSize); - if (EFI_ERROR (Status)) { - return SHELL_DEVICE_ERROR; - } - - ShellStatus = SHELL_SUCCESS; - - InitializeListHead (&List); - - Position = 0; - while (Position < FileSize) { - // - // NameSize - // - BufferSize = sizeof (NameSize); - Status = ShellReadFile (FileHandle, &BufferSize, &NameSize); - if (EFI_ERROR (Status) || (BufferSize != sizeof (NameSize))) { - ShellStatus = SHELL_VOLUME_CORRUPTED; - break; - } - - // - // DataSize - // - BufferSize = sizeof (DataSize); - Status = ShellReadFile (FileHandle, &BufferSize, &DataSize); - if (EFI_ERROR (Status) || (BufferSize != sizeof (DataSize))) { - ShellStatus = SHELL_VOLUME_CORRUPTED; - break; - } - - // - // Name, Guid, Attributes, Data, Crc32 - // - RemainingSize = NameSize + sizeof (EFI_GUID) + sizeof (UINT32) + DataSize + sizeof (Crc32); - BufferSize = sizeof (NameSize) + sizeof (DataSize) + RemainingSize; - Buffer = AllocatePool (BufferSize); - if (Buffer == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - break; - } - BufferSize = RemainingSize; - Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *) Buffer + 2); - if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) { - ShellStatus = SHELL_VOLUME_CORRUPTED; - FreePool (Buffer); - break; - } - - // - // Check Crc32 - // - * (UINT32 *) Buffer = NameSize; - * ((UINT32 *) Buffer + 1) = DataSize; - BufferSize = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32); - gBS->CalculateCrc32 ( - Buffer, - BufferSize, - &Crc32 - ); - if (Crc32 != * (UINT32 *) (Buffer + BufferSize)) { - FreePool (Buffer); - ShellStatus = SHELL_VOLUME_CORRUPTED; - break; - } - - Position += BufferSize + sizeof (Crc32); - - Variable = AllocateZeroPool (sizeof (*Variable) + NameSize + DataSize); - if (Variable == NULL) { - FreePool (Buffer); - ShellStatus = SHELL_OUT_OF_RESOURCES; - break; - } - Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE; - Variable->Name = (CHAR16 *) (Variable + 1); - Variable->DataSize = DataSize; - Variable->Data = (UINT8 *) Variable->Name + NameSize; - CopyMem (Variable->Name, Buffer + sizeof (NameSize) + sizeof (DataSize), NameSize); - CopyMem (&Variable->Guid, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize, sizeof (EFI_GUID)); - CopyMem (&Variable->Attributes, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID), sizeof (UINT32)); - CopyMem (Variable->Data, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize); - - InsertTailList (&List, &Variable->Link); - FreePool (Buffer); - } - - if ((Position != FileSize) || (ShellStatus != SHELL_SUCCESS)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle, L"dmpstore"); - if (Position != FileSize) { - ShellStatus = SHELL_VOLUME_CORRUPTED; - } - } - - for ( Link = GetFirstNode (&List) - ; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS) - ; Link = GetNextNode (&List, Link) - ) { - Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE); - - if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *) Name)) && - ((Guid == NULL) || CompareGuid (&Variable->Guid, Guid)) - ) { - Attributes = GetAttrType (Variable->Attributes); - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle, - Attributes, &Variable->Guid, Variable->Name, Variable->DataSize - ); - SHELL_FREE_NON_NULL(Attributes); - - *Found = TRUE; - Status = gRT->SetVariable ( - Variable->Name, - &Variable->Guid, - Variable->Attributes, - Variable->DataSize, - Variable->Data - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", Variable->Name, Status); - } - } - } - - for (Link = GetFirstNode (&List); !IsNull (&List, Link); ) { - Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE); - Link = RemoveEntryList (&Variable->Link); - FreePool (Variable); - } - - return ShellStatus; -} - -/** - Append one variable to file. - - @param[in] FileHandle The file to be appended. - @param[in] Name The variable name. - @param[in] Guid The variable GUID. - @param[in] Attributes The variable attributes. - @param[in] DataSize The variable data size. - @param[in] Data The variable data. - - @retval EFI_OUT_OF_RESOURCES There is not enough memory to perform the operation. - @retval EFI_SUCCESS The variable is appended to file successfully. - @retval others Failed to append the variable to file. -**/ -EFI_STATUS -AppendSingleVariableToFile ( - IN SHELL_FILE_HANDLE FileHandle, - IN CONST CHAR16 *Name, - IN CONST EFI_GUID *Guid, - IN UINT32 Attributes, - IN UINT32 DataSize, - IN CONST UINT8 *Data - ) -{ - UINT32 NameSize; - UINT8 *Buffer; - UINT8 *Ptr; - UINTN BufferSize; - EFI_STATUS Status; - - NameSize = (UINT32) StrSize (Name); - BufferSize = sizeof (NameSize) + sizeof (DataSize) - + sizeof (*Guid) - + sizeof (Attributes) - + NameSize + DataSize - + sizeof (UINT32); - - Buffer = AllocatePool (BufferSize); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Ptr = Buffer; - // - // NameSize and DataSize - // - * (UINT32 *) Ptr = NameSize; - Ptr += sizeof (NameSize); - *(UINT32 *) Ptr = DataSize; - Ptr += sizeof (DataSize); - - // - // Name - // - CopyMem (Ptr, Name, NameSize); - Ptr += NameSize; - - // - // Guid - // - CopyMem (Ptr, Guid, sizeof (*Guid)); - Ptr += sizeof (*Guid); - - // - // Attributes - // - * (UINT32 *) Ptr = Attributes; - Ptr += sizeof (Attributes); - - // - // Data - // - CopyMem (Ptr, Data, DataSize); - Ptr += DataSize; - - // - // Crc32 - // - gBS->CalculateCrc32 (Buffer, (UINTN) Ptr - (UINTN) Buffer, (UINT32 *) Ptr); - - Status = ShellWriteFile (FileHandle, &BufferSize, Buffer); - FreePool (Buffer); - - if (!EFI_ERROR (Status) && - (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32)) - ) { - Status = EFI_DEVICE_ERROR; - } - - return Status; -} - -/** - Recursive function to display or delete variables. - - This function will call itself to create a stack-based list of allt he variables to process, - then fromt he last to the first, they will do either printing or deleting. - - This is necessary since once a delete happens GetNextVariableName() will work. - - @param[in] Name The variable name of the EFI variable (or NULL). - @param[in] Guid The GUID of the variable set (or NULL). - @param[in] Type The operation type. - @param[in] FileHandle The file to operate on (or NULL). - @param[in] PrevName The previous variable name from GetNextVariableName. L"" to start. - @param[in] FoundVarGuid The previous GUID from GetNextVariableName. ignored at start. - @param[in] FoundOne If a VariableName or Guid was specified and one was printed or - deleted, then set this to TRUE, otherwise ignored. - @param[in] StandardFormatOutput TRUE indicates Standard-Format Output. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_OUT_OF_RESOURCES A memorty allocation failed. - @retval SHELL_ABORTED The abort message was received. - @retval SHELL_DEVICE_ERROR UEFI Variable Services returned an error. - @retval SHELL_NOT_FOUND the Name/Guid pair could not be found. -**/ -SHELL_STATUS -CascadeProcessVariables ( - IN CONST CHAR16 *Name OPTIONAL, - IN CONST EFI_GUID *Guid OPTIONAL, - IN DMP_STORE_TYPE Type, - IN EFI_FILE_PROTOCOL *FileHandle OPTIONAL, - IN CONST CHAR16 * CONST PrevName, - IN EFI_GUID FoundVarGuid, - IN BOOLEAN *FoundOne, - IN BOOLEAN StandardFormatOutput - ) -{ - EFI_STATUS Status; - CHAR16 *FoundVarName; - UINT8 *DataBuffer; - UINTN DataSize; - UINT32 Atts; - SHELL_STATUS ShellStatus; - UINTN NameSize; - CHAR16 *AttrString; - CHAR16 *HexString; - EFI_STATUS SetStatus; - CONST CHAR16 *GuidName; - - if (ShellGetExecutionBreakFlag()) { - return (SHELL_ABORTED); - } - - NameSize = 0; - FoundVarName = NULL; - - if (PrevName!=NULL) { - StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0); - } else { - FoundVarName = AllocateZeroPool(sizeof(CHAR16)); - NameSize = sizeof(CHAR16); - } - - Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid); - if (Status == EFI_BUFFER_TOO_SMALL) { - SHELL_FREE_NON_NULL(FoundVarName); - FoundVarName = AllocateZeroPool (NameSize); - if (FoundVarName != NULL) { - if (PrevName != NULL) { - StrnCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName, NameSize/sizeof(CHAR16) - 1); - } - - Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid); - } else { - Status = EFI_OUT_OF_RESOURCES; - } - } - - // - // No more is fine. - // - if (Status == EFI_NOT_FOUND) { - SHELL_FREE_NON_NULL(FoundVarName); - return (SHELL_SUCCESS); - } else if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(FoundVarName); - return (SHELL_DEVICE_ERROR); - } - - // - // Recurse to the next iteration. We know "our" variable's name. - // - ShellStatus = CascadeProcessVariables (Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne, StandardFormatOutput); - - if (ShellGetExecutionBreakFlag() || (ShellStatus == SHELL_ABORTED)) { - SHELL_FREE_NON_NULL(FoundVarName); - return (SHELL_ABORTED); - } - - // - // No matter what happened we process our own variable - // Only continue if Guid and VariableName are each either NULL or a match - // - if ( ( Name == NULL - || gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*) Name) ) - && ( Guid == NULL - || CompareGuid(&FoundVarGuid, Guid) ) - ) { - DataSize = 0; - DataBuffer = NULL; - // - // do the print or delete - // - *FoundOne = TRUE; - Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - SHELL_FREE_NON_NULL (DataBuffer); - DataBuffer = AllocatePool (DataSize); - if (DataBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer); - } - } - // - // Last error check then print this variable out. - // - if (Type == DmpStoreDisplay) { - if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) { - AttrString = GetAttrType(Atts); - if (StandardFormatOutput) { - HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16)); - if (HexString != NULL) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_VAR_SFO), gShellDebug1HiiHandle, - FoundVarName, &FoundVarGuid, Atts, DataSize, - BinaryToHexString ( - DataBuffer, DataSize, HexString, (DataSize * 2 + 1) * sizeof (CHAR16) - ) - ); - FreePool (HexString); - } else { - Status = EFI_OUT_OF_RESOURCES; - } - } else { - Status = gEfiShellProtocol->GetGuidName(&FoundVarGuid, &GuidName); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle, - AttrString, &FoundVarGuid, FoundVarName, DataSize - ); - } else { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2), gShellDebug1HiiHandle, - AttrString, GuidName, FoundVarName, DataSize - ); - } - DumpHex (2, 0, DataSize, DataBuffer); - } - SHELL_FREE_NON_NULL (AttrString); - } - } else if (Type == DmpStoreSave) { - if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) { - AttrString = GetAttrType (Atts); - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle, - AttrString, &FoundVarGuid, FoundVarName, DataSize - ); - Status = AppendSingleVariableToFile ( - FileHandle, - FoundVarName, - &FoundVarGuid, - Atts, - (UINT32) DataSize, - DataBuffer - ); - SHELL_FREE_NON_NULL (AttrString); - } - } else if (Type == DmpStoreDelete) { - // - // We only need name to delete it... - // - SetStatus = gRT->SetVariable (FoundVarName, &FoundVarGuid, Atts, 0, NULL); - if (StandardFormatOutput) { - if (SetStatus == EFI_SUCCESS) { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO), gShellDebug1HiiHandle, - FoundVarName, &FoundVarGuid - ); - } - } else { - ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_DELETE_LINE), gShellDebug1HiiHandle, - &FoundVarGuid, FoundVarName, SetStatus - ); - } - } - SHELL_FREE_NON_NULL(DataBuffer); - } - - SHELL_FREE_NON_NULL(FoundVarName); - - if (Status == EFI_DEVICE_ERROR) { - ShellStatus = SHELL_DEVICE_ERROR; - } else if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_READY; - } - - return (ShellStatus); -} - -/** - Function to display or delete variables. This will set up and call into the recursive function. - - @param[in] Name The variable name of the EFI variable (or NULL). - @param[in] Guid The GUID of the variable set (or NULL). - @param[in] Type The operation type. - @param[in] FileHandle The file to save or load variables. - @param[in] StandardFormatOutput TRUE indicates Standard-Format Output. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_OUT_OF_RESOURCES A memorty allocation failed. - @retval SHELL_ABORTED The abort message was received. - @retval SHELL_DEVICE_ERROR UEFI Variable Services returned an error. - @retval SHELL_NOT_FOUND the Name/Guid pair could not be found. -**/ -SHELL_STATUS -ProcessVariables ( - IN CONST CHAR16 *Name OPTIONAL, - IN CONST EFI_GUID *Guid OPTIONAL, - IN DMP_STORE_TYPE Type, - IN SHELL_FILE_HANDLE FileHandle OPTIONAL, - IN BOOLEAN StandardFormatOutput - ) -{ - SHELL_STATUS ShellStatus; - BOOLEAN Found; - EFI_GUID FoundVarGuid; - - Found = FALSE; - ShellStatus = SHELL_SUCCESS; - ZeroMem (&FoundVarGuid, sizeof(EFI_GUID)); - - if (StandardFormatOutput) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"dmpstore"); - } - - if (Type == DmpStoreLoad) { - ShellStatus = LoadVariablesFromFile (FileHandle, Name, Guid, &Found); - } else { - ShellStatus = CascadeProcessVariables (Name, Guid, Type, FileHandle, NULL, FoundVarGuid, &Found, StandardFormatOutput); - } - - if (!Found) { - if (ShellStatus == SHELL_OUT_OF_RESOURCES) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"dmpstore"); - return (ShellStatus); - } else if (Name != NULL && Guid == NULL) { - if (StandardFormatOutput) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name); - } - } else if (Name != NULL && Guid != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name); - } else if (Name == NULL && Guid == NULL) { - if (StandardFormatOutput) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle, L"dmpstore"); - } - } else if (Name == NULL && Guid != NULL) { - if (StandardFormatOutput) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid); - } - } - return (SHELL_NOT_FOUND); - } - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-d", TypeFlag}, - {L"-l", TypeValue}, - {L"-s", TypeValue}, - {L"-all", TypeFlag}, - {L"-guid", TypeValue}, - {L"-sfo", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'dmpstore' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDmpStore ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - RETURN_STATUS RStatus; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *GuidStr; - CONST CHAR16 *File; - EFI_GUID *Guid; - EFI_GUID GuidData; - CONST CHAR16 *Name; - DMP_STORE_TYPE Type; - SHELL_FILE_HANDLE FileHandle; - EFI_FILE_INFO *FileInfo; - BOOLEAN StandardFormatOutput; - - ShellStatus = SHELL_SUCCESS; - Package = NULL; - FileHandle = NULL; - File = NULL; - Type = DmpStoreDisplay; - StandardFormatOutput = FALSE; - - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmpstore"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-all") && ShellCommandLineGetFlag(Package, L"-guid")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-all", L"-guid"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-l")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-d")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-d"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-sfo")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-sfo"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Determine the GUID to search for based on -all and -guid parameters - // - if (!ShellCommandLineGetFlag(Package, L"-all")) { - GuidStr = ShellCommandLineGetValue(Package, L"-guid"); - if (GuidStr != NULL) { - RStatus = StrToGuid (GuidStr, &GuidData); - if (RETURN_ERROR (RStatus) || (GuidStr[GUID_STRING_LENGTH] != L'\0')) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmpstore", GuidStr); - ShellStatus = SHELL_INVALID_PARAMETER; - } - Guid = &GuidData; - } else { - Guid = &gEfiGlobalVariableGuid; - } - } else { - Guid = NULL; - } - - // - // Get the Name of the variable to find - // - Name = ShellCommandLineGetRawValue(Package, 1); - - if (ShellStatus == SHELL_SUCCESS) { - if (ShellCommandLineGetFlag(Package, L"-s")) { - Type = DmpStoreSave; - File = ShellCommandLineGetValue(Package, L"-s"); - if (File == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0); - if (!EFI_ERROR (Status)) { - // - // Delete existing file, but do not delete existing directory - // - FileInfo = ShellGetFileInfo (FileHandle); - if (FileInfo == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - Status = EFI_DEVICE_ERROR; - } else { - if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File); - Status = EFI_INVALID_PARAMETER; - } else { - Status = ShellDeleteFile (&FileHandle); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - } - } - FreePool (FileInfo); - } - } else if (Status == EFI_NOT_FOUND) { - // - // Good when file doesn't exist - // - Status = EFI_SUCCESS; - } else { - // - // Otherwise it's bad. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - } - - if (!EFI_ERROR (Status)) { - Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_CREATE | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - } - } - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } else if (ShellCommandLineGetFlag(Package, L"-l")) { - Type = DmpStoreLoad; - File = ShellCommandLineGetValue(Package, L"-l"); - if (File == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-l"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - FileInfo = ShellGetFileInfo (FileHandle); - if (FileInfo == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File); - ShellStatus = SHELL_DEVICE_ERROR; - } else { - if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File); - ShellStatus = SHELL_INVALID_PARAMETER; - } - FreePool (FileInfo); - } - } - } - } else if (ShellCommandLineGetFlag(Package, L"-d")) { - Type = DmpStoreDelete; - } - - if (ShellCommandLineGetFlag (Package,L"-sfo")) { - StandardFormatOutput = TRUE; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - if (Type == DmpStoreSave) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_SAVE), gShellDebug1HiiHandle, File); - } else if (Type == DmpStoreLoad) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File); - } - ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput); - if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) { - ShellCloseFile (&FileHandle); - } - } - } - } - - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c deleted file mode 100644 index 73be5b2..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c +++ /dev/null @@ -1,162 +0,0 @@ -/** @file - Main file for Edit shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "TextEditor.h" - -/** - Function for 'edit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEdit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - CHAR16 *Buffer; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - LIST_ENTRY *Package; - CONST CHAR16 *Cwd; - CHAR16 *Nfs; - CHAR16 *Spot; - CONST CHAR16 *TempParam; -// SHELL_FILE_HANDLE TempHandle; - - Buffer = NULL; - ShellStatus = SHELL_SUCCESS; - Nfs = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Cwd = gEfiShellProtocol->GetCurDir(NULL); - if (Cwd == NULL) { - Cwd = ShellGetEnvironmentVariable(L"path"); - if (Cwd != NULL) { - Nfs = StrnCatGrow(&Nfs, NULL, Cwd+3, 0); - if (Nfs != NULL) { - Spot = StrStr(Nfs, L";"); - if (Spot != NULL) { - *Spot = CHAR_NULL; - } - Spot = StrStr(Nfs, L"\\"); - if (Spot != NULL) { - Spot[1] = CHAR_NULL; - } - gEfiShellProtocol->SetCurDir(NULL, Nfs); - FreePool(Nfs); - } - } - } - - Status = MainEditorInit (); - - if (EFI_ERROR (Status)) { - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_INIT_FAILED), gShellDebug1HiiHandle); - } else { - MainEditorBackup (); - - // - // if editor launched with file named - // - if (ShellCommandLineGetCount(Package) == 2) { - TempParam = ShellCommandLineGetRawValue(Package, 1); - ASSERT(TempParam != NULL); - FileBufferSetFileName (TempParam); -// if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) { -// Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0); -// if (!EFI_ERROR(Status)) { -// ShellCloseFile(&TempHandle); -// } -// } - } - - Status = FileBufferRead (MainEditor.FileBuffer->FileName, FALSE); - if (!EFI_ERROR (Status)) { - MainEditorRefresh (); - - Status = MainEditorKeyInput (); - } - - if (Status != EFI_OUT_OF_RESOURCES) { - // - // back up the status string - // - Buffer = CatSPrint (NULL, L"%s", StatusBarGetString()); - } - - MainEditorCleanup (); - - // - // print editor exit code on screen - // - if (Status == EFI_SUCCESS) { - } else if (Status == EFI_OUT_OF_RESOURCES) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"edit"); - } else { - if (Buffer != NULL) { - if (StrCmp (Buffer, L"") != 0) { - // - // print out the status string - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_BUFFER), gShellDebug1HiiHandle, Buffer); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle); - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle); - } - } - - if (Status != EFI_OUT_OF_RESOURCES) { - SHELL_FREE_NON_NULL (Buffer); - } - } - } - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c deleted file mode 100644 index 856058a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c +++ /dev/null @@ -1,3325 +0,0 @@ -/** @file - Implements filebuffer interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "TextEditor.h" -#include -#include - -EFI_EDITOR_FILE_BUFFER FileBuffer; -EFI_EDITOR_FILE_BUFFER FileBufferBackupVar; - -// -// for basic initialization of FileBuffer -// -EFI_EDITOR_FILE_BUFFER FileBufferConst = { - NULL, - FileTypeUnicode, - NULL, - NULL, - 0, - { - 0, - 0 - }, - { - 0, - 0 - }, - { - 0, - 0 - }, - { - 0, - 0 - }, - FALSE, - TRUE, - FALSE, - NULL -}; - -// -// the whole edit area needs to be refreshed -// -BOOLEAN FileBufferNeedRefresh; - -// -// only the current line in edit area needs to be refresh -// -BOOLEAN FileBufferOnlyLineNeedRefresh; - -BOOLEAN FileBufferMouseNeedRefresh; - -extern BOOLEAN EditorMouseAction; - -/** - Initialization function for FileBuffer. - - @param EFI_SUCCESS The initialization was successful. - @param EFI_LOAD_ERROR A default name could not be created. - @param EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferInit ( - VOID - ) -{ - // - // basically initialize the FileBuffer - // - CopyMem (&FileBuffer , &FileBufferConst, sizeof (EFI_EDITOR_FILE_BUFFER)); - CopyMem (&FileBufferBackupVar, &FileBufferConst, sizeof (EFI_EDITOR_FILE_BUFFER)); - - // - // set default FileName - // - FileBuffer.FileName = EditGetDefaultFileName (L"txt"); - if (FileBuffer.FileName == NULL) { - return EFI_LOAD_ERROR; - } - - FileBuffer.ListHead = AllocateZeroPool (sizeof (LIST_ENTRY)); - if (FileBuffer.ListHead == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - InitializeListHead (FileBuffer.ListHead); - - FileBuffer.DisplayPosition.Row = 2; - FileBuffer.DisplayPosition.Column = 1; - FileBuffer.LowVisibleRange.Row = 2; - FileBuffer.LowVisibleRange.Column = 1; - - FileBufferNeedRefresh = FALSE; - FileBufferMouseNeedRefresh = FALSE; - FileBufferOnlyLineNeedRefresh = FALSE; - - return EFI_SUCCESS; -} - -/** - Backup function for FileBuffer. Only backup the following items: - Mouse/Cursor position - File Name, Type, ReadOnly, Modified - Insert Mode - - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The backup operation was successful. -**/ -EFI_STATUS -FileBufferBackup ( - VOID - ) -{ - FileBufferBackupVar.MousePosition = FileBuffer.MousePosition; - - SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName); - FileBufferBackupVar.FileName = NULL; - FileBufferBackupVar.FileName = StrnCatGrow (&FileBufferBackupVar.FileName, NULL, FileBuffer.FileName, 0); - - FileBufferBackupVar.ModeInsert = FileBuffer.ModeInsert; - FileBufferBackupVar.FileType = FileBuffer.FileType; - - FileBufferBackupVar.FilePosition = FileBuffer.FilePosition; - FileBufferBackupVar.LowVisibleRange = FileBuffer.LowVisibleRange; - - FileBufferBackupVar.FileModified = FileBuffer.FileModified; - FileBufferBackupVar.ReadOnly = FileBuffer.ReadOnly; - - return EFI_SUCCESS; -} - -/** - Advance to the next Count lines - - @param[in] Count The line number to advance by. - @param[in] CurrentLine The pointer to the current line structure. - @param[in] LineList The pointer to the linked list of lines. - - @retval NULL There was an error. - @return The line structure after the advance. -**/ -EFI_EDITOR_LINE * -InternalEditorMiscLineAdvance ( - IN CONST UINTN Count, - IN CONST EFI_EDITOR_LINE *CurrentLine, - IN CONST LIST_ENTRY *LineList - ) - -{ - UINTN Index; - CONST EFI_EDITOR_LINE *Line; - - if (CurrentLine == NULL || LineList == NULL) { - return NULL; - } - - for (Line = CurrentLine, Index = 0; Index < Count; Index++) { - // - // if already last line - // - if (Line->Link.ForwardLink == LineList) { - return NULL; - } - - Line = CR (Line->Link.ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - } - - return ((EFI_EDITOR_LINE *)Line); -} - -/** - Retreat to the previous Count lines. - - @param[in] Count The line number to retreat by. - @param[in] CurrentLine The pointer to the current line structure. - @param[in] LineList The pointer to the linked list of lines. - - @retval NULL There was an error. - @return The line structure after the retreat. -**/ -EFI_EDITOR_LINE * -InternalEditorMiscLineRetreat ( - IN CONST UINTN Count, - IN CONST EFI_EDITOR_LINE *CurrentLine, - IN CONST LIST_ENTRY *LineList - ) - -{ - UINTN Index; - CONST EFI_EDITOR_LINE *Line; - - if (CurrentLine == NULL || LineList == NULL) { - return NULL; - } - - for (Line = CurrentLine, Index = 0; Index < Count; Index++) { - // - // already the first line - // - if (Line->Link.BackLink == LineList) { - return NULL; - } - - Line = CR (Line->Link.BackLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - } - - return ((EFI_EDITOR_LINE *)Line); -} - -/** - Advance/Retreat lines - - @param[in] Count line number to advance/retreat - >0 : advance - <0 : retreat - - @retval NULL An error occured. - @return The line after advance/retreat. -**/ -EFI_EDITOR_LINE * -MoveLine ( - IN CONST INTN Count - ) -{ - EFI_EDITOR_LINE *Line; - UINTN AbsCount; - - // - // if < 0, then retreat - // if > 0, the advance - // - if (Count <= 0) { - AbsCount = (UINTN)ABS(Count); - Line = InternalEditorMiscLineRetreat (AbsCount,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead); - } else { - Line = InternalEditorMiscLineAdvance ((UINTN)Count,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead); - } - - return Line; -} - -/** - Function to update the 'screen' to display the mouse position. - - @retval EFI_SUCCESS The backup operation was successful. -**/ -EFI_STATUS -FileBufferRestoreMousePosition ( - VOID - ) -{ - EFI_EDITOR_COLOR_UNION Orig; - EFI_EDITOR_COLOR_UNION New; - UINTN FRow; - UINTN FColumn; - BOOLEAN HasCharacter; - EFI_EDITOR_LINE *CurrentLine; - EFI_EDITOR_LINE *Line; - CHAR16 Value; - - // - // variable initialization - // - Line = NULL; - - if (MainEditor.MouseSupported) { - - if (FileBufferMouseNeedRefresh) { - - FileBufferMouseNeedRefresh = FALSE; - - // - // if mouse position not moved and only mouse action - // so do not need to refresh mouse position - // - if ((FileBuffer.MousePosition.Row == FileBufferBackupVar.MousePosition.Row && - FileBuffer.MousePosition.Column == FileBufferBackupVar.MousePosition.Column) - && EditorMouseAction) { - return EFI_SUCCESS; - } - // - // backup the old screen attributes - // - Orig = MainEditor.ColorAttributes; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background & 0xF; - New.Colors.Background = Orig.Colors.Foreground & 0x7; - - // - // clear the old mouse position - // - FRow = FileBuffer.LowVisibleRange.Row + FileBufferBackupVar.MousePosition.Row - 2; - - FColumn = FileBuffer.LowVisibleRange.Column + FileBufferBackupVar.MousePosition.Column - 1; - - HasCharacter = TRUE; - if (FRow > FileBuffer.NumLines) { - HasCharacter = FALSE; - } else { - CurrentLine = FileBuffer.CurrentLine; - Line = MoveLine (FRow - FileBuffer.FilePosition.Row); - - if (Line == NULL || FColumn > Line->Size) { - HasCharacter = FALSE; - } - - FileBuffer.CurrentLine = CurrentLine; - } - - ShellPrintEx ( - (INT32)FileBufferBackupVar.MousePosition.Column - 1, - (INT32)FileBufferBackupVar.MousePosition.Row - 1, - L" " - ); - - if (HasCharacter) { - Value = (Line->Buffer[FColumn - 1]); - ShellPrintEx ( - (INT32)FileBufferBackupVar.MousePosition.Column - 1, - (INT32)FileBufferBackupVar.MousePosition.Row - 1, - L"%c", - Value - ); - } - // - // set the new mouse position - // - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - - // - // clear the old mouse position - // - FRow = FileBuffer.LowVisibleRange.Row + FileBuffer.MousePosition.Row - 2; - FColumn = FileBuffer.LowVisibleRange.Column + FileBuffer.MousePosition.Column - 1; - - HasCharacter = TRUE; - if (FRow > FileBuffer.NumLines) { - HasCharacter = FALSE; - } else { - CurrentLine = FileBuffer.CurrentLine; - Line = MoveLine (FRow - FileBuffer.FilePosition.Row); - - if (Line == NULL || FColumn > Line->Size) { - HasCharacter = FALSE; - } - - FileBuffer.CurrentLine = CurrentLine; - } - - ShellPrintEx ( - (INT32)FileBuffer.MousePosition.Column - 1, - (INT32)FileBuffer.MousePosition.Row - 1, - L" " - ); - - if (HasCharacter) { - Value = Line->Buffer[FColumn - 1]; - ShellPrintEx ( - (INT32)FileBuffer.MousePosition.Column - 1, - (INT32)FileBuffer.MousePosition.Row - 1, - L"%c", - Value - ); - } - // - // end of HasCharacter - // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - } - // - // end of MouseNeedRefresh - // - } - // - // end of MouseSupported - // - return EFI_SUCCESS; -} - -/** - Free all the lines in FileBuffer - Fields affected: - Lines - CurrentLine - NumLines - ListHead - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferFreeLines ( - VOID - ) -{ - LIST_ENTRY *Link; - EFI_EDITOR_LINE *Line; - - // - // free all the lines - // - if (FileBuffer.Lines != NULL) { - - Line = FileBuffer.Lines; - Link = &(Line->Link); - do { - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - Link = Link->ForwardLink; - - // - // free line's buffer and line itself - // - LineFree (Line); - } while (Link != FileBuffer.ListHead); - } - // - // clean the line list related structure - // - FileBuffer.Lines = NULL; - FileBuffer.CurrentLine = NULL; - FileBuffer.NumLines = 0; - - FileBuffer.ListHead->ForwardLink = FileBuffer.ListHead; - FileBuffer.ListHead->BackLink = FileBuffer.ListHead; - - return EFI_SUCCESS; -} - -/** - Cleanup function for FileBuffer. - - @retval EFI_SUCCESS The cleanup was successful. -**/ -EFI_STATUS -FileBufferCleanup ( - VOID - ) -{ - EFI_STATUS Status; - - SHELL_FREE_NON_NULL (FileBuffer.FileName); - - // - // free all the lines - // - Status = FileBufferFreeLines (); - - SHELL_FREE_NON_NULL (FileBuffer.ListHead); - FileBuffer.ListHead = NULL; - - SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName); - return Status; - -} - -/** - Print a line specified by Line on a row specified by Row of the screen. - - @param[in] Line The line to print. - @param[in] Row The row on the screen to print onto (begin from 1). - - @retval EFI_SUCCESS The printing was successful. -**/ -EFI_STATUS -FileBufferPrintLine ( - IN CONST EFI_EDITOR_LINE *Line, - IN CONST UINTN Row - ) -{ - - CHAR16 *Buffer; - UINTN Limit; - CHAR16 *PrintLine; - CHAR16 *PrintLine2; - UINTN BufLen; - - // - // print start from correct character - // - Buffer = Line->Buffer + FileBuffer.LowVisibleRange.Column - 1; - - Limit = Line->Size - FileBuffer.LowVisibleRange.Column + 1; - if (Limit > Line->Size) { - Limit = 0; - } - - BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16); - PrintLine = AllocatePool (BufLen); - if (PrintLine != NULL) { - StrnCpyS (PrintLine, BufLen/sizeof(CHAR16), Buffer, MIN(Limit, MainEditor.ScreenSize.Column)); - for (Limit = StrLen (PrintLine); Limit < MainEditor.ScreenSize.Column; Limit++) { - PrintLine[Limit] = L' '; - } - - PrintLine[MainEditor.ScreenSize.Column] = CHAR_NULL; - - PrintLine2 = AllocatePool (BufLen * 2); - if (PrintLine2 != NULL) { - ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE); - - ShellPrintEx ( - 0, - (INT32)Row - 1, - L"%s", - PrintLine2 - ); - FreePool (PrintLine2); - } - FreePool (PrintLine); - } - - return EFI_SUCCESS; -} - -/** - Set the cursor position according to FileBuffer.DisplayPosition. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferRestorePosition ( - VOID - ) -{ - // - // set cursor position - // - return (gST->ConOut->SetCursorPosition ( - gST->ConOut, - FileBuffer.DisplayPosition.Column - 1, - FileBuffer.DisplayPosition.Row - 1 - )); -} - -/** - Refresh the screen with whats in the buffer. - - @retval EFI_SUCCESS The refresh was successful. - @retval EFI_LOAD_ERROR There was an error finding what to write. -**/ -EFI_STATUS -FileBufferRefresh ( - VOID - ) -{ - LIST_ENTRY *Link; - EFI_EDITOR_LINE *Line; - UINTN Row; - - // - // if it's the first time after editor launch, so should refresh - // - if (!EditorFirst) { - // - // no definite required refresh - // and file position displayed on screen has not been changed - // - if (!FileBufferNeedRefresh && - !FileBufferOnlyLineNeedRefresh && - FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row && - FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column - ) { - - FileBufferRestoreMousePosition (); - FileBufferRestorePosition (); - - return EFI_SUCCESS; - } - } - - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - - // - // only need to refresh current line - // - if (FileBufferOnlyLineNeedRefresh && - FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row && - FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column - ) { - - EditorClearLine (FileBuffer.DisplayPosition.Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row); - FileBufferPrintLine ( - FileBuffer.CurrentLine, - FileBuffer.DisplayPosition.Row - ); - } else { - // - // the whole edit area need refresh - // - - // - // no line - // - if (FileBuffer.Lines == NULL) { - FileBufferRestoreMousePosition (); - FileBufferRestorePosition (); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - return EFI_SUCCESS; - } - // - // get the first line that will be displayed - // - Line = MoveLine (FileBuffer.LowVisibleRange.Row - FileBuffer.FilePosition.Row); - if (Line == NULL) { - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - return EFI_LOAD_ERROR; - } - - Link = &(Line->Link); - Row = 2; - do { - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - // - // print line at row - // - FileBufferPrintLine (Line, Row); - - Link = Link->ForwardLink; - Row++; - } while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 1)); - // - // while not file end and not screen full - // - while (Row <= (MainEditor.ScreenSize.Row - 1)) { - EditorClearLine (Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row); - Row++; - } - } - - FileBufferRestoreMousePosition (); - FileBufferRestorePosition (); - - FileBufferNeedRefresh = FALSE; - FileBufferOnlyLineNeedRefresh = FALSE; - - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - return EFI_SUCCESS; -} - -/** - Create a new line and append it to the line list. - Fields affected: - NumLines - Lines - - @retval NULL The create line failed. - @return The line created. -**/ -EFI_EDITOR_LINE * -FileBufferCreateLine ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - - // - // allocate a line structure - // - Line = AllocateZeroPool (sizeof (EFI_EDITOR_LINE)); - if (Line == NULL) { - return NULL; - } - // - // initialize the structure - // - Line->Signature = LINE_LIST_SIGNATURE; - Line->Size = 0; - Line->TotalSize = 0; - Line->Type = NewLineTypeDefault; - - // - // initial buffer of the line is "\0" - // - ASSERT(CHAR_NULL == CHAR_NULL); - Line->Buffer = CatSPrint (NULL, L"\0"); - if (Line->Buffer == NULL) { - return NULL; - } - - FileBuffer.NumLines++; - - // - // insert the line into line list - // - InsertTailList (FileBuffer.ListHead, &Line->Link); - - if (FileBuffer.Lines == NULL) { - FileBuffer.Lines = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - } - - return Line; -} - -/** - Set FileName field in FileBuffer. - - @param Str The file name to set. - - @retval EFI_SUCCESS The filename was successfully set. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER Str is not a valid filename. -**/ -EFI_STATUS -FileBufferSetFileName ( - IN CONST CHAR16 *Str - ) -{ - // - // Verify the parameters - // - if (!IsValidFileName(Str)) { - return (EFI_INVALID_PARAMETER); - } - // - // free the old file name - // - SHELL_FREE_NON_NULL (FileBuffer.FileName); - - // - // Allocate and set the new name - // - FileBuffer.FileName = CatSPrint (NULL, L"%s", Str); - if (FileBuffer.FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} -/** - Free the existing file lines and reset the modified flag. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferFree ( - VOID - ) -{ - // - // free all the lines - // - FileBufferFreeLines (); - FileBuffer.FileModified = FALSE; - - return EFI_SUCCESS; -} - - -/** - Read a file from disk into the FileBuffer. - - @param[in] FileName The filename to read. - @param[in] Recover TRUE if is for recover mode, no information printouts. - - @retval EFI_SUCCESS The load was successful. - @retval EFI_LOAD_ERROR The load failed. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER FileName is a directory. -**/ -EFI_STATUS -FileBufferRead ( - IN CONST CHAR16 *FileName, - IN CONST BOOLEAN Recover - ) -{ - EFI_EDITOR_LINE *Line; - EE_NEWLINE_TYPE Type; - UINTN LoopVar1; - UINTN LoopVar2; - UINTN LineSize; - VOID *Buffer; - CHAR16 *UnicodeBuffer; - UINT8 *AsciiBuffer; - UINTN FileSize; - SHELL_FILE_HANDLE FileHandle; - BOOLEAN CreateFile; - EFI_STATUS Status; - UINTN LineSizeBackup; - EFI_FILE_INFO *Info; - - Line = NULL; - LoopVar1 = 0; - FileSize = 0; - UnicodeBuffer = NULL; - Type = NewLineTypeDefault; - FileHandle = NULL; - CreateFile = FALSE; - - // - // in this function, when you return error ( except EFI_OUT_OF_RESOURCES ) - // you should set status string via StatusBarSetStatusString(L"blah") - // since this function maybe called before the editorhandleinput loop - // so any error will cause editor return - // so if you want to print the error status - // you should set the status string - // - - // - // try to open the file - // - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0); - - if (!EFI_ERROR(Status)) { - CreateFile = FALSE; - if (FileHandle == NULL) { - StatusBarSetStatusString (L"Disk Error"); - return EFI_LOAD_ERROR; - } - - Info = ShellGetFileInfo(FileHandle); - - if (Info->Attribute & EFI_FILE_DIRECTORY) { - StatusBarSetStatusString (L"Directory Can Not Be Edited"); - FreePool (Info); - return EFI_INVALID_PARAMETER; - } - - if (Info->Attribute & EFI_FILE_READ_ONLY) { - FileBuffer.ReadOnly = TRUE; - } else { - FileBuffer.ReadOnly = FALSE; - } - // - // get file size - // - FileSize = (UINTN) Info->FileSize; - - FreePool (Info); - } else if (Status == EFI_NOT_FOUND) { - // - // file not exists. add create and try again - // - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR (Status)) { - if (Status == EFI_WRITE_PROTECTED || - Status == EFI_ACCESS_DENIED || - Status == EFI_NO_MEDIA || - Status == EFI_MEDIA_CHANGED - ) { - StatusBarSetStatusString (L"Access Denied"); - } else if (Status == EFI_DEVICE_ERROR || Status == EFI_VOLUME_CORRUPTED || Status == EFI_VOLUME_FULL) { - StatusBarSetStatusString (L"Disk Error"); - } else { - StatusBarSetStatusString (L"Invalid File Name or Current-working-directory"); - } - - return Status; - } else { - // - // it worked. now delete it and move on with the name (now validated) - // - Status = ShellDeleteFile (&FileHandle); - if (Status == EFI_WARN_DELETE_FAILURE) { - Status = EFI_ACCESS_DENIED; - } - FileHandle = NULL; - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Access Denied"); - return Status; - } - } - // - // file doesn't exist, so set CreateFile to TRUE - // - CreateFile = TRUE; - FileBuffer.ReadOnly = FALSE; - - // - // all the check ends - // so now begin to set file name, free lines - // - if (StrCmp (FileName, FileBuffer.FileName) != 0) { - FileBufferSetFileName (FileName); - } - // - // free the old lines - // - FileBufferFree (); - - } - // - // the file exists - // - if (!CreateFile) { - // - // allocate buffer to read file - // - Buffer = AllocateZeroPool (FileSize); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // read file into Buffer - // - Status = ShellReadFile (FileHandle, &FileSize, Buffer); - ShellCloseFile(&FileHandle); - FileHandle = NULL; - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read File Failed"); - SHELL_FREE_NON_NULL (Buffer); - return EFI_LOAD_ERROR; - } - // - // nothing in this file - // - if (FileSize == 0) { - SHELL_FREE_NON_NULL (Buffer); - // - // since has no head, so only can be an ASCII file - // - FileBuffer.FileType = FileTypeAscii; - - goto Done; - } - - AsciiBuffer = Buffer; - - if (FileSize < 2) { - // - // size < Unicode file header, so only can be ASCII file - // - FileBuffer.FileType = FileTypeAscii; - } else { - // - // Unicode file - // - if (*(UINT16 *) Buffer == EFI_UNICODE_BYTE_ORDER_MARK) { - // - // Unicode file's size should be even - // - if ((FileSize % 2) != 0) { - StatusBarSetStatusString (L"File Format Wrong"); - SHELL_FREE_NON_NULL (Buffer); - return EFI_LOAD_ERROR; - } - - FileSize /= 2; - - FileBuffer.FileType = FileTypeUnicode; - UnicodeBuffer = Buffer; - - // - // pass this 0xff and 0xfe - // - UnicodeBuffer++; - FileSize--; - } else { - FileBuffer.FileType = FileTypeAscii; - } - // - // end of AsciiBuffer == - // - } - // - // end of FileSize < 2 - // all the check ends - // so now begin to set file name, free lines - // - if (StrCmp (FileName, FileBuffer.FileName) != 0) { - FileBufferSetFileName (FileName); - } - - // - // free the old lines - // - FileBufferFree (); - - // - // parse file content line by line - // - for (LoopVar1 = 0; LoopVar1 < FileSize; LoopVar1++) { - Type = NewLineTypeUnknown; - - for (LineSize = LoopVar1; LineSize < FileSize; LineSize++) { - if (FileBuffer.FileType == FileTypeAscii) { - if (AsciiBuffer[LineSize] == CHAR_CARRIAGE_RETURN) { - Type = NewLineTypeCarriageReturn; - - // - // has LF following - // - if (LineSize < FileSize - 1) { - if (AsciiBuffer[LineSize + 1] == CHAR_LINEFEED) { - Type = NewLineTypeCarriageReturnLineFeed; - } - } - - break; - } else if (AsciiBuffer[LineSize] == CHAR_LINEFEED) { - Type = NewLineTypeLineFeed; - - // - // has CR following - // - if (LineSize < FileSize - 1) { - if (AsciiBuffer[LineSize + 1] == CHAR_CARRIAGE_RETURN) { - Type = NewLineTypeLineFeedCarriageReturn; - } - } - - break; - } - } else { - if (UnicodeBuffer[LineSize] == CHAR_CARRIAGE_RETURN) { - Type = NewLineTypeCarriageReturn; - - // - // has LF following - // - if (LineSize < FileSize - 1) { - if (UnicodeBuffer[LineSize + 1] == CHAR_LINEFEED) { - Type = NewLineTypeCarriageReturnLineFeed; - } - } - - break; - } else if (UnicodeBuffer[LineSize] == CHAR_LINEFEED) { - Type = NewLineTypeLineFeed; - - // - // has CR following - // - if (LineSize < FileSize - 1) { - if (UnicodeBuffer[LineSize + 1] == CHAR_CARRIAGE_RETURN) { - Type = NewLineTypeLineFeedCarriageReturn; - } - } - - break; - } - } - // - // endif == ASCII - // - } - // - // end of for LineSize - // - // if the type is wrong, then exit - // - if (Type == NewLineTypeUnknown) { - // - // Now if Type is NewLineTypeUnknown, it should be file end - // - Type = NewLineTypeDefault; - } - - LineSizeBackup = LineSize; - - // - // create a new line - // - Line = FileBufferCreateLine (); - if (Line == NULL) { - SHELL_FREE_NON_NULL (Buffer); - return EFI_OUT_OF_RESOURCES; - } - // - // calculate file length - // - LineSize -= LoopVar1; - - // - // Unicode and one CHAR_NULL - // - SHELL_FREE_NON_NULL (Line->Buffer); - Line->Buffer = AllocateZeroPool (LineSize * 2 + 2); - - if (Line->Buffer == NULL) { - RemoveEntryList (&Line->Link); - return EFI_OUT_OF_RESOURCES; - } - // - // copy this line to Line->Buffer - // - for (LoopVar2 = 0; LoopVar2 < LineSize; LoopVar2++) { - if (FileBuffer.FileType == FileTypeAscii) { - Line->Buffer[LoopVar2] = (CHAR16) AsciiBuffer[LoopVar1]; - } else { - Line->Buffer[LoopVar2] = UnicodeBuffer[LoopVar1]; - } - - LoopVar1++; - } - // - // LoopVar1 now points to where CHAR_CARRIAGE_RETURN or CHAR_LINEFEED; - // - Line->Buffer[LineSize] = 0; - - Line->Size = LineSize; - Line->TotalSize = LineSize; - Line->Type = Type; - - if (Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) { - LoopVar1++; - } - - // - // last character is a return, SO create a new line - // - if (((Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) && LineSizeBackup == FileSize - 2) || - ((Type == NewLineTypeLineFeed || Type == NewLineTypeCarriageReturn) && LineSizeBackup == FileSize - 1) - ) { - Line = FileBufferCreateLine (); - if (Line == NULL) { - SHELL_FREE_NON_NULL (Buffer); - return EFI_OUT_OF_RESOURCES; - } - } - // - // end of if - // - } - // - // end of LoopVar1 - // - SHELL_FREE_NON_NULL (Buffer); - - } - // - // end of if CreateFile - // -Done: - - FileBuffer.DisplayPosition.Row = 2; - FileBuffer.DisplayPosition.Column = 1; - FileBuffer.LowVisibleRange.Row = 1; - FileBuffer.LowVisibleRange.Column = 1; - FileBuffer.FilePosition.Row = 1; - FileBuffer.FilePosition.Column = 1; - FileBuffer.MousePosition.Row = 2; - FileBuffer.MousePosition.Column = 1; - - if (!Recover) { - UnicodeBuffer = CatSPrint (NULL, L"%d Lines Read", FileBuffer.NumLines); - if (UnicodeBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (UnicodeBuffer); - FreePool (UnicodeBuffer); - } -/* - // - // check whether we have fs?: in filename - // - LoopVar1 = 0; - FSMappingPtr = NULL; - while (FileName[LoopVar1] != 0) { - if (FileName[LoopVar1] == L':') { - FSMappingPtr = &FileName[LoopVar1]; - break; - } - - LoopVar1++; - } - - if (FSMappingPtr == NULL) { - CurDir = ShellGetCurrentDir (NULL); - } else { - LoopVar1 = 0; - LoopVar2 = 0; - while (FileName[LoopVar1] != 0) { - if (FileName[LoopVar1] == L':') { - break; - } - - FSMapping[LoopVar2++] = FileName[LoopVar1]; - - LoopVar1++; - } - - FSMapping[LoopVar2] = 0; - CurDir = ShellGetCurrentDir (FSMapping); - } - - if (CurDir != NULL) { - for (LoopVar1 = 0; LoopVar1 < StrLen (CurDir) && CurDir[LoopVar1] != ':'; LoopVar1++); - - CurDir[LoopVar1] = 0; - DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) ShellGetMap (CurDir); - FreePool (CurDir); - } else { - return EFI_LOAD_ERROR; - } - - Status = LibDevicePathToInterface ( - &gEfiSimpleFileSystemProtocolGuid, - DevicePath, - (VOID **) &Vol - ); - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - - Status = Vol->OpenVolume (Vol, &RootFs); - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - // - // Get volume information of file system - // - Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + 100; - VolumeInfo = (EFI_FILE_SYSTEM_INFO *) AllocateZeroPool (Size); - Status = RootFs->GetInfo (RootFs, &gEfiFileSystemInfoGuid, &Size, VolumeInfo); - if (EFI_ERROR (Status)) { - RootFs->Close (RootFs); - return EFI_LOAD_ERROR; - } - - if (VolumeInfo->ReadOnly) { - StatusBarSetStatusString (L"WARNING: Volume Read Only"); - } - - FreePool (VolumeInfo); - RootFs->Close (RootFs); - } -// -*/ - // - // has line - // - if (FileBuffer.Lines != 0) { - FileBuffer.CurrentLine = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - } else { - // - // create a dummy line - // - Line = FileBufferCreateLine (); - if (Line == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - FileBuffer.CurrentLine = Line; - } - - FileBuffer.FileModified = FALSE; - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - FileBufferMouseNeedRefresh = TRUE; - - - return EFI_SUCCESS; -} - -/** - According to FileBuffer.NewLineType & FileBuffer.FileType, - get the return buffer and size. - - @param[in] Type The type of line. - @param[out] Buffer The buffer to fill. - @param[out] Size The amount of the buffer used on return. -**/ -VOID -GetNewLine ( - IN CONST EE_NEWLINE_TYPE Type, - OUT CHAR8 *Buffer, - OUT UINT8 *Size - ) -{ - UINT8 NewLineSize; - - // - // give new line buffer, - // and will judge unicode or ascii - // - NewLineSize = 0; - - // - // not legal new line type - // - if (Type != NewLineTypeLineFeed && Type != NewLineTypeCarriageReturn && Type != NewLineTypeCarriageReturnLineFeed && Type != NewLineTypeLineFeedCarriageReturn) { - *Size = 0; - return ; - } - // - // use_cr: give 0x0d - // - if (Type == NewLineTypeCarriageReturn) { - if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { - Buffer[0] = 0x0d; - Buffer[1] = 0; - NewLineSize = 2; - } else { - Buffer[0] = 0x0d; - NewLineSize = 1; - } - - *Size = NewLineSize; - return ; - } - // - // use_lf: give 0x0a - // - if (Type == NewLineTypeLineFeed) { - if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { - Buffer[0] = 0x0a; - Buffer[1] = 0; - NewLineSize = 2; - } else { - Buffer[0] = 0x0a; - NewLineSize = 1; - } - - *Size = NewLineSize; - return ; - } - // - // use_crlf: give 0x0d 0x0a - // - if (Type == NewLineTypeCarriageReturnLineFeed) { - if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { - Buffer[0] = 0x0d; - Buffer[1] = 0; - Buffer[2] = 0x0a; - Buffer[3] = 0; - - NewLineSize = 4; - } else { - Buffer[0] = 0x0d; - Buffer[1] = 0x0a; - NewLineSize = 2; - } - - *Size = NewLineSize; - return ; - } - // - // use_lfcr: give 0x0a 0x0d - // - if (Type == NewLineTypeLineFeedCarriageReturn) { - if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { - Buffer[0] = 0x0a; - Buffer[1] = 0; - Buffer[2] = 0x0d; - Buffer[3] = 0; - - NewLineSize = 4; - } else { - Buffer[0] = 0x0a; - Buffer[1] = 0x0d; - NewLineSize = 2; - } - - *Size = NewLineSize; - return ; - } - -} - -/** - Change a Unicode string to an ASCII string. - - @param[in] UStr The Unicode string. - @param[in] Length The maximum size of AStr. - @param[out] AStr ASCII string to pass out. - - @return The actuall length. -**/ -UINTN -UnicodeToAscii ( - IN CONST CHAR16 *UStr, - IN CONST UINTN Length, - OUT CHAR8 *AStr - ) -{ - UINTN Index; - - // - // just buffer copy, not character copy - // - for (Index = 0; Index < Length; Index++) { - *AStr++ = (CHAR8) *UStr++; - } - - return Index; -} - -/** - Save lines in FileBuffer to disk - - @param[in] FileName The file name for writing. - - @retval EFI_SUCCESS Data was written. - @retval EFI_LOAD_ERROR - @retval EFI_OUT_OF_RESOURCES There were not enough resources to write the file. -**/ -EFI_STATUS -FileBufferSave ( - IN CONST CHAR16 *FileName - ) -{ - SHELL_FILE_HANDLE FileHandle; - LIST_ENTRY *Link; - EFI_EDITOR_LINE *Line; - CHAR16 *Str; - - EFI_STATUS Status; - UINTN Length; - UINTN NumLines; - CHAR8 NewLineBuffer[4]; - UINT8 NewLineSize; - - EFI_FILE_INFO *Info; - - UINT64 Attribute; - - EE_NEWLINE_TYPE Type; - - UINTN TotalSize; - // - // 2M - // - CHAR8 *Cache; - UINTN LeftSize; - UINTN Size; - CHAR8 *Ptr; - - Length = 0; - // - // 2M - // - TotalSize = 0x200000; - - Attribute = 0; - - - - // - // if is the old file - // - if (FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) == 0) { - // - // file has not been modified - // - if (!FileBuffer.FileModified) { - return EFI_SUCCESS; - } - - // - // if file is read-only, set error - // - if (FileBuffer.ReadOnly) { - StatusBarSetStatusString (L"Read Only File Can Not Be Saved"); - return EFI_SUCCESS; - } - } - - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0); - - if (!EFI_ERROR (Status)) { - Info = ShellGetFileInfo(FileHandle); - - if (Info != NULL && Info->Attribute & EFI_FILE_DIRECTORY) { - StatusBarSetStatusString (L"Directory Can Not Be Saved"); - ShellCloseFile(FileHandle); - FreePool(Info); - return EFI_LOAD_ERROR; - } - - if (Info != NULL) { - Attribute = Info->Attribute & ~EFI_FILE_READ_ONLY; - FreePool(Info); - } - - // - // if file exits, so delete it - // - Status = ShellDeleteFile (&FileHandle); - if (EFI_ERROR (Status) || Status == EFI_WARN_DELETE_FAILURE) { - StatusBarSetStatusString (L"Write File Failed"); - return EFI_LOAD_ERROR; - } - } - - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, Attribute); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Create File Failed"); - return EFI_LOAD_ERROR; - } - - // - // if file is Unicode file, write Unicode header to it. - // - if (FileBuffer.FileType == FileTypeUnicode) { - Length = 2; - Status = ShellWriteFile (FileHandle, &Length, (VOID*)&gUnicodeFileTag); - if (EFI_ERROR (Status)) { - ShellDeleteFile (&FileHandle); - return EFI_LOAD_ERROR; - } - } - - Cache = AllocateZeroPool (TotalSize); - if (Cache == NULL) { - ShellDeleteFile (&FileHandle); - return EFI_OUT_OF_RESOURCES; - } - - // - // write all the lines back to disk - // - NumLines = 0; - Type = NewLineTypeCarriageReturnLineFeed; - - Ptr = Cache; - LeftSize = TotalSize; - - for (Link = FileBuffer.ListHead->ForwardLink; Link != FileBuffer.ListHead; Link = Link->ForwardLink) { - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - if (Line->Type != NewLineTypeDefault) { - Type = Line->Type; - } - // - // newline character is at most 4 bytes ( two Unicode characters ) - // - Length = 4; - if (Line->Buffer != NULL && Line->Size != 0) { - if (FileBuffer.FileType == FileTypeAscii) { - Length += Line->Size; - } else { - Length += (Line->Size * 2); - } - // - // end if FileTypeAscii - // - } - - // - // no cache room left, so write cache to disk - // - if (LeftSize < Length) { - Size = TotalSize - LeftSize; - Status = ShellWriteFile (FileHandle, &Size, Cache); - if (EFI_ERROR (Status)) { - ShellDeleteFile (&FileHandle); - FreePool (Cache); - return EFI_LOAD_ERROR; - } - Ptr = Cache; - LeftSize = TotalSize; - } - - if (Line->Buffer != NULL && Line->Size != 0) { - if (FileBuffer.FileType == FileTypeAscii) { - UnicodeToAscii (Line->Buffer, Line->Size, Ptr); - Length = Line->Size; - } else { - Length = (Line->Size * 2); - CopyMem (Ptr, (CHAR8 *) Line->Buffer, Length); - } - // - // end if FileTypeAscii - // - Ptr += Length; - LeftSize -= Length; - - } - // - // end of if Line -> Buffer != NULL && Line -> Size != 0 - // - // if not the last line , write return buffer to disk - // - if (Link->ForwardLink != FileBuffer.ListHead) { - GetNewLine (Type, NewLineBuffer, &NewLineSize); - CopyMem (Ptr, (CHAR8 *) NewLineBuffer, NewLineSize); - - Ptr += NewLineSize; - LeftSize -= NewLineSize; - } - - NumLines++; - } - - if (TotalSize != LeftSize) { - Size = TotalSize - LeftSize; - Status = ShellWriteFile (FileHandle, &Size, Cache); - if (EFI_ERROR (Status)) { - ShellDeleteFile (&FileHandle); - FreePool (Cache); - return EFI_LOAD_ERROR; - } - } - - FreePool (Cache); - - ShellCloseFile(&FileHandle); - - FileBuffer.FileModified = FALSE; - - // - // set status string - // - Str = CatSPrint (NULL, L"%d Lines Wrote", NumLines); - if (Str == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (Str); - SHELL_FREE_NON_NULL (Str); - - // - // now everything is ready , you can set the new file name to filebuffer - // - if (FileName != NULL && FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) != 0) { - // - // not the same - // - FileBufferSetFileName (FileName); - if (FileBuffer.FileName == NULL) { - ShellDeleteFile (&FileHandle); - return EFI_OUT_OF_RESOURCES; - } - } - - FileBuffer.ReadOnly = FALSE; - return EFI_SUCCESS; -} - -/** - Scroll cursor to left 1 character position. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferScrollLeft ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = FileBuffer.CurrentLine; - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // if already at start of this line, so move to the end of previous line - // - if (FCol <= 1) { - // - // has previous line - // - if (Line->Link.BackLink != FileBuffer.ListHead) { - FRow--; - Line = CR (Line->Link.BackLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - FCol = Line->Size + 1; - } else { - return EFI_SUCCESS; - } - } else { - // - // if not at start of this line, just move to previous column - // - FCol--; - } - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Delete a char in line - - @param[in, out] Line The line to delete in. - @param[in] Pos Position to delete the char at ( start from 0 ). -**/ -VOID -LineDeleteAt ( - IN OUT EFI_EDITOR_LINE *Line, - IN UINTN Pos - ) -{ - UINTN Index; - - // - // move the latter characters front - // - for (Index = Pos - 1; Index < Line->Size; Index++) { - Line->Buffer[Index] = Line->Buffer[Index + 1]; - } - - Line->Size--; -} - -/** - Concatenate Src into Dest. - - @param[in, out] Dest Destination string - @param[in] Src Src String. -**/ -VOID -LineCat ( - IN OUT EFI_EDITOR_LINE *Dest, - IN EFI_EDITOR_LINE *Src - ) -{ - CHAR16 *Str; - UINTN Size; - - Size = Dest->Size; - - Dest->Buffer[Size] = 0; - - // - // concatenate the two strings - // - Str = CatSPrint (NULL, L"%s%s", Dest->Buffer, Src->Buffer); - if (Str == NULL) { - Dest->Buffer = NULL; - return ; - } - - Dest->Size = Size + Src->Size; - Dest->TotalSize = Dest->Size; - - FreePool (Dest->Buffer); - FreePool (Src->Buffer); - - // - // put str to dest->buffer - // - Dest->Buffer = Str; -} - -/** - Delete the previous character. - - @retval EFI_SUCCESS The delete was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferDoBackspace ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - EFI_EDITOR_LINE *End; - LIST_ENTRY *Link; - UINTN FileColumn; - - FileColumn = FileBuffer.FilePosition.Column; - - Line = FileBuffer.CurrentLine; - - // - // the first column - // - if (FileColumn == 1) { - // - // the first row - // - if (FileBuffer.FilePosition.Row == 1) { - return EFI_SUCCESS; - } - - FileBufferScrollLeft (); - - Line = FileBuffer.CurrentLine; - Link = Line->Link.ForwardLink; - End = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - // - // concatenate this line with previous line - // - LineCat (Line, End); - if (Line->Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // remove End from line list - // - RemoveEntryList (&End->Link); - FreePool (End); - - FileBuffer.NumLines--; - - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - - } else { - // - // just delete the previous character - // - LineDeleteAt (Line, FileColumn - 1); - FileBufferScrollLeft (); - FileBufferOnlyLineNeedRefresh = TRUE; - } - - if (!FileBuffer.FileModified) { - FileBuffer.FileModified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Add a return into line at current position. - - @retval EFI_SUCCESS The insetrion of the character was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferDoReturn ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - EFI_EDITOR_LINE *NewLine; - UINTN FileColumn; - UINTN Index; - CHAR16 *Buffer; - UINTN Row; - UINTN Col; - - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - - Line = FileBuffer.CurrentLine; - - FileColumn = FileBuffer.FilePosition.Column; - - NewLine = AllocateZeroPool (sizeof (EFI_EDITOR_LINE)); - if (NewLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - NewLine->Signature = LINE_LIST_SIGNATURE; - NewLine->Size = Line->Size - FileColumn + 1; - NewLine->TotalSize = NewLine->Size; - NewLine->Buffer = CatSPrint (NULL, L"\0"); - if (NewLine->Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - NewLine->Type = NewLineTypeDefault; - - if (NewLine->Size > 0) { - // - // UNICODE + CHAR_NULL - // - Buffer = AllocateZeroPool (2 * (NewLine->Size + 1)); - if (Buffer == NULL) { - FreePool (NewLine->Buffer); - FreePool (NewLine); - return EFI_OUT_OF_RESOURCES; - } - - FreePool (NewLine->Buffer); - - NewLine->Buffer = Buffer; - - for (Index = 0; Index < NewLine->Size; Index++) { - NewLine->Buffer[Index] = Line->Buffer[Index + FileColumn - 1]; - } - - NewLine->Buffer[NewLine->Size] = CHAR_NULL; - - Line->Buffer[FileColumn - 1] = CHAR_NULL; - Line->Size = FileColumn - 1; - } - // - // increase NumLines - // - FileBuffer.NumLines++; - - // - // insert it into the correct position of line list - // - NewLine->Link.BackLink = &(Line->Link); - NewLine->Link.ForwardLink = Line->Link.ForwardLink; - Line->Link.ForwardLink->BackLink = &(NewLine->Link); - Line->Link.ForwardLink = &(NewLine->Link); - - // - // move cursor to the start of next line - // - Row = FileBuffer.FilePosition.Row + 1; - Col = 1; - - FileBufferMovePosition (Row, Col); - - // - // set file is modified - // - if (!FileBuffer.FileModified) { - FileBuffer.FileModified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Delete current character from current line. This is the effect caused - by the 'del' key. - - @retval EFI_SUCCESS -**/ -EFI_STATUS -FileBufferDoDelete ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - EFI_EDITOR_LINE *Next; - LIST_ENTRY *Link; - UINTN FileColumn; - - Line = FileBuffer.CurrentLine; - FileColumn = FileBuffer.FilePosition.Column; - - // - // the last column - // - if (FileColumn >= Line->Size + 1) { - // - // the last line - // - if (Line->Link.ForwardLink == FileBuffer.ListHead) { - return EFI_SUCCESS; - } - // - // since last character, - // so will add the next line to this line - // - Link = Line->Link.ForwardLink; - Next = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - LineCat (Line, Next); - if (Line->Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - RemoveEntryList (&Next->Link); - FreePool (Next); - - FileBuffer.NumLines--; - - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - - } else { - // - // just delete current character - // - LineDeleteAt (Line, FileColumn); - FileBufferOnlyLineNeedRefresh = TRUE; - } - - if (!FileBuffer.FileModified) { - FileBuffer.FileModified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Scroll cursor to right 1 character. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferScrollRight ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = FileBuffer.CurrentLine; - if (Line->Buffer == NULL) { - return EFI_SUCCESS; - } - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // if already at end of this line, scroll it to the start of next line - // - if (FCol > Line->Size) { - // - // has next line - // - if (Line->Link.ForwardLink != FileBuffer.ListHead) { - FRow++; - FCol = 1; - } else { - return EFI_SUCCESS; - } - } else { - // - // if not at end of this line, just move to next column - // - FCol++; - } - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Insert a char into line - - - @param[in] Line The line to insert into. - @param[in] Char The char to insert. - @param[in] Pos The position to insert the char at ( start from 0 ). - @param[in] StrSize The current string size ( include CHAR_NULL ),unit is Unicode character. - - @return The new string size ( include CHAR_NULL ) ( unit is Unicode character ). -**/ -UINTN -LineStrInsert ( - IN EFI_EDITOR_LINE *Line, - IN CHAR16 Char, - IN UINTN Pos, - IN UINTN StrSize - ) -{ - UINTN Index; - CHAR16 *TempStringPtr; - CHAR16 *Str; - - Index = (StrSize) * 2; - - Str = Line->Buffer; - - // - // do not have free space - // - if (Line->TotalSize <= Line->Size) { - Str = ReallocatePool (Index, Index + 16, Str); - if (Str == NULL) { - return 0; - } - - Line->TotalSize += 8; - } - // - // move the later part of the string one character right - // - TempStringPtr = Str; - for (Index = StrSize; Index > Pos; Index--) { - TempStringPtr[Index] = TempStringPtr[Index - 1]; - } - // - // insert char into it. - // - TempStringPtr[Index] = Char; - - Line->Buffer = Str; - Line->Size++; - - return StrSize + 1; -} - -/** - Add a character to the current line. - - @param[in] Char The Character to input. - - @retval EFI_SUCCESS The input was succesful. -**/ -EFI_STATUS -FileBufferAddChar ( - IN CHAR16 Char - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FilePos; - - Line = FileBuffer.CurrentLine; - - // - // only needs to refresh current line - // - FileBufferOnlyLineNeedRefresh = TRUE; - - // - // when is insert mode, or cursor is at end of this line, - // so insert this character - // or replace the character. - // - FilePos = FileBuffer.FilePosition.Column - 1; - if (FileBuffer.ModeInsert || FilePos + 1 > Line->Size) { - LineStrInsert (Line, Char, FilePos, Line->Size + 1); - } else { - Line->Buffer[FilePos] = Char; - } - // - // move cursor to right - // - FileBufferScrollRight (); - - if (!FileBuffer.FileModified) { - FileBuffer.FileModified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Handles inputs from characters (ASCII key + Backspace + return) - - @param[in] Char The input character. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR There was an error. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferDoCharInput ( - IN CONST CHAR16 Char - ) -{ - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - switch (Char) { - case CHAR_NULL: - break; - - case CHAR_BACKSPACE: - Status = FileBufferDoBackspace (); - break; - - case CHAR_TAB: - // - // Tabs are ignored - // - break; - - case CHAR_LINEFEED: - case CHAR_CARRIAGE_RETURN: - Status = FileBufferDoReturn (); - break; - - default: - // - // DEAL WITH ASCII CHAR, filter out thing like ctrl+f - // - if (Char > 127 || Char < 32) { - Status = StatusBarSetStatusString (L"Unknown Command"); - } else { - Status = FileBufferAddChar (Char); - } - - break; - - } - - return Status; -} - -/** - Scroll cursor to the next line. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferScrollDown ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = FileBuffer.CurrentLine; - if (Line->Buffer == NULL) { - return EFI_SUCCESS; - } - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // has next line - // - if (Line->Link.ForwardLink != FileBuffer.ListHead) { - FRow++; - Line = CR (Line->Link.ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - // - // if the next line is not that long, so move to end of next line - // - if (FCol > Line->Size) { - FCol = Line->Size + 1; - } - - } else { - return EFI_SUCCESS; - } - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Scroll the cursor to previous line. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferScrollUp ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = FileBuffer.CurrentLine; - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // has previous line - // - if (Line->Link.BackLink != FileBuffer.ListHead) { - FRow--; - Line = CR (Line->Link.BackLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - // - // if previous line is not that long, so move to the end of previous line - // - if (FCol > Line->Size) { - FCol = Line->Size + 1; - } - - } else { - return EFI_SUCCESS; - } - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to next page. - - @retval EFI_SUCCESS The operation wa successful. -**/ -EFI_STATUS -FileBufferPageDown ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - UINTN Gap; - - Line = FileBuffer.CurrentLine; - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // has next page - // - if (FileBuffer.NumLines >= FRow + (MainEditor.ScreenSize.Row - 2)) { - Gap = (MainEditor.ScreenSize.Row - 2); - } else { - // - // MOVE CURSOR TO LAST LINE - // - Gap = FileBuffer.NumLines - FRow; - } - // - // get correct line - // - Line = MoveLine (Gap); - - // - // if that line, is not that long, so move to the end of that line - // - if (Line != NULL && FCol > Line->Size) { - FCol = Line->Size + 1; - } - - FRow += Gap; - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to previous screen. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferPageUp ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - UINTN Gap; - INTN Retreat; - - Line = FileBuffer.CurrentLine; - - FRow = FileBuffer.FilePosition.Row; - FCol = FileBuffer.FilePosition.Column; - - // - // has previous page - // - if (FRow > (MainEditor.ScreenSize.Row - 2)) { - Gap = (MainEditor.ScreenSize.Row - 2); - } else { - // - // the first line of file will displayed on the first line of screen - // - Gap = FRow - 1; - } - - Retreat = Gap; - Retreat = -Retreat; - - // - // get correct line - // - Line = MoveLine (Retreat); - - // - // if that line is not that long, so move to the end of that line - // - if (Line != NULL && FCol > Line->Size) { - FCol = Line->Size + 1; - } - - FRow -= Gap; - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to end of the current line. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferEnd ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = FileBuffer.CurrentLine; - - FRow = FileBuffer.FilePosition.Row; - - // - // goto the last column of the line - // - FCol = Line->Size + 1; - - FileBufferMovePosition (FRow, FCol); - - return EFI_SUCCESS; -} - -/** - Dispatch input to different handler - @param[in] Key The input key. One of: - ASCII KEY - Backspace/Delete - Return - Direction key: up/down/left/right/pgup/pgdn - Home/End - INS - - @retval EFI_SUCCESS The dispatch was done successfully. - @retval EFI_LOAD_ERROR The dispatch was not successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferHandleInput ( - IN CONST EFI_INPUT_KEY *Key - ) -{ - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - switch (Key->ScanCode) { - // - // ordinary key input - // - case SCAN_NULL: - if (!FileBuffer.ReadOnly) { - Status = FileBufferDoCharInput (Key->UnicodeChar); - } else { - Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - } - - break; - - // - // up arrow - // - case SCAN_UP: - Status = FileBufferScrollUp (); - break; - - // - // down arrow - // - case SCAN_DOWN: - Status = FileBufferScrollDown (); - break; - - // - // right arrow - // - case SCAN_RIGHT: - Status = FileBufferScrollRight (); - break; - - // - // left arrow - // - case SCAN_LEFT: - Status = FileBufferScrollLeft (); - break; - - // - // page up - // - case SCAN_PAGE_UP: - Status = FileBufferPageUp (); - break; - - // - // page down - // - case SCAN_PAGE_DOWN: - Status = FileBufferPageDown (); - break; - - // - // delete - // - case SCAN_DELETE: - if (!FileBuffer.ReadOnly) { - Status = FileBufferDoDelete (); - } else { - Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - } - - break; - - // - // home - // - case SCAN_HOME: - FileBufferMovePosition (FileBuffer.FilePosition.Row, 1); - Status = EFI_SUCCESS; - break; - - // - // end - // - case SCAN_END: - Status = FileBufferEnd (); - break; - - // - // insert - // - case SCAN_INSERT: - FileBuffer.ModeInsert = (BOOLEAN)!FileBuffer.ModeInsert; - Status = EFI_SUCCESS; - break; - - default: - Status = StatusBarSetStatusString (L"Unknown Command"); - break; - } - - return Status; -} - -/** - Check user specified FileRow is above current screen. - - @param[in] FileRow The row of file position ( start from 1 ). - - @retval TRUE It is above the current screen. - @retval FALSE It is not above the current screen. -**/ -BOOLEAN -AboveCurrentScreen ( - IN UINTN FileRow - ) -{ - // - // if is to the above of the screen - // - if (FileRow < FileBuffer.LowVisibleRange.Row) { - return TRUE; - } - - return FALSE; -} - -/** - Check user specified FileRow is under current screen. - - @param[in] FileRow The row of file position ( start from 1 ). - - @retval TRUE It is under the current screen. - @retval FALSE It is not under the current screen. -**/ -BOOLEAN -UnderCurrentScreen ( - IN UINTN FileRow - ) -{ - // - // if is to the under of the screen - // - if (FileRow > FileBuffer.LowVisibleRange.Row + (MainEditor.ScreenSize.Row - 2) - 1) { - return TRUE; - } - - return FALSE; -} - -/** - Check user specified FileCol is left to current screen. - - @param[in] FileCol The column of file position ( start from 1 ). - - @retval TRUE It is to the left. - @retval FALSE It is not to the left. -**/ -BOOLEAN -LeftCurrentScreen ( - IN UINTN FileCol - ) -{ - // - // if is to the left of the screen - // - if (FileCol < FileBuffer.LowVisibleRange.Column) { - return TRUE; - } - - return FALSE; -} - -/** - Check user specified FileCol is right to current screen. - - @param[in] FileCol The column of file position ( start from 1 ). - - @retval TRUE It is to the right. - @retval FALSE It is not to the right. -**/ -BOOLEAN -RightCurrentScreen ( - IN UINTN FileCol - ) -{ - // - // if is to the right of the screen - // - if (FileCol > FileBuffer.LowVisibleRange.Column + MainEditor.ScreenSize.Column - 1) { - return TRUE; - } - - return FALSE; -} - -/** - Advance/Retreat lines and set CurrentLine in FileBuffer to it - - @param[in] Count The line number to advance/retreat - >0 : advance - <0: retreat - - @retval NULL An error occured. - @return The line after advance/retreat. -**/ -EFI_EDITOR_LINE * -MoveCurrentLine ( - IN INTN Count - ) -{ - EFI_EDITOR_LINE *Line; - UINTN AbsCount; - - if (Count <= 0) { - AbsCount = (UINTN)ABS(Count); - Line = InternalEditorMiscLineRetreat (AbsCount,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead); - } else { - Line = InternalEditorMiscLineAdvance ((UINTN)Count,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead); - } - - if (Line == NULL) { - return NULL; - } - - MainEditor.FileBuffer->CurrentLine = Line; - - return Line; -} - -/** - According to cursor's file position, adjust screen display - - @param[in] NewFilePosRow The row of file position ( start from 1 ). - @param[in] NewFilePosCol The column of file position ( start from 1 ). -**/ -VOID -FileBufferMovePosition ( - IN CONST UINTN NewFilePosRow, - IN CONST UINTN NewFilePosCol - ) -{ - INTN RowGap; - INTN ColGap; - UINTN Abs; - BOOLEAN Above; - BOOLEAN Under; - BOOLEAN Right; - BOOLEAN Left; - - // - // CALCULATE gap between current file position and new file position - // - RowGap = NewFilePosRow - FileBuffer.FilePosition.Row; - ColGap = NewFilePosCol - FileBuffer.FilePosition.Column; - - Under = UnderCurrentScreen (NewFilePosRow); - Above = AboveCurrentScreen (NewFilePosRow); - // - // if is below current screen - // - if (Under) { - // - // display row will be unchanged - // - FileBuffer.FilePosition.Row = NewFilePosRow; - } else { - if (Above) { - // - // has enough above line, so display row unchanged - // not has enough above lines, so the first line is at the - // first display line - // - if (NewFilePosRow < (FileBuffer.DisplayPosition.Row - 1)) { - FileBuffer.DisplayPosition.Row = NewFilePosRow + 1; - } - - FileBuffer.FilePosition.Row = NewFilePosRow; - } else { - // - // in current screen - // - FileBuffer.FilePosition.Row = NewFilePosRow; - if (RowGap < 0) { - Abs = (UINTN)ABS(RowGap); - FileBuffer.DisplayPosition.Row -= Abs; - } else { - FileBuffer.DisplayPosition.Row += RowGap; - } - } - } - - FileBuffer.LowVisibleRange.Row = FileBuffer.FilePosition.Row - (FileBuffer.DisplayPosition.Row - 2); - - Right = RightCurrentScreen (NewFilePosCol); - Left = LeftCurrentScreen (NewFilePosCol); - - // - // if right to current screen - // - if (Right) { - // - // display column will be changed to end - // - FileBuffer.DisplayPosition.Column = MainEditor.ScreenSize.Column; - FileBuffer.FilePosition.Column = NewFilePosCol; - } else { - if (Left) { - // - // has enough left characters , so display row unchanged - // not has enough left characters, - // so the first character is at the first display column - // - if (NewFilePosCol < (FileBuffer.DisplayPosition.Column)) { - FileBuffer.DisplayPosition.Column = NewFilePosCol; - } - - FileBuffer.FilePosition.Column = NewFilePosCol; - } else { - // - // in current screen - // - FileBuffer.FilePosition.Column = NewFilePosCol; - if (ColGap < 0) { - Abs = (UINTN)(-ColGap); - FileBuffer.DisplayPosition.Column -= Abs; - } else { - FileBuffer.DisplayPosition.Column += ColGap; - } - } - } - - FileBuffer.LowVisibleRange.Column = FileBuffer.FilePosition.Column - (FileBuffer.DisplayPosition.Column - 1); - - // - // let CurrentLine point to correct line; - // - FileBuffer.CurrentLine = MoveCurrentLine (RowGap); - -} - -/** - Cut current line out and return a pointer to it. - - @param[out] CutLine Upon a successful return pointer to the pointer to - the allocated cut line. - - @retval EFI_SUCCESS The cut was successful. - @retval EFI_NOT_FOUND There was no selection to cut. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferCutLine ( - OUT EFI_EDITOR_LINE **CutLine - ) -{ - EFI_EDITOR_LINE *Line; - EFI_EDITOR_LINE *NewLine; - UINTN Row; - UINTN Col; - - if (FileBuffer.ReadOnly) { - StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - return EFI_SUCCESS; - } - - Line = FileBuffer.CurrentLine; - - // - // if is the last dummy line, SO CAN not cut - // - if (StrCmp (Line->Buffer, L"\0") == 0 && Line->Link.ForwardLink == FileBuffer.ListHead - // - // last line - // - ) { - // - // LAST LINE AND NOTHING ON THIS LINE, SO CUT NOTHING - // - StatusBarSetStatusString (L"Nothing to Cut"); - return EFI_NOT_FOUND; - } - // - // if is the last line, so create a dummy line - // - if (Line->Link.ForwardLink == FileBuffer.ListHead) { - // - // last line - // create a new line - // - NewLine = FileBufferCreateLine (); - if (NewLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } - - FileBuffer.NumLines--; - Row = FileBuffer.FilePosition.Row; - Col = 1; - // - // move home - // - FileBuffer.CurrentLine = CR ( - FileBuffer.CurrentLine->Link.ForwardLink, - EFI_EDITOR_LINE, - Link, - LINE_LIST_SIGNATURE - ); - - RemoveEntryList (&Line->Link); - - FileBuffer.Lines = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - FileBufferMovePosition (Row, Col); - - FileBuffer.FileModified = TRUE; - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - - *CutLine = Line; - - return EFI_SUCCESS; -} - -/** - Paste a line into line list. - - @retval EFI_SUCCESS The paste was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferPasteLine ( - VOID - ) -{ - EFI_EDITOR_LINE *Line; - EFI_EDITOR_LINE *NewLine; - UINTN Row; - UINTN Col; - - // - // if nothing is on clip board - // then do nothing - // - if (MainEditor.CutLine == NULL) { - return EFI_SUCCESS; - } - // - // read only file can not be pasted on - // - if (FileBuffer.ReadOnly) { - StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - return EFI_SUCCESS; - } - - NewLine = LineDup (MainEditor.CutLine); - if (NewLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // insert it above current line - // - Line = FileBuffer.CurrentLine; - NewLine->Link.BackLink = Line->Link.BackLink; - NewLine->Link.ForwardLink = &Line->Link; - - Line->Link.BackLink->ForwardLink = &NewLine->Link; - Line->Link.BackLink = &NewLine->Link; - - FileBuffer.NumLines++; - FileBuffer.CurrentLine = NewLine; - - FileBuffer.Lines = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - Col = 1; - // - // move home - // - Row = FileBuffer.FilePosition.Row; - - FileBufferMovePosition (Row, Col); - - // - // after paste, set some value so that refresh knows to do something - // - FileBuffer.FileModified = TRUE; - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - - return EFI_SUCCESS; -} - -/** - Search string from current position on in file - - @param[in] Str The search string. - @param[in] Offset The offset from current position. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND The string Str was not found. -**/ -EFI_STATUS -FileBufferSearch ( - IN CONST CHAR16 *Str, - IN CONST UINTN Offset - ) -{ - CHAR16 *Current; - UINTN Position; - UINTN Row; - UINTN Column; - EFI_EDITOR_LINE *Line; - CHAR16 *CharPos; - LIST_ENTRY *Link; - BOOLEAN Found; - - Column = 0; - Position = 0; - - // - // search if in current line - // - Current = FileBuffer.CurrentLine->Buffer + FileBuffer.FilePosition.Column - 1 + Offset; - - if (Current >= (FileBuffer.CurrentLine->Buffer + FileBuffer.CurrentLine->Size)) { - // - // the end - // - Current = FileBuffer.CurrentLine->Buffer + FileBuffer.CurrentLine->Size; - } - - Found = FALSE; - - CharPos = StrStr (Current, Str); - if (CharPos != NULL) { - Position = CharPos - Current + 1; - Found = TRUE; - } - - // - // found - // - if (Found) { - Column = (Position - 1) + FileBuffer.FilePosition.Column + Offset; - Row = FileBuffer.FilePosition.Row; - } else { - // - // not found so find through next lines - // - Link = FileBuffer.CurrentLine->Link.ForwardLink; - - Row = FileBuffer.FilePosition.Row + 1; - while (Link != FileBuffer.ListHead) { - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); -// Position = StrStr (Line->Buffer, Str); - CharPos = StrStr (Line->Buffer, Str); - if (CharPos != NULL) { - Position = CharPos - Line->Buffer + 1; - Found = TRUE; - } - - if (Found) { - // - // found - // - Column = Position; - break; - } - - Row++; - Link = Link->ForwardLink; - } - - if (Link == FileBuffer.ListHead) { - Found = FALSE; - } else { - Found = TRUE; - } - } - - if (!Found) { - return EFI_NOT_FOUND; - } - - FileBufferMovePosition (Row, Column); - - // - // call refresh to fresh edit area, - // because the outer may loop to find multiply occurrence of this string - // - FileBufferRefresh (); - - return EFI_SUCCESS; -} - -/** - Replace SearchLen characters from current position on with Replace. - - This will modify the current buffer at the current position. - - @param[in] Replace The string to replace. - @param[in] SearchLen Search string's length. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferReplace ( - IN CONST CHAR16 *Replace, - IN CONST UINTN SearchLen - ) -{ - UINTN ReplaceLen; - UINTN Index; - CHAR16 *Buffer; - UINTN NewSize; - UINTN OldSize; - UINTN Gap; - - ReplaceLen = StrLen (Replace); - - OldSize = FileBuffer.CurrentLine->Size + 1; - // - // include CHAR_NULL - // - NewSize = OldSize + (ReplaceLen - SearchLen); - - if (ReplaceLen > SearchLen) { - // - // do not have the enough space - // - if (FileBuffer.CurrentLine->TotalSize + 1 <= NewSize) { - FileBuffer.CurrentLine->Buffer = ReallocatePool ( - 2 * OldSize, - 2 * NewSize, - FileBuffer.CurrentLine->Buffer - ); - FileBuffer.CurrentLine->TotalSize = NewSize - 1; - } - - if (FileBuffer.CurrentLine->Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // the end CHAR_NULL character; - // - Buffer = FileBuffer.CurrentLine->Buffer + (NewSize - 1); - Gap = ReplaceLen - SearchLen; - - // - // keep the latter part - // - for (Index = 0; Index < (FileBuffer.CurrentLine->Size - FileBuffer.FilePosition.Column - SearchLen + 2); Index++) { - *Buffer = *(Buffer - Gap); - Buffer--; - } - // - // set replace into it - // - Buffer = FileBuffer.CurrentLine->Buffer + FileBuffer.FilePosition.Column - 1; - for (Index = 0; Index < ReplaceLen; Index++) { - Buffer[Index] = Replace[Index]; - } - } - - if (ReplaceLen < SearchLen) { - Buffer = FileBuffer.CurrentLine->Buffer + FileBuffer.FilePosition.Column - 1; - - for (Index = 0; Index < ReplaceLen; Index++) { - Buffer[Index] = Replace[Index]; - } - - Buffer += ReplaceLen; - Gap = SearchLen - ReplaceLen; - - // - // set replace into it - // - for (Index = 0; Index < (FileBuffer.CurrentLine->Size - FileBuffer.FilePosition.Column - ReplaceLen + 2); Index++) { - *Buffer = *(Buffer + Gap); - Buffer++; - } - } - - if (ReplaceLen == SearchLen) { - Buffer = FileBuffer.CurrentLine->Buffer + FileBuffer.FilePosition.Column - 1; - for (Index = 0; Index < ReplaceLen; Index++) { - Buffer[Index] = Replace[Index]; - } - } - - FileBuffer.CurrentLine->Size += (ReplaceLen - SearchLen); - - FileBufferOnlyLineNeedRefresh = TRUE; - - FileBuffer.FileModified = TRUE; - - MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0); - FileBufferRestorePosition (); - FileBufferRefresh (); - - return EFI_SUCCESS; -} - -/** - Move the mouse cursor position. - - @param[in] TextX The new x-coordinate. - @param[in] TextY The new y-coordinate. -**/ -VOID -FileBufferAdjustMousePosition ( - IN CONST INT32 TextX, - IN CONST INT32 TextY - ) -{ - UINTN CoordinateX; - UINTN CoordinateY; - UINTN AbsX; - UINTN AbsY; - - // - // TextX and TextY is mouse movement data returned by mouse driver - // This function will change it to MousePosition - // - // - // get absolute value - // - - AbsX = ABS(TextX); - AbsY = ABS(TextY); - - CoordinateX = FileBuffer.MousePosition.Column; - CoordinateY = FileBuffer.MousePosition.Row; - - if (TextX >= 0) { - CoordinateX += TextX; - } else { - if (CoordinateX >= AbsX) { - CoordinateX -= AbsX; - } else { - CoordinateX = 0; - } - } - - if (TextY >= 0) { - CoordinateY += TextY; - } else { - if (CoordinateY >= AbsY) { - CoordinateY -= AbsY; - } else { - CoordinateY = 0; - } - } - // - // check whether new mouse column position is beyond screen - // if not, adjust it - // - if (CoordinateX >= 1 && CoordinateX <= MainEditor.ScreenSize.Column) { - FileBuffer.MousePosition.Column = CoordinateX; - } else if (CoordinateX < 1) { - FileBuffer.MousePosition.Column = 1; - } else if (CoordinateX > MainEditor.ScreenSize.Column) { - FileBuffer.MousePosition.Column = MainEditor.ScreenSize.Column; - } - // - // check whether new mouse row position is beyond screen - // if not, adjust it - // - if (CoordinateY >= 2 && CoordinateY <= (MainEditor.ScreenSize.Row - 1)) { - FileBuffer.MousePosition.Row = CoordinateY; - } else if (CoordinateY < 2) { - FileBuffer.MousePosition.Row = 2; - } else if (CoordinateY > (MainEditor.ScreenSize.Row - 1)) { - FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 1); - } - -} - -/** - Search and replace operation. - - @param[in] SearchStr The string to search for. - @param[in] ReplaceStr The string to replace with. - @param[in] Offset The column to start at. -**/ -EFI_STATUS -FileBufferReplaceAll ( - IN CHAR16 *SearchStr, - IN CHAR16 *ReplaceStr, - IN UINTN Offset - ) -{ - CHAR16 *Buffer; - UINTN Position; - UINTN Column; - UINTN ReplaceLen; - UINTN SearchLen; - UINTN Index; - UINTN NewSize; - UINTN OldSize; - UINTN Gap; - EFI_EDITOR_LINE *Line; - LIST_ENTRY *Link; - CHAR16 *CharPos; - - SearchLen = StrLen (SearchStr); - ReplaceLen = StrLen (ReplaceStr); - - Column = FileBuffer.FilePosition.Column + Offset - 1; - - if (Column > FileBuffer.CurrentLine->Size) { - Column = FileBuffer.CurrentLine->Size; - } - - Link = &(FileBuffer.CurrentLine->Link); - - while (Link != FileBuffer.ListHead) { - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - CharPos = StrStr (Line->Buffer + Column, SearchStr); - if (CharPos != NULL) { - Position = CharPos - Line->Buffer;// + Column; - // - // found - // - if (ReplaceLen > SearchLen) { - OldSize = Line->Size + 1; - // - // include CHAR_NULL - // - NewSize = OldSize + (ReplaceLen - SearchLen); - - // - // do not have the enough space - // - if (Line->TotalSize + 1 <= NewSize) { - Line->Buffer = ReallocatePool ( - 2 * OldSize, - 2 * NewSize, - Line->Buffer - ); - Line->TotalSize = NewSize - 1; - } - - if (Line->Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // the end CHAR_NULL character; - // - Buffer = Line->Buffer + (NewSize - 1); - Gap = ReplaceLen - SearchLen; - - // - // keep the latter part - // - for (Index = 0; Index < (Line->Size - Position - SearchLen + 1); Index++) { - *Buffer = *(Buffer - Gap); - Buffer--; - } - - } else if (ReplaceLen < SearchLen){ - Buffer = Line->Buffer + Position + ReplaceLen; - Gap = SearchLen - ReplaceLen; - - for (Index = 0; Index < (Line->Size - Position - ReplaceLen + 1); Index++) { - *Buffer = *(Buffer + Gap); - Buffer++; - } - } else { - ASSERT(ReplaceLen == SearchLen); - } - // - // set replace into it - // - Buffer = Line->Buffer + Position; - for (Index = 0; Index < ReplaceLen; Index++) { - Buffer[Index] = ReplaceStr[Index]; - } - - Line->Size += (ReplaceLen - SearchLen); - Column += ReplaceLen; - } else { - // - // not found - // - Column = 0; - Link = Link->ForwardLink; - } - } - // - // call refresh to fresh edit area - // - FileBuffer.FileModified = TRUE; - FileBufferNeedRefresh = TRUE; - FileBufferRefresh (); - - return EFI_SUCCESS; -} - -/** - Set the modified state to TRUE. -**/ -VOID -FileBufferSetModified ( - VOID - ) -{ - FileBuffer.FileModified = TRUE; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h deleted file mode 100644 index 38e3c7d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h +++ /dev/null @@ -1,246 +0,0 @@ -/** @file - Declares filebuffer interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_FILE_BUFFER_H_ -#define _LIB_FILE_BUFFER_H_ - -#include "TextEditorTypes.h" - -/** - Initialization function for FileBuffer. - - @param EFI_SUCCESS The initialization was successful. - @param EFI_LOAD_ERROR A default name could not be created. - @param EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferInit ( - VOID - ); - -/** - Cleanup function for FileBuffer. - - @retval EFI_SUCCESS The cleanup was successful. -**/ -EFI_STATUS -FileBufferCleanup ( - VOID - ); - -/** - Refresh the screen with whats in the buffer. - - @retval EFI_SUCCESS The refresh was successful. - @retval EFI_LOAD_ERROR There was an error finding what to write. -**/ -EFI_STATUS -FileBufferRefresh ( - VOID - ); - -/** - Dispatch input to different handler - @param[in] Key The input key. One of: - ASCII KEY - Backspace/Delete - Return - Direction key: up/down/left/right/pgup/pgdn - Home/End - INS - - @retval EFI_SUCCESS The dispatch was done successfully. - @retval EFI_LOAD_ERROR The dispatch was not successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferHandleInput ( - IN CONST EFI_INPUT_KEY * Key - ); - -/** - Backup function for FileBuffer. Only backup the following items: - Mouse/Cursor position - File Name, Type, ReadOnly, Modified - Insert Mode - - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The backup operation was successful. -**/ -EFI_STATUS -FileBufferBackup ( - VOID - ); - -/** - Set the cursor position according to FileBuffer.DisplayPosition. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -FileBufferRestorePosition ( - VOID - ); - -/** - Set FileName field in FileBuffer. - - @param Str The file name to set. - - @retval EFI_SUCCESS The filename was successfully set. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER Str is not a valid filename. -**/ -EFI_STATUS -FileBufferSetFileName ( - IN CONST CHAR16 *Str - ); - -/** - Read a file from disk into the FileBuffer. - - @param[in] FileName The filename to read. - @param[in] Recover TRUE if is for recover mode, no information printouts. - - @retval EFI_SUCCESS The load was successful. - @retval EFI_LOAD_ERROR The load failed. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER FileName is a directory. -**/ -EFI_STATUS -FileBufferRead ( - IN CONST CHAR16 *FileName, - IN CONST BOOLEAN Recover - ); - -/** - Save lines in FileBuffer to disk - - @param[in] FileName The file name for writing. - - @retval EFI_SUCCESS Data was written. - @retval EFI_LOAD_ERROR - @retval EFI_OUT_OF_RESOURCES There were not enough resources to write the file. -**/ -EFI_STATUS -FileBufferSave ( - CONST CHAR16 *FileName - ); - -/** - According to cursor's file position, adjust screen display - - @param[in] NewFilePosRow The row of file position ( start from 1 ). - @param[in] NewFilePosCol The column of file position ( start from 1 ). -**/ -VOID -FileBufferMovePosition ( - IN CONST UINTN NewFilePosRow, - IN CONST UINTN NewFilePosCol - ); - -/** - Cut current line out and return a pointer to it. - - @param[out] CutLine Upon a successful return pointer to the pointer to - the allocated cut line. - - @retval EFI_SUCCESS The cut was successful. - @retval EFI_NOT_FOUND There was no selection to cut. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferCutLine ( - OUT EFI_EDITOR_LINE **CutLine - ); - -/** - Paste a line into line list. - - @retval EFI_SUCCESS The paste was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferPasteLine ( - VOID - ); - -/** - Search string from current position on in file - - @param[in] Str The search string. - @param[in] Offset The offset from current position. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND The string Str was not found. -**/ -EFI_STATUS -FileBufferSearch ( - IN CONST CHAR16 *Str, - IN CONST UINTN Offset - ); - -/** - Replace SearchLen characters from current position on with Replace. - - This will modify the current buffer at the current position. - - @param[in] Replace The string to replace. - @param[in] SearchLen Search string's length. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -FileBufferReplace ( - IN CONST CHAR16 *Replace, - IN CONST UINTN SearchLen - ); - -/** - Search and replace operation. - - @param[in] SearchStr The string to search for. - @param[in] ReplaceStr The string to replace with. - @param[in] Offset The column to start at. -**/ -EFI_STATUS -FileBufferReplaceAll ( - IN CHAR16 *SearchStr, - IN CHAR16 *ReplaceStr, - IN UINTN Offset - ); - -/** - Move the mouse cursor position. - - @param[in] TextX The new x-coordinate. - @param[in] TextY The new y-coordinate. -**/ -VOID -FileBufferAdjustMousePosition ( - IN CONST INT32 TextX, - IN CONST INT32 TextY - ); - -/** - Set the modified state to TRUE. -**/ -VOID -FileBufferSetModified ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c deleted file mode 100644 index 9810c2f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c +++ /dev/null @@ -1,1980 +0,0 @@ -/** @file - Implements editor interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "TextEditor.h" -#include "EditStatusBar.h" -#include "EditInputBar.h" -#include "EditMenuBar.h" - -// -// the first time editor launch -// -BOOLEAN EditorFirst; - -// -// it's time editor should exit -// -BOOLEAN EditorExit; - -BOOLEAN EditorMouseAction; - -extern EFI_EDITOR_FILE_BUFFER FileBuffer; - -extern BOOLEAN FileBufferNeedRefresh; - -extern BOOLEAN FileBufferOnlyLineNeedRefresh; - -extern BOOLEAN FileBufferMouseNeedRefresh; - -extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar; - -EFI_EDITOR_GLOBAL_EDITOR MainEditor; - - -/** - Load a file from disk to editor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainCommandOpenFile ( - VOID - ); - -/** - Switch a file from ASCII to UNICODE or vise-versa. - - @retval EFI_SUCCESS The switch was ok or a warning was presented. -**/ -EFI_STATUS -MainCommandSwitchFileType ( - VOID - ); - -/** - move cursor to specified lines - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainCommandGotoLine ( - VOID - ); - -/** - Save current file to disk, you can save to current file name or - save to another file name. - - @retval EFI_SUCCESS The file was saved correctly. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A file access error occured. -**/ -EFI_STATUS -MainCommandSaveFile ( - VOID - ); - -/** - Show help information for the editor. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainCommandDisplayHelp ( - VOID - ); - -/** - exit editor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandExit ( - VOID - ); - -/** - search string in file buffer - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandSearch ( - VOID - ); - -/** - search string in file buffer, and replace it with another str - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandSearchReplace ( - VOID - ); - -/** - cut current line to clipboard - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandCutLine ( - VOID - ); - -/** - paste line to file buffer. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandPasteLine ( - VOID - ); - -/** - Help info that will be displayed. -**/ -EFI_STRING_ID MainMenuHelpInfo[] = { - STRING_TOKEN(STR_EDIT_HELP_TITLE), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_LIST_TITLE), - STRING_TOKEN(STR_EDIT_HELP_DIV), - STRING_TOKEN(STR_EDIT_HELP_GO_TO_LINE), - STRING_TOKEN(STR_EDIT_HELP_SAVE_FILE), - STRING_TOKEN(STR_EDIT_HELP_EXIT), - STRING_TOKEN(STR_EDIT_HELP_SEARCH), - STRING_TOKEN(STR_EDIT_HELP_SEARCH_REPLACE), - STRING_TOKEN(STR_EDIT_HELP_CUT_LINE), - STRING_TOKEN(STR_EDIT_HELP_PASTE_LINE), - STRING_TOKEN(STR_EDIT_HELP_OPEN_FILE), - STRING_TOKEN(STR_EDIT_HELP_FILE_TYPE), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_EXIT_HELP), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_BLANK), - STRING_TOKEN(STR_EDIT_HELP_DIV), -0 -}; - -MENU_ITEM_FUNCTION MainControlBasedMenuFunctions[] = { - NULL, - NULL, /* Ctrl - A */ - NULL, /* Ctrl - B */ - NULL, /* Ctrl - C */ - NULL, /* Ctrl - D */ - MainCommandDisplayHelp, /* Ctrl - E */ - MainCommandSearch, /* Ctrl - F */ - MainCommandGotoLine, /* Ctrl - G */ - NULL, /* Ctrl - H */ - NULL, /* Ctrl - I */ - NULL, /* Ctrl - J */ - MainCommandCutLine, /* Ctrl - K */ - NULL, /* Ctrl - L */ - NULL, /* Ctrl - M */ - NULL, /* Ctrl - N */ - MainCommandOpenFile, /* Ctrl - O */ - NULL, /* Ctrl - P */ - MainCommandExit, /* Ctrl - Q */ - MainCommandSearchReplace, /* Ctrl - R */ - MainCommandSaveFile, /* Ctrl - S */ - MainCommandSwitchFileType, /* Ctrl - T */ - MainCommandPasteLine, /* Ctrl - U */ - NULL, /* Ctrl - V */ - NULL, /* Ctrl - W */ - NULL, /* Ctrl - X */ - NULL, /* Ctrl - Y */ - NULL, /* Ctrl - Z */ -}; - -EDITOR_MENU_ITEM MainMenuItems[] = { - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_GO_TO_LINE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F1), - MainCommandGotoLine - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_SAVE_FILE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F2), - MainCommandSaveFile - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_EXIT), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F3), - MainCommandExit - }, - - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_SEARCH), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F4), - MainCommandSearch - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_SEARCH_REPLACE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F5), - MainCommandSearchReplace - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_CUT_LINE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F6), - MainCommandCutLine - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_PASTE_LINE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F7), - MainCommandPasteLine - }, - - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_OPEN_FILE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F8), - MainCommandOpenFile - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_FILE_TYPE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F9), - MainCommandSwitchFileType - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_FILE_TYPE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F11), - MainCommandSwitchFileType - }, - - { - 0, - 0, - NULL - } -}; - - -/** - Load a file from disk to editor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainCommandOpenFile ( - VOID - ) -{ - BOOLEAN Done; - EFI_STATUS Status; - - // - // This command will open a file from current working directory. - // Read-only file can also be opened. But it can not be modified. - // Below is the scenario of Open File command: - // 1.IF currently opened file has not been modIFied, directly go to step . - // IF currently opened file has been modified, - // an Input Bar will be prompted as : - // "File Modified. Save ( Yes/No/Cancel) ?" - // IF user press 'y' or 'Y', currently opened file will be saved. - // IF user press 'n' or 'N', currently opened file will - // not be saved. - // IF user press 'c' or 'C' or ESC, Open File command ends and - // currently opened file is still opened. - // - // 2. An Input Bar will be prompted as : "File Name to Open: " - // IF user press ESC, Open File command ends and - // currently opened file is still opened. - // Any other inputs with a Return will - // cause currently opened file close. - // - // 3. IF user input file name is an existing file , this file will be read - // and opened. - // IF user input file name is a new file, this file will be created - // and opened. This file's type ( UNICODE or ASCII ) is the same - // with the old file. - // if current file is modified, so you need to choose - // whether to save it first. - // - if (MainEditor.FileBuffer->FileModified) { - - Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // the answer is just one character - // - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - // - // loop for user's answer - // valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C' - // - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // want to save this file first - // - Status = FileBufferSave (MainEditor.FileBuffer->FileName); - if (EFI_ERROR (Status)) { - return Status; - } - - MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0); - FileBufferRestorePosition (); - Done = TRUE; - break; - - case L'n': - case L'N': - // - // the file won't be saved - // - Done = TRUE; - break; - - case L'c': - case L'C': - return EFI_SUCCESS; - } - } - } - // - // TO get the open file name - // - Status = InputBarSetPrompt (L"File Name to Open: "); - if (EFI_ERROR (Status)) { - FileBufferRead (MainEditor.FileBuffer->FileName, TRUE); - return Status; - } - - Status = InputBarSetStringSize (100); - if (EFI_ERROR (Status)) { - FileBufferRead (MainEditor.FileBuffer->FileName, TRUE); - return Status; - } - - while (1) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - // - // The input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - // - // CHECK if filename is valid - // - if (!IsValidFileName (InputBarGetString())) { - FileBufferRead (MainEditor.FileBuffer->FileName, TRUE); - StatusBarSetStatusString (L"Invalid File Name"); - return EFI_SUCCESS; - } - - break; - } - } - // - // read from disk - // - Status = FileBufferRead (InputBarGetString(), FALSE); - - if (EFI_ERROR (Status)) { - FileBufferRead (MainEditor.FileBuffer->FileName, TRUE); - return EFI_LOAD_ERROR; - } - - return EFI_SUCCESS; -} - -/** - Switch a file from ASCII to UNICODE or vise-versa. - - @retval EFI_SUCCESS The switch was ok or a warning was presented. -**/ -EFI_STATUS -MainCommandSwitchFileType ( - VOID - ) -{ - // - // Below is the scenario of File Type command: - // After File Type is executed, file type will be changed to another type - // if file is read-only, can not be modified - // - if (MainEditor.FileBuffer->ReadOnly) { - StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - return EFI_SUCCESS; - } - - if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { - MainEditor.FileBuffer->FileType = FileTypeAscii; - } else { - MainEditor.FileBuffer->FileType = FileTypeUnicode; - } - - MainEditor.FileBuffer->FileModified = TRUE; - - return EFI_SUCCESS; -} - -/** - cut current line to clipboard - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandCutLine ( - VOID - ) -{ - EFI_STATUS Status; - EFI_EDITOR_LINE *Line; - - // - // This command will cut current line ( where cursor is on ) to clip board. - // And cursor will move to the beginning of next line. - // Below is the scenario of Cut Line command: - // 1. IF cursor is on valid line, current line will be cut to clip board. - // IF cursor is not on valid line, an Status String will be prompted : - // "Nothing to Cut". - // - Line = NULL; - Status = FileBufferCutLine (&Line); - if (Status == EFI_NOT_FOUND) { - return EFI_SUCCESS; - } - - if (EFI_ERROR (Status)) { - return Status; - } - - MainEditor.CutLine = Line; - - return EFI_SUCCESS; -} - -/** - paste line to file buffer. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandPasteLine ( - VOID - ) -{ - EFI_STATUS Status; - - // - // Below is the scenario of Paste Line command: - // 1. IF nothing is on clipboard, a Status String will be prompted : - // "No Line to Paste" and Paste Line command ends. - // IF something is on clipboard, insert it above current line. - // nothing on clipboard - // - if (MainEditor.CutLine == NULL) { - StatusBarSetStatusString (L"No Line to Paste"); - return EFI_SUCCESS; - } - - Status = FileBufferPasteLine (); - - return Status; -} - - -/** - search string in file buffer - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandSearch ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 *Buffer; - BOOLEAN Done; - UINTN Offset; - - // - // Below is the scenario of Search command: - // 1. An Input Bar will be prompted : "Enter Search String:". - // IF user press ESC, Search command ends. - // IF user just press Enter, Search command ends. - // IF user inputs the search string, do Step 2. - // - // 2. IF input search string is found, cursor will move to the first - // occurrence and do Step 3. - // IF input search string is not found, a Status String - // "Search String Not Found" will be prompted and Search command ends. - // - // 3. An Input Bar will be prompted: "Find Next (Yes/No/Cancel ) ?". - // IF user press ESC, Search command ends. - // IF user press 'y' or 'Y', do Step 2. - // IF user press 'n' or 'N', Search command ends. - // IF user press 'c' or 'C', Search command ends. - // - Status = InputBarSetPrompt (L"Enter Search String: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (40); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - // - // just enter pressed - // - if (StrLen (InputBarGetString()) == 0) { - return EFI_SUCCESS; - } - - Buffer = CatSPrint (NULL, L"%s", InputBarGetString()); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // the first time , search from current position - // - Offset = 0; - do { - // - // since search may be continued to search multiple times - // so we need to backup editor each time - // - MainEditorBackup (); - - Status = FileBufferSearch (Buffer, Offset); - - if (Status == EFI_NOT_FOUND) { - break; - } - // - // Find next - // - Status = InputBarSetPrompt (L"Find Next (Yes/No) ?"); - if (EFI_ERROR (Status)) { - FreePool (Buffer); - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - FreePool (Buffer); - return Status; - } - - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - FreePool (Buffer); - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - Done = TRUE; - break; - - case L'n': - case L'N': - FreePool (Buffer); - return EFI_SUCCESS; - - } - // - // end of which - // - } - // - // end of while !Done - // for search second, third time, search from current position + strlen - // - Offset = StrLen (Buffer); - - } while (1); - // - // end of do - // - FreePool (Buffer); - StatusBarSetStatusString (L"Search String Not Found"); - - return EFI_SUCCESS; -} - -/** - Search string in file buffer, and replace it with another str. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandSearchReplace ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 *Search; - CHAR16 *Replace; - BOOLEAN Done; - BOOLEAN First; - BOOLEAN ReplaceOption; - UINTN SearchLen; - UINTN ReplaceLen; - BOOLEAN ReplaceAll; - - ReplaceOption = FALSE; - - // - // Below is the scenario of Search/Replace command: - // 1. An Input Bar is prompted : "Enter Search String:". - // IF user press ESC, Search/Replace command ends. - // IF user just press Enter, Search/Replace command ends. - // IF user inputs the search string S, do Step 2. - // - // 2. An Input Bar is prompted: "Replace With:". - // IF user press ESC, Search/Replace command ends. - // IF user inputs the replace string R, do Step 3. - // - // 3. IF input search string is not found, an Status String - // "Search String Not Found" will be prompted - // and Search/Replace command ends - // IF input search string is found, do Step 4. - // - // 4. An Input Bar will be prompted: "Replace ( Yes/No/All/Cancel )?" - // IF user press 'y' or 'Y', S will be replaced with R and do Step 5 - // IF user press 'n' or 'N', S will not be replaced and do Step 5. - // IF user press 'a' or 'A', all the S from file current position on - // will be replaced with R and Search/Replace command ends. - // IF user press 'c' or 'C' or ESC, Search/Replace command ends. - // - // 5. An Input Bar will be prompted: "Find Next (Yes/No/Cancel) ?". - // IF user press ESC, Search/Replace command ends. - // IF user press 'y' or 'Y', do Step 3. - // IF user press 'n' or 'N', Search/Replace command ends. - // IF user press 'c' or 'C', Search/Replace command ends. - // input search string - // - Status = InputBarSetPrompt (L"Enter Search String: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (40); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - // - // if just pressed enter - // - if (StrLen (InputBarGetString()) == 0) { - return EFI_SUCCESS; - } - - Search = CatSPrint (NULL, L"%s", InputBarGetString()); - if (Search == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - SearchLen = StrLen (Search); - - // - // input replace string - // - Status = InputBarSetPrompt (L"Replace With: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (40); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - Replace = CatSPrint (NULL, L"%s", InputBarGetString()); - if (Replace == NULL) { - FreePool (Search); - return EFI_OUT_OF_RESOURCES; - } - - ReplaceLen = StrLen (Replace); - - First = TRUE; - ReplaceAll = FALSE; - do { - // - // since search may be continued to search multiple times - // so we need to backup editor each time - // - MainEditorBackup (); - - if (First) { - Status = FileBufferSearch (Search, 0); - } else { - // - // if just replace, so skip this replace string - // if replace string is an empty string, so skip to next character - // - if (ReplaceOption) { - Status = FileBufferSearch (Search, (ReplaceLen == 0) ? 1 : ReplaceLen); - } else { - Status = FileBufferSearch (Search, SearchLen); - } - } - - if (Status == EFI_NOT_FOUND) { - break; - } - // - // replace or not? - // - Status = InputBarSetPrompt (L"Replace (Yes/No/All/Cancel) ?"); - - if (EFI_ERROR (Status)) { - FreePool (Search); - FreePool (Replace); - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - FreePool (Search); - FreePool (Replace); - return Status; - } - - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - FreePool (Search); - FreePool (Replace); - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - Done = TRUE; - ReplaceOption = TRUE; - break; - - case L'n': - case L'N': - Done = TRUE; - ReplaceOption = FALSE; - break; - - case L'a': - case L'A': - Done = TRUE; - ReplaceOption = TRUE; - ReplaceAll = TRUE; - break; - - case L'c': - case L'C': - FreePool (Search); - FreePool (Replace); - return EFI_SUCCESS; - - } - // - // end of which - // - } - // - // end of while !Done - // Decide to Replace - // - if (ReplaceOption) { - // - // file is read-only - // - if (MainEditor.FileBuffer->ReadOnly) { - StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); - return EFI_SUCCESS; - } - // - // replace all - // - if (ReplaceAll) { - Status = FileBufferReplaceAll (Search, Replace, 0); - FreePool (Search); - FreePool (Replace); - return Status; - } - // - // replace - // - Status = FileBufferReplace (Replace, SearchLen); - if (EFI_ERROR (Status)) { - FreePool (Search); - FreePool (Replace); - return Status; - } - } - // - // Find next - // - Status = InputBarSetPrompt (L"Find Next (Yes/No) ?"); - if (EFI_ERROR (Status)) { - FreePool (Search); - FreePool (Replace); - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - FreePool (Search); - FreePool (Replace); - return Status; - } - - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - FreePool (Search); - FreePool (Replace); - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - Done = TRUE; - break; - - case L'n': - case L'N': - FreePool (Search); - FreePool (Replace); - return EFI_SUCCESS; - - } - // - // end of which - // - } - // - // end of while !Done - // - First = FALSE; - - } while (1); - // - // end of do - // - FreePool (Search); - FreePool (Replace); - - StatusBarSetStatusString (L"Search String Not Found"); - - return EFI_SUCCESS; -} - -/** - exit editor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainCommandExit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // Below is the scenario of Exit command: - // 1. IF currently opened file is not modified, exit the editor and - // Exit command ends. - // IF currently opened file is modified, do Step 2 - // - // 2. An Input Bar will be prompted: - // "File modified. Save ( Yes/No/Cancel )?" - // IF user press 'y' or 'Y', currently opened file will be saved - // and Editor exits - // IF user press 'n' or 'N', currently opened file will not be saved - // and Editor exits. - // IF user press 'c' or 'C' or ESC, Exit command ends. - // if file has been modified, so will prompt user whether to save the changes - // - if (MainEditor.FileBuffer->FileModified) { - - Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // write file back to disk - // - Status = FileBufferSave (MainEditor.FileBuffer->FileName); - if (!EFI_ERROR (Status)) { - EditorExit = TRUE; - } - - return Status; - - case L'n': - case L'N': - EditorExit = TRUE; - return EFI_SUCCESS; - - case L'c': - case L'C': - return EFI_SUCCESS; - - } - } - } - - EditorExit = TRUE; - return EFI_SUCCESS; - -} - -/** - move cursor to specified lines - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainCommandGotoLine ( - VOID - ) -{ - EFI_STATUS Status; - UINTN Row; - - // - // Below is the scenario of Go To Line command: - // 1. An Input Bar will be prompted : "Go To Line:". - // IF user press ESC, Go To Line command ends. - // IF user just press Enter, cursor remains unchanged. - // IF user inputs line number, do Step 2. - // - // 2. IF input line number is valid, move cursor to the beginning - // of specified line and Go To Line command ends. - // IF input line number is invalid, a Status String will be prompted: - // "No Such Line" and Go To Line command ends. - // - Status = InputBarSetPrompt (L"Go To Line: "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // line number's digit <= 6 - // - Status = InputBarSetStringSize (6); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // press ESC - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - // - // if JUST press enter - // - if (StrLen (InputBarGetString()) == 0) { - return EFI_SUCCESS; - } - - Row = ShellStrToUintn (InputBarGetString()); - - // - // invalid line number - // - if (Row > MainEditor.FileBuffer->NumLines || Row <= 0) { - StatusBarSetStatusString (L"No Such Line"); - return EFI_SUCCESS; - } - // - // move cursor to that line's start - // - FileBufferMovePosition (Row, 1); - - return EFI_SUCCESS; -} - -/** - Save current file to disk, you can save to current file name or - save to another file name. - - @retval EFI_SUCCESS The file was saved correctly. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A file access error occured. -**/ -EFI_STATUS -MainCommandSaveFile ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 *FileName; - BOOLEAN OldFile; - CHAR16 *Str; - SHELL_FILE_HANDLE FileHandle; - EFI_FILE_INFO *Info; - - // - // This command will save currently opened file to disk. - // You can choose save to another file name or just save to - // current file name. - // Below is the scenario of Save File command: - // ( Suppose the old file name is A ) - // 1. An Input Bar will be prompted: "File To Save: [ old file name]" - // IF user press ESC, Save File command ends . - // IF user press Enter, input file name will be A. - // IF user inputs a new file name B, input file name will be B. - // - // 2. IF input file name is A, go to do Step 3. - // IF input file name is B, go to do Step 4. - // - // 3. IF A is read only, Status Bar will show "Access Denied" and - // Save File commands ends. - // IF A is not read only, save file buffer to disk and remove modified - // flag in Title Bar , then Save File command ends. - // - // 4. IF B does not exist, create this file and save file buffer to it. - // Go to do Step 7. - // IF B exits, do Step 5. - // - // 5.An Input Bar will be prompted: - // "File Exists. Overwrite ( Yes/No/Cancel )?" - // IF user press 'y' or 'Y', do Step 6. - // IF user press 'n' or 'N', Save File commands ends. - // IF user press 'c' or 'C' or ESC, Save File commands ends. - // - // 6. IF B is a read-only file, Status Bar will show "Access Denied" and - // Save File commands ends. - // IF B can be read and write, save file buffer to B. - // - // 7. Update File Name field in Title Bar to B and remove the modified - // flag in Title Bar. - // - Str = CatSPrint (NULL, L"File to Save: [%s]", MainEditor.FileBuffer->FileName); - if (Str == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (StrLen (Str) >= 50) { - // - // replace the long file name with "..." - // - Str[46] = L'.'; - Str[47] = L'.'; - Str[48] = L'.'; - Str[49] = L']'; - Str[50] = CHAR_NULL; - } - - Status = InputBarSetPrompt (Str); - FreePool(Str); - - if (EFI_ERROR (Status)) { - return Status; - } - - - Status = InputBarSetStringSize (100); - if (EFI_ERROR (Status)) { - return Status; - } - // - // get new file name - // - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // if user pressed ESC - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - // - // if just enter pressed, so think save to current file name - // - if (StrLen (InputBarGetString()) == 0) { - FileName = CatSPrint (NULL, L"%s", MainEditor.FileBuffer->FileName); - } else { - FileName = CatSPrint (NULL, L"%s", InputBarGetString()); - } - - if (FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (!IsValidFileName (FileName)) { - StatusBarSetStatusString (L"Invalid File Name"); - FreePool (FileName); - return EFI_SUCCESS; - } - - OldFile = FALSE; - - // - // save to the old file - // - if (StringNoCaseCompare (&FileName, &MainEditor.FileBuffer->FileName) == 0) { - OldFile = TRUE; - } - - if (OldFile) { - // - // if the file is read only, so can not write back to it. - // - if (MainEditor.FileBuffer->ReadOnly == TRUE) { - StatusBarSetStatusString (L"Access Denied"); - FreePool (FileName); - return EFI_SUCCESS; - } - } else { - // - // if the file exists - // - if (ShellFileExists(FileName) != EFI_NOT_FOUND) { - // - // check for read only - // - Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - StatusBarSetStatusString (L"Open Failed"); - FreePool (FileName); - return EFI_SUCCESS; - } - - Info = ShellGetFileInfo(FileHandle); - if (Info == NULL) { - StatusBarSetStatusString (L"Access Denied"); - FreePool (FileName); - return (EFI_SUCCESS); - } - - if (Info->Attribute & EFI_FILE_READ_ONLY) { - StatusBarSetStatusString (L"Access Denied - Read Only"); - FreePool (Info); - FreePool (FileName); - return (EFI_SUCCESS); - } - FreePool (Info); - - // - // ask user whether to overwrite this file - // - Status = InputBarSetPrompt (L"File exists. Overwrite (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (FileName); - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (FileName); - return Status; - } - - while (TRUE) { - Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column); - StatusBarSetRefresh(); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - break; - - case L'n': - case L'N': - case L'c': - case L'C': - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } // end switch - } // while (!done) - } // file does exist - } // if old file name same - - // - // save file to disk with specified name - // - FileBufferSetModified(); - Status = FileBufferSave (FileName); - SHELL_FREE_NON_NULL (FileName); - - return Status; -} - -/** - Show help information for the editor. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainCommandDisplayHelp ( - VOID - ) -{ - INT32 CurrentLine; - CHAR16 *InfoString; - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - UINTN EventIndex; - - // - // print helpInfo - // - for (CurrentLine = 0; 0 != MainMenuHelpInfo[CurrentLine]; CurrentLine++) { - InfoString = HiiGetString(gShellDebug1HiiHandle, MainMenuHelpInfo[CurrentLine], NULL); - ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString); - } - - // - // scan for ctrl+w - // - while (TRUE) { - Status = gBS->WaitForEvent (1, &MainEditor.TextInputEx->WaitForKeyEx, &EventIndex); - if (EFI_ERROR (Status) || (EventIndex != 0)) { - continue; - } - Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData); - if (EFI_ERROR (Status)) { - continue; - } - - if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || - (KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) { - // - // For consoles that don't support/report shift state, - // CTRL+W is translated to L'W' - L'A' + 1. - // - if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) { - break; - } - } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) && - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) { - // - // For consoles that supports/reports shift state, - // make sure that only CONTROL shift key is pressed. - // - if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) { - break; - } - } - } - // - // update screen with file buffer's info - // - FileBufferRestorePosition (); - FileBufferNeedRefresh = TRUE; - FileBufferOnlyLineNeedRefresh = FALSE; - FileBufferRefresh (); - - return EFI_SUCCESS; -} - -EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors; -INTN OriginalMode; - - -// -// basic initialization for MainEditor -// -EFI_EDITOR_GLOBAL_EDITOR MainEditorConst = { - &FileBuffer, - { - {0, 0} - }, - { - 0, - 0 - }, - NULL, - NULL, - FALSE, - NULL -}; - -/** - The initialization function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainEditorInit ( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - UINTN Index; - - // - // basic initialization - // - CopyMem (&MainEditor, &MainEditorConst, sizeof (MainEditor)); - - // - // set screen attributes - // - MainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff; - - MainEditor.ColorAttributes.Colors.Background = (UINT8) (gST->ConOut->Mode->Attribute >> 4); - OriginalColors = MainEditor.ColorAttributes.Colors; - - OriginalMode = gST->ConOut->Mode->Mode; - - // - // query screen size - // - gST->ConOut->QueryMode ( - gST->ConOut, - gST->ConOut->Mode->Mode, - &(MainEditor.ScreenSize.Column), - &(MainEditor.ScreenSize.Row) - ); - - // - // Find TextInEx in System Table ConsoleInHandle - // Per UEFI Spec, TextInEx is required for a console capable platform. - // - Status = gBS->HandleProtocol ( - gST->ConsoleInHandle, - &gEfiSimpleTextInputExProtocolGuid, - (VOID**)&MainEditor.TextInputEx - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Find mouse in System Table ConsoleInHandle - // - Status = gBS->HandleProtocol ( - gST->ConsoleInHandle, - &gEfiSimplePointerProtocolGuid, - (VOID**)&MainEditor.MouseInterface - ); - if (EFI_ERROR (Status)) { - // - // If there is no Simple Pointer Protocol on System Table - // - HandleBuffer = NULL; - MainEditor.MouseInterface = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiSimplePointerProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (!EFI_ERROR (Status) && HandleCount > 0) { - // - // Try to find the first available mouse device - // - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiSimplePointerProtocolGuid, - (VOID**)&MainEditor.MouseInterface - ); - if (!EFI_ERROR (Status)) { - break; - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - } - - if (!EFI_ERROR (Status) && MainEditor.MouseInterface != NULL) { - MainEditor.MouseAccumulatorX = 0; - MainEditor.MouseAccumulatorY = 0; - MainEditor.MouseSupported = TRUE; - } - - // - // below will call the five components' init function - // - Status = MainTitleBarInit (L"UEFI EDIT"); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_TITLEBAR), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - Status = ControlHotKeyInit (MainControlBasedMenuFunctions); - Status = MenuBarInit (MainMenuItems); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_MAINMENU), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - Status = StatusBarInit (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_STATUSBAR), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - InputBarInit (MainEditor.TextInputEx); - - Status = FileBufferInit (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_FILEBUFFER), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - // - // clear whole screen and enable cursor - // - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - // - // initialize EditorFirst and EditorExit - // - EditorFirst = TRUE; - EditorExit = FALSE; - EditorMouseAction = FALSE; - - return EFI_SUCCESS; -} - -/** - The cleanup function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainEditorCleanup ( - VOID - ) -{ - EFI_STATUS Status; - - // - // call the five components' cleanup function - // if error, do not exit - // just print some warning - // - MainTitleBarCleanup(); - StatusBarCleanup(); - InputBarCleanup(); - MenuBarCleanup (); - - Status = FileBufferCleanup (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_FILEBUFFER_CLEANUP), gShellDebug1HiiHandle); - } - // - // restore old mode - // - if (OriginalMode != gST->ConOut->Mode->Mode) { - gST->ConOut->SetMode (gST->ConOut, OriginalMode); - } - // - // restore old screen color - // - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR (OriginalColors.Foreground, OriginalColors.Background) - ); - - gST->ConOut->ClearScreen (gST->ConOut); - - return EFI_SUCCESS; -} - -/** - Refresh the main editor component. -**/ -VOID -MainEditorRefresh ( - VOID - ) -{ - // - // The Stall value is from experience. NOT from spec. avoids 'flicker' - // - gBS->Stall (50); - - // - // call the components refresh function - // - if (EditorFirst - || StrCmp (FileBufferBackupVar.FileName, FileBuffer.FileName) != 0 - || FileBufferBackupVar.FileType != FileBuffer.FileType - || FileBufferBackupVar.FileModified != FileBuffer.FileModified - || FileBufferBackupVar.ReadOnly != FileBuffer.ReadOnly) { - - MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0); - FileBufferRestorePosition (); - } - - if (EditorFirst - || FileBufferBackupVar.FilePosition.Row != FileBuffer.FilePosition.Row - || FileBufferBackupVar.FilePosition.Column != FileBuffer.FilePosition.Column - || FileBufferBackupVar.ModeInsert != FileBuffer.ModeInsert - || StatusBarGetRefresh()) { - - StatusBarRefresh (EditorFirst, MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column, MainEditor.FileBuffer->FilePosition.Row, MainEditor.FileBuffer->FilePosition.Column, MainEditor.FileBuffer->ModeInsert); - FileBufferRestorePosition (); - } - - if (EditorFirst) { - FileBufferRestorePosition (); - } - - FileBufferRefresh (); - - // - // EditorFirst is now set to FALSE - // - EditorFirst = FALSE; -} - -/** - Get's the resultant location of the cursor based on the relative movement of the Mouse. - - @param[in] GuidX The relative mouse movement. - - @return The X location of the mouse. -**/ -INT32 -GetTextX ( - IN INT32 GuidX - ) -{ - INT32 Gap; - - MainEditor.MouseAccumulatorX += GuidX; - Gap = (MainEditor.MouseAccumulatorX * (INT32) MainEditor.ScreenSize.Column) / (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionX); - MainEditor.MouseAccumulatorX = (MainEditor.MouseAccumulatorX * (INT32) MainEditor.ScreenSize.Column) % (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionX); - MainEditor.MouseAccumulatorX = MainEditor.MouseAccumulatorX / (INT32) MainEditor.ScreenSize.Column; - return Gap; -} - -/** - Get's the resultant location of the cursor based on the relative movement of the Mouse. - - @param[in] GuidY The relative mouse movement. - - @return The Y location of the mouse. -**/ -INT32 -GetTextY ( - IN INT32 GuidY - ) -{ - INT32 Gap; - - MainEditor.MouseAccumulatorY += GuidY; - Gap = (MainEditor.MouseAccumulatorY * (INT32) MainEditor.ScreenSize.Row) / (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionY); - MainEditor.MouseAccumulatorY = (MainEditor.MouseAccumulatorY * (INT32) MainEditor.ScreenSize.Row) % (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionY); - MainEditor.MouseAccumulatorY = MainEditor.MouseAccumulatorY / (INT32) MainEditor.ScreenSize.Row; - - return Gap; -} - -/** - Support mouse movement. Move the cursor. - - @param[in] MouseState The current mouse state. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND There was no mouse support found. -**/ -EFI_STATUS -MainEditorHandleMouseInput ( - IN EFI_SIMPLE_POINTER_STATE MouseState - ) -{ - - INT32 TextX; - INT32 TextY; - UINTN FRow; - UINTN FCol; - - LIST_ENTRY *Link; - EFI_EDITOR_LINE *Line; - - UINTN Index; - BOOLEAN Action; - - // - // mouse action means: - // mouse movement - // mouse left button - // - Action = FALSE; - - // - // have mouse movement - // - if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) { - // - // handle - // - TextX = GetTextX (MouseState.RelativeMovementX); - TextY = GetTextY (MouseState.RelativeMovementY); - - FileBufferAdjustMousePosition (TextX, TextY); - - Action = TRUE; - - } - - // - // if left button pushed down - // - if (MouseState.LeftButton) { - - FCol = MainEditor.FileBuffer->MousePosition.Column - 1 + 1; - - FRow = MainEditor.FileBuffer->FilePosition.Row + - MainEditor.FileBuffer->MousePosition.Row - - MainEditor.FileBuffer->DisplayPosition.Row; - - // - // beyond the file line length - // - if (MainEditor.FileBuffer->NumLines < FRow) { - FRow = MainEditor.FileBuffer->NumLines; - } - - Link = MainEditor.FileBuffer->ListHead->ForwardLink; - for (Index = 0; Index < FRow - 1; Index++) { - Link = Link->ForwardLink; - } - - Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE); - - // - // beyond the line's column length - // - if (FCol > Line->Size + 1) { - FCol = Line->Size + 1; - } - - FileBufferMovePosition (FRow, FCol); - - MainEditor.FileBuffer->MousePosition.Row = MainEditor.FileBuffer->DisplayPosition.Row; - - MainEditor.FileBuffer->MousePosition.Column = MainEditor.FileBuffer->DisplayPosition.Column; - - Action = TRUE; - } - // - // mouse has action - // - if (Action) { - return EFI_SUCCESS; - } - - // - // no mouse action - // - return EFI_NOT_FOUND; -} - -/** - Handle user key input. This routes to other functions for the actions. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainEditorKeyInput ( - VOID - ) -{ - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - EFI_SIMPLE_POINTER_STATE MouseState; - BOOLEAN NoShiftState; - - do { - - Status = EFI_SUCCESS; - EditorMouseAction = FALSE; - - // - // backup some key elements, so that can aVOID some refresh work - // - MainEditorBackup (); - - // - // change priority of checking mouse/keyboard activity dynamically - // so prevent starvation of keyboard. - // if last time, mouse moves then this time check keyboard - // - if (MainEditor.MouseSupported) { - Status = MainEditor.MouseInterface->GetState ( - MainEditor.MouseInterface, - &MouseState - ); - if (!EFI_ERROR (Status)) { - - Status = MainEditorHandleMouseInput (MouseState); - - if (!EFI_ERROR (Status)) { - EditorMouseAction = TRUE; - FileBufferMouseNeedRefresh = TRUE; - } else if (Status == EFI_LOAD_ERROR) { - StatusBarSetStatusString (L"Invalid Mouse Movement "); - } - } - } - - // - // CheckEvent() returns Success when non-partial key is pressed. - // - Status = gBS->CheckEvent (MainEditor.TextInputEx->WaitForKeyEx); - if (!EFI_ERROR (Status)) { - Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData); - if (!EFI_ERROR (Status)) { - // - // dispatch to different components' key handling function - // so not everywhere has to set this variable - // - FileBufferMouseNeedRefresh = TRUE; - // - // clear previous status string - // - StatusBarSetRefresh(); - // - // NoShiftState: TRUE when no shift key is pressed. - // - NoShiftState = ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || (KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID); - // - // dispatch to different components' key handling function - // - if (EFI_NOT_FOUND != MenuBarDispatchControlHotKey(&KeyData)) { - Status = EFI_SUCCESS; - } else if (NoShiftState && ((KeyData.Key.ScanCode == SCAN_NULL) || ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN)))) { - Status = FileBufferHandleInput (&KeyData.Key); - } else if (NoShiftState && (KeyData.Key.ScanCode >= SCAN_F1) && (KeyData.Key.ScanCode <= SCAN_F12)) { - Status = MenuBarDispatchFunctionKey (&KeyData.Key); - } else { - StatusBarSetStatusString (L"Unknown Command"); - FileBufferMouseNeedRefresh = FALSE; - } - - if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) { - // - // not already has some error status - // - if (StatusBarGetString() != NULL && StrCmp (L"", StatusBarGetString()) == 0) { - StatusBarSetStatusString (L"Disk Error. Try Again"); - } - } - - } - } - // - // after handling, refresh editor - // - MainEditorRefresh (); - - } while (Status != EFI_OUT_OF_RESOURCES && !EditorExit); - - return Status; -} - -/** - Set clipboard - - @param[in] Line A pointer to the line to be set to clipboard - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainEditorSetCutLine ( - EFI_EDITOR_LINE *Line - ) -{ - if (Line == NULL) { - return EFI_SUCCESS; - } - - if (MainEditor.CutLine != NULL) { - // - // free the old clipboard - // - LineFree (MainEditor.CutLine); - } - // - // duplicate the line to clipboard - // - MainEditor.CutLine = LineDup (Line); - if (MainEditor.CutLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Backup function for MainEditor - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainEditorBackup ( - VOID - ) -{ - FileBufferBackup (); - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.h deleted file mode 100644 index 11b9661..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.h +++ /dev/null @@ -1,72 +0,0 @@ -/** @file - Declares editor interface functions. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_EDITOR_H_ -#define _LIB_EDITOR_H_ - -#include "TextEditorTypes.h" - -/** - The initialization function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainEditorInit ( - VOID - ); - -/** - The cleanup function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -MainEditorCleanup ( - VOID - ); - -/** - Refresh the main editor component. -**/ -VOID -MainEditorRefresh ( - VOID - ); - -/** - Handle user key input. This routes to other functions for the actions. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainEditorKeyInput ( - VOID - ); - -/** - Backup function for MainEditor - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainEditorBackup ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c deleted file mode 100644 index 370695b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c +++ /dev/null @@ -1,90 +0,0 @@ -/** @file - Implementation of various string and line routines. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "TextEditor.h" -#include "Misc.h" - -/** - Duplicate a EFI_EDITOR_LINE structure. - - @param Src The line structure to copy from. - - @retval NULL A memory allocation failed. - @return a pointer to the newly allcoated line. -**/ -EFI_EDITOR_LINE * -LineDup ( - IN EFI_EDITOR_LINE *Src - ) -{ - EFI_EDITOR_LINE *Dest; - - // - // allocate for the line structure - // - Dest = AllocateZeroPool (sizeof (EFI_EDITOR_LINE)); - if (Dest == NULL) { - return NULL; - } - // - // allocate and set the line buffer - // - Dest->Buffer = CatSPrint (NULL, L"%s", Src->Buffer); - if (Dest->Buffer == NULL) { - FreePool (Dest); - return NULL; - } - - // - // set the other structure members - // - Dest->Signature = LINE_LIST_SIGNATURE; - Dest->Size = Src->Size; - Dest->TotalSize = Dest->Size; - Dest->Type = Src->Type; - Dest->Link = Src->Link; - - return Dest; -} - -/** - Free a EFI_EDITOR_LINE structure. - - @param Src The line structure to free. -**/ -VOID -LineFree ( - IN EFI_EDITOR_LINE *Src - ) -{ - if (Src == NULL) { - return ; - } - // - // free the line buffer and then the line structure itself - // - SHELL_FREE_NON_NULL (Src->Buffer); - SHELL_FREE_NON_NULL (Src); - -} - - - - - - - - - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h deleted file mode 100644 index 288e25e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - Declares generic editor helper functions. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_MISC_H_ -#define _LIB_MISC_H_ - -#include "TextEditorTypes.h" - - - -/** - Free a EFI_EDITOR_LINE structure. - - @param Src The line structure to free. -**/ -VOID -LineFree ( - IN EFI_EDITOR_LINE *Src - ); - -/** - Duplicate a EFI_EDITOR_LINE structure. - - @param Src The line structure to copy from. - - @retval NULL A memory allocation failed. - @return a pointer to the newly allcoated line. -**/ -EFI_EDITOR_LINE * -LineDup ( - IN EFI_EDITOR_LINE *Src - ); - - - - - - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditStrings.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditStrings.uni deleted file mode 100644 index e5bcb88..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditStrings.uni +++ /dev/null @@ -1,75 +0,0 @@ -// /** -// -// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Abstract: -// -// Additional string definitions for UEFI Shell 2.0 Debug1 profile Edit command -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_EDIT_LIBEDITOR_TITLEBAR #language en-US "%EMainEditor init failed on TitleBar init\r\n%N" -#string STR_EDIT_LIBEDITOR_MAINMENU #language en-US "%EMainEditor init was not successful on MainMenu init\r\n%N" -#string STR_EDIT_LIBEDITOR_STATUSBAR #language en-US "%EMainEditor init was not successful on StatusBar init\r\n%N" -#string STR_EDIT_LIBEDITOR_INPUTBAR #language en-US "%EMainEditor init was not successful on InputBar init\r\n%N" -#string STR_EDIT_LIBEDITOR_FILEBUFFER #language en-US "%EMainEditor init was not successful on FileBuffer init\r\n%N" -#string STR_EDIT_LIBEDITOR_TITLEBAR_CLEANUP #language en-US "TitleBar cleanup was not successful\r\n" -#string STR_EDIT_LIBEDITOR_MENUBAR_CLEANUP #language en-US "MenuBar cleanup was not successful\r\n" -#string STR_EDIT_LIBEDITOR_STATUSBAR_CLEANUP #language en-US "StatusBar cleanup was not successful\r\n" -#string STR_EDIT_LIBEDITOR_INPUTBAR_CLEANUP #language en-US "InputBar cleanup was not successful\r\n" -#string STR_EDIT_LIBEDITOR_FILEBUFFER_CLEANUP #language en-US "FileBuffer cleanup was not successful\r\n" -#string STR_EDIT_LIBEDITOR_MAINEDITOR_INIT #language en-US "%EMainEditor init was not succesful on TitleBar init\r\n%N" -#string STR_EDIT_LIBINPUTBAR_MAININPUTBAR #language en-US "%s" -#string STR_EDIT_LIBMENUBAR_OPEN_FILE #language en-US "Open File" -#string STR_EDIT_LIBMENUBAR_SAVE_FILE #language en-US "Save File" -#string STR_EDIT_LIBMENUBAR_EXIT #language en-US "Exit" -#string STR_EDIT_LIBMENUBAR_CUT_LINE #language en-US "Cut Line" -#string STR_EDIT_LIBMENUBAR_PASTE_LINE #language en-US "Paste Line" -#string STR_EDIT_LIBMENUBAR_GO_TO_LINE #language en-US "Go To Line" -#string STR_EDIT_LIBMENUBAR_SEARCH #language en-US "Search" -#string STR_EDIT_LIBMENUBAR_SEARCH_REPLACE #language en-US "Search/Replace" -#string STR_EDIT_LIBMENUBAR_FILE_TYPE #language en-US "File Type" -#string STR_EDIT_LIBMENUBAR_F1 #language en-US "F1" -#string STR_EDIT_LIBMENUBAR_F2 #language en-US "F2" -#string STR_EDIT_LIBMENUBAR_F3 #language en-US "F3" -#string STR_EDIT_LIBMENUBAR_F4 #language en-US "F4" -#string STR_EDIT_LIBMENUBAR_F5 #language en-US "F5" -#string STR_EDIT_LIBMENUBAR_F6 #language en-US "F6" -#string STR_EDIT_LIBMENUBAR_F7 #language en-US "F7" -#string STR_EDIT_LIBMENUBAR_F8 #language en-US "F8" -#string STR_EDIT_LIBMENUBAR_F9 #language en-US "F9" -#string STR_EDIT_LIBMENUBAR_F10 #language en-US "F10" -#string STR_EDIT_LIBMENUBAR_F11 #language en-US "F11" -#string STR_EDIT_LIBMENUBAR_F12 #language en-US "F12" -#string STR_EDIT_LIBMENUBAR_CTRL_E #language en-US "Ctrl+E" -#string STR_EDIT_LIBMENUBAR_CTRL_W #language en-US "Ctrl+W" -#string STR_EDIT_HELP_TITLE #language en-US "Help \n" -#string STR_EDIT_HELP_BLANK #language en-US " \n" -#string STR_EDIT_HELP_LIST_TITLE #language en-US "Control Key Function Key Command \n" -#string STR_EDIT_HELP_DIV #language en-US "----------- ------------ ----------------- \n" -#string STR_EDIT_HELP_GO_TO_LINE #language en-US "Ctrl-G F1 Go To Line \n" -#string STR_EDIT_HELP_SAVE_FILE #language en-US "Ctrl-S F2 Save File \n" -#string STR_EDIT_HELP_EXIT #language en-US "Ctrl-Q F3 Exit \n" -#string STR_EDIT_HELP_SEARCH #language en-US "Ctrl-F F4 Search \n" -#string STR_EDIT_HELP_SEARCH_REPLACE #language en-US "Ctrl-R F5 Search/Replace \n" -#string STR_EDIT_HELP_CUT_LINE #language en-US "Ctrl-K F6 Cut Line \n" -#string STR_EDIT_HELP_PASTE_LINE #language en-US "Ctrl-U F7 Paste Line \n" -#string STR_EDIT_HELP_OPEN_FILE #language en-US "Ctrl-O F8 Open File \n" -#string STR_EDIT_HELP_FILE_TYPE #language en-US "Ctrl-T F9 File Type \n" -#string STR_EDIT_HELP_EXIT_HELP #language en-US "Use Ctrl-W to exit this help \n" -#string STR_EDIT_MAIN_INVALID_FILE_NAME #language en-US "%Hedit%N: Invalid File Name\r\n" -#string STR_EDIT_MAIN_INIT_FAILED #language en-US "%Hedit%N: Initialization was not successful\r\n" -#string STR_EDIT_MAIN_BUFFER #language en-US "%Hedit%N: %s\r\n" -#string STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR #language en-US "%Hedit%N: Unknown Editor Error\r\n" diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h deleted file mode 100644 index 321fec7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - Main include file for Edit shell Debug1 function. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EFI_EDIT_H_ -#define _EFI_EDIT_H_ - -#include "TextEditorTypes.h" - -#include "MainTextEditor.h" -#include "FileBuffer.h" -#include "EditTitleBar.h" -#include "EditStatusBar.h" -#include "EditInputBar.h" -#include "EditMenuBar.h" -#include "Misc.h" - -extern EFI_EDITOR_GLOBAL_EDITOR MainEditor; -extern BOOLEAN EditorFirst; -extern BOOLEAN EditorExit; - -#endif // _EFI_EDIT_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h deleted file mode 100644 index 4a8cdc2..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - Declares editor types. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EDITOR_TYPE_H_ -#define _EDITOR_TYPE_H_ - -#include "UefiShellDebug1CommandsLib.h" -#include "EditTitleBar.h" -#include "EditMenuBar.h" - -#define MIN_POOL_SIZE 125 -#define MAX_STRING_LENGTH 127 - -typedef struct { - UINTN Row; - UINTN Column; -} EFI_EDITOR_POSITION; - -typedef -EFI_STATUS -(*EFI_MENU_ITEM_FUNCTION) ( - VOID - ); - -typedef enum { - NewLineTypeDefault, - NewLineTypeLineFeed, - NewLineTypeCarriageReturn, - NewLineTypeCarriageReturnLineFeed, - NewLineTypeLineFeedCarriageReturn, - NewLineTypeUnknown -} EE_NEWLINE_TYPE; - -#define LINE_LIST_SIGNATURE SIGNATURE_32 ('e', 'e', 'l', 'l') -typedef struct _EFI_EDITOR_LINE { - UINTN Signature; - CHAR16 *Buffer; - UINTN Size; // unit is Unicode - UINTN TotalSize; // unit is Unicode, exclude CHAR_NULL - EE_NEWLINE_TYPE Type; - LIST_ENTRY Link; -} EFI_EDITOR_LINE; - -typedef struct { - UINT32 Foreground : 4; - UINT32 Background : 4; -} EFI_EDITOR_COLOR_ATTRIBUTES; - -typedef union { - EFI_EDITOR_COLOR_ATTRIBUTES Colors; - UINTN Data; -} EFI_EDITOR_COLOR_UNION; - -typedef struct { - UINTN Columns; - UINTN Rows; -} EFI_EDITOR_TEXT_MODE; - -typedef struct { - CHAR16 *FileName; // file name current edited in editor - EDIT_FILE_TYPE FileType; // Unicode file or ASCII file - LIST_ENTRY *ListHead; // list head of lines - EFI_EDITOR_LINE *Lines; // lines of current file - UINTN NumLines; // total line numbers - EFI_EDITOR_POSITION DisplayPosition; // cursor position in screen - EFI_EDITOR_POSITION FilePosition; // cursor position in file - EFI_EDITOR_POSITION MousePosition; // mouse position in screen - // file position of first byte displayed on screen - // - EFI_EDITOR_POSITION LowVisibleRange; - - BOOLEAN FileModified; // file is modified or not - BOOLEAN ModeInsert; // input mode INS or OVR - BOOLEAN ReadOnly; // file is read-only or not - EFI_EDITOR_LINE *CurrentLine; // current line cursor is at -} EFI_EDITOR_FILE_BUFFER; - -typedef struct { - EFI_EDITOR_FILE_BUFFER *FileBuffer; - - EFI_EDITOR_COLOR_UNION ColorAttributes; - EFI_EDITOR_POSITION ScreenSize; // row number and column number - EFI_EDITOR_LINE *CutLine; // clip board - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx; - BOOLEAN MouseSupported; - EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface; - INT32 MouseAccumulatorX; - INT32 MouseAccumulatorY; - -} EFI_EDITOR_GLOBAL_EDITOR; - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c deleted file mode 100644 index b79fe7d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c +++ /dev/null @@ -1,330 +0,0 @@ -/** @file - Implements inputbar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "EditInputBar.h" -#include "UefiShellDebug1CommandsLib.h" - -CHAR16 *mPrompt; // Input bar mPrompt string. -CHAR16 *mReturnString; // The returned string. -UINTN StringSize; // Size of mReturnString space size. -EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx; - -/** - Initialize the input bar. - - @param[in] TextInEx Pointer to SimpleTextInEx instance in System Table. -**/ -VOID -InputBarInit ( - IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx - ) -{ - mPrompt = NULL; - mReturnString = NULL; - StringSize = 0; - mTextInEx = TextInEx; -} - -/** - Cleanup function for input bar. -**/ -VOID -InputBarCleanup ( - VOID - ) -{ - // - // free input bar's prompt and input string - // - SHELL_FREE_NON_NULL (mPrompt); - SHELL_FREE_NON_NULL (mReturnString); - mPrompt = NULL; - mReturnString = NULL; -} - -/** - Display the prompt. - Do the requesting of input. - - @param[in] LastColumn The last printable column. - @param[in] LastRow The last printable row. -**/ -VOID -InputBarPrintInput ( - IN UINTN LastColumn, - IN UINTN LastRow - ) -{ - UINTN Limit; - UINTN Size; - CHAR16 *Buffer; - UINTN Index; - UINTN mPromptLen; - - mPromptLen = StrLen (mPrompt); - Limit = LastColumn - mPromptLen - 1; - Size = StrLen (mReturnString); - - // - // check whether the mPrompt length and input length will - // exceed limit - // - if (Size <= Limit) { - Buffer = mReturnString; - } else { - Buffer = mReturnString + Size - Limit; - } - - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - - ShellPrintEx (((INT32)mPromptLen), ((INT32)LastRow) - 1, L"%s", Buffer); - Size = StrLen (Buffer); - - // - // print " " after mPrompt - // - for (Index = Size; Index < Limit; Index++) { - ShellPrintEx ((INT32)(mPromptLen + Size), ((INT32)LastRow) - 1, L" "); - } - - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - gST->ConOut->SetCursorPosition (gST->ConOut, Size + mPromptLen, LastRow - 1); -} - -typedef struct { - UINT32 Foreground : 4; - UINT32 Background : 3; -} INPUT_BAR_COLOR_ATTRIBUTES; - -typedef union { - INPUT_BAR_COLOR_ATTRIBUTES Colors; - UINTN Data; -} INPUT_BAR_COLOR_UNION; - - -/** - The refresh function for InputBar, it will wait for user input - - @param[in] LastRow The last printable row. - @param[in] LastColumn The last printable column. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -InputBarRefresh ( - UINTN LastRow, - UINTN LastColumn - ) -{ - INPUT_BAR_COLOR_UNION Orig; - INPUT_BAR_COLOR_UNION New; - EFI_KEY_DATA KeyData; - UINTN Size; - EFI_STATUS Status; - BOOLEAN NoDisplay; - UINTN EventIndex; - UINTN CursorRow; - UINTN CursorCol; - - // - // variable initialization - // - Size = 0; - Status = EFI_SUCCESS; - - // - // back up the old screen attributes - // - CursorCol = gST->ConOut->Mode->CursorColumn; - CursorRow = gST->ConOut->Mode->CursorRow; - Orig.Data = gST->ConOut->Mode->Attribute; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background & 0xF; - New.Colors.Background = Orig.Colors.Foreground & 0x7; - - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - - // - // clear input bar - // - EditorClearLine (LastRow , LastColumn, LastRow); - - gST->ConOut->SetCursorPosition (gST->ConOut, 0, LastRow - 1); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBINPUTBAR_MAININPUTBAR), gShellDebug1HiiHandle, mPrompt); - - // - // this is a selection mPrompt, cursor will stay in edit area - // actually this is for search , search/replace - // - if (StrStr (mPrompt, L"Yes/No")) { - NoDisplay = TRUE; - gST->ConOut->SetCursorPosition (gST->ConOut, CursorCol, CursorRow); - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - } else { - NoDisplay = FALSE; - } - // - // wait for user input - // - for (;;) { - Status = gBS->WaitForEvent (1, &mTextInEx->WaitForKeyEx, &EventIndex); - if (EFI_ERROR (Status) || (EventIndex != 0)) { - continue; - } - Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData); - if (EFI_ERROR (Status)) { - continue; - } - if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && - (KeyData.KeyState.KeyShiftState != EFI_SHIFT_STATE_VALID)) { - // - // Shift key pressed. - // - continue; - } - // - // pressed ESC - // - if (KeyData.Key.ScanCode == SCAN_ESC) { - Size = 0; - Status = EFI_NOT_READY; - break; - } - // - // return pressed - // - if (KeyData.Key.UnicodeChar == CHAR_LINEFEED || KeyData.Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { - break; - } else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) { - // - // backspace - // - if (Size > 0) { - Size--; - mReturnString[Size] = CHAR_NULL; - if (!NoDisplay) { - - InputBarPrintInput (LastColumn, LastRow); - - } - } - } else if (KeyData.Key.UnicodeChar <= 127 && KeyData.Key.UnicodeChar >= 32) { - // - // VALID ASCII char pressed - // - mReturnString[Size] = KeyData.Key.UnicodeChar; - - // - // should be less than specified length - // - if (Size >= StringSize) { - continue; - } - - Size++; - - mReturnString[Size] = CHAR_NULL; - - if (!NoDisplay) { - - InputBarPrintInput (LastColumn, LastRow); - - } else { - // - // if just choose yes/no - // - break; - } - - } - } - - mReturnString[Size] = CHAR_NULL; - - - // - // restore screen attributes - // - gST->ConOut->SetCursorPosition (gST->ConOut, CursorCol, CursorRow); - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - - return Status; -} - -/** - SetPrompt and wait for input. - - @param[in] Str The prompt string. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -InputBarSetPrompt ( - IN CONST CHAR16 *Str - ) -{ - // - // FREE the old mPrompt string - // - SHELL_FREE_NON_NULL (mPrompt); - - mPrompt = CatSPrint (NULL, L"%s ", Str); - if (mPrompt == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Set the size of the string in characters. - - @param[in] Size The max number of characters to accept. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -InputBarSetStringSize ( - UINTN Size - ) -{ - // - // free the old ReturnStirng - // - SHELL_FREE_NON_NULL (mReturnString); - - StringSize = Size; - mReturnString = AllocateZeroPool ((StringSize + 1) * sizeof(mReturnString[0])); - if (mReturnString == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Function to retrieve the input from the user. - - @retval NULL No input has been received. - @return The string that was input. -**/ -CONST CHAR16* -InputBarGetString ( - VOID - ) -{ - return (mReturnString); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h deleted file mode 100644 index 475cca1..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h +++ /dev/null @@ -1,87 +0,0 @@ -/** @file - Declares imputbar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_INPUT_BAR_H_ -#define _LIB_INPUT_BAR_H_ - -/** - Initialize the input bar. - - @param[in] TextInEx Pointer to SimpleTextInEx instance in System Table. -**/ -VOID -InputBarInit ( - IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx - ); - -/** - Cleanup function for input bar. -**/ -VOID -InputBarCleanup ( - VOID - ); - -/** - The refresh function for InputBar, it will wait for user input - - @param[in] LastRow The last printable row. - @param[in] LastColumn The last printable column. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -InputBarRefresh ( - UINTN LastRow, - UINTN LastColumn - ); - -/** - SetPrompt and wait for input. - - @param[in] Str The prompt string. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -InputBarSetPrompt ( - IN CONST CHAR16 *Str - ); - -/** - Set the size of the string in characters. - - @param[in] Size The max number of characters to accept. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -InputBarSetStringSize ( - UINTN Size - ); - -/** - Function to retrieve the input from the user. - - @retval NULL No input has been received. - @return The string that was input. -**/ -CONST CHAR16* -InputBarGetString ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c deleted file mode 100644 index 3047438..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c +++ /dev/null @@ -1,216 +0,0 @@ -/** @file - implements menubar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "EditMenuBar.h" -#include "UefiShellDebug1CommandsLib.h" -#include "EditStatusBar.h" - -EDITOR_MENU_ITEM *MenuItems; -MENU_ITEM_FUNCTION *ControlBasedMenuFunctions; -UINTN NumItems; - -/** - Cleanup function for a menu bar. frees all allocated memory. -**/ -VOID -MenuBarCleanup ( - VOID - ) -{ - SHELL_FREE_NON_NULL(MenuItems); -} - -/** - Initialize the menu bar with the specified items. - - @param[in] Items The items to display and their functions. - - @retval EFI_SUCCESS The initialization was correct. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MenuBarInit ( - IN CONST EDITOR_MENU_ITEM *Items - ) -{ - CONST EDITOR_MENU_ITEM *ItemsWalker; - - for (NumItems = 0, ItemsWalker = Items ; ItemsWalker != NULL && ItemsWalker->Function != NULL ; ItemsWalker++,NumItems++); - - MenuItems = AllocateZeroPool((NumItems+1) * sizeof(EDITOR_MENU_ITEM)); - if (MenuItems == NULL) { - return EFI_OUT_OF_RESOURCES; - } - CopyMem(MenuItems, Items, (NumItems+1) * sizeof(EDITOR_MENU_ITEM)); - return EFI_SUCCESS; -} - -/** - Initialize the control hot-key with the specified items. - - @param[in] Items The hot-key functions. - - @retval EFI_SUCCESS The initialization was correct. -**/ -EFI_STATUS -ControlHotKeyInit ( - IN MENU_ITEM_FUNCTION *Items - ) -{ - ControlBasedMenuFunctions = Items; - return EFI_SUCCESS; -} -/** - Refresh function for the menu bar. - - @param[in] LastRow The last printable row. - @param[in] LastCol The last printable column. - - @retval EFI_SUCCESS The refresh was successful. -**/ -EFI_STATUS -MenuBarRefresh ( - IN CONST UINTN LastRow, - IN CONST UINTN LastCol - ) -{ - EDITOR_MENU_ITEM *Item; - UINTN Col; - UINTN Row; - UINTN Width; - CHAR16 *NameString; - CHAR16 *FunctionKeyString; - - // - // variable initialization - // - Col = 1; - Row = (LastRow - 2); - - // - // clear menu bar rows - // - EditorClearLine (LastRow - 2, LastCol, LastRow); - EditorClearLine (LastRow - 1, LastCol, LastRow); - EditorClearLine (LastRow , LastCol, LastRow); - - - // - // print out the menu items - // - for (Item = MenuItems; Item != NULL && Item->Function != NULL; Item++) { - - - NameString = HiiGetString(gShellDebug1HiiHandle, Item->NameToken, NULL); - - - Width = MAX ((StrLen (NameString) + 6), 20); - if (((Col + Width) > LastCol)) { - Row++; - Col = 1; - } - - FunctionKeyString = HiiGetString(gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL); - - ShellPrintEx ((INT32)(Col) - 1, (INT32)(Row) - 1, L"%E%s%N %H%s%N ", FunctionKeyString, NameString); - - FreePool (NameString); - FreePool (FunctionKeyString); - Col += Width; - } - - return EFI_SUCCESS; -} - -/** - Function to dispatch the correct function based on a function key (F1...) - - @param[in] Key The pressed key. - - @retval EFI_NOT_FOUND The key was not a valid function key - (an error was sent to the status bar). - @return The return value from the called dispatch function. -**/ -EFI_STATUS -MenuBarDispatchFunctionKey ( - IN CONST EFI_INPUT_KEY *Key - ) -{ - UINTN Index; - - Index = Key->ScanCode - SCAN_F1; - - // - // check whether in range - // - if (Index > (NumItems - 1)) { - StatusBarSetStatusString (L"Unknown Command"); - return EFI_SUCCESS; - } - - return (MenuItems[Index].Function ()); -} - -/** - Function to dispatch the correct function based on a control-based key (ctrl+o...) - - @param[in] KeyData The pressed key. - - @retval EFI_NOT_FOUND The key was not a valid control-based key - (an error was sent to the status bar). - @return EFI_SUCCESS. -**/ -EFI_STATUS -MenuBarDispatchControlHotKey ( - IN CONST EFI_KEY_DATA *KeyData - ) -{ - UINT16 ControlIndex; - - // - // Set to invalid value first. - // - ControlIndex = MAX_UINT16; - - if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || - (KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) { - // - // For consoles that don't support/report shift state, - // Ctrl+A is translated to 1 (UnicodeChar). - // - ControlIndex = KeyData->Key.UnicodeChar; - } else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && - ((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) && - ((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) { - // - // For consoles that supports/reports shift state, - // make sure only CONTROL is pressed. - // - if ((KeyData->Key.UnicodeChar >= L'A') && (KeyData->Key.UnicodeChar <= L'Z')) { - ControlIndex = KeyData->Key.UnicodeChar - L'A' + 1; - } else if ((KeyData->Key.UnicodeChar >= L'a') && (KeyData->Key.UnicodeChar <= L'z')) { - ControlIndex = KeyData->Key.UnicodeChar - L'a' + 1; - } - } - if ((SCAN_CONTROL_Z < ControlIndex) - ||(NULL == ControlBasedMenuFunctions[ControlIndex])) - { - return EFI_NOT_FOUND; - } - - ControlBasedMenuFunctions[ControlIndex](); - return EFI_SUCCESS; -} - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h deleted file mode 100644 index f0fbefa..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h +++ /dev/null @@ -1,119 +0,0 @@ -/** @file - Declares menubar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_MENU_BAR_H_ -#define _LIB_MENU_BAR_H_ - -#define SCAN_CONTROL_E 5 -#define SCAN_CONTROL_F 6 -#define SCAN_CONTROL_G 7 -#define SCAN_CONTROL_K 11 -#define SCAN_CONTROL_O 15 -#define SCAN_CONTROL_Q 17 -#define SCAN_CONTROL_R 18 -#define SCAN_CONTROL_S 19 -#define SCAN_CONTROL_T 20 -#define SCAN_CONTROL_U 21 -#define SCAN_CONTROL_W 23 -#define SCAN_CONTROL_Z 26 - - -typedef -EFI_STATUS -(*MENU_ITEM_FUNCTION) ( - VOID - ); - -typedef struct _EDITOR_MENU_ITEM { - EFI_STRING_ID NameToken; - CHAR16 FunctionKeyToken; - MENU_ITEM_FUNCTION Function; -} EDITOR_MENU_ITEM; - -/** - Initializa the menu bar with the specified items. - - @param[in] Items The items to display and their functions. - - @retval EFI_SUCCESS The initialization was correct. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MenuBarInit ( - IN CONST EDITOR_MENU_ITEM *Items - ); - -/** - Initialize the control hot-key with the specified items. - - @param[in] Items The hot-key functions. - - @retval EFI_SUCCESS The initialization was correct. -**/ -EFI_STATUS -ControlHotKeyInit ( - IN MENU_ITEM_FUNCTION *Items - ); - -/** - Cleanup function for a menu bar. frees all allocated memory. -**/ -VOID -MenuBarCleanup ( - VOID - ); - -/** - Refresh function for the menu bar. - - @param[in] LastRow The last printable row. - @param[in] LastCol The last printable column. - - @retval EFI_SUCCESS The refresh was successful. -**/ -EFI_STATUS -MenuBarRefresh ( - IN CONST UINTN LastRow, - IN CONST UINTN LastCol - ); - -/** - Function to dispatch the correct function based on a function key (F1...) - - @param[in] Key The pressed key. - - @retval EFI_NOT_FOUND The key was not a valid function key - (an error was sent to the status bar). - @return The return value from the called dispatch function. -**/ -EFI_STATUS -MenuBarDispatchFunctionKey ( - IN CONST EFI_INPUT_KEY *Key - ); - -/** - Function to dispatch the correct function based on a control-based key (ctrl+o...) - - @param[in] KeyData The pressed key. - - @retval EFI_NOT_FOUND The key was not a valid control-based key - (an error was sent to the status bar). - @return EFI_SUCCESS. -**/ -EFI_STATUS -MenuBarDispatchControlHotKey ( - IN CONST EFI_KEY_DATA *KeyData - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c deleted file mode 100644 index 95f47fa..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c +++ /dev/null @@ -1,230 +0,0 @@ -/** @file - Implements statusbar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "EditStatusBar.h" -#include "UefiShellDebug1CommandsLib.h" - -CHAR16 *StatusString; -BOOLEAN StatusBarNeedRefresh; -BOOLEAN StatusStringChanged; - -/** - Initialization function for Status Bar. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @sa StatusBarSetStatusString -**/ -EFI_STATUS -StatusBarInit ( - VOID - ) -{ - // - // initialize the statusbar - // - StatusString = NULL; - StatusBarNeedRefresh = TRUE; - StatusStringChanged = FALSE; - - // - // status string set to "" - // - return (StatusBarSetStatusString (L"")); -} - -/** - Cleanup function for the status bar. -**/ -VOID -StatusBarCleanup ( - VOID - ) -{ - // - // free the status string and backvar's status string - // - SHELL_FREE_NON_NULL (StatusString); -} - -typedef struct { - UINT32 Foreground : 4; - UINT32 Background : 3; -} STATUS_BAR_COLOR_ATTRIBUTES; - -typedef union { - STATUS_BAR_COLOR_ATTRIBUTES Colors; - UINTN Data; -} STATUS_BAR_COLOR_UNION; - -/** - Cause the status bar to refresh it's printing on the screen. - - @param[in] EditorFirst TRUE to indicate the first launch of the editor. - FALSE otherwise. - @param[in] LastRow LastPrintable row. - @param[in] LastCol Last printable column. - @param[in] FileRow Row in the file. - @param[in] FileCol Column in the file. - @param[in] InsertMode TRUE to indicate InsertMode. FALSE otherwise. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -StatusBarRefresh ( - IN BOOLEAN EditorFirst, - IN UINTN LastRow, - IN UINTN LastCol, - IN UINTN FileRow, - IN UINTN FileCol, - IN BOOLEAN InsertMode - ) -{ - STATUS_BAR_COLOR_UNION Orig; - STATUS_BAR_COLOR_UNION New; - - if (!StatusStringChanged && StatusBarNeedRefresh) { - StatusBarSetStatusString (L"\0"); - } - // - // when it's called first time after editor launch, so refresh is mandatory - // - if (!StatusBarNeedRefresh && !StatusStringChanged) { - return EFI_SUCCESS; - } - - // - // back up the screen attributes - // - Orig.Data = gST->ConOut->Mode->Attribute; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background & 0xF; - New.Colors.Background = Orig.Colors.Foreground & 0x7; - - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - - // - // clear status bar - // - EditorClearLine (LastRow, LastCol, LastRow); - - // - // print row, column fields - // - if (FileRow != (UINTN)(-1) && FileCol != (UINTN)(-1)) { - ShellPrintEx ( - 0, - (INT32)(LastRow) - 1, - L" %d,%d %s", - FileRow, - FileCol, - StatusString - ); - } else { - ShellPrintEx ( - 0, - (INT32)(LastRow) - 1, - L" %s", - StatusString - ); - } - - // - // print insert mode field - // - if (InsertMode) { - ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"INS"); - } else { - ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"OVR"); - } - // - // restore the old screen attributes - // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - - // - // restore position in edit area - // - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - StatusBarNeedRefresh = FALSE; - StatusStringChanged = FALSE; - - return EFI_SUCCESS; -} - -/** - Set the status string text part. - - @param[in] Str The string to use. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -StatusBarSetStatusString ( - IN CHAR16 *Str - ) -{ - StatusStringChanged = TRUE; - - // - // free the old status string - // - SHELL_FREE_NON_NULL (StatusString); - StatusString = CatSPrint (NULL, L"%s", Str); - if (StatusString == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Function to retrieve the current status string. - - @return The string that is used. -**/ -CONST CHAR16* -StatusBarGetString ( - VOID - ) -{ - return (StatusString); -} - -/** - Function to set the need refresh boolean to TRUE. -**/ -VOID -StatusBarSetRefresh( - VOID - ) -{ - StatusBarNeedRefresh = TRUE; -} - -/** - Function to get the need refresh boolean to TRUE. - - @retval TRUE The status bar needs to be refreshed. -**/ -BOOLEAN -StatusBarGetRefresh( - VOID - ) -{ - return (StatusBarNeedRefresh); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h deleted file mode 100644 index 02a9b66..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h +++ /dev/null @@ -1,102 +0,0 @@ -/** @file - Declares statusbar interface functions. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_STATUS_BAR_H_ -#define _LIB_STATUS_BAR_H_ - -/** - Initialization function for Status Bar. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @sa StatusBarSetStatusString -**/ -EFI_STATUS -StatusBarInit ( - VOID - ); - -/** - Cleanup function for the status bar. -**/ -VOID -StatusBarCleanup ( - VOID - ); - -/** - Cause the status bar to refresh it's printing on the screen. - - @param[in] EditorFirst TRUE to indicate the first launch of the editor. - FALSE otherwise. - @param[in] LastRow LastPrintable row. - @param[in] LastCol Last printable column. - @param[in] FileRow Row in the file. - @param[in] FileCol Column in the file. - @param[in] InsertMode TRUE to indicate InsertMode. FALSE otherwise. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -StatusBarRefresh ( - IN BOOLEAN EditorFirst, - IN UINTN LastRow, - IN UINTN LastCol, - IN UINTN FileRow, - IN UINTN FileCol, - IN BOOLEAN InsertMode - ); - -/** - Set the status string text part. - - @param[in] Str The string to use. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -StatusBarSetStatusString ( - IN CHAR16 *Str - ); - -/** - Function to retrieve the current status string. - - @return The string that is used. -**/ -CONST CHAR16* -StatusBarGetString ( - VOID - ); - -/** - Function to set the need refresh boolean to TRUE. -**/ -VOID -StatusBarSetRefresh( - VOID - ); - -/** - Function to get the need refresh boolean to TRUE. - - @retval TRUE The status bar needs to be refreshed. -**/ -BOOLEAN -StatusBarGetRefresh( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c deleted file mode 100644 index 5c1852c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c +++ /dev/null @@ -1,207 +0,0 @@ -/** @file - Implements titlebar interface functions. - - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "EditTitleBar.h" -#include "UefiShellDebug1CommandsLib.h" - -CHAR16 *Title = NULL; - -/** - Initialize a title bar. - - @param[in] Prompt The prompt to print in the title bar. - - @retval EFI_SUCCESS The initialization was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainTitleBarInit ( - CONST CHAR16 *Prompt - ) -{ - SHELL_FREE_NON_NULL (Title); - if (Prompt == NULL) { - Title = CatSPrint (NULL, L""); - } else { - // - // set Title - // - Title = CatSPrint (NULL, L"%s", Prompt); - } - if (Title == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Clean up the memory used. -**/ -VOID -MainTitleBarCleanup ( - VOID - ) -{ - SHELL_FREE_NON_NULL (Title); - Title = NULL; -} - -typedef struct { - UINT32 Foreground : 4; - UINT32 Background : 4; -} TITLE_BAR_COLOR_ATTRIBUTES; - -typedef union { - TITLE_BAR_COLOR_ATTRIBUTES Colors; - UINTN Data; -} TITLE_BAR_COLOR_UNION; - -/** - Refresh function for MainTitleBar - - @param[in] FileName The open file's name (or NULL). - @param[in] FileType The type fo the file. - @param[in] ReadOnly TRUE if the file is read only. FALSE otherwise. - @param[in] Modified TRUE if the file was modified. FALSE otherwise. - @param[in] LastCol The last printable column. - @param[in] LastRow The last printable row. - @param[in] Offset The offset into the file. (only for mem/disk) - @param[in] Size The file's size. (only for mem/disk) - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainTitleBarRefresh ( - IN CONST CHAR16 *FileName OPTIONAL, - IN CONST EDIT_FILE_TYPE FileType, - IN CONST BOOLEAN ReadOnly, - IN CONST BOOLEAN Modified, - IN CONST UINTN LastCol, - IN CONST UINTN LastRow, - IN CONST UINTN Offset, - IN CONST UINTN Size - ) -{ - TITLE_BAR_COLOR_UNION Orig; - TITLE_BAR_COLOR_UNION New; - CONST CHAR16 *FileNameTmp; - INTN TempInteger; - - - // - // backup the old screen attributes - // - Orig.Data = gST->ConOut->Mode->Attribute; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background & 0xF; - New.Colors.Background = Orig.Colors.Foreground & 0x7; - - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - - // - // clear the title line - // - EditorClearLine (1, LastCol, LastRow); - - if (Title != NULL) { - // - // print the new title bar prefix - // - ShellPrintEx ( - 0, - 0, - L"%s ", - Title - ); - } - if (FileName == NULL) { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - return EFI_SUCCESS; - } - // - // First Extract the FileName from fullpath - // - FileNameTmp = FileName; - for (TempInteger = StrLen (FileNameTmp) - 1; TempInteger >= 0; TempInteger--) { - if (FileNameTmp[TempInteger] == L'\\') { - break; - } - } - - FileNameTmp = FileNameTmp + TempInteger + 1; - - // - // the space for file name is 20 characters - // - if (StrLen (FileNameTmp) <= 20) { - ShellPrintEx (-1,-1, L"%s ", FileNameTmp); - for (TempInteger = StrLen (FileNameTmp); TempInteger < 20; TempInteger++) { - ShellPrintEx (-1,-1, L" "); - } - - } else { - for (TempInteger = 0; TempInteger < 17; TempInteger++) { - ShellPrintEx (-1,-1, L"%c", FileNameTmp[TempInteger]); - } - // - // print "..." - // - ShellPrintEx (-1,-1, L"... "); - } - // - // print file type field - // - switch (FileType){ - case FileTypeAscii: - case FileTypeUnicode: - if (FileType == FileTypeAscii){ - ShellPrintEx (-1,-1, L" ASCII "); - } else { - ShellPrintEx (-1,-1, L" UNICODE "); - } - // - // print read-only field for text files - // - if (ReadOnly) { - ShellPrintEx (-1,-1, L"ReadOnly "); - } else { - ShellPrintEx (-1,-1, L" "); - } - break; - case FileTypeDiskBuffer: - case FileTypeMemBuffer: - // - // Print the offset. - // - ShellPrintEx (-1,-1, L"Offset %X | Size %X", Offset, Size); - case FileTypeFileBuffer: - break; - default: - break; - } - // - // print modified field - // - if (Modified) { - ShellPrintEx (-1,-1, L"Modified"); - } - // - // restore the old attribute - // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h deleted file mode 100644 index 13acd21..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h +++ /dev/null @@ -1,74 +0,0 @@ -/** @file - Declares titlebar interface functions. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_TITLE_BAR_H_ -#define _LIB_TITLE_BAR_H_ - -/** - Initialize a title bar. - - @param[in] Prompt The prompt to print in the title bar. - - @retval EFI_SUCCESS The initialization was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MainTitleBarInit ( - CONST CHAR16 *Prompt - ); - -/** - Clean up the memory used. -**/ -VOID -MainTitleBarCleanup ( - VOID - ); - -typedef enum { - FileTypeNone, - FileTypeAscii, - FileTypeUnicode, - FileTypeDiskBuffer, - FileTypeMemBuffer, - FileTypeFileBuffer -} EDIT_FILE_TYPE; - -/** - Refresh function for MainTitleBar - - @param[in] FileName The open file's name (or NULL). - @param[in] FileType The type fo the file. - @param[in] ReadOnly TRUE if the file is read only. FALSE otherwise. - @param[in] Modified TRUE if the file was modified. FALSE otherwise. - @param[in] LastCol The last printable column. - @param[in] LastRow The last printable row. - @param[in] Offset The offset into the file. (only for mem/disk) - @param[in] Size The file's size. (only for mem/disk) - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -MainTitleBarRefresh ( - IN CONST CHAR16 *FileName OPTIONAL, - IN CONST EDIT_FILE_TYPE FileType, - IN CONST BOOLEAN ReadOnly, - IN CONST BOOLEAN Modified, - IN CONST UINTN LastCol, - IN CONST UINTN LastRow, - IN CONST UINTN Offset, - IN CONST UINTN Size - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c deleted file mode 100644 index 0327313..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c +++ /dev/null @@ -1,164 +0,0 @@ -/** @file - Main file for EfiCompress shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "Compress.h" - -/** - Function for 'compress' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEfiCompress ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - SHELL_FILE_HANDLE InShellFileHandle; - SHELL_FILE_HANDLE OutShellFileHandle; - UINT64 OutSize; - UINTN OutSize2; - VOID *OutBuffer; - UINT64 InSize; - UINTN InSize2; - VOID *InBuffer; - CHAR16 *InFileName; - CONST CHAR16 *OutFileName; - CONST CHAR16 *TempParam; - - InFileName = NULL; - OutFileName = NULL; - OutSize = 0; - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - OutBuffer = NULL; - InShellFileHandle = NULL; - OutShellFileHandle = NULL; - InBuffer = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"eficompress"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"eficompress"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempParam = ShellCommandLineGetRawValue(Package, 1); - ASSERT(TempParam != NULL); - InFileName = ShellFindFilePath(TempParam); - OutFileName = ShellCommandLineGetRawValue(Package, 2); - if (InFileName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"eficompress", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } else { - if (ShellIsDirectory(InFileName) == EFI_SUCCESS){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", InFileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - if (ShellIsDirectory(OutFileName) == EFI_SUCCESS){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", OutFileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - if (ShellStatus == SHELL_SUCCESS) { - Status = ShellOpenFileByName(InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_NOT_FOUND; - } - Status = ShellOpenFileByName(OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue(Package, 2)); - ShellStatus = SHELL_NOT_FOUND; - } - } - if (ShellStatus == SHELL_SUCCESS) { - Status = gEfiShellProtocol->GetFileSize(InShellFileHandle, &InSize); - ASSERT_EFI_ERROR(Status); - InBuffer = AllocateZeroPool((UINTN)InSize); - if (InBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - InSize2 = (UINTN) InSize; - Status = gEfiShellProtocol->ReadFile (InShellFileHandle, &InSize2, InBuffer); - InSize = InSize2; - ASSERT_EFI_ERROR (Status); - Status = Compress (InBuffer, InSize, OutBuffer, &OutSize); - if (Status == EFI_BUFFER_TOO_SMALL) { - OutBuffer = AllocateZeroPool ((UINTN) OutSize); - if (OutBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = Compress (InBuffer, InSize, OutBuffer, &OutSize); - } - } - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_COMPRESS_FAIL), gShellDebug1HiiHandle, Status); - ShellStatus = ((Status == EFI_OUT_OF_RESOURCES) ? SHELL_OUT_OF_RESOURCES : SHELL_DEVICE_ERROR); - } else { - OutSize2 = (UINTN)OutSize; - Status = gEfiShellProtocol->WriteFile(OutShellFileHandle, &OutSize2, OutBuffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, L"eficompress", OutFileName); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - } - } - } - - ShellCommandLineFreeVarList (Package); - } - if (InShellFileHandle != NULL) { - gEfiShellProtocol->CloseFile(InShellFileHandle); - } - if (OutShellFileHandle != NULL) { - gEfiShellProtocol->CloseFile(OutShellFileHandle); - } - SHELL_FREE_NON_NULL(InFileName); - SHELL_FREE_NON_NULL(InBuffer); - SHELL_FREE_NON_NULL(OutBuffer); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c deleted file mode 100644 index cbd4e1c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c +++ /dev/null @@ -1,186 +0,0 @@ -/** @file - Main file for EfiDecompress shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include - - -/** - Function for 'decompress' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEfiDecompress ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - SHELL_FILE_HANDLE InFileHandle; - SHELL_FILE_HANDLE OutFileHandle; - UINT32 OutSize; - UINTN OutSizeTemp; - VOID *OutBuffer; - UINTN InSize; - VOID *InBuffer; - CHAR16 *InFileName; - CONST CHAR16 *OutFileName; - UINT64 Temp64Bit; - UINT32 ScratchSize; - VOID *ScratchBuffer; - EFI_DECOMPRESS_PROTOCOL *Decompress; - CONST CHAR16 *TempParam; - - InFileName = NULL; - OutFileName = NULL; - OutSize = 0; - ScratchSize = 0; - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - OutBuffer = NULL; - InBuffer = NULL; - ScratchBuffer = NULL; - InFileHandle = NULL; - OutFileHandle = NULL; - Decompress = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"efidecompress", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"efidecompress"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"efidecompress"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempParam = ShellCommandLineGetRawValue(Package, 1); - ASSERT(TempParam != NULL); - InFileName = ShellFindFilePath(TempParam); - OutFileName = ShellCommandLineGetRawValue(Package, 2); - if (InFileName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"efidecompress", TempParam); - ShellStatus = SHELL_NOT_FOUND; - } else { - if (ShellIsDirectory(InFileName) == EFI_SUCCESS){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", InFileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - if (ShellIsDirectory(OutFileName) == EFI_SUCCESS){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", OutFileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - if (ShellStatus == SHELL_SUCCESS) { - Status = ShellOpenFileByName(InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"efidecompress", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_NOT_FOUND; - } - } - - if (ShellStatus == SHELL_SUCCESS) { - Status = FileHandleGetSize(InFileHandle, &Temp64Bit); - ASSERT(Temp64Bit <= (UINT32)(-1)); - InSize = (UINTN)Temp64Bit; - ASSERT_EFI_ERROR(Status); - InBuffer = AllocateZeroPool(InSize); - if (InBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = gEfiShellProtocol->ReadFile (InFileHandle, &InSize, InBuffer); - ASSERT_EFI_ERROR (Status); - - Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID**) &Decompress); - ASSERT_EFI_ERROR (Status); - - Status = Decompress->GetInfo (Decompress, InBuffer, (UINT32) InSize, &OutSize, &ScratchSize); - } - - if (EFI_ERROR(Status) || OutSize == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName); - ShellStatus = SHELL_NOT_FOUND; - } else { - Status = ShellOpenFileByName(OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status); - ShellStatus = SHELL_NOT_FOUND; - } else { - OutBuffer = AllocateZeroPool(OutSize); - ScratchBuffer = AllocateZeroPool(ScratchSize); - if (OutBuffer == NULL || ScratchBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = Decompress->Decompress (Decompress, InBuffer, (UINT32) InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize); - } - } - } - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_FAIL), gShellDebug1HiiHandle, Status); - ShellStatus = ((Status == EFI_OUT_OF_RESOURCES) ? SHELL_OUT_OF_RESOURCES : SHELL_DEVICE_ERROR); - } else { - OutSizeTemp = OutSize; - Status = gEfiShellProtocol->WriteFile (OutFileHandle, &OutSizeTemp, OutBuffer); - OutSize = (UINT32) OutSizeTemp; - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, L"efidecompress", OutFileName, Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - } - } - } - - ShellCommandLineFreeVarList (Package); - } - if (InFileHandle != NULL) { - gEfiShellProtocol->CloseFile(InFileHandle); - } - if (OutFileHandle != NULL) { - gEfiShellProtocol->CloseFile(OutFileHandle); - } - - SHELL_FREE_NON_NULL(InFileName); - SHELL_FREE_NON_NULL(InBuffer); - SHELL_FREE_NON_NULL(OutBuffer); - SHELL_FREE_NON_NULL(ScratchBuffer); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c deleted file mode 100644 index df23511..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c +++ /dev/null @@ -1,2475 +0,0 @@ -/** @file - Defines HBufferImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" - -extern EFI_HANDLE HImageHandleBackup; - -extern HEFI_EDITOR_FILE_IMAGE HFileImage; -extern HEFI_EDITOR_DISK_IMAGE HDiskImage; -extern HEFI_EDITOR_MEM_IMAGE HMemImage; - -extern HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar; -extern HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar; -extern HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar; - -extern BOOLEAN HEditorMouseAction; - -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar; - -HEFI_EDITOR_BUFFER_IMAGE HBufferImage; -HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar; - -// -// for basic initialization of HBufferImage -// -HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst = { - NULL, - NULL, - 0, - NULL, - { - 0, - 0 - }, - { - 0, - 0 - }, - { - 0, - 0 - }, - 0, - TRUE, - FALSE, - FileTypeNone, - NULL, - NULL, - NULL -}; - -// -// the whole edit area needs to be refreshed -// -BOOLEAN HBufferImageNeedRefresh; - -// -// only the current line in edit area needs to be refresh -// -BOOLEAN HBufferImageOnlyLineNeedRefresh; - -BOOLEAN HBufferImageMouseNeedRefresh; - -/** - Initialization function for HBufferImage - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HBufferImageInit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // basically initialize the HBufferImage - // - CopyMem (&HBufferImage, &HBufferImageConst, sizeof (HBufferImage)); - - // - // INIT listhead - // - HBufferImage.ListHead = AllocateZeroPool (sizeof (LIST_ENTRY)); - if (HBufferImage.ListHead == NULL) { - return EFI_LOAD_ERROR; - } - - InitializeListHead (HBufferImage.ListHead); - - HBufferImage.DisplayPosition.Row = 2; - HBufferImage.DisplayPosition.Column = 10; - HBufferImage.MousePosition.Row = 2; - HBufferImage.MousePosition.Column = 10; - - HBufferImage.FileImage = &HFileImage; - HBufferImage.DiskImage = &HDiskImage; - HBufferImage.MemImage = &HMemImage; - - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageMouseNeedRefresh = FALSE; - - HBufferImageBackupVar.FileImage = &HFileImageBackupVar; - HBufferImageBackupVar.DiskImage = &HDiskImageBackupVar; - HBufferImageBackupVar.MemImage = &HMemImageBackupVar; - - Status = HFileImageInit (); - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - - Status = HDiskImageInit (); - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - - Status = HMemImageInit (); - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - - return EFI_SUCCESS; -} - -/** - Backup function for HBufferImage. Only a few fields need to be backup. - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageBackup ( - VOID - ) -{ - HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition; - - HBufferImageBackupVar.BufferPosition = HBufferImage.BufferPosition; - - HBufferImageBackupVar.Modified = HBufferImage.Modified; - - HBufferImageBackupVar.BufferType = HBufferImage.BufferType; - HBufferImageBackupVar.LowVisibleRow = HBufferImage.LowVisibleRow; - HBufferImageBackupVar.HighBits = HBufferImage.HighBits; - - // - // three kinds of buffer supported - // file buffer - // disk buffer - // memory buffer - // - switch (HBufferImage.BufferType) { - case FileTypeFileBuffer: - HFileImageBackup (); - break; - - case FileTypeDiskBuffer: - HDiskImageBackup (); - break; - - case FileTypeMemBuffer: - HMemImageBackup (); - break; - - default: - break; - } - - return EFI_SUCCESS; -} - -/** - Free all the lines in HBufferImage. - Fields affected: - Lines - CurrentLine - NumLines - ListHead - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageFreeLines ( - VOID - ) -{ - HFreeLines (HBufferImage.ListHead, HBufferImage.Lines); - - HBufferImage.Lines = NULL; - HBufferImage.CurrentLine = NULL; - HBufferImage.NumLines = 0; - - return EFI_SUCCESS; -} - -/** - Cleanup function for HBufferImage - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageCleanup ( - VOID - ) -{ - EFI_STATUS Status; - - // - // free all the lines - // - Status = HBufferImageFreeLines (); - - SHELL_FREE_NON_NULL (HBufferImage.ListHead); - HBufferImage.ListHead = NULL; - - HFileImageCleanup (); - HDiskImageCleanup (); - - return Status; - -} - -/** - Print Line on Row - - @param[in] Line The lline to print. - @param[in] Row The row on screen ( begin from 1 ). - @param[in] FRow The FRow. - @param[in] Orig The original color. - @param[in] New The color to print with. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImagePrintLine ( - IN HEFI_EDITOR_LINE *Line, - IN UINTN Row, - IN UINTN FRow, - IN HEFI_EDITOR_COLOR_UNION Orig, - IN HEFI_EDITOR_COLOR_UNION New - - ) -{ - - UINTN Index; - UINTN Pos; - BOOLEAN Selected; - BOOLEAN BeNewColor; - UINTN RowStart; - UINTN RowEnd; - UINTN ColStart; - UINTN ColEnd; - - // - // variable initialization - // - ColStart = 0; - ColEnd = 0; - Selected = FALSE; - - // - // print the selected area in opposite color - // - if (HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) { - RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1; - RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1; - - ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1; - ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1; - - if (FRow >= RowStart && FRow <= RowEnd) { - Selected = TRUE; - } - - if (FRow > RowStart) { - ColStart = 1; - } - - if (FRow < RowEnd) { - ColEnd = 0x10; - } - - } - - if (!HEditorMouseAction) { - ShellPrintEx ( - 0, - (INT32)Row - 1, - L"%8X ", - ((INT32)Row - 2 + HBufferImage.LowVisibleRow - 1) * 0x10 - ); - - } - - for (Index = 0; Index < 0x08 && Index < Line->Size; Index++) { - - BeNewColor = FALSE; - - if (Selected) { - if (Index + 1 >= ColStart && Index + 1 <= ColEnd) { - BeNewColor = TRUE; - } - } - - if (BeNewColor) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - } else { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); - } - - Pos = 10 + (Index * 3); - if (Line->Buffer[Index] < 0x10) { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"0"); - Pos++; - } - - if (Index < 0x07) { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]); - } else { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]); - } - - } - - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); - while (Index < 0x08) { - Pos = 10 + (Index * 3); - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - Index++; - } - - while (Index < 0x10 && Index < Line->Size) { - - BeNewColor = FALSE; - - if (Selected) { - if (Index + 1 >= ColStart && Index + 1 <= ColEnd) { - BeNewColor = TRUE; - } - } - - if (BeNewColor) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - } else { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); - } - - Pos = 10 + (Index * 3) + 1; - if (Line->Buffer[Index] < 0x10) { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"0"); - Pos++; - } - - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]); - Index++; - } - - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); - while (Index < 0x10) { - Pos = 10 + (Index * 3) + 1; - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - Index++; - } - // - // restore the original color - // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); - - // - // PRINT the buffer content - // - if (!HEditorMouseAction) { - for (Index = 0; Index < 0x10 && Index < Line->Size; Index++) { - Pos = ASCII_POSITION + Index; - - // - // learned from shelle.h -- IsValidChar - // - if (Line->Buffer[Index] >= L' ') { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%c", (CHAR16) Line->Buffer[Index]); - } else { - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%c", '.'); - } - } - - while (Index < 0x10) { - Pos = ASCII_POSITION + Index; - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - Index++; - } - } - // - // restore the abundant blank in hex edit area to original color - // - if (Selected) { - if (ColEnd <= 7) { - Pos = 10 + (ColEnd - 1) * 3 + 2; - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - } else if (ColEnd == 8) { - Pos = 10 + (ColEnd - 1) * 3 + 2; - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - } else { - Pos = 10 + (ColEnd - 1) * 3 + 3; - ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); - } - } - - return EFI_SUCCESS; -} - -/** - Function to decide if a column number is stored in the high bits. - - @param[in] Column The column to examine. - @param[out] FCol The actual column number. - - @retval TRUE The actual column was in high bits and is now in FCol. - @retval FALSE There was not a column number in the high bits. -**/ -BOOLEAN -HBufferImageIsAtHighBits ( - IN UINTN Column, - OUT UINTN *FCol - ) -{ - Column -= 10; - - // - // NOW AFTER THE SUB, Column start from 0 - // 23 AND 24 ARE BOTH BLANK - // - if (Column == 24) { - *FCol = 0; - return FALSE; - } - - if (Column > 24) { - Column--; - } - - *FCol = (Column / 3) + 1; - - if (Column % 3 == 0) { - return TRUE; - } - - if ((Column % 3 == 2)) { - *FCol = 0; - } - - return FALSE; -} - -/** - Decide if a point is in the already selected area. - - @param[in] MouseRow The row of the point to test. - @param[in] MouseCol The col of the point to test. - - @retval TRUE The point is in the selected area. - @retval FALSE The point is not in the selected area. -**/ -BOOLEAN -HBufferImageIsInSelectedArea ( - IN UINTN MouseRow, - IN UINTN MouseCol - ) -{ - UINTN FRow; - UINTN RowStart; - UINTN RowEnd; - UINTN ColStart; - UINTN ColEnd; - UINTN MouseColStart; - UINTN MouseColEnd; - - // - // judge mouse position whether is in selected area - // - // - // not select - // - if (HMainEditor.SelectStart == 0 || HMainEditor.SelectEnd == 0) { - return FALSE; - } - // - // calculate the select area - // - RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1; - RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1; - - ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1; - ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1; - - FRow = HBufferImage.LowVisibleRow + MouseRow - 2; - if (FRow < RowStart || FRow > RowEnd) { - return FALSE; - } - - if (FRow > RowStart) { - ColStart = 1; - } - - if (FRow < RowEnd) { - ColEnd = 0x10; - } - - MouseColStart = 10 + (ColStart - 1) * 3; - if (ColStart > 8) { - MouseColStart++; - } - - MouseColEnd = 10 + (ColEnd - 1) * 3 + 1; - if (ColEnd > 8) { - MouseColEnd++; - } - - if (MouseCol < MouseColStart || MouseCol > MouseColEnd) { - return FALSE; - } - - return TRUE; -} - -/** - Set mouse position according to HBufferImage.MousePosition. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageRestoreMousePosition ( - VOID - ) -{ - HEFI_EDITOR_COLOR_UNION Orig; - HEFI_EDITOR_COLOR_UNION New; - UINTN FRow; - UINTN FColumn; - BOOLEAN HasCharacter; - HEFI_EDITOR_LINE *CurrentLine; - HEFI_EDITOR_LINE *Line; - UINT8 Value; - BOOLEAN HighBits; - - Line = NULL; - if (HMainEditor.MouseSupported) { - - if (HBufferImageMouseNeedRefresh) { - - HBufferImageMouseNeedRefresh = FALSE; - - // - // if mouse position not moved and only mouse action - // so do not need to refresh mouse position - // - if (( - HBufferImage.MousePosition.Row == HBufferImageBackupVar.MousePosition.Row && - HBufferImage.MousePosition.Column == HBufferImageBackupVar.MousePosition.Column - ) && - HEditorMouseAction - ) { - return EFI_SUCCESS; - } - // - // backup the old screen attributes - // - Orig = HMainEditor.ColorAttributes; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background & 0xF; - New.Colors.Background = Orig.Colors.Foreground & 0x7; - - // - // if in selected area, - // so do not need to refresh mouse - // - if (!HBufferImageIsInSelectedArea ( - HBufferImageBackupVar.MousePosition.Row, - HBufferImageBackupVar.MousePosition.Column - )) { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - } else { - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - } - // - // clear the old mouse position - // - FRow = HBufferImage.LowVisibleRow + HBufferImageBackupVar.MousePosition.Row - 2; - - HighBits = HBufferImageIsAtHighBits ( - HBufferImageBackupVar.MousePosition.Column, - &FColumn - ); - - HasCharacter = TRUE; - if (FRow > HBufferImage.NumLines || FColumn == 0) { - HasCharacter = FALSE; - } else { - CurrentLine = HBufferImage.CurrentLine; - Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row); - - if (Line == NULL || FColumn > Line->Size) { - HasCharacter = FALSE; - } - - HBufferImage.CurrentLine = CurrentLine; - } - - ShellPrintEx ( - (INT32)HBufferImageBackupVar.MousePosition.Column - 1, - (INT32)HBufferImageBackupVar.MousePosition.Row - 1, - L" " - ); - - if (HasCharacter) { - if (HighBits) { - Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf0); - Value = (UINT8) (Value >> 4); - } else { - Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf); - } - - ShellPrintEx ( - (INT32)HBufferImageBackupVar.MousePosition.Column - 1, - (INT32)HBufferImageBackupVar.MousePosition.Row - 1, - L"%x", - Value - ); - } - - if (!HBufferImageIsInSelectedArea ( - HBufferImage.MousePosition.Row, - HBufferImage.MousePosition.Column - )) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); - } else { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - } - // - // clear the old mouse position - // - FRow = HBufferImage.LowVisibleRow + HBufferImage.MousePosition.Row - 2; - - HighBits = HBufferImageIsAtHighBits ( - HBufferImage.MousePosition.Column, - &FColumn - ); - - HasCharacter = TRUE; - if (FRow > HBufferImage.NumLines || FColumn == 0) { - HasCharacter = FALSE; - } else { - CurrentLine = HBufferImage.CurrentLine; - Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row); - - if (Line == NULL || FColumn > Line->Size) { - HasCharacter = FALSE; - } - - HBufferImage.CurrentLine = CurrentLine; - } - - ShellPrintEx ( - (INT32)HBufferImage.MousePosition.Column - 1, - (INT32)HBufferImage.MousePosition.Row - 1, - L" " - ); - - if (HasCharacter) { - if (HighBits) { - Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf0); - Value = (UINT8) (Value >> 4); - } else { - Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf); - } - - ShellPrintEx ( - (INT32)HBufferImage.MousePosition.Column - 1, - (INT32)HBufferImage.MousePosition.Row - 1, - L"%x", - Value - ); - } - // - // end of HasCharacter - // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); - } - // - // end of MouseNeedRefresh - // - } - // - // end of MouseSupported - // - return EFI_SUCCESS; -} - -/** - Set cursor position according to HBufferImage.DisplayPosition. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageRestorePosition ( - VOID - ) -{ - // - // set cursor position - // - gST->ConOut->SetCursorPosition ( - gST->ConOut, - HBufferImage.DisplayPosition.Column - 1, - HBufferImage.DisplayPosition.Row - 1 - ); - - return EFI_SUCCESS; -} - -/** - Refresh function for HBufferImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A Load error occured. - -**/ -EFI_STATUS -HBufferImageRefresh ( - VOID - ) -{ - LIST_ENTRY *Link; - HEFI_EDITOR_LINE *Line; - UINTN Row; - HEFI_EDITOR_COLOR_UNION Orig; - HEFI_EDITOR_COLOR_UNION New; - - UINTN StartRow; - UINTN EndRow; - UINTN FStartRow; - UINTN Tmp; - - Orig = HMainEditor.ColorAttributes; - New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background; - New.Colors.Background = Orig.Colors.Foreground; - - // - // if it's the first time after editor launch, so should refresh - // - if (HEditorFirst == FALSE) { - // - // no definite required refresh - // and file position displayed on screen has not been changed - // - if (!HBufferImageNeedRefresh && - !HBufferImageOnlyLineNeedRefresh && - HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow - ) { - HBufferImageRestoreMousePosition (); - HBufferImageRestorePosition (); - return EFI_SUCCESS; - } - } - - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - - // - // only need to refresh current line - // - if (HBufferImageOnlyLineNeedRefresh && HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow) { - - HBufferImagePrintLine ( - HBufferImage.CurrentLine, - HBufferImage.DisplayPosition.Row, - HBufferImage.BufferPosition.Row, - Orig, - New - ); - } else { - // - // the whole edit area need refresh - // - if (HEditorMouseAction && HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) { - if (HMainEditor.SelectStart != HMainEditorBackupVar.SelectStart) { - if (HMainEditor.SelectStart >= HMainEditorBackupVar.SelectStart && HMainEditorBackupVar.SelectStart != 0) { - StartRow = (HMainEditorBackupVar.SelectStart - 1) / 0x10 + 1; - } else { - StartRow = (HMainEditor.SelectStart - 1) / 0x10 + 1; - } - } else { - StartRow = (HMainEditor.SelectStart - 1) / 0x10 + 1; - } - - if (HMainEditor.SelectEnd <= HMainEditorBackupVar.SelectEnd) { - EndRow = (HMainEditorBackupVar.SelectEnd - 1) / 0x10 + 1; - } else { - EndRow = (HMainEditor.SelectEnd - 1) / 0x10 + 1; - } - // - // swap - // - if (StartRow > EndRow) { - Tmp = StartRow; - StartRow = EndRow; - EndRow = Tmp; - } - - FStartRow = StartRow; - - StartRow = 2 + StartRow - HBufferImage.LowVisibleRow; - EndRow = 2 + EndRow - HBufferImage.LowVisibleRow; - - } else { - // - // not mouse selection actions - // - FStartRow = HBufferImage.LowVisibleRow; - StartRow = 2; - EndRow = (HMainEditor.ScreenSize.Row - 1); - } - // - // no line - // - if (HBufferImage.Lines == NULL) { - HBufferImageRestoreMousePosition (); - HBufferImageRestorePosition (); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - return EFI_SUCCESS; - } - // - // get the first line that will be displayed - // - Line = HMoveLine (FStartRow - HBufferImage.BufferPosition.Row); - if (Line == NULL) { - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - return EFI_LOAD_ERROR; - } - - Link = &(Line->Link); - Row = StartRow; - do { - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - // - // print line at row - // - HBufferImagePrintLine ( - Line, - Row, - HBufferImage.LowVisibleRow + Row - 2, - Orig, - New - ); - - Link = Link->ForwardLink; - Row++; - } while (Link != HBufferImage.ListHead && Row <= EndRow); - - while (Row <= EndRow) { - EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row); - Row++; - } - // - // while not file end and not screen full - // - } - - HBufferImageRestoreMousePosition (); - HBufferImageRestorePosition (); - - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = FALSE; - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - return EFI_SUCCESS; -} - -/** - Read an image into a buffer friom a source. - - @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer. - @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] BufferType The type of buffer to save. IGNORED. - @param[in] Recover TRUE for recovermode, FALSE otherwise. - - @return EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageRead ( - IN CONST CHAR16 *FileName, - IN CONST CHAR16 *DiskName, - IN UINTN DiskOffset, - IN UINTN DiskSize, - IN UINTN MemOffset, - IN UINTN MemSize, - IN EDIT_FILE_TYPE BufferType, - IN BOOLEAN Recover - ) -{ - EFI_STATUS Status; - EDIT_FILE_TYPE BufferTypeBackup; - - // - // variable initialization - // - Status = EFI_SUCCESS; - HBufferImage.BufferType = BufferType; - - // - // three types of buffer supported - // file buffer - // disk buffer - // memory buffer - // - BufferTypeBackup = HBufferImage.BufferType; - - switch (BufferType) { - case FileTypeFileBuffer: - Status = HFileImageRead (FileName, Recover); - break; - - case FileTypeDiskBuffer: - Status = HDiskImageRead (DiskName, DiskOffset, DiskSize, Recover); - break; - - case FileTypeMemBuffer: - Status = HMemImageRead (MemOffset, MemSize, Recover); - break; - - default: - Status = EFI_NOT_FOUND; - break; - } - - if (EFI_ERROR (Status)) { - HBufferImage.BufferType = BufferTypeBackup; - } - - return Status; -} - -/** - Save the current image. - - @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer. - @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] BufferType The type of buffer to save. IGNORED. - - @return EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageSave ( - IN CHAR16 *FileName, - IN CHAR16 *DiskName, - IN UINTN DiskOffset, - IN UINTN DiskSize, - IN UINTN MemOffset, - IN UINTN MemSize, - IN EDIT_FILE_TYPE BufferType - ) -{ - EFI_STATUS Status; - EDIT_FILE_TYPE BufferTypeBackup; - - // - // variable initialization - // - Status = EFI_SUCCESS; - BufferTypeBackup = HBufferImage.BufferType; - - switch (HBufferImage.BufferType) { - // - // file buffer - // - case FileTypeFileBuffer: - Status = HFileImageSave (FileName); - break; - - // - // disk buffer - // - case FileTypeDiskBuffer: - Status = HDiskImageSave (DiskName, DiskOffset, DiskSize); - break; - - // - // memory buffer - // - case FileTypeMemBuffer: - Status = HMemImageSave (MemOffset, MemSize); - break; - - default: - Status = EFI_NOT_FOUND; - break; - } - - if (EFI_ERROR (Status)) { - HBufferImage.BufferType = BufferTypeBackup; - } - - return Status; -} - -/** - Create a new line and append it to the line list. - Fields affected: - NumLines - Lines - - @retval NULL create line failed. - @return the line created. - -**/ -HEFI_EDITOR_LINE * -HBufferImageCreateLine ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - - // - // allocate for line structure - // - Line = AllocateZeroPool (sizeof (HEFI_EDITOR_LINE)); - if (Line == NULL) { - return NULL; - } - - Line->Signature = EFI_EDITOR_LINE_LIST; - Line->Size = 0; - - HBufferImage.NumLines++; - - // - // insert to line list - // - InsertTailList (HBufferImage.ListHead, &Line->Link); - - if (HBufferImage.Lines == NULL) { - HBufferImage.Lines = CR ( - HBufferImage.ListHead->ForwardLink, - HEFI_EDITOR_LINE, - Link, - EFI_EDITOR_LINE_LIST - ); - } - - return Line; -} - -/** - Free the current image. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageFree ( - VOID - ) -{ - // - // free all lines - // - HBufferImageFreeLines (); - - return EFI_SUCCESS; -} - -/** - change char to int value based on Hex. - - @param[in] Char The input char. - - @return The character's index value. - @retval -1 The operation failed. -**/ -INTN -HBufferImageCharToHex ( - IN CHAR16 Char - ) -{ - // - // change the character to hex - // - if (Char >= L'0' && Char <= L'9') { - return (Char - L'0'); - } - - if (Char >= L'a' && Char <= L'f') { - return (Char - L'a' + 10); - } - - if (Char >= L'A' && Char <= L'F') { - return (Char - L'A' + 10); - } - - return -1; -} - -/** - Add character. - - @param[in] Char -- input char. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HBufferImageAddChar ( - IN CHAR16 Char - ) -{ - HEFI_EDITOR_LINE *Line; - HEFI_EDITOR_LINE *NewLine; - INTN Value; - UINT8 Old; - UINTN FRow; - UINTN FCol; - BOOLEAN High; - - Value = HBufferImageCharToHex (Char); - - // - // invalid input - // - if (Value == -1) { - return EFI_SUCCESS; - } - - Line = HBufferImage.CurrentLine; - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - High = HBufferImage.HighBits; - - // - // only needs to refresh current line - // - HBufferImageOnlyLineNeedRefresh = TRUE; - - // - // not a full line and beyond the last character - // - if (FCol > Line->Size) { - // - // cursor always at high 4 bits - // and always put input to the low 4 bits - // - Line->Buffer[Line->Size] = (UINT8) Value; - Line->Size++; - High = FALSE; - } else { - - Old = Line->Buffer[FCol - 1]; - - // - // always put the input to the low 4 bits - // - Old = (UINT8) (Old & 0x0f); - Old = (UINT8) (Old << 4); - Old = (UINT8) (Value + Old); - Line->Buffer[FCol - 1] = Old; - - // - // at the low 4 bits of the last character of a full line - // so if no next line, need to create a new line - // - if (!High && FCol == 0x10) { - - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageNeedRefresh = TRUE; - - if (Line->Link.ForwardLink == HBufferImage.ListHead) { - // - // last line - // - // create a new line - // - NewLine = HBufferImageCreateLine (); - if (NewLine == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // end of NULL - // - } - // - // end of == ListHead - // - } - // - // end of == 0x10 - // - // if already at end of this line, scroll it to the start of next line - // - if (FCol == 0x10 && !High) { - // - // definitely has next line - // - FRow++; - FCol = 1; - High = TRUE; - } else { - // - // if not at end of this line, just move to next column - // - if (!High) { - FCol++; - } - - if (High) { - High = FALSE; - } else { - High = TRUE; - } - - } - // - // end of ==FALSE - // - } - // - // move cursor to right - // - HBufferImageMovePosition (FRow, FCol, High); - - if (!HBufferImage.Modified) { - HBufferImage.Modified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Delete the previous character. - - @retval EFI_SUCCESS The operationw as successful. -**/ -EFI_STATUS -HBufferImageDoBackspace ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - - UINTN FileColumn; - UINTN FPos; - BOOLEAN LastLine; - - // - // variable initialization - // - LastLine = FALSE; - - // - // already the first character - // - if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) { - return EFI_SUCCESS; - } - - FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1; - - FileColumn = HBufferImage.BufferPosition.Column; - - Line = HBufferImage.CurrentLine; - LastLine = FALSE; - if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) { - LastLine = TRUE; - } - - HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL); - - // - // if is the last line - // then only this line need to be refreshed - // - if (LastLine) { - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = TRUE; - } else { - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - } - - if (!HBufferImage.Modified) { - HBufferImage.Modified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - ASCII key + Backspace + return. - - @param[in] Char The input char. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HBufferImageDoCharInput ( - IN CHAR16 Char - ) -{ - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - switch (Char) { - case 0: - break; - - case 0x08: - Status = HBufferImageDoBackspace (); - break; - - case 0x09: - case 0x0a: - case 0x0d: - // - // Tabs, Returns are thought as nothing - // - break; - - default: - // - // DEAL WITH ASCII CHAR, filter out thing like ctrl+f - // - if (Char > 127 || Char < 32) { - Status = StatusBarSetStatusString (L"Unknown Command"); - } else { - Status = HBufferImageAddChar (Char); - } - - break; - } - - return Status; -} - -/** - Check user specified FileRow is above current screen. - - @param[in] FileRow Row of file position ( start from 1 ). - - @retval TRUE It is above the current screen. - @retval FALSE It is not above the current screen. - -**/ -BOOLEAN -HAboveCurrentScreen ( - IN UINTN FileRow - ) -{ - if (FileRow < HBufferImage.LowVisibleRow) { - return TRUE; - } - - return FALSE; -} - -/** - Check user specified FileRow is under current screen. - - @param[in] FileRow Row of file position ( start from 1 ). - - @retval TRUE It is under the current screen. - @retval FALSE It is not under the current screen. - -**/ -BOOLEAN -HUnderCurrentScreen ( - IN UINTN FileRow - ) -{ - if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 2) - 1) { - return TRUE; - } - - return FALSE; -} - -/** - According to cursor's file position, adjust screen display. - - @param[in] NewFilePosRow Row of file position ( start from 1 ). - @param[in] NewFilePosCol Column of file position ( start from 1 ). - @param[in] HighBits Cursor will on high4 bits or low4 bits. -**/ -VOID -HBufferImageMovePosition ( - IN UINTN NewFilePosRow, - IN UINTN NewFilePosCol, - IN BOOLEAN HighBits - ) -{ - INTN RowGap; - UINTN Abs; - BOOLEAN Above; - BOOLEAN Under; - UINTN NewDisplayCol; - - // - // CALCULATE gap between current file position and new file position - // - RowGap = NewFilePosRow - HBufferImage.BufferPosition.Row; - - Under = HUnderCurrentScreen (NewFilePosRow); - Above = HAboveCurrentScreen (NewFilePosRow); - - HBufferImage.HighBits = HighBits; - - // - // if is below current screen - // - if (Under) { - // - // display row will be unchanged - // - HBufferImage.BufferPosition.Row = NewFilePosRow; - } else { - if (Above) { - // - // has enough above line, so display row unchanged - // not has enough above lines, so the first line is - // at the first display line - // - if (NewFilePosRow < (HBufferImage.DisplayPosition.Row - 2 + 1)) { - HBufferImage.DisplayPosition.Row = NewFilePosRow + 2 - 1; - } - - HBufferImage.BufferPosition.Row = NewFilePosRow; - } else { - // - // in current screen - // - HBufferImage.BufferPosition.Row = NewFilePosRow; - if (RowGap <= 0) { - Abs = (UINTN)ABS(RowGap); - HBufferImage.DisplayPosition.Row -= Abs; - } else { - HBufferImage.DisplayPosition.Row += RowGap; - } - - } - } - - HBufferImage.LowVisibleRow = HBufferImage.BufferPosition.Row - (HBufferImage.DisplayPosition.Row - 2); - - // - // always in current screen - // - HBufferImage.BufferPosition.Column = NewFilePosCol; - - NewDisplayCol = 10 + (NewFilePosCol - 1) * 3; - if (NewFilePosCol > 0x8) { - NewDisplayCol++; - } - - if (!HighBits) { - NewDisplayCol++; - } - - HBufferImage.DisplayPosition.Column = NewDisplayCol; - - // - // let CurrentLine point to correct line; - // - HBufferImage.CurrentLine = HMoveCurrentLine (RowGap); - -} - -/** - Scroll cursor to right. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageScrollRight ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - // - // scroll right will always move to the high4 bits of the next character - // - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = FALSE; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - - // - // this line is not full and no next line - // - if (FCol > Line->Size) { - return EFI_SUCCESS; - } - // - // if already at end of this line, scroll it to the start of next line - // - if (FCol == 0x10) { - // - // has next line - // - if (Line->Link.ForwardLink != HBufferImage.ListHead) { - FRow++; - FCol = 1; - - } else { - return EFI_SUCCESS; - } - } else { - // - // if not at end of this line, just move to next column - // - FCol++; - - } - - HBufferImageMovePosition (FRow, FCol, TRUE); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to left. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageScrollLeft ( - VOID - ) -{ - - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = FALSE; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - - // - // if already at start of this line, so move to the end of previous line - // - if (FCol <= 1) { - // - // has previous line - // - if (Line->Link.BackLink != HBufferImage.ListHead) { - FRow--; - Line = CR (Line->Link.BackLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - FCol = Line->Size; - } else { - return EFI_SUCCESS; - } - } else { - // - // if not at start of this line, just move to previous column - // - FCol--; - } - - HBufferImageMovePosition (FRow, FCol, TRUE); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to the next line - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageScrollDown ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - BOOLEAN HighBits; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - HighBits = HBufferImage.HighBits; - - // - // has next line - // - if (Line->Link.ForwardLink != HBufferImage.ListHead) { - FRow++; - Line = CR (Line->Link.ForwardLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - // - // if the next line is not that long, so move to end of next line - // - if (FCol > Line->Size) { - FCol = Line->Size + 1; - HighBits = TRUE; - } - - } else { - return EFI_SUCCESS; - } - - HBufferImageMovePosition (FRow, FCol, HighBits); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to previous line - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageScrollUp ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - - // - // has previous line - // - if (Line->Link.BackLink != HBufferImage.ListHead) { - FRow--; - - } else { - return EFI_SUCCESS; - } - - HBufferImageMovePosition (FRow, FCol, HBufferImage.HighBits); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to next page - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImagePageDown ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - UINTN Gap; - BOOLEAN HighBits; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - HighBits = HBufferImage.HighBits; - - // - // has next page - // - if (HBufferImage.NumLines >= FRow + (HMainEditor.ScreenSize.Row - 2)) { - Gap = (HMainEditor.ScreenSize.Row - 2); - } else { - // - // MOVE CURSOR TO LAST LINE - // - Gap = HBufferImage.NumLines - FRow; - } - // - // get correct line - // - Line = HMoveLine (Gap); - - // - // if that line, is not that long, so move to the end of that line - // - if (Line != NULL && FCol > Line->Size) { - FCol = Line->Size + 1; - HighBits = TRUE; - } - - FRow += Gap; - - HBufferImageMovePosition (FRow, FCol, HighBits); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to previous page - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImagePageUp ( - VOID - ) -{ - UINTN FRow; - UINTN FCol; - UINTN Gap; - INTN Retreat; - - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - - // - // has previous page - // - if (FRow > (HMainEditor.ScreenSize.Row - 2)) { - Gap = (HMainEditor.ScreenSize.Row - 2); - } else { - // - // the first line of file will displayed on the first line of screen - // - Gap = FRow - 1; - } - - Retreat = Gap; - Retreat = -Retreat; - - FRow -= Gap; - - HBufferImageMovePosition (FRow, FCol, HBufferImage.HighBits); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to start of line - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageHome ( - VOID - ) -{ - UINTN FRow; - UINTN FCol; - BOOLEAN HighBits; - - // - // curosr will at the high bit - // - FRow = HBufferImage.BufferPosition.Row; - FCol = 1; - HighBits = TRUE; - - // - // move cursor position - // - HBufferImageMovePosition (FRow, FCol, HighBits); - - return EFI_SUCCESS; -} - -/** - Scroll cursor to end of line. - - @retval EFI_SUCCESS Teh operation was successful. -**/ -EFI_STATUS -HBufferImageEnd ( - VOID - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN FRow; - UINTN FCol; - BOOLEAN HighBits; - - // - // need refresh mouse - // - HBufferImageMouseNeedRefresh = TRUE; - - Line = HBufferImage.CurrentLine; - - FRow = HBufferImage.BufferPosition.Row; - - if (Line->Size == 0x10) { - FCol = Line->Size; - HighBits = FALSE; - } else { - FCol = Line->Size + 1; - HighBits = TRUE; - } - // - // move cursor position - // - HBufferImageMovePosition (FRow, FCol, HighBits); - - return EFI_SUCCESS; -} - -/** - Get the size of the open buffer. - - @retval The size in bytes. -**/ -UINTN -HBufferImageGetTotalSize ( - VOID - ) -{ - UINTN Size; - - HEFI_EDITOR_LINE *Line; - - // - // calculate the total size of whole line list's buffer - // - if (HBufferImage.Lines == NULL) { - return 0; - } - - Line = CR ( - HBufferImage.ListHead->BackLink, - HEFI_EDITOR_LINE, - Link, - EFI_EDITOR_LINE_LIST - ); - // - // one line at most 0x10 - // - Size = 0x10 * (HBufferImage.NumLines - 1) + Line->Size; - - return Size; -} - -/** - Delete character from buffer. - - @param[in] Pos Position, Pos starting from 0. - @param[in] Count The Count of characters to delete. - @param[out] DeleteBuffer The DeleteBuffer. - - @retval EFI_SUCCESS Success -**/ -EFI_STATUS -HBufferImageDeleteCharacterFromBuffer ( - IN UINTN Pos, - IN UINTN Count, - OUT UINT8 *DeleteBuffer - ) -{ - UINTN Index; - - VOID *Buffer; - UINT8 *BufferPtr; - UINTN Size; - - HEFI_EDITOR_LINE *Line; - LIST_ENTRY *Link; - - UINTN OldFCol; - UINTN OldFRow; - UINTN OldPos; - - UINTN NewPos; - - EFI_STATUS Status; - - Size = HBufferImageGetTotalSize (); - - if (Size < Count) { - return EFI_LOAD_ERROR; - } - - if (Size == 0) { - return EFI_SUCCESS; - } - - // - // relocate all the HBufferImage fields - // - OldFRow = HBufferImage.BufferPosition.Row; - OldFCol = HBufferImage.BufferPosition.Column; - OldPos = (OldFRow - 1) * 0x10 + OldFCol - 1; - - if (Pos > 0) { - // - // has character before it, - // so locate according to block's previous character - // - NewPos = Pos - 1; - - } else { - // - // has no character before it, - // so locate according to block's next character - // - NewPos = 0; - } - - HBufferImageMovePosition (NewPos / 0x10 + 1, NewPos % 0x10 + 1, TRUE); - - Buffer = AllocateZeroPool (Size); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - HBufferImageListToBuffer (Buffer, Size); - - BufferPtr = (UINT8 *) Buffer; - - // - // pass deleted buffer out - // - if (DeleteBuffer != NULL) { - for (Index = 0; Index < Count; Index++) { - DeleteBuffer[Index] = BufferPtr[Pos + Index]; - } - } - // - // delete the part from Pos - // - for (Index = Pos; Index < Size - Count; Index++) { - BufferPtr[Index] = BufferPtr[Index + Count]; - } - - Size -= Count; - - HBufferImageFreeLines (); - - Status = HBufferImageBufferToList (Buffer, Size); - FreePool (Buffer); - - if (EFI_ERROR (Status)) { - return Status; - } - - Link = HMainEditor.BufferImage->ListHead->ForwardLink; - for (Index = 0; Index < NewPos / 0x10; Index++) { - Link = Link->ForwardLink; - } - - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - HBufferImage.CurrentLine = Line; - - // - // if current cursor position if inside select area - // then move it to the block's NEXT character - // - if (OldPos >= Pos && OldPos < (Pos + Count)) { - NewPos = Pos; - } else { - if (OldPos < Pos) { - NewPos = OldPos; - } else { - NewPos = OldPos - Count; - } - } - - HBufferImageMovePosition (NewPos / 0x10 + 1, NewPos % 0x10 + 1, TRUE); - - return EFI_SUCCESS; -} - -/** - Add character to buffer, add before pos. - - @param[in] Pos Position, Pos starting from 0. - @param[in] Count Count of characters to add. - @param[in] AddBuffer Add buffer. - - @retval EFI_SUCCESS Success. -**/ -EFI_STATUS -HBufferImageAddCharacterToBuffer ( - IN UINTN Pos, - IN UINTN Count, - IN UINT8 *AddBuffer - ) -{ - INTN Index; - - VOID *Buffer; - UINT8 *BufferPtr; - UINTN Size; - - HEFI_EDITOR_LINE *Line; - - LIST_ENTRY *Link; - - UINTN OldFCol; - UINTN OldFRow; - UINTN OldPos; - - UINTN NewPos; - - Size = HBufferImageGetTotalSize (); - - // - // relocate all the HBufferImage fields - // - OldFRow = HBufferImage.BufferPosition.Row; - OldFCol = HBufferImage.BufferPosition.Column; - OldPos = (OldFRow - 1) * 0x10 + OldFCol - 1; - - // - // move cursor before Pos - // - if (Pos > 0) { - NewPos = Pos - 1; - } else { - NewPos = 0; - } - - HBufferImageMovePosition (NewPos / 0x10 + 1, NewPos % 0x10 + 1, TRUE); - - Buffer = AllocateZeroPool (Size + Count); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - HBufferImageListToBuffer (Buffer, Size); - - BufferPtr = (UINT8 *) Buffer; - - // - // get a place to add - // - for (Index = (INTN) (Size + Count - 1); Index >= (INTN) Pos; Index--) { - BufferPtr[Index] = BufferPtr[Index - Count]; - } - // - // add the buffer - // - for (Index = (INTN) 0; Index < (INTN) Count; Index++) { - BufferPtr[Index + Pos] = AddBuffer[Index]; - } - - Size += Count; - - HBufferImageFreeLines (); - - HBufferImageBufferToList (Buffer, Size); - - FreePool (Buffer); - - Link = HMainEditor.BufferImage->ListHead->ForwardLink; - for (Index = 0; Index < (INTN) NewPos / 0x10; Index++) { - Link = Link->ForwardLink; - } - - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - HBufferImage.CurrentLine = Line; - - if (OldPos >= Pos) { - NewPos = OldPos + Count; - } else { - NewPos = OldPos; - } - - HBufferImageMovePosition (NewPos / 0x10 + 1, NewPos % 0x10 + 1, TRUE); - - return EFI_SUCCESS; -} - -/** - Delete current character from line. - - @retval EFI_SUCCESS The operationw as successful. -**/ -EFI_STATUS -HBufferImageDoDelete ( - VOID - ) -{ - - HEFI_EDITOR_LINE *Line; - - BOOLEAN LastLine; - UINTN FileColumn; - UINTN FPos; - - FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1; - - FileColumn = HBufferImage.BufferPosition.Column; - - Line = HBufferImage.CurrentLine; - - // - // if beyond the last character - // - if (FileColumn > Line->Size) { - return EFI_SUCCESS; - } - - LastLine = FALSE; - if (Line->Link.ForwardLink == HBufferImage.ListHead) { - LastLine = TRUE; - } - - HBufferImageDeleteCharacterFromBuffer (FPos, 1, NULL); - - // - // if is the last line - // then only this line need to be refreshed - // - if (LastLine) { - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = TRUE; - } else { - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - } - - if (!HBufferImage.Modified) { - HBufferImage.Modified = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Change the raw buffer to a list of lines for the UI. - - @param[in] Buffer The pointer to the buffer to fill. - @param[in] Bytes The size of the buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HBufferImageBufferToList ( - IN VOID *Buffer, - IN UINTN Bytes - ) -{ - UINTN TempI; - UINTN TempJ; - UINTN Left; - HEFI_EDITOR_LINE *Line; - UINT8 *BufferPtr; - - TempI = 0; - Left = 0; - BufferPtr = (UINT8 *) Buffer; - - // - // parse file content line by line - // - while (TempI < Bytes) { - if (Bytes - TempI >= 0x10) { - Left = 0x10; - } else { - Left = Bytes - TempI; - } - - // - // allocate a new line - // - Line = HBufferImageCreateLine (); - if (Line == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Line->Size = Left; - - for (TempJ = 0; TempJ < Left; TempJ++) { - Line->Buffer[TempJ] = BufferPtr[TempI]; - TempI++; - } - - } - - // - // last line is a full line, SO create a new line - // - if (Left == 0x10 || Bytes == 0) { - Line = HBufferImageCreateLine (); - if (Line == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } - - return EFI_SUCCESS; -} - -/** - Change the list of lines from the UI to a raw buffer. - - @param[in] Buffer The pointer to the buffer to fill. - @param[in] Bytes The size of the buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageListToBuffer ( - IN VOID *Buffer, - IN UINTN Bytes - ) -{ - UINTN Count; - UINTN Index; - HEFI_EDITOR_LINE *Line; - LIST_ENTRY *Link; - UINT8 *BufferPtr; - - // - // change the line list to a large buffer - // - if (HBufferImage.Lines == NULL) { - return EFI_SUCCESS; - } - - Link = &HBufferImage.Lines->Link; - Count = 0; - BufferPtr = (UINT8 *) Buffer; - - // - // deal line by line - // - while (Link != HBufferImage.ListHead) { - - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - //@todo shouldn't this be an error??? - if (Count + Line->Size > Bytes) { - return EFI_SUCCESS; - } - - for (Index = 0; Index < Line->Size; Index++) { - BufferPtr[Index] = Line->Buffer[Index]; - } - - Count += Line->Size; - BufferPtr += Line->Size; - - Link = Link->ForwardLink; - } - - return EFI_SUCCESS; -} - -/** - Move the mouse in the image buffer. - - @param[in] TextX The x-coordinate. - @param[in] TextY The y-coordinate. -**/ -VOID -HBufferImageAdjustMousePosition ( - IN INT32 TextX, - IN INT32 TextY - ) -{ - UINTN TempX; - UINTN TempY; - UINTN AbsX; - UINTN AbsY; - - // - // TextX and TextY is mouse movement data returned by mouse driver - // This function will change it to MousePosition - // - // - // get absolute TempX value - // - if (TextX >= 0) { - AbsX = TextX; - } else { - AbsX = -TextX; - } - // - // get absolute TempY value - // - if (TextY >= 0) { - AbsY = TextY; - } else { - AbsY = -TextY; - } - - TempX = HBufferImage.MousePosition.Column; - TempY = HBufferImage.MousePosition.Row; - - if (TextX >= 0) { - TempX += TextX; - } else { - if (TempX >= AbsX) { - TempX -= AbsX; - } else { - TempX = 0; - } - } - - if (TextY >= 0) { - TempY += TextY; - } else { - if (TempY >= AbsY) { - TempY -= AbsY; - } else { - TempY = 0; - } - } - // - // check whether new mouse column position is beyond screen - // if not, adjust it - // - if (TempX >= 10 && TempX <= (10 + 0x10 * 3 - 1)) { - HBufferImage.MousePosition.Column = TempX; - } else if (TempX < 10) { - HBufferImage.MousePosition.Column = 10; - } else if (TempX > (10 + 0x10 * 3 - 1)) { - HBufferImage.MousePosition.Column = 10 + 0x10 * 3 - 1; - } - // - // check whether new mouse row position is beyond screen - // if not, adjust it - // - if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 1)) { - HBufferImage.MousePosition.Row = TempY; - } else if (TempY < 2) { - HBufferImage.MousePosition.Row = 2; - } else if (TempY > (HMainEditor.ScreenSize.Row - 1)) { - HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1); - } - -} - -/** - Dispatch input to different handler - - @param[in] Key The input key: - the keys can be: - ASCII KEY - Backspace/Delete - Direction key: up/down/left/right/pgup/pgdn - Home/End - INS - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A Memory allocation failed. -**/ -EFI_STATUS -HBufferImageHandleInput ( - IN EFI_INPUT_KEY *Key - ) -{ - EFI_STATUS Status; - - Status = EFI_SUCCESS; - - switch (Key->ScanCode) { - // - // ordinary key - // - case SCAN_NULL: - Status = HBufferImageDoCharInput (Key->UnicodeChar); - break; - - // - // up arrow - // - case SCAN_UP: - Status = HBufferImageScrollUp (); - break; - - // - // down arrow - // - case SCAN_DOWN: - Status = HBufferImageScrollDown (); - break; - - // - // right arrow - // - case SCAN_RIGHT: - Status = HBufferImageScrollRight (); - break; - - // - // left arrow - // - case SCAN_LEFT: - Status = HBufferImageScrollLeft (); - break; - - // - // page up - // - case SCAN_PAGE_UP: - Status = HBufferImagePageUp (); - break; - - // - // page down - // - case SCAN_PAGE_DOWN: - Status = HBufferImagePageDown (); - break; - - // - // delete - // - case SCAN_DELETE: - Status = HBufferImageDoDelete (); - break; - - // - // home - // - case SCAN_HOME: - Status = HBufferImageHome (); - break; - - // - // end - // - case SCAN_END: - Status = HBufferImageEnd (); - break; - - default: - Status = StatusBarSetStatusString (L"Unknown Command"); - break; - } - - return Status; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h deleted file mode 100644 index c113434..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h +++ /dev/null @@ -1,273 +0,0 @@ -/** @file - Defines BufferImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_BUFFER_IMAGE_H_ -#define _LIB_BUFFER_IMAGE_H_ - -#include "HexEditor.h" - -/** - Initialization function for HBufferImage - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HBufferImageInit ( - VOID - ); - -/** - Cleanup function for HBufferImage - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageCleanup ( - VOID - ); - -/** - Refresh function for HBufferImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A Load error occured. - -**/ -EFI_STATUS -HBufferImageRefresh ( - VOID - ); - -/** - Dispatch input to different handler - - @param[in] Key The input key: - the keys can be: - ASCII KEY - Backspace/Delete - Direction key: up/down/left/right/pgup/pgdn - Home/End - INS - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_OUT_OF_RESOURCES A Memory allocation failed. -**/ -EFI_STATUS -HBufferImageHandleInput ( - IN EFI_INPUT_KEY *Key - ); - -/** - Backup function for HBufferImage. Only a few fields need to be backup. - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageBackup ( - VOID - ); - -/** - Read an image into a buffer friom a source. - - @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer. - @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] BufferType The type of buffer to save. IGNORED. - @param[in] Recover TRUE for recovermode, FALSE otherwise. - - @return EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageRead ( - IN CONST CHAR16 *FileName, - IN CONST CHAR16 *DiskName, - IN UINTN DiskOffset, - IN UINTN DiskSize, - IN UINTN MemOffset, - IN UINTN MemSize, - IN EDIT_FILE_TYPE BufferType, - IN BOOLEAN Recover - ); - -/** - Save the current image. - - @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer. - @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer. - @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer. - @param[in] BufferType The type of buffer to save. IGNORED. - - @return EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageSave ( - IN CHAR16 *FileName, - IN CHAR16 *DiskName, - IN UINTN DiskOffset, - IN UINTN DiskSize, - IN UINTN MemOffset, - IN UINTN MemSize, - IN EDIT_FILE_TYPE BufferType - ); - -/** - According to cursor's file position, adjust screen display. - - @param[in] NewFilePosRow Row of file position ( start from 1 ). - @param[in] NewFilePosCol Column of file position ( start from 1 ). - @param[in] HighBits Cursor will on high4 bits or low4 bits. -**/ -VOID -HBufferImageMovePosition ( - IN UINTN NewFilePosRow, - IN UINTN NewFilePosCol, - IN BOOLEAN HighBits - ); - - -/** - Create a new line and append it to the line list. - Fields affected: - NumLines - Lines - - @retval NULL create line failed. - @return the line created. - -**/ -HEFI_EDITOR_LINE * -HBufferImageCreateLine ( - VOID - ); - -/** - Free the current image. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageFree ( - VOID - ); - -/** - Delete character from buffer. - - @param[in] Pos Position, Pos starting from 0. - @param[in] Count The Count of characters to delete. - @param[out] DeleteBuffer The DeleteBuffer. - - @retval EFI_SUCCESS Success -**/ -EFI_STATUS -HBufferImageDeleteCharacterFromBuffer ( - IN UINTN Pos, - IN UINTN Count, - OUT UINT8 *DeleteBuffer - ); - -/** - Add character to buffer, add before pos. - - @param[in] Pos Position, Pos starting from 0. - @param[in] Count Count of characters to add. - @param[in] AddBuffer Add buffer. - - @retval EFI_SUCCESS Success. -**/ -EFI_STATUS -HBufferImageAddCharacterToBuffer ( - IN UINTN Pos, - IN UINTN Count, - IN UINT8 *AddBuffer - ); - -/** - Change the raw buffer to a list of lines for the UI. - - @param[in] Buffer The pointer to the buffer to fill. - @param[in] Bytes The size of the buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HBufferImageBufferToList ( - IN VOID *Buffer, - IN UINTN Bytes - ); - -/** - Change the list of lines from the UI to a raw buffer. - - @param[in] Buffer The pointer to the buffer to fill. - @param[in] Bytes The size of the buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HBufferImageListToBuffer ( - IN VOID *Buffer, - IN UINTN Bytes - ); - -/** - Move the mouse in the image buffer. - - @param[in] TextX The x-coordinate. - @param[in] TextY The y-coordinate. -**/ -VOID -HBufferImageAdjustMousePosition ( - IN INT32 TextX, - IN INT32 TextY - ); - -/** - Function to decide if a column number is stored in the high bits. - - @param[in] Column The column to examine. - @param[out] FCol The actual column number. - - @retval TRUE The actual column was in high bits and is now in FCol. - @retval FALSE There was not a column number in the high bits. -**/ -BOOLEAN -HBufferImageIsAtHighBits ( - IN UINTN Column, - OUT UINTN *FCol - ); - -/** - Get the size of the open buffer. - - @retval The size in bytes. -**/ -UINTN -HBufferImageGetTotalSize ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c deleted file mode 100644 index e229799..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c +++ /dev/null @@ -1,112 +0,0 @@ -/** @file - Functions to deal with Clip Board - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" - -typedef struct { - UINT8 *Buffer; - UINTN Size; -} HEFI_EDITOR_CLIPBOARD; - -HEFI_EDITOR_CLIPBOARD HClipBoard; - -// -// for basic initialization of HClipBoard -// -HEFI_EDITOR_CLIPBOARD HClipBoardConst = { - NULL, - 0 -}; - -/** - Initialization function for HDiskImage. - - @param[in] EFI_SUCCESS The operation was successful. - @param[in] EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HClipBoardInit ( - VOID - ) -{ - // - // basiclly initialize the HDiskImage - // - CopyMem (&HClipBoard, &HClipBoardConst, sizeof (HClipBoard)); - - return EFI_SUCCESS; -} - -/** - Initialization function for HDiskImage. - - @param[in] EFI_SUCCESS The operation was successful. - @param[in] EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HClipBoardCleanup ( - VOID - ) -{ - - SHELL_FREE_NON_NULL (HClipBoard.Buffer); - - return EFI_SUCCESS; -} - -/** - Set a buffer into the clipboard. - - @param[in] Buffer The buffer to add to the clipboard. - @param[in] Size The size of Buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HClipBoardSet ( - IN UINT8 *Buffer, - IN UINTN Size - ) -{ - // - // free the old clipboard buffer - // and set new clipboard buffer - // - SHELL_FREE_NON_NULL (HClipBoard.Buffer); - HClipBoard.Buffer = Buffer; - - HClipBoard.Size = Size; - - return EFI_SUCCESS; -} - -/** - Get a buffer from the clipboard. - - @param[out] Buffer The pointer to the buffer to add to the clipboard. - - @return the size of the buffer. -**/ -UINTN -HClipBoardGet ( - OUT UINT8 **Buffer - ) -{ - // - // return the clipboard buffer - // - *Buffer = HClipBoard.Buffer; - - return HClipBoard.Size; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h deleted file mode 100644 index 6a97b0d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - Defines DiskImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_CLIP_BOARD_H_ -#define _LIB_CLIP_BOARD_H_ - -#include "HexEditor.h" - -/** - Initialization function for HDiskImage - - @param[in] EFI_SUCCESS The operation was successful. - @param[in] EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HClipBoardInit ( - VOID - ); - -/** - Initialization function for HDiskImage. - - @param[in] EFI_SUCCESS The operation was successful. - @param[in] EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HClipBoardCleanup ( - VOID - ); - -/** - Set a buffer into the clipboard. - - @param[in] Buffer The buffer to add to the clipboard. - @param[in] Size The size of Buffer in bytes. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HClipBoardSet ( - IN UINT8 *Buffer, - IN UINTN Size - ); - -/** - Get a buffer from the clipboard. - - @param[out] Buffer The pointer to the buffer to add to the clipboard. - - @return the size of the buffer. -**/ -UINTN -HClipBoardGet ( - OUT UINT8 **Buffer - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c deleted file mode 100644 index e782491..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c +++ /dev/null @@ -1,417 +0,0 @@ -/** @file - Functions to deal with Disk buffer. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" -#include - -extern EFI_HANDLE HImageHandleBackup; -extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage; - -extern BOOLEAN HBufferImageNeedRefresh; -extern BOOLEAN HBufferImageOnlyLineNeedRefresh; -extern BOOLEAN HBufferImageMouseNeedRefresh; - -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; - -HEFI_EDITOR_DISK_IMAGE HDiskImage; -HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar; - -// -// for basic initialization of HDiskImage -// -HEFI_EDITOR_DISK_IMAGE HDiskImageConst = { - NULL, - 0, - 0, - 0 -}; - -/** - Initialization function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HDiskImageInit ( - VOID - ) -{ - // - // basically initialize the HDiskImage - // - CopyMem (&HDiskImage, &HDiskImageConst, sizeof (HDiskImage)); - - CopyMem (&HDiskImageBackupVar, &HDiskImageConst, sizeof (HDiskImageBackupVar)); - - return EFI_SUCCESS; -} - -/** - Backup function for HDiskImage. Only a few fields need to be backup. - This is for making the Disk buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES gST->ConOut of resources. -**/ -EFI_STATUS -HDiskImageBackup ( - VOID - ) -{ - // - // backup the disk name, offset and size - // - // - SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name); - - HDiskImageBackupVar.Name = CatSPrint(NULL, L"%s", HDiskImage.Name); - if (HDiskImageBackupVar.Name == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - HDiskImageBackupVar.Offset = HDiskImage.Offset; - HDiskImageBackupVar.Size = HDiskImage.Size; - - return EFI_SUCCESS; -} - -/** - Cleanup function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HDiskImageCleanup ( - VOID - ) -{ - SHELL_FREE_NON_NULL (HDiskImage.Name); - SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name); - - return EFI_SUCCESS; -} - -/** - Set FileName field in HFileImage. - - @param[in] Str File name to set. - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HDiskImageSetDiskNameOffsetSize ( - IN CONST CHAR16 *Str, - IN UINTN Offset, - IN UINTN Size - ) -{ - if (Str == HDiskImage.Name) { - // - // This function might be called using HDiskImage.FileName as Str. - // Directly return without updating HDiskImage.FileName. - // - return EFI_SUCCESS; - } - - // - // free the old file name - // - SHELL_FREE_NON_NULL (HDiskImage.Name); - HDiskImage.Name = AllocateCopyPool (StrSize (Str), Str); - if (HDiskImage.Name == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - HDiskImage.Offset = Offset; - HDiskImage.Size = Size; - - return EFI_SUCCESS; -} - -/** - Read a disk from disk into HBufferImage. - - @param[in] DeviceName filename to read. - @param[in] Offset The offset. - @param[in] Size The size. - @param[in] Recover if is for recover, no information print. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -HDiskImageRead ( - IN CONST CHAR16 *DeviceName, - IN UINTN Offset, - IN UINTN Size, - IN BOOLEAN Recover - ) -{ - CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *DupDevicePath; - EFI_DEVICE_PATH_PROTOCOL *DupDevicePathForFree; - EFI_HANDLE Handle; - EFI_BLOCK_IO_PROTOCOL *BlkIo; - EFI_STATUS Status; - - VOID *Buffer; - CHAR16 *Str; - UINTN Bytes; - - HEFI_EDITOR_LINE *Line; - - HBufferImage.BufferType = FileTypeDiskBuffer; - - DevicePath = gEfiShellProtocol->GetDevicePathFromMap(DeviceName); - if (DevicePath == NULL) { - StatusBarSetStatusString (L"Cannot Find Device"); - return EFI_INVALID_PARAMETER; - } - DupDevicePath = DuplicateDevicePath(DevicePath); - DupDevicePathForFree = DupDevicePath; - // - // get blkio interface - // - Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid,&DupDevicePath,&Handle); - FreePool(DupDevicePathForFree); - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Disk Failed"); - return Status; - } - Status = gBS->OpenProtocol(Handle, &gEfiBlockIoProtocolGuid, (VOID**)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Disk Failed"); - return Status; - } - // - // if Offset exceeds LastBlock, - // return error - // - if (Offset > BlkIo->Media->LastBlock || Offset + Size > BlkIo->Media->LastBlock) { - StatusBarSetStatusString (L"Invalid Offset + Size"); - return EFI_LOAD_ERROR; - } - - Bytes = BlkIo->Media->BlockSize * Size; - Buffer = AllocateZeroPool (Bytes); - - if (Buffer == NULL) { - StatusBarSetStatusString (L"Read Disk Failed"); - return EFI_OUT_OF_RESOURCES; - } - - // - // read from disk - // - Status = BlkIo->ReadBlocks ( - BlkIo, - BlkIo->Media->MediaId, - Offset, - Bytes, - Buffer - ); - - if (EFI_ERROR (Status)) { - FreePool (Buffer); - StatusBarSetStatusString (L"Read Disk Failed"); - return EFI_LOAD_ERROR; - } - - HBufferImageFree (); - - // - // convert buffer to line list - // - Status = HBufferImageBufferToList (Buffer, Bytes); - FreePool (Buffer); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Disk Failed"); - return Status; - } - - Status = HDiskImageSetDiskNameOffsetSize (DeviceName, Offset, Size); - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Disk Failed"); - return EFI_OUT_OF_RESOURCES; - } - // - // initialize some variables - // - HDiskImage.BlockSize = BlkIo->Media->BlockSize; - - HBufferImage.DisplayPosition.Row = 2; - HBufferImage.DisplayPosition.Column = 10; - - HBufferImage.MousePosition.Row = 2; - HBufferImage.MousePosition.Column = 10; - - HBufferImage.LowVisibleRow = 1; - HBufferImage.HighBits = TRUE; - - HBufferImage.BufferPosition.Row = 1; - HBufferImage.BufferPosition.Column = 1; - - if (!Recover) { - Str = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines); - if (Str == NULL) { - StatusBarSetStatusString (L"Read Disk Failed"); - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (Str); - SHELL_FREE_NON_NULL (Str); - - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - - } - - // - // has line - // - if (HBufferImage.Lines != NULL) { - HBufferImage.CurrentLine = CR ( - HBufferImage.ListHead->ForwardLink, - HEFI_EDITOR_LINE, - Link, - EFI_EDITOR_LINE_LIST - ); - } else { - // - // create a dummy line - // - Line = HBufferImageCreateLine (); - if (Line == NULL) { - StatusBarSetStatusString (L"Read Disk Failed"); - return EFI_OUT_OF_RESOURCES; - } - - HBufferImage.CurrentLine = Line; - } - - HBufferImage.Modified = FALSE; - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageMouseNeedRefresh = TRUE; - - return EFI_SUCCESS; -} - -/** - Save lines in HBufferImage to disk. - NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!! - - @param[in] DeviceName The device name. - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -HDiskImageSave ( - IN CHAR16 *DeviceName, - IN UINTN Offset, - IN UINTN Size - ) -{ - - CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *DupDevicePath; - EFI_DEVICE_PATH_PROTOCOL *DupDevicePathForFree; - EFI_BLOCK_IO_PROTOCOL *BlkIo; - EFI_STATUS Status; - EFI_HANDLE Handle; - VOID *Buffer; - UINTN Bytes; - - // - // if not modified, directly return - // - if (HBufferImage.Modified == FALSE) { - return EFI_SUCCESS; - } - - HBufferImage.BufferType = FileTypeDiskBuffer; - - DevicePath = gEfiShellProtocol->GetDevicePathFromMap(DeviceName); - if (DevicePath == NULL) { -// StatusBarSetStatusString (L"Cannot Find Device"); - return EFI_INVALID_PARAMETER; - } - DupDevicePath = DuplicateDevicePath(DevicePath); - DupDevicePathForFree = DupDevicePath; - - // - // get blkio interface - // - Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid,&DupDevicePath,&Handle); - FreePool(DupDevicePathForFree); - if (EFI_ERROR (Status)) { -// StatusBarSetStatusString (L"Read Disk Failed"); - return Status; - } - Status = gBS->OpenProtocol(Handle, &gEfiBlockIoProtocolGuid, (VOID**)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR (Status)) { -// StatusBarSetStatusString (L"Read Disk Failed"); - return Status; - } - - Bytes = BlkIo->Media->BlockSize * Size; - Buffer = AllocateZeroPool (Bytes); - - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // concatenate the line list to a buffer - // - Status = HBufferImageListToBuffer (Buffer, Bytes); - if (EFI_ERROR (Status)) { - FreePool (Buffer); - return Status; - } - - // - // write the buffer to disk - // - Status = BlkIo->WriteBlocks ( - BlkIo, - BlkIo->Media->MediaId, - Offset, - Bytes, - Buffer - ); - - FreePool (Buffer); - - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - // - // now not modified - // - HBufferImage.Modified = FALSE; - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h deleted file mode 100644 index dbbac88..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h +++ /dev/null @@ -1,95 +0,0 @@ -/** @file - Defines DiskImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_DISK_IMAGE_H_ -#define _LIB_DISK_IMAGE_H_ - -#include "HexEditor.h" - -/** - Initialization function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HDiskImageInit ( - VOID - ); - -/** - Cleanup function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HDiskImageCleanup ( - VOID - ); - -/** - Backup function for HDiskImage. Only a few fields need to be backup. - This is for making the Disk buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES gST->ConOut of resources. -**/ -EFI_STATUS -HDiskImageBackup ( - VOID - ); - -/** - Read a disk from disk into HBufferImage. - - @param[in] DeviceName filename to read. - @param[in] Offset The offset. - @param[in] Size The size. - @param[in] Recover if is for recover, no information print. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -HDiskImageRead ( - IN CONST CHAR16 *DeviceName, - IN UINTN Offset, - IN UINTN Size, - IN BOOLEAN Recover - ); - -/** - Save lines in HBufferImage to disk. - NOT ALLOW TO WRITE TO ANOTHER DISK!!!!!!!!! - - @param[in] DeviceName The device name. - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -HDiskImageSave ( - IN CHAR16 *DeviceName, - IN UINTN Offset, - IN UINTN Size - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c deleted file mode 100644 index aa426d2..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c +++ /dev/null @@ -1,398 +0,0 @@ -/** @file - Functions to deal with file buffer. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" - -extern EFI_HANDLE HImageHandleBackup; -extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage; - -extern BOOLEAN HBufferImageNeedRefresh; -extern BOOLEAN HBufferImageOnlyLineNeedRefresh; -extern BOOLEAN HBufferImageMouseNeedRefresh; - -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; - -HEFI_EDITOR_FILE_IMAGE HFileImage; -HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar; - -// -// for basic initialization of HFileImage -// -HEFI_EDITOR_BUFFER_IMAGE HFileImageConst = { - NULL, - 0, - FALSE -}; - -/** - Initialization function for HFileImage - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFileImageInit ( - VOID - ) -{ - // - // basically initialize the HFileImage - // - CopyMem (&HFileImage, &HFileImageConst, sizeof (HFileImage)); - - CopyMem ( - &HFileImageBackupVar, - &HFileImageConst, - sizeof (HFileImageBackupVar) - ); - - return EFI_SUCCESS; -} - -/** - Backup function for HFileImage. Only a few fields need to be backup. - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HFileImageBackup ( - VOID - ) -{ - SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName); - HFileImageBackupVar.FileName = CatSPrint(NULL, L"%s", HFileImage.FileName); - if (HFileImageBackupVar.FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Cleanup function for HFileImage. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFileImageCleanup ( - VOID - ) -{ - - SHELL_FREE_NON_NULL (HFileImage.FileName); - SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName); - - return EFI_SUCCESS; -} - -/** - Set FileName field in HFileImage - - @param[in] Str File name to set. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HFileImageSetFileName ( - IN CONST CHAR16 *Str - ) -{ - if (Str == HFileImage.FileName) { - // - // This function might be called using HFileImage.FileName as Str. - // Directly return without updating HFileImage.FileName. - // - return EFI_SUCCESS; - } - // - // free the old file name - // - SHELL_FREE_NON_NULL (HFileImage.FileName); - HFileImage.FileName = AllocateCopyPool (StrSize (Str), Str); - if (HFileImage.FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - return EFI_SUCCESS; -} - -/** - Read a file from disk into HBufferImage. - - @param[in] FileName filename to read. - @param[in] Recover if is for recover, no information print. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HFileImageRead ( - IN CONST CHAR16 *FileName, - IN BOOLEAN Recover - ) -{ - HEFI_EDITOR_LINE *Line; - UINT8 *Buffer; - CHAR16 *UnicodeBuffer; - EFI_STATUS Status; - - // - // variable initialization - // - Line = NULL; - - // - // in this function, when you return error ( except EFI_OUT_OF_RESOURCES ) - // you should set status string - // since this function maybe called before the editorhandleinput loop - // so any error will cause editor return - // so if you want to print the error status - // you should set the status string - // - Status = ReadFileIntoBuffer (FileName, (VOID**)&Buffer, &HFileImage.Size, &HFileImage.ReadOnly); - // - // NULL pointer is only also a failure for a non-zero file size. - // - if ((EFI_ERROR(Status)) || (Buffer == NULL && HFileImage.Size != 0)) { - UnicodeBuffer = CatSPrint(NULL, L"Read error on file %s: %r", FileName, Status); - if (UnicodeBuffer == NULL) { - SHELL_FREE_NON_NULL(Buffer); - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (UnicodeBuffer); - FreePool (UnicodeBuffer); - return EFI_OUT_OF_RESOURCES; - } - - HFileImageSetFileName (FileName); - - // - // free the old lines - // - HBufferImageFree (); - - Status = HBufferImageBufferToList (Buffer, HFileImage.Size); - SHELL_FREE_NON_NULL (Buffer); - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Error parsing file."); - return Status; - } - - HBufferImage.DisplayPosition.Row = 2; - HBufferImage.DisplayPosition.Column = 10; - HBufferImage.MousePosition.Row = 2; - HBufferImage.MousePosition.Column = 10; - HBufferImage.LowVisibleRow = 1; - HBufferImage.HighBits = TRUE; - HBufferImage.BufferPosition.Row = 1; - HBufferImage.BufferPosition.Column = 1; - HBufferImage.BufferType = FileTypeFileBuffer; - - if (!Recover) { - UnicodeBuffer = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines); - if (UnicodeBuffer == NULL) { - SHELL_FREE_NON_NULL(Buffer); - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (UnicodeBuffer); - FreePool (UnicodeBuffer); - - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - } - - // - // has line - // - if (HBufferImage.Lines != 0) { - HBufferImage.CurrentLine = CR (HBufferImage.ListHead->ForwardLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - } else { - // - // create a dummy line - // - Line = HBufferImageCreateLine (); - if (Line == NULL) { - SHELL_FREE_NON_NULL(Buffer); - return EFI_OUT_OF_RESOURCES; - } - - HBufferImage.CurrentLine = Line; - } - - HBufferImage.Modified = FALSE; - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageMouseNeedRefresh = TRUE; - - return EFI_SUCCESS; -} - -/** - Save lines in HBufferImage to disk. - - @param[in] FileName The file name. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HFileImageSave ( - IN CHAR16 *FileName - ) -{ - - LIST_ENTRY *Link; - HEFI_EDITOR_LINE *Line; - CHAR16 *Str; - EFI_STATUS Status; - UINTN NumLines; - SHELL_FILE_HANDLE FileHandle; - UINTN TotalSize; - UINT8 *Buffer; - UINT8 *Ptr; - EDIT_FILE_TYPE BufferTypeBackup; - - BufferTypeBackup = HBufferImage.BufferType; - HBufferImage.BufferType = FileTypeFileBuffer; - - // - // if is the old file - // - if (HFileImage.FileName != NULL && FileName != NULL && StrCmp (FileName, HFileImage.FileName) == 0) { - // - // check whether file exists on disk - // - if (ShellIsFile(FileName) == EFI_SUCCESS) { - // - // current file exists on disk - // so if not modified, then not save - // - if (HBufferImage.Modified == FALSE) { - return EFI_SUCCESS; - } - // - // if file is read-only, set error - // - if (HFileImage.ReadOnly == TRUE) { - StatusBarSetStatusString (L"Read Only File Can Not Be Saved"); - return EFI_SUCCESS; - } - } - } - - if (ShellIsDirectory(FileName) == EFI_SUCCESS) { - StatusBarSetStatusString (L"Directory Can Not Be Saved"); - return EFI_LOAD_ERROR; - } - - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0); - - if (!EFI_ERROR (Status)) { - // - // the file exits, delete it - // - Status = ShellDeleteFile (&FileHandle); - if (EFI_ERROR (Status) || Status == EFI_WARN_DELETE_FAILURE) { - StatusBarSetStatusString (L"Write File Failed"); - return EFI_LOAD_ERROR; - } - } - - // - // write all the lines back to disk - // - NumLines = 0; - TotalSize = 0; - for (Link = HBufferImage.ListHead->ForwardLink; Link != HBufferImage.ListHead; Link = Link->ForwardLink) { - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - if (Line->Size != 0) { - TotalSize += Line->Size; - } - // - // end of if Line -> Size != 0 - // - NumLines++; - } - // - // end of for Link - // - Buffer = AllocateZeroPool (TotalSize); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Ptr = Buffer; - for (Link = HBufferImage.ListHead->ForwardLink; Link != HBufferImage.ListHead; Link = Link->ForwardLink) { - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - if (Line->Size != 0) { - CopyMem (Ptr, Line->Buffer, Line->Size); - Ptr += Line->Size; - } - // - // end of if Line -> Size != 0 - // - } - - - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Create File Failed"); - return EFI_LOAD_ERROR; - } - - Status = ShellWriteFile (FileHandle, &TotalSize, Buffer); - FreePool (Buffer); - if (EFI_ERROR (Status)) { - ShellDeleteFile (&FileHandle); - return EFI_LOAD_ERROR; - } - - ShellCloseFile(&FileHandle); - - HBufferImage.Modified = FALSE; - - // - // set status string - // - Str = CatSPrint(NULL, L"%d Lines Wrote", NumLines); - StatusBarSetStatusString (Str); - FreePool (Str); - - // - // now everything is ready , you can set the new file name to filebuffer - // - if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) || - (FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){ - // - // not the same - // - HFileImageSetFileName (FileName); - if (HFileImage.FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } - - HFileImage.ReadOnly = FALSE; - - return EFI_SUCCESS; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h deleted file mode 100644 index 17263c1..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h +++ /dev/null @@ -1,83 +0,0 @@ -/** @file - Defines FileImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_FILE_IMAGE_H_ -#define _LIB_FILE_IMAGE_H_ - -#include "HexEditor.h" - -/** - Initialization function for HFileImage - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFileImageInit ( - VOID - ); - -/** - Cleanup function for HFileImage. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFileImageCleanup ( - VOID - ); - -/** - Backup function for HFileImage. Only a few fields need to be backup. - This is for making the file buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HFileImageBackup ( - VOID - ); - -/** - Read a file from disk into HBufferImage. - - @param[in] FileName filename to read. - @param[in] Recover if is for recover, no information print. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HFileImageRead ( - IN CONST CHAR16 *FileName, - IN BOOLEAN Recover - ); - -/** - Save lines in HBufferImage to disk. - - @param[in] FileName The file name. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HFileImageSave ( - IN CHAR16 *FileName - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c deleted file mode 100644 index d4c9b67..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - Main entry point of editor - - (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "HexEditor.h" - -// -// Global Variables -// -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-f", TypeFlag}, - {L"-d", TypeFlag}, - {L"-m", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'hexedit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunHexEdit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - CHAR16 *Buffer; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - LIST_ENTRY *Package; - CHAR16 *NewName; - CONST CHAR16 *Name; - UINTN Offset; - UINTN Size; - EDIT_FILE_TYPE WhatToDo; - - Buffer = NULL; - ShellStatus = SHELL_SUCCESS; - NewName = NULL; - Buffer = NULL; - Name = NULL; - Offset = 0; - Size = 0; - WhatToDo = FileTypeNone; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // Check for -d - // - if (ShellCommandLineGetFlag(Package, L"-d")){ - if (ShellCommandLineGetCount(Package) < 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) > 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - WhatToDo = FileTypeDiskBuffer; - Name = ShellCommandLineGetRawValue(Package, 1); - Offset = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2)); - Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 3)); - } - if (Offset == (UINTN)-1 || Size == (UINTN)-1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - // - // check for -f - // - if (ShellCommandLineGetFlag(Package, L"-f") && (WhatToDo == FileTypeNone)){ - if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Name = ShellCommandLineGetRawValue(Package, 1); - if (Name == NULL || !IsValidFileName(Name)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - WhatToDo = FileTypeFileBuffer; - } - } - } - - // - // check for -m - // - if (ShellCommandLineGetFlag(Package, L"-m") && (WhatToDo == FileTypeNone)){ - if (ShellCommandLineGetCount(Package) < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - WhatToDo = FileTypeMemBuffer; - Offset = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 1)); - Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2)); - } - } - Name = ShellCommandLineGetRawValue(Package, 1); - if (WhatToDo == FileTypeNone && Name != NULL) { - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (!IsValidFileName(Name)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - WhatToDo = FileTypeFileBuffer; - } - } else if (WhatToDo == FileTypeNone) { - if (gEfiShellProtocol->GetCurDir(NULL) == NULL) { - ShellStatus = SHELL_NOT_FOUND; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit"); - } else { - NewName = EditGetDefaultFileName(L"bin"); - Name = NewName; - WhatToDo = FileTypeFileBuffer; - } - } - - if (ShellStatus == SHELL_SUCCESS && WhatToDo == FileTypeNone) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (WhatToDo == FileTypeFileBuffer && ShellGetCurrentDir(NULL) == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - - if (ShellStatus == SHELL_SUCCESS) { - // - // Do the editor - // - Status = HMainEditorInit (); - if (EFI_ERROR (Status)) { - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_INIT_FAILED), gShellDebug1HiiHandle); - } else { - HMainEditorBackup (); - switch (WhatToDo) { - case FileTypeFileBuffer: - Status = HBufferImageRead ( - Name==NULL?L"":Name, - NULL, - 0, - 0, - 0, - 0, - FileTypeFileBuffer, - FALSE - ); - break; - - case FileTypeDiskBuffer: - Status = HBufferImageRead ( - NULL, - Name==NULL?L"":Name, - Offset, - Size, - 0, - 0, - FileTypeDiskBuffer, - FALSE - ); - break; - - case FileTypeMemBuffer: - Status = HBufferImageRead ( - NULL, - NULL, - 0, - 0, - (UINT32) Offset, - Size, - FileTypeMemBuffer, - FALSE - ); - break; - - default: - Status = EFI_NOT_FOUND; - break; - } - if (!EFI_ERROR (Status)) { - HMainEditorRefresh (); - Status = HMainEditorKeyInput (); - } - if (Status != EFI_OUT_OF_RESOURCES) { - // - // back up the status string - // - Buffer = CatSPrint (NULL, L"%s\r\n", StatusBarGetString()); - } - } - - // - // cleanup - // - HMainEditorCleanup (); - - if (EFI_ERROR (Status)) { - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = SHELL_UNSUPPORTED; - } - } - - // - // print editor exit code on screen - // - if (Status == EFI_OUT_OF_RESOURCES) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"hexedit"); - } else if (EFI_ERROR(Status)){ - if (Buffer != NULL) { - if (StrCmp (Buffer, L"") != 0) { - // - // print out the status string - // - ShellPrintEx(-1, -1, L"%s", Buffer); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle); - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle); - } - } - } - ShellCommandLineFreeVarList (Package); - } - - SHELL_FREE_NON_NULL (Buffer); - SHELL_FREE_NON_NULL (NewName); - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h deleted file mode 100644 index a258f62..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Main include file for hex editor - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EFI_SHELL_HEXEDIT_H_ -#define _EFI_SHELL_HEXEDIT_H_ - -#include "UefiShellDebug1CommandsLib.h" -#include "HexEditorTypes.h" - -#include "MainHexEditor.h" - -#include "BufferImage.h" -#include "FileImage.h" -#include "DiskImage.h" -#include "MemImage.h" - -#include "EditTitleBar.h" -#include "EditStatusBar.h" -#include "EditInputBar.h" -#include "EditMenuBar.h" - -#include "Misc.h" - -#include "Clipboard.h" - -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; -extern BOOLEAN HEditorFirst; -extern BOOLEAN HEditorExit; - -#endif // _HEDITOR_H diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h deleted file mode 100644 index 5afb0da..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h +++ /dev/null @@ -1,126 +0,0 @@ -/** @file - data types that are used by editor - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _HEDITOR_TYPE_H_ -#define _HEDITOR_TYPE_H_ - -#include "UefiShellDebug1CommandsLib.h" -#include "EditTitleBar.h" - -#define EFI_EDITOR_LINE_LIST SIGNATURE_32 ('e', 'e', 'l', 'l') - -#define ASCII_POSITION ((0x10 * 3) + 12) - - -typedef struct { - UINTN Row; - UINTN Column; -} HEFI_EDITOR_POSITION; - -typedef -EFI_STATUS -(*HEFI_MENU_ITEM_FUNCTION) ( - VOID - ); - -typedef struct { - CHAR16 Name[50]; - CHAR16 Key[3]; - HEFI_MENU_ITEM_FUNCTION Function; -} HMENU_ITEMS; - -typedef struct _HEFI_EDITOR_LINE { - UINTN Signature; - UINT8 Buffer[0x10]; - UINTN Size; // unit is Unicode - LIST_ENTRY Link; -} HEFI_EDITOR_LINE; - -typedef struct _HEFI_EDITOR_MENU_ITEM { - CHAR16 NameToken; - CHAR16 FunctionKeyToken; - HEFI_MENU_ITEM_FUNCTION Function; -} HEFI_EDITOR_MENU_ITEM; - -typedef struct { - UINT32 Foreground : 4; - UINT32 Background : 4; -} HEFI_EDITOR_COLOR_ATTRIBUTES; - -typedef union { - HEFI_EDITOR_COLOR_ATTRIBUTES Colors; - UINTN Data; -} HEFI_EDITOR_COLOR_UNION; - -typedef struct { - UINTN Columns; - UINTN Rows; -} HEFI_EDITOR_TEXT_MODE; - - -typedef struct { - CHAR16 *Name; - - UINTN BlockSize; - UINTN Size; - UINTN Offset; -} HEFI_EDITOR_DISK_IMAGE; - -typedef struct { - EFI_CPU_IO2_PROTOCOL *IoFncs; - UINTN Offset; - UINTN Size; -} HEFI_EDITOR_MEM_IMAGE; - -typedef struct { - CHAR16 *FileName; - UINTN Size; // file size - BOOLEAN ReadOnly; // file is read-only or not -} HEFI_EDITOR_FILE_IMAGE; - -typedef struct { - LIST_ENTRY *ListHead; // list head of lines - HEFI_EDITOR_LINE *Lines; // lines of current file - UINTN NumLines; // number of lines - HEFI_EDITOR_LINE *CurrentLine; // current line cursor is at - HEFI_EDITOR_POSITION DisplayPosition; // cursor position in screen - HEFI_EDITOR_POSITION MousePosition; // mouse position in screen - HEFI_EDITOR_POSITION BufferPosition; // cursor position in buffer - UINTN LowVisibleRow; // the lowest visible row of file position - BOOLEAN HighBits; // cursor is at the high4 bits or low4 bits - BOOLEAN Modified; // BUFFER is modified or not - EDIT_FILE_TYPE BufferType; - - HEFI_EDITOR_FILE_IMAGE *FileImage; - HEFI_EDITOR_DISK_IMAGE *DiskImage; - HEFI_EDITOR_MEM_IMAGE *MemImage; - -} HEFI_EDITOR_BUFFER_IMAGE; - -typedef struct { - HEFI_EDITOR_BUFFER_IMAGE *BufferImage; - - HEFI_EDITOR_COLOR_UNION ColorAttributes; - HEFI_EDITOR_POSITION ScreenSize; // row number and column number - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx; - BOOLEAN MouseSupported; - EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface; - INT32 MouseAccumulatorX; - INT32 MouseAccumulatorY; - - UINTN SelectStart; // starting from 1 - UINTN SelectEnd; // starting from 1 -} HEFI_EDITOR_GLOBAL_EDITOR; - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexeditStrings.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexeditStrings.uni deleted file mode 100644 index 5f7855f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexeditStrings.uni +++ /dev/null @@ -1,76 +0,0 @@ -// /** -// -// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-// (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Abstract: -// -// Additional string definitions for UEFI Shell 2.0 Debug1 profile Edit command -// -// -// **/ - -/=# - -#langdef en-US "english" - - -#string STR_HEXEDIT_USAGE #language en-US "\n\n %EHexEditor Usage%N\n" -#string STR_HEXEDIT_FILENAME #language en-US " %H[-f] Filename%N Open File For Editing\n" -#string STR_HEXEDIT_DISKNAME #language en-US " %H-d DiskName FirstBlockNo. BlockNumber%N Open Disk Block For Editing\n" -#string STR_HEXEDIT_OFFSET_SIZE #language en-US " %H-m Offset Size%N Open Memory Region For Editing\n" -#string STR_HEXEDIT_FILE_NAME #language en-US "%Hhexedit%N: Invalid File Name\n" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_TITLE #language en-US "%EMainEditor init failed on TitleBar init\n%N" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU #language en-US "%EMainEditor init failed on MainMenu init\n%N" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_STATUS #language en-US "%EMainEditor init failed on StatusBar init\n%N" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_INPUTBAR #language en-US "%EMainEditor init failed on InputBar init\n%N" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_BUFFERIMAGE #language en-US "%EMainEditor init failed on BufferImage init\n%N" -#string STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD #language en-US "%EMainEditor init failed on ClipBoard init\n%N" -#string STR_HEXEDIT_LIBEDITOR_TITLEBAR_CLEAN #language en-US "TitleBar cleanup failed\n" -#string STR_HEXEDIT_LIBEDITOR_MENUBAR_CLEAN #language en-US "MenuBar cleanup failed\n" -#string STR_HEXEDIT_LIBEDITOR_STATUSBAR_CLEAN #language en-US "StatusBar cleanup failed\n" -#string STR_HEXEDIT_LIBEDITOR_INPUTBAR_CLEAN #language en-US "InputBar cleanup failed\n" -#string STR_HEXEDIT_LIBEDITOR_BUFFERIMAGE_CLEAN #language en-US "BufferImage cleanup failed\n" -#string STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN #language en-US "ClipBoard cleanup failed\n" -#string STR_HEXEDIT_LIBINPUTBAR_MAININPUTBAR #language en-US "%s" -#string STR_HEXEDIT_LIBMENUBAR_OPEN_FILE #language en-US "Open File" -#string STR_HEXEDIT_LIBMENUBAR_OPEN_DISK #language en-US "Open Disk" -#string STR_HEXEDIT_LIBMENUBAR_OPEN_MEMORY #language en-US "Open Memory" -#string STR_HEXEDIT_LIBMENUBAR_SAVE_BUFFER #language en-US "Save Buffer" -#string STR_HEXEDIT_LIBMENUBAR_SELECT_START #language en-US "Select Start" -#string STR_HEXEDIT_LIBMENUBAR_SELECT_END #language en-US "Select End" -#string STR_HEXEDIT_LIBMENUBAR_CUT #language en-US "Cut" -#string STR_HEXEDIT_LIBMENUBAR_PASTE #language en-US "Paste" -#string STR_HEXEDIT_LIBMENUBAR_GO_TO_OFFSET #language en-US "Go To Offset" -#string STR_HEXEDIT_LIBTITLEBAR_MAINEDITOR #language en-US "%s" -#string STR_HEXEDIT_LIBTITLEBAR_MAINEDITOR_C #language en-US "%c" -#string STR_HEXEDIT_LIBTITLEBAR_MAINEDITOR_TWOVARS #language en-US "( %X ~ %X ) " -#string STR_HEXEDIT_LIBTITLEBAR_FILE #language en-US " [FILE]" -#string STR_HEXEDIT_LIBTITLEBAR_DISK #language en-US " [DISK]" -#string STR_HEXEDIT_LIBTITLEBAR_MEM #language en-US " [MEM]" -#string STR_HEXEDIT_HELP_TITLE #language en-US "Help \n" -#string STR_HEXEDIT_HELP_BLANK #language en-US " \n" -#string STR_HEXEDIT_HELP_LIST_TITLE #language en-US "Control Key Function Key Command \n" -#string STR_HEXEDIT_HELP_DIV #language en-US "----------- ------------ ----------------- \n" -#string STR_HEXEDIT_HELP_GO_TO_OFFSET #language en-US "Ctrl-G F1 Go To Offset \n" -#string STR_HEXEDIT_HELP_SAVE_BUFFER #language en-US "Ctrl-S F2 Save Buffer \n" -#string STR_HEXEDIT_HELP_EXIT #language en-US "Ctrl-Q F3 Exit \n" -#string STR_HEXEDIT_HELP_SELECT_START #language en-US "Ctrl-T F4 Select Start \n" -#string STR_HEXEDIT_HELP_SELECT_END #language en-US "Ctrl-D F5 Select End \n" -#string STR_HEXEDIT_HELP_CUT #language en-US "Ctrl-X F6 Cut \n" -#string STR_HEXEDIT_HELP_PASTE #language en-US "Ctrl-V F7 Paste \n" -#string STR_HEXEDIT_HELP_OPEN_FILE #language en-US "Ctrl-O F8 Open File \n" -#string STR_HEXEDIT_HELP_OPEN_DISK #language en-US "Ctrl-I F9 Open Disk \n" -#string STR_HEXEDIT_HELP_OPEN_MEMORY #language en-US "Ctrl-M F10 Open Memory \n" -#string STR_HEXEDIT_HELP_EXIT_HELP #language en-US "Use Ctrl-W to exit this help \n" -#string STR_HEXEDIT_INIT_FAILED #language en-US "%Hhexedit%N: Initialization failed\n" -#string STR_HEXEDIT_ONE_VAR #language en-US "%Hhexedit%N: %s\n" -#string STR_HEXEDIT_UNKNOWN_EDITOR #language en-US "%Hhexedit%N: Unknown editor error\n" -#string STR_HEXEDIT_NOREDIRECT #language en-US "%Hhexedit%N: Redirection is not allowed\n" diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c deleted file mode 100644 index ffb6514..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c +++ /dev/null @@ -1,2378 +0,0 @@ -/** @file - Defines the Main Editor data type - - - Global variables - - Instances of the other objects of the editor - - Main Interfaces - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" -#include "EditStatusBar.h" -#include "EditInputBar.h" - -HEFI_EDITOR_COLOR_ATTRIBUTES HOriginalColors; -INTN HOriginalMode; - -// -// the first time editor launch -// -BOOLEAN HEditorFirst; - -// -// it's time editor should exit -// -BOOLEAN HEditorExit; - -BOOLEAN HEditorMouseAction; - -extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage; -extern HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar; - -extern BOOLEAN HBufferImageMouseNeedRefresh; -extern BOOLEAN HBufferImageNeedRefresh; -extern BOOLEAN HBufferImageOnlyLineNeedRefresh; - -HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; -HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar; - -// -// basic initialization for MainEditor -// -HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = { - &HBufferImage, - { - {0, 0} - }, - { - 0, - 0 - }, - NULL, - FALSE, - NULL, - 0, - 0, - 1, - 1 -}; - -/** - Help info that will be displayed. -**/ -EFI_STRING_ID HexMainMenuHelpInfo[] = { - STRING_TOKEN(STR_HEXEDIT_HELP_TITLE), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_LIST_TITLE), - STRING_TOKEN(STR_HEXEDIT_HELP_DIV), - STRING_TOKEN(STR_HEXEDIT_HELP_GO_TO_OFFSET), - STRING_TOKEN(STR_HEXEDIT_HELP_SAVE_BUFFER), - STRING_TOKEN(STR_HEXEDIT_HELP_EXIT), - STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_START), - STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_END), - STRING_TOKEN(STR_HEXEDIT_HELP_CUT), - STRING_TOKEN(STR_HEXEDIT_HELP_PASTE), - STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_FILE), - STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_DISK), - STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_MEMORY), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_EXIT_HELP), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_BLANK), - STRING_TOKEN(STR_HEXEDIT_HELP_DIV), - 0 -}; - - -/** - show help menu. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMainCommandDisplayHelp ( - VOID - ) -{ - INT32 CurrentLine; - CHAR16 *InfoString; - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - UINTN EventIndex; - - // - // print helpInfo - // - for (CurrentLine = 0; 0 != HexMainMenuHelpInfo[CurrentLine]; CurrentLine++) { - InfoString = HiiGetString(gShellDebug1HiiHandle, HexMainMenuHelpInfo[CurrentLine] -, NULL); - ShellPrintEx (0,CurrentLine+1,L"%E%s%N",InfoString); - } - - // - // scan for ctrl+w - // - while (TRUE) { - Status = gBS->WaitForEvent (1, &HMainEditor.TextInputEx->WaitForKeyEx, &EventIndex); - if (EFI_ERROR (Status) || (EventIndex != 0)) { - continue; - } - Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData); - if (EFI_ERROR (Status)) { - continue; - } - - if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || - (KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) { - // - // For consoles that don't support/report shift state, - // CTRL+W is translated to L'W' - L'A' + 1. - // - if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) { - break; - } - } else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && - ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) && - ((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) { - // - // For consoles that supports/reports shift state, - // make sure that only CONTROL shift key is pressed. - // - if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) { - break; - } - } - } - - // update screen with buffer's info - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageRefresh (); - - return EFI_SUCCESS; -} - -/** - Move cursor to specified lines. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMainCommandGoToOffset ( - VOID - ) -{ - UINTN Size; - UINT64 Offset; - EFI_STATUS Status; - UINTN FRow; - UINTN FCol; - - // - // variable initialization - // - Size = 0; - Offset = 0; - FRow = 0; - FCol = 0; - - // - // get offset - // - Status = InputBarSetPrompt (L"Go To Offset: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (8); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE); - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Invalid Offset"); - return EFI_SUCCESS; - } - - break; - } - } - - Size = HBufferImageGetTotalSize (); - if (Offset >= Size) { - StatusBarSetStatusString (L"Invalid Offset"); - return EFI_SUCCESS; - } - - FRow = (UINTN)DivU64x32(Offset , 0x10) + 1; - FCol = (UINTN)ModU64x32(Offset , 0x10) + 1; - - HBufferImageMovePosition (FRow, FCol, TRUE); - - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageMouseNeedRefresh = TRUE; - - return EFI_SUCCESS; -} - -/** - Save current opened buffer. - If is file buffer, you can save to current file name or - save to another file name. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandSaveBuffer ( - VOID - ) -{ - EFI_STATUS Status; - BOOLEAN Done; - CHAR16 *FileName; - BOOLEAN OldFile; - CHAR16 *Str; - EFI_FILE_INFO *Info; - SHELL_FILE_HANDLE ShellFileHandle; - - if (HMainEditor.BufferImage->BufferType != FileTypeFileBuffer) { - if (!HMainEditor.BufferImage->Modified) { - return EFI_SUCCESS; - } - - Status = InputBarSetPrompt (L"Dangerous to save disk/mem buffer. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // the answer is just one character - // - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - // - // loop for user's answer - // valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C' - // - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // want to save this buffer first - // - Status = HBufferImageSave ( - NULL, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - HMainEditor.BufferImage->BufferType - ); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"BufferSave: Problems Writing"); - return Status; - } - - return EFI_SUCCESS; - - case L'n': - case L'N': - // - // the file won't be saved - // - return EFI_SUCCESS; - - case L'c': - case L'C': - return EFI_SUCCESS; - } - // - // end of switch - // - } - // - // ENDOF WHILE - // - } - // - // ENDOF != FILEBUFFER - // - // This command will save currently opened file to disk. - // You can choose save to another file name or just save to - // current file name. - // Below is the scenario of Save File command: ( - // Suppose the old file name is A ) - // 1. An Input Bar will be prompted: "File To Save: [ old file name]" - // IF user press ESC, Save File command ends . - // IF user press Enter, input file name will be A. - // IF user inputs a new file name B, input file name will be B. - // - // 2. IF input file name is A, go to do Step 3. - // IF input file name is B, go to do Step 4. - // - // 3. IF A is read only, Status Bar will show "Access Denied" - // and Save File commands ends. - // IF A is not read only, save file buffer to disk - // and remove Modified flag in Title Bar , then Save File command ends. - // - // 4. IF B does not exist, create this file and save file buffer to it. - // Go to do Step 7. - // IF B exits, do Step 5. - // - // 5. An Input Bar will be prompted: - // "File Exists. Overwrite ( Yes/No/Cancel ) ?" - // IF user press 'y' or 'Y', do Step 6. - // IF user press 'n' or 'N', Save File commands ends. - // IF user press 'c' or 'C' or ESC, Save File commands ends. - // - // 6. IF B is a read-only file, Status Bar will show "Access Denied" - // and Save File commands ends. - // IF B can be read and write, save file buffer to B. - // - // 7. Update File Name field in Title Bar to B - // and remove the Modified flag in Title Bar. - // - Str = CatSPrint(NULL, - L"File to Save: [%s]", - HMainEditor.BufferImage->FileImage->FileName - ); - if (Str == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (StrLen (Str) >= 50) { - // - // replace the long file name with "..." - // - Str[46] = L'.'; - Str[47] = L'.'; - Str[48] = L'.'; - Str[49] = L']'; - Str[50] = L'\0'; - } - - Status = InputBarSetPrompt (Str); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (100); - if (EFI_ERROR (Status)) { - return Status; - } - // - // get new file name - // - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // if user pressed ESC - // - if (Status == EFI_NOT_READY) { - SHELL_FREE_NON_NULL (Str); - return EFI_SUCCESS; - } - - SHELL_FREE_NON_NULL (Str); - - // - // if just enter pressed, so think save to current file name - // - if (StrLen (InputBarGetString()) == 0) { - FileName = CatSPrint(NULL, - L"%s", - HMainEditor.BufferImage->FileImage->FileName - ); - } else { - FileName = CatSPrint(NULL, L"%s", InputBarGetString()); - } - - if (FileName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (!IsValidFileName (FileName)) { - StatusBarSetStatusString (L"Invalid File Name"); - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } - - OldFile = FALSE; - - // - // save to the old file - // - if (StringNoCaseCompare ( - &FileName, - &HMainEditor.BufferImage->FileImage->FileName - ) == 0) { - OldFile = TRUE; - } - - if (OldFile) { - // - // if the file is read only, so can not write back to it. - // - if (HMainEditor.BufferImage->FileImage->ReadOnly) { - StatusBarSetStatusString (L"Access Denied"); - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } - } else { - Status = ShellOpenFileByName (FileName, &ShellFileHandle, EFI_FILE_MODE_READ, 0); - - if (!EFI_ERROR (Status)) { - - Info = ShellGetFileInfo(ShellFileHandle); - - ShellCloseFile(&ShellFileHandle); - // - // check if read only - // - if (Info->Attribute & EFI_FILE_READ_ONLY) { - StatusBarSetStatusString (L"Access Denied"); - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } - - SHELL_FREE_NON_NULL(Info); - // - // ask user whether to overwrite this file - // - Status = InputBarSetPrompt (L"File exists. Overwrite (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (FileName); - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (FileName); - return Status; - } - - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - if (Status == EFI_NOT_READY) { - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - Done = TRUE; - break; - case L'n': - case L'N': - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - case L'c': - case L'C': - SHELL_FREE_NON_NULL (FileName); - return EFI_SUCCESS; - } // switch - } // while - } // if opened existing file - } // if OldFile - - // - // save file back to disk - // - Status = HBufferImageSave ( - FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - FileTypeFileBuffer - ); - SHELL_FREE_NON_NULL (FileName); - - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - - return EFI_SUCCESS; -} - -/** - Load a disk buffer editor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandSelectStart ( - VOID - ) -{ - UINTN Start; - - Start = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column; - - // - // last line - // - if (HMainEditor.BufferImage->CurrentLine->Link.ForwardLink == HMainEditor.BufferImage->ListHead) { - if (HMainEditor.BufferImage->BufferPosition.Column > HMainEditor.BufferImage->CurrentLine->Size) { - StatusBarSetStatusString (L"Invalid Block Start"); - return EFI_LOAD_ERROR; - } - } - - if (HMainEditor.SelectEnd != 0 && Start > HMainEditor.SelectEnd) { - StatusBarSetStatusString (L"Invalid Block Start"); - return EFI_LOAD_ERROR; - } - - HMainEditor.SelectStart = Start; - - HBufferImageNeedRefresh = TRUE; - - return EFI_SUCCESS; -} - -/** - Load a disk buffer editor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandSelectEnd ( - VOID - ) -{ - UINTN End; - - End = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column; - - // - // last line - // - if (HMainEditor.BufferImage->CurrentLine->Link.ForwardLink == HMainEditor.BufferImage->ListHead) { - if (HMainEditor.BufferImage->BufferPosition.Column > HMainEditor.BufferImage->CurrentLine->Size) { - StatusBarSetStatusString (L"Invalid Block End"); - return EFI_LOAD_ERROR; - } - } - - if (HMainEditor.SelectStart != 0 && End < HMainEditor.SelectStart) { - StatusBarSetStatusString (L"Invalid Block End"); - return EFI_SUCCESS; - } - - HMainEditor.SelectEnd = End; - - HBufferImageNeedRefresh = TRUE; - - return EFI_SUCCESS; -} - -/** - Cut current line to clipboard. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandCut ( - VOID - ) -{ - UINTN Index; - LIST_ENTRY *Link; - UINT8 *Buffer; - UINTN Count; - - // - // not select, so not allowed to cut - // - if (HMainEditor.SelectStart == 0) { - StatusBarSetStatusString (L"No Block is Selected"); - return EFI_SUCCESS; - } - // - // not select, so not allowed to cut - // - if (HMainEditor.SelectEnd == 0) { - StatusBarSetStatusString (L"No Block is Selected"); - return EFI_SUCCESS; - } - - Link = HMainEditor.BufferImage->ListHead->ForwardLink; - for (Index = 0; Index < (HMainEditor.SelectEnd - 1) / 0x10; Index++) { - Link = Link->ForwardLink; - } - - Count = HMainEditor.SelectEnd - HMainEditor.SelectStart + 1; - Buffer = AllocateZeroPool (Count); - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // cut the selected area - // - HBufferImageDeleteCharacterFromBuffer ( - HMainEditor.SelectStart - 1, - Count, - Buffer - ); - - // - // put to clipboard - // - HClipBoardSet (Buffer, Count); - - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - - if (!HMainEditor.BufferImage->Modified) { - HMainEditor.BufferImage->Modified = TRUE; - } - - // - // now no select area - // - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - - return EFI_SUCCESS; -} - -/** - Paste line to file buffer. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandPaste ( - VOID - ) -{ - - BOOLEAN OnlyLineRefresh; - HEFI_EDITOR_LINE *Line; - UINT8 *Buffer; - UINTN Count; - UINTN FPos; - - Count = HClipBoardGet (&Buffer); - if (Count == 0 || Buffer == NULL) { - StatusBarSetStatusString (L"Nothing to Paste"); - return EFI_SUCCESS; - } - - Line = HMainEditor.BufferImage->CurrentLine; - - OnlyLineRefresh = FALSE; - if (Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead && Line->Size + Count < 0x10) { - // - // is at last line, and after paste will not exceed - // so only this line need to be refreshed - // - // if after add, the line is 0x10, then will append a new line - // so the whole page will need be refreshed - // - OnlyLineRefresh = TRUE; - - } - - FPos = 0x10 * (HMainEditor.BufferImage->BufferPosition.Row - 1) + HMainEditor.BufferImage->BufferPosition.Column - 1; - - HBufferImageAddCharacterToBuffer (FPos, Count, Buffer); - - if (OnlyLineRefresh) { - HBufferImageNeedRefresh = FALSE; - HBufferImageOnlyLineNeedRefresh = TRUE; - } else { - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - } - - if (!HMainEditor.BufferImage->Modified) { - HMainEditor.BufferImage->Modified = TRUE; - } - - return EFI_SUCCESS; - -} - -/** - Exit editor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandExit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // Below is the scenario of Exit command: - // 1. IF currently opened file is not modified, exit the editor and - // Exit command ends. - // IF currently opened file is modified, do Step 2 - // - // 2. An Input Bar will be prompted: - // "File modified. Save ( Yes/No/Cancel )?" - // IF user press 'y' or 'Y', currently opened file will be saved and - // Editor exits - // IF user press 'n' or 'N', currently opened file will not be saved - // and Editor exits. - // IF user press 'c' or 'C' or ESC, Exit command ends. - // - // - // if file has been modified, so will prompt user - // whether to save the changes - // - if (HMainEditor.BufferImage->Modified) { - - Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // write file back to disk - // - Status = HBufferImageSave ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - HMainEditor.BufferImage->BufferType - ); - if (!EFI_ERROR (Status)) { - HEditorExit = TRUE; - } - - return Status; - - case L'n': - case L'N': - HEditorExit = TRUE; - return EFI_SUCCESS; - - case L'c': - case L'C': - return EFI_SUCCESS; - - } - } - } - - HEditorExit = TRUE; - return EFI_SUCCESS; - -} - -/** - Load a file from disk to editor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainCommandOpenFile ( - VOID - ) -{ - BOOLEAN Done; - EFI_STATUS Status; - EDIT_FILE_TYPE BufferType; - - BufferType = HMainEditor.BufferImage->BufferType; - - // - // This command will open a file from current working directory. - // Read-only file can also be opened. But it can not be modified. - // Below is the scenario of Open File command: - // 1. IF currently opened file has not been modified, directly go to step . - // IF currently opened file has been modified, an Input Bar will be - // prompted as : - // "File Modified. Save ( Yes/No/Cancel) ?" - // IF user press 'y' or 'Y', currently opened file will be saved. - // IF user press 'n' or 'N', currently opened file will - // not be saved. - // IF user press 'c' or 'C' or ESC, Open File command ends and - // currently opened file is still opened. - // - // 2. An Input Bar will be prompted as : "File Name to Open: " - // IF user press ESC, Open File command ends and - // currently opened file is still opened. - // Any other inputs with a Return will cause - // currently opened file close. - // - // 3. IF user input file name is an existing file , - // this file will be read and opened. - // IF user input file name is a new file, this file will be created - // and opened. This file's type ( UNICODE or ASCII ) is the same with - // the old file. - // - // - // if current file is modified, so you need to choose whether to - // save it first. - // - if (HMainEditor.BufferImage->Modified) { - - Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // the answer is just one character - // - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - // - // loop for user's answer - // valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C' - // - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // want to save this buffer first - // - Status = HBufferImageSave ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - HMainEditor.BufferImage->BufferType - ); - if (EFI_ERROR (Status)) { - return Status; - } - - MainTitleBarRefresh ( - HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL, - HMainEditor.BufferImage->BufferType, - HMainEditor.BufferImage->FileImage->ReadOnly, - FALSE, - HMainEditor.ScreenSize.Column, - HMainEditor.ScreenSize.Row, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0 - ); - Done = TRUE; - break; - - case L'n': - case L'N': - // - // the file won't be saved - // - Done = TRUE; - break; - - case L'c': - case L'C': - return EFI_SUCCESS; - } - } - } - // - // TO get the open file name - // - Status = InputBarSetPrompt (L"File Name to Open: "); - if (EFI_ERROR (Status)) { - HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - return Status; - } - - Status = InputBarSetStringSize (100); - if (EFI_ERROR (Status)) { - Status = HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - Status = HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - - return Status; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - // - // CHECK if filename's valid - // - if (!IsValidFileName (InputBarGetString())) { - HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - - StatusBarSetStatusString (L"Invalid File Name"); - return EFI_SUCCESS; - } - - break; - } - } - // - // read from disk - // - Status = HBufferImageRead ( - InputBarGetString(), - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - FileTypeFileBuffer, - FALSE - ); - - if (EFI_ERROR (Status)) { - HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - - return EFI_LOAD_ERROR; - } - - return EFI_SUCCESS; -} - -/** - Load a disk buffer editor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_NOT_FOUND The disk was not found. -**/ -EFI_STATUS -HMainCommandOpenDisk ( - VOID - ) -{ - UINT64 Size; - UINT64 Offset; - CHAR16 *DeviceName; - EFI_STATUS Status; - BOOLEAN Done; - - EDIT_FILE_TYPE BufferType; - - // - // variable initialization - // - Size = 0; - Offset = 0; - BufferType = HMainEditor.BufferImage->BufferType; - - // - // if current file is modified, so you need to choose - // whether to save it first. - // - if (HMainEditor.BufferImage->Modified) { - - Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // the answer is just one character - // - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - // - // loop for user's answer - // valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C' - // - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // want to save this buffer first - // - Status = HBufferImageSave ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType - ); - if (EFI_ERROR (Status)) { - return Status; - } - - MainTitleBarRefresh ( - HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL, - HMainEditor.BufferImage->BufferType, - HMainEditor.BufferImage->FileImage->ReadOnly, - FALSE, - HMainEditor.ScreenSize.Column, - HMainEditor.ScreenSize.Row, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0 - ); - Done = TRUE; - break; - - case L'n': - case L'N': - // - // the file won't be saved - // - Done = TRUE; - break; - - case L'c': - case L'C': - return EFI_SUCCESS; - } - } - } - // - // get disk block device name - // - Status = InputBarSetPrompt (L"Block Device to Open: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (100); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - break; - } - } - - DeviceName = CatSPrint(NULL, L"%s", InputBarGetString()); - if (DeviceName == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // get starting offset - // - Status = InputBarSetPrompt (L"First Block No.: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (16); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE); - if (EFI_ERROR (Status)) { - continue; - } - - break; - } - } - // - // get Number of Blocks: - // - Status = InputBarSetPrompt (L"Number of Blocks: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (8); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - Status = ShellConvertStringToUint64 (InputBarGetString(), &Size, TRUE, FALSE); - if (EFI_ERROR (Status)) { - continue; - } - - if (Size == 0) { - continue; - } - - break; - } - } - - Status = HBufferImageRead ( - NULL, - DeviceName, - (UINTN)Offset, - (UINTN)Size, - 0, - 0, - FileTypeDiskBuffer, - FALSE - ); - - if (EFI_ERROR (Status)) { - - HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - return EFI_NOT_FOUND; - } - - return EFI_SUCCESS; -} - -/** - Load memory content to editor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_NOT_FOUND The disk was not found. -**/ -EFI_STATUS -HMainCommandOpenMemory ( - VOID - ) -{ - UINT64 Size; - UINT64 Offset; - EFI_STATUS Status; - BOOLEAN Done; - EDIT_FILE_TYPE BufferType; - - // - // variable initialization - // - Size = 0; - Offset = 0; - BufferType = HMainEditor.BufferImage->BufferType; - - // - // if current buffer is modified, so you need to choose - // whether to save it first. - // - if (HMainEditor.BufferImage->Modified) { - - Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? "); - if (EFI_ERROR (Status)) { - return Status; - } - // - // the answer is just one character - // - Status = InputBarSetStringSize (1); - if (EFI_ERROR (Status)) { - return Status; - } - // - // loop for user's answer - // valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C' - // - Done = FALSE; - while (!Done) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - return EFI_SUCCESS; - } - - switch (InputBarGetString()[0]) { - case L'y': - case L'Y': - // - // want to save this buffer first - // - Status = HBufferImageSave ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType - ); - if (EFI_ERROR (Status)) { - return Status; - } - - MainTitleBarRefresh ( - HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL, - HMainEditor.BufferImage->BufferType, - HMainEditor.BufferImage->FileImage->ReadOnly, - FALSE, - HMainEditor.ScreenSize.Column, - HMainEditor.ScreenSize.Row, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0 - ); - Done = TRUE; - break; - - case L'n': - case L'N': - // - // the file won't be saved - // - Done = TRUE; - break; - - case L'c': - case L'C': - return EFI_SUCCESS; - } - } - } - // - // get starting offset - // - Status = InputBarSetPrompt (L"Starting Offset: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (8); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE); - if (EFI_ERROR (Status)) { - continue; - } - - break; - } - } - // - // get Number of Blocks: - // - Status = InputBarSetPrompt (L"Buffer Size: "); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = InputBarSetStringSize (8); - if (EFI_ERROR (Status)) { - return Status; - } - - while (1) { - Status = InputBarRefresh (HMainEditor.ScreenSize.Row, HMainEditor.ScreenSize.Column); - - // - // ESC pressed - // - if (Status == EFI_NOT_READY) { - - return EFI_SUCCESS; - } - // - // THE input string length should > 0 - // - if (StrLen (InputBarGetString()) > 0) { - Status = ShellConvertStringToUint64 (InputBarGetString(), &Size, TRUE, FALSE); - if (EFI_ERROR (Status)) { - continue; - } - - if (Size == 0) { - continue; - } - - break; - } - } - - if ((Offset + Size - 1)> 0xffffffff) { - StatusBarSetStatusString (L"Invalid parameter"); - return EFI_LOAD_ERROR; - } - - Status = HBufferImageRead ( - NULL, - NULL, - 0, - 0, - (UINTN)Offset, - (UINTN)Size, - FileTypeMemBuffer, - FALSE - ); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Device Error!"); - HBufferImageRead ( - HMainEditor.BufferImage->FileImage->FileName, - HMainEditor.BufferImage->DiskImage->Name, - HMainEditor.BufferImage->DiskImage->Offset, - HMainEditor.BufferImage->DiskImage->Size, - HMainEditor.BufferImage->MemImage->Offset, - HMainEditor.BufferImage->MemImage->Size, - BufferType, - TRUE - ); - return EFI_NOT_FOUND; - } - return EFI_SUCCESS; - -} - -MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = { - NULL, - NULL, /* Ctrl - A */ - NULL, /* Ctrl - B */ - NULL, /* Ctrl - C */ - HMainCommandSelectEnd, /* Ctrl - D */ - HMainCommandDisplayHelp, /* Ctrl - E */ - NULL, /* Ctrl - F */ - HMainCommandGoToOffset, /* Ctrl - G */ - NULL, /* Ctrl - H */ - HMainCommandOpenDisk, /* Ctrl - I */ - NULL, /* Ctrl - J */ - NULL, /* Ctrl - K */ - NULL, /* Ctrl - L */ - HMainCommandOpenMemory, /* Ctrl - M */ - NULL, /* Ctrl - N */ - HMainCommandOpenFile, /* Ctrl - O */ - NULL, /* Ctrl - P */ - HMainCommandExit, /* Ctrl - Q */ - NULL, /* Ctrl - R */ - HMainCommandSaveBuffer, /* Ctrl - S */ - HMainCommandSelectStart, /* Ctrl - T */ - NULL, /* Ctrl - U */ - HMainCommandPaste, /* Ctrl - V */ - NULL, /* Ctrl - W */ - HMainCommandCut, /* Ctrl - X */ - NULL, /* Ctrl - Y */ - NULL, /* Ctrl - Z */ -}; - -CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = { - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_GO_TO_OFFSET), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F1), - HMainCommandGoToOffset - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SAVE_BUFFER), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F2), - HMainCommandSaveBuffer - }, - { - STRING_TOKEN(STR_EDIT_LIBMENUBAR_EXIT), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F3), - HMainCommandExit - }, - - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SELECT_START), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F4), - HMainCommandSelectStart - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SELECT_END), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F5), - HMainCommandSelectEnd - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_CUT), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F6), - HMainCommandCut - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_PASTE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F7), - HMainCommandPaste - }, - - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_FILE), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F8), - HMainCommandOpenFile - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_DISK), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F9), - HMainCommandOpenDisk - }, - { - STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_MEMORY), - STRING_TOKEN(STR_EDIT_LIBMENUBAR_F10), - HMainCommandOpenMemory - }, - - { - 0, - 0, - NULL - } -}; - -/** - Init function for MainEditor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorInit ( - VOID - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - UINTN Index; - - // - // basic initialization - // - CopyMem (&HMainEditor, &HMainEditorConst, sizeof (HMainEditor)); - - // - // set screen attributes - // - HMainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff; - - HMainEditor.ColorAttributes.Colors.Background = (UINT8) (gST->ConOut->Mode->Attribute >> 4); - - HOriginalColors = HMainEditor.ColorAttributes.Colors; - - HOriginalMode = gST->ConOut->Mode->Mode; - - // - // query screen size - // - gST->ConOut->QueryMode ( - gST->ConOut, - gST->ConOut->Mode->Mode, - &(HMainEditor.ScreenSize.Column), - &(HMainEditor.ScreenSize.Row) - ); - - // - // Find TextInEx in System Table ConsoleInHandle - // Per UEFI Spec, TextInEx is required for a console capable platform. - // - Status = gBS->HandleProtocol ( - gST->ConsoleInHandle, - &gEfiSimpleTextInputExProtocolGuid, - (VOID**)&HMainEditor.TextInputEx - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Find mouse in System Table ConsoleInHandle - // - Status = gBS->HandleProtocol ( - gST->ConsoleInHandle, - &gEfiSimplePointerProtocolGuid, - (VOID**)&HMainEditor.MouseInterface - ); - if (EFI_ERROR (Status)) { - // - // If there is no Simple Pointer Protocol on System Table - // - HandleBuffer = NULL; - HMainEditor.MouseInterface = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiSimplePointerProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (!EFI_ERROR (Status) && HandleCount > 0) { - // - // Try to find the first available mouse device - // - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiSimplePointerProtocolGuid, - (VOID**)&HMainEditor.MouseInterface - ); - if (!EFI_ERROR (Status)) { - break; - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - } - - if (!EFI_ERROR (Status) && HMainEditor.MouseInterface != NULL) { - HMainEditor.MouseAccumulatorX = 0; - HMainEditor.MouseAccumulatorY = 0; - HMainEditor.MouseSupported = TRUE; - } - - // - // below will call the five components' init function - // - Status = MainTitleBarInit (L"UEFI HEXEDIT"); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_TITLE), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - Status = ControlHotKeyInit (HexMainControlBasedMenuFunctions); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - Status = MenuBarInit (HexEditorMenuItems); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - Status = StatusBarInit (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_STATUS), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - InputBarInit (HMainEditor.TextInputEx); - - Status = HBufferImageInit (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_BUFFERIMAGE), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - - Status = HClipBoardInit (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD), gShellDebug1HiiHandle); - return EFI_LOAD_ERROR; - } - // - // clear whole screen and enable cursor - // - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->EnableCursor (gST->ConOut, TRUE); - - // - // initialize EditorFirst and EditorExit - // - HEditorFirst = TRUE; - HEditorExit = FALSE; - HEditorMouseAction = FALSE; - - return EFI_SUCCESS; -} - -/** - Cleanup function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorCleanup ( - VOID - ) -{ - EFI_STATUS Status; - - // - // call the five components' cleanup function - // - MainTitleBarCleanup (); - - MenuBarCleanup (); - - StatusBarCleanup (); - - InputBarCleanup (); - - Status = HBufferImageCleanup (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_BUFFERIMAGE_CLEAN), gShellDebug1HiiHandle); - } - - Status = HClipBoardCleanup (); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN), gShellDebug1HiiHandle); - } - // - // restore old mode - // - if (HOriginalMode != gST->ConOut->Mode->Mode) { - gST->ConOut->SetMode (gST->ConOut, HOriginalMode); - } - - gST->ConOut->SetAttribute ( - gST->ConOut, - EFI_TEXT_ATTR (HOriginalColors.Foreground, HOriginalColors.Background) - ); - gST->ConOut->ClearScreen (gST->ConOut); - - return EFI_SUCCESS; -} - -/** - Refresh function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMainEditorRefresh ( - VOID - ) -{ - BOOLEAN NameChange; - BOOLEAN ReadChange; - - NameChange = FALSE; - ReadChange = FALSE; - - if (HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer) { - if (HMainEditor.BufferImage->DiskImage != NULL && - HBufferImageBackupVar.DiskImage != NULL && - (HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset || - HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size) ){ - NameChange = TRUE; - } - } else if (HMainEditor.BufferImage->BufferType == FileTypeMemBuffer) { - if (HMainEditor.BufferImage->MemImage != NULL && - HBufferImageBackupVar.MemImage != NULL && - (HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset || - HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size) ){ - NameChange = TRUE; - } - } else if (HMainEditor.BufferImage->BufferType == FileTypeFileBuffer) { - if ( HMainEditor.BufferImage->FileImage != NULL && - HMainEditor.BufferImage->FileImage->FileName != NULL && - HBufferImageBackupVar.FileImage != NULL && - HBufferImageBackupVar.FileImage->FileName != NULL && - StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0 ) { - NameChange = TRUE; - } - } - if ( HMainEditor.BufferImage->FileImage != NULL && - HBufferImageBackupVar.FileImage != NULL && - HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly ) { - ReadChange = TRUE; - } - - // - // to aVOID screen flicker - // the stall value is from experience - // - gBS->Stall (50); - - // - // call the components refresh function - // - if (HEditorFirst - || NameChange - || HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType - || HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified - || ReadChange ) { - - MainTitleBarRefresh ( - HMainEditor.BufferImage->BufferType == FileTypeFileBuffer&&HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Name:NULL, - HMainEditor.BufferImage->BufferType, - (BOOLEAN)(HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->ReadOnly:FALSE), - HMainEditor.BufferImage->Modified, - HMainEditor.ScreenSize.Column, - HMainEditor.ScreenSize.Row, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Offset:0, - HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Size :0 - ); - HBufferImageRefresh (); - } - if (HEditorFirst - || HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row - || HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column - || StatusBarGetRefresh()) { - - StatusBarRefresh ( - HEditorFirst, - HMainEditor.ScreenSize.Row, - HMainEditor.ScreenSize.Column, - (UINTN)(-1), - (UINTN)(-1), - FALSE - ); - HBufferImageRefresh (); - } - - if (HEditorFirst) { - HBufferImageRefresh (); - } - - // - // EditorFirst is now set to FALSE - // - HEditorFirst = FALSE; - - return EFI_SUCCESS; -} - -/** - Handle the mouse input. - - @param[in] MouseState The current mouse state. - @param[out] BeforeLeftButtonDown helps with selections. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_NOT_FOUND The disk was not found. -**/ -EFI_STATUS -HMainEditorHandleMouseInput ( - IN EFI_SIMPLE_POINTER_STATE MouseState, - OUT BOOLEAN *BeforeLeftButtonDown - ) -{ - - INT32 TextX; - INT32 TextY; - UINTN FRow; - UINTN FCol; - BOOLEAN HighBits; - LIST_ENTRY *Link; - HEFI_EDITOR_LINE *Line; - UINTN Index; - BOOLEAN Action; - - Action = FALSE; - - // - // have mouse movement - // - if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) { - // - // handle - // - TextX = HGetTextX (MouseState.RelativeMovementX); - TextY = HGetTextY (MouseState.RelativeMovementY); - - HBufferImageAdjustMousePosition (TextX, TextY); - - Action = TRUE; - - } - - if (MouseState.LeftButton) { - HighBits = HBufferImageIsAtHighBits ( - HMainEditor.BufferImage->MousePosition.Column, - &FCol - ); - - // - // not at an movable place - // - if (FCol == 0) { - // - // now just move mouse pointer to legal position - // - // - // move mouse position to legal position - // - HMainEditor.BufferImage->MousePosition.Column -= 10; - if (HMainEditor.BufferImage->MousePosition.Column > 24) { - HMainEditor.BufferImage->MousePosition.Column--; - FCol = HMainEditor.BufferImage->MousePosition.Column / 3 + 1 + 1; - } else { - if (HMainEditor.BufferImage->MousePosition.Column < 24) { - FCol = HMainEditor.BufferImage->MousePosition.Column / 3 + 1 + 1; - } else { - // - // == 24 - // - FCol = 9; - } - } - - HighBits = TRUE; - - } - - FRow = HMainEditor.BufferImage->BufferPosition.Row + - HMainEditor.BufferImage->MousePosition.Row - - HMainEditor.BufferImage->DisplayPosition.Row; - - if (HMainEditor.BufferImage->NumLines < FRow) { - // - // dragging - // - // - // now just move mouse pointer to legal position - // - FRow = HMainEditor.BufferImage->NumLines; - HighBits = TRUE; - } - - Link = HMainEditor.BufferImage->ListHead->ForwardLink; - for (Index = 0; Index < FRow - 1; Index++) { - Link = Link->ForwardLink; - } - - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - - // - // dragging - // - // - // now just move mouse pointer to legal position - // - if (FCol > Line->Size) { - if (*BeforeLeftButtonDown) { - HighBits = FALSE; - - if (Line->Size == 0) { - if (FRow > 1) { - FRow--; - FCol = 16; - } else { - FRow = 1; - FCol = 1; - } - - } else { - FCol = Line->Size; - } - } else { - FCol = Line->Size + 1; - HighBits = TRUE; - } - } - - HBufferImageMovePosition (FRow, FCol, HighBits); - - HMainEditor.BufferImage->MousePosition.Row = HMainEditor.BufferImage->DisplayPosition.Row; - - HMainEditor.BufferImage->MousePosition.Column = HMainEditor.BufferImage->DisplayPosition.Column; - - *BeforeLeftButtonDown = TRUE; - - Action = TRUE; - } else { - // - // else of if LButton - // - // release LButton - // - if (*BeforeLeftButtonDown) { - Action = TRUE; - } - // - // mouse up - // - *BeforeLeftButtonDown = FALSE; - } - - if (Action) { - return EFI_SUCCESS; - } - - return EFI_NOT_FOUND; -} - -/** - Handle user key input. will route it to other components handle function. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorKeyInput ( - VOID - ) -{ - EFI_KEY_DATA KeyData; - EFI_STATUS Status; - EFI_SIMPLE_POINTER_STATE MouseState; - BOOLEAN NoShiftState; - BOOLEAN LengthChange; - UINTN Size; - UINTN OldSize; - BOOLEAN BeforeMouseIsDown; - BOOLEAN MouseIsDown; - BOOLEAN FirstDown; - BOOLEAN MouseDrag; - UINTN FRow; - UINTN FCol; - UINTN SelectStartBackup; - UINTN SelectEndBackup; - - // - // variable initialization - // - OldSize = 0; - FRow = 0; - FCol = 0; - LengthChange = FALSE; - - MouseIsDown = FALSE; - FirstDown = FALSE; - MouseDrag = FALSE; - - do { - - Status = EFI_SUCCESS; - - HEditorMouseAction = FALSE; - - // - // backup some key elements, so that can aVOID some refresh work - // - HMainEditorBackup (); - - // - // wait for user key input - // - // - // change priority of checking mouse/keyboard activity dynamically - // so prevent starvation of keyboard. - // if last time, mouse moves then this time check keyboard - // - if (HMainEditor.MouseSupported) { - Status = HMainEditor.MouseInterface->GetState ( - HMainEditor.MouseInterface, - &MouseState - ); - if (!EFI_ERROR (Status)) { - - BeforeMouseIsDown = MouseIsDown; - - Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown); - - if (!EFI_ERROR (Status)) { - if (!BeforeMouseIsDown) { - // - // mouse down - // - if (MouseIsDown) { - FRow = HBufferImage.BufferPosition.Row; - FCol = HBufferImage.BufferPosition.Column; - SelectStartBackup = HMainEditor.SelectStart; - SelectEndBackup = HMainEditor.SelectEnd; - - FirstDown = TRUE; - } - } else { - - SelectStartBackup = HMainEditor.SelectStart; - SelectEndBackup = HMainEditor.SelectEnd; - - // - // begin to drag - // - if (MouseIsDown) { - if (FirstDown) { - if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) { - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - HMainEditor.SelectStart = (FRow - 1) * 0x10 + FCol; - - MouseDrag = TRUE; - FirstDown = FALSE; - } - } else { - if (( - (HBufferImage.BufferPosition.Row - 1) * - 0x10 + - HBufferImage.BufferPosition.Column - ) >= HMainEditor.SelectStart - ) { - HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) * - 0x10 + - HBufferImage.BufferPosition.Column; - } else { - HMainEditor.SelectEnd = 0; - } - } - // - // end of if RelativeX/Y - // - } else { - // - // mouse is up - // - if (MouseDrag) { - if (HBufferImageGetTotalSize () == 0) { - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - FirstDown = FALSE; - MouseDrag = FALSE; - } - - if (( - (HBufferImage.BufferPosition.Row - 1) * - 0x10 + - HBufferImage.BufferPosition.Column - ) >= HMainEditor.SelectStart - ) { - HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) * - 0x10 + - HBufferImage.BufferPosition.Column; - } else { - HMainEditor.SelectEnd = 0; - } - - if (HMainEditor.SelectEnd == 0) { - HMainEditor.SelectStart = 0; - } - } - - FirstDown = FALSE; - MouseDrag = FALSE; - } - - if (SelectStartBackup != HMainEditor.SelectStart || SelectEndBackup != HMainEditor.SelectEnd) { - if ((SelectStartBackup - 1) / 0x10 != (HMainEditor.SelectStart - 1) / 0x10) { - HBufferImageNeedRefresh = TRUE; - } else { - if ((SelectEndBackup - 1) / 0x10 != (HMainEditor.SelectEnd - 1) / 0x10) { - HBufferImageNeedRefresh = TRUE; - } else { - HBufferImageOnlyLineNeedRefresh = TRUE; - } - } - } - } - - HEditorMouseAction = TRUE; - HBufferImageMouseNeedRefresh = TRUE; - - } else if (Status == EFI_LOAD_ERROR) { - StatusBarSetStatusString (L"Invalid Mouse Movement "); - } - } - } - - // - // CheckEvent() returns Success when non-partial key is pressed. - // - Status = gBS->CheckEvent (HMainEditor.TextInputEx->WaitForKeyEx); - if (!EFI_ERROR (Status)) { - Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData); - if (!EFI_ERROR (Status)) { - // - // dispatch to different components' key handling function - // so not everywhere has to set this variable - // - HBufferImageMouseNeedRefresh = TRUE; - - // - // clear previous status string - // - StatusBarSetRefresh(); - // - // NoShiftState: TRUE when no shift key is pressed. - // - NoShiftState = ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || (KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID); - // - // dispatch to different components' key handling function - // - if (EFI_SUCCESS == MenuBarDispatchControlHotKey(&KeyData)) { - Status = EFI_SUCCESS; - } else if (NoShiftState && KeyData.Key.ScanCode == SCAN_NULL) { - Status = HBufferImageHandleInput (&KeyData.Key); - } else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN))) { - Status = HBufferImageHandleInput (&KeyData.Key); - } else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_F1) && KeyData.Key.ScanCode <= SCAN_F12)) { - Status = MenuBarDispatchFunctionKey (&KeyData.Key); - } else { - StatusBarSetStatusString (L"Unknown Command"); - - HBufferImageMouseNeedRefresh = FALSE; - } - - if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) { - // - // not already has some error status - // - if (StrCmp (L"", StatusBarGetString()) == 0) { - StatusBarSetStatusString (L"Disk Error. Try Again"); - } - } - } - // - // decide if has to set length warning - // - if (HBufferImage.BufferType != HBufferImageBackupVar.BufferType) { - LengthChange = FALSE; - } else { - // - // still the old buffer - // - if (HBufferImage.BufferType != FileTypeFileBuffer) { - Size = HBufferImageGetTotalSize (); - - switch (HBufferImage.BufferType) { - case FileTypeDiskBuffer: - OldSize = HBufferImage.DiskImage->Size * HBufferImage.DiskImage->BlockSize; - break; - - case FileTypeMemBuffer: - OldSize = HBufferImage.MemImage->Size; - break; - - default: - OldSize = 0; - break; - } - - if (!LengthChange) { - if (OldSize != Size) { - StatusBarSetStatusString (L"Disk/Mem Buffer Length should not be changed"); - } - } - - if (OldSize != Size) { - LengthChange = TRUE; - } else { - LengthChange = FALSE; - } - } - } - } - // - // after handling, refresh editor - // - HMainEditorRefresh (); - - } while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit); - - return Status; -} - -/** - Backup function for MainEditor. -**/ -VOID -HMainEditorBackup ( - VOID - ) -{ - HMainEditorBackupVar.SelectStart = HMainEditor.SelectStart; - HMainEditorBackupVar.SelectEnd = HMainEditor.SelectEnd; - HBufferImageBackup (); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h deleted file mode 100644 index edf7da2..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.h +++ /dev/null @@ -1,75 +0,0 @@ -/** @file - Defines the Main Editor data type - - - Global variables - - Instances of the other objects of the editor - - Main Interfaces - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_EDITOR_H_ -#define _LIB_EDITOR_H_ - -#include "HexEditor.h" - -/** - Init function for MainEditor - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorInit ( - VOID - ); - -/** - Cleanup function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorCleanup ( - VOID - ); - -/** - Refresh function for MainEditor. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMainEditorRefresh ( - VOID - ); - -/** - Handle user key input. will route it to other components handle function. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation occured. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMainEditorKeyInput ( - VOID - ); - -/** - Backup function for MainEditor. -**/ -VOID -HMainEditorBackup ( - VOID - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c deleted file mode 100644 index eec29dc..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c +++ /dev/null @@ -1,284 +0,0 @@ -/** @file - Functions to deal with Mem buffer - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" - -extern EFI_HANDLE HImageHandleBackup; - -extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage; - -extern BOOLEAN HBufferImageNeedRefresh; -extern BOOLEAN HBufferImageOnlyLineNeedRefresh; -extern BOOLEAN HBufferImageMouseNeedRefresh; - -extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; - -HEFI_EDITOR_MEM_IMAGE HMemImage; -HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar; - -// -// for basic initialization of HDiskImage -// -HEFI_EDITOR_MEM_IMAGE HMemImageConst = { - NULL, - 0, - 0 -}; - -/** - Initialization function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMemImageInit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // basically initialize the HMemImage - // - CopyMem (&HMemImage, &HMemImageConst, sizeof (HMemImage)); - - Status = gBS->LocateProtocol ( - &gEfiCpuIo2ProtocolGuid, - NULL, - (VOID**)&HMemImage.IoFncs - ); - if (!EFI_ERROR (Status)) { - return EFI_SUCCESS; - } else { - return EFI_LOAD_ERROR; - } -} - -/** - Backup function for HDiskImage. Only a few fields need to be backup. - This is for making the Disk buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMemImageBackup ( - VOID - ) -{ - HMemImageBackupVar.Offset = HMemImage.Offset; - HMemImageBackupVar.Size = HMemImage.Size; - - return EFI_SUCCESS; -} - -/** - Set FileName field in HFileImage. - - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageSetMemOffsetSize ( - IN UINTN Offset, - IN UINTN Size - ) -{ - - HMemImage.Offset = Offset; - HMemImage.Size = Size; - - return EFI_SUCCESS; -} - -/** - Read a disk from disk into HBufferImage. - - @param[in] Offset The offset. - @param[in] Size The size. - @param[in] Recover if is for recover, no information print. - - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageRead ( - IN UINTN Offset, - IN UINTN Size, - IN BOOLEAN Recover - ) -{ - - EFI_STATUS Status; - void *Buffer; - CHAR16 *Str; - HEFI_EDITOR_LINE *Line; - - HBufferImage.BufferType = FileTypeMemBuffer; - - Buffer = AllocateZeroPool (Size); - if (Buffer == NULL) { - StatusBarSetStatusString (L"Read Memory Failed"); - return EFI_OUT_OF_RESOURCES; - } - - Status = HMemImage.IoFncs->Mem.Read ( - HMemImage.IoFncs, - EfiCpuIoWidthUint8, - Offset, - Size, - Buffer - ); - - if (EFI_ERROR (Status)) { - FreePool (Buffer); - StatusBarSetStatusString (L"Memory Specified Not Accessible"); - return EFI_LOAD_ERROR; - } - - HBufferImageFree (); - - Status = HBufferImageBufferToList (Buffer, Size); - FreePool (Buffer); - - if (EFI_ERROR (Status)) { - StatusBarSetStatusString (L"Read Memory Failed"); - return Status; - } - - Status = HMemImageSetMemOffsetSize (Offset, Size); - - HBufferImage.DisplayPosition.Row = 2; - HBufferImage.DisplayPosition.Column = 10; - - HBufferImage.MousePosition.Row = 2; - HBufferImage.MousePosition.Column = 10; - - HBufferImage.LowVisibleRow = 1; - HBufferImage.HighBits = TRUE; - - HBufferImage.BufferPosition.Row = 1; - HBufferImage.BufferPosition.Column = 1; - - if (!Recover) { - Str = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines); - if (Str == NULL) { - StatusBarSetStatusString (L"Read Memory Failed"); - return EFI_OUT_OF_RESOURCES; - } - - StatusBarSetStatusString (Str); - SHELL_FREE_NON_NULL (Str); - - HMainEditor.SelectStart = 0; - HMainEditor.SelectEnd = 0; - - } - - // - // has line - // - if (HBufferImage.Lines != NULL) { - HBufferImage.CurrentLine = CR (HBufferImage.ListHead->ForwardLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - } else { - // - // create a dummy line - // - Line = HBufferImageCreateLine (); - if (Line == NULL) { - StatusBarSetStatusString (L"Read Memory Failed"); - return EFI_OUT_OF_RESOURCES; - } - - HBufferImage.CurrentLine = Line; - } - - HBufferImage.Modified = FALSE; - HBufferImageNeedRefresh = TRUE; - HBufferImageOnlyLineNeedRefresh = FALSE; - HBufferImageMouseNeedRefresh = TRUE; - - return EFI_SUCCESS; - -} - -/** - Save lines in HBufferImage to disk. - - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageSave ( - IN UINTN Offset, - IN UINTN Size - ) -{ - - EFI_STATUS Status; - VOID *Buffer; - - // - // not modified, so directly return - // - if (HBufferImage.Modified == FALSE) { - return EFI_SUCCESS; - } - - HBufferImage.BufferType = FileTypeMemBuffer; - - Buffer = AllocateZeroPool (Size); - - if (Buffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status = HBufferImageListToBuffer (Buffer, Size); - if (EFI_ERROR (Status)) { - FreePool (Buffer); - return Status; - } - // - // write back to memory - // - Status = HMemImage.IoFncs->Mem.Write ( - HMemImage.IoFncs, - EfiCpuIoWidthUint8, - Offset, - Size, - Buffer - ); - - FreePool (Buffer); - - if (EFI_ERROR (Status)) { - return EFI_LOAD_ERROR; - } - // - // now not modified - // - HBufferImage.Modified = FALSE; - - return EFI_SUCCESS; -} - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h deleted file mode 100644 index 09d3eb4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h +++ /dev/null @@ -1,92 +0,0 @@ -/** @file - Defines MemImage - the view of the file that is visible at any point, - as well as the event handlers for editing the file - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_MEM_IMAGE_H_ -#define _LIB_MEM_IMAGE_H_ - -#include "HexEditor.h" - -/** - Initialization function for HDiskImage. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_LOAD_ERROR A load error occured. -**/ -EFI_STATUS -HMemImageInit ( - VOID - ); - -/** - Backup function for HDiskImage. Only a few fields need to be backup. - This is for making the Disk buffer refresh as few as possible. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HMemImageBackup ( - VOID - ); - -/** - Set FileName field in HFileImage. - - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageSetMemOffsetSize ( - IN UINTN Offset, - IN UINTN Size - ); - -/** - Read a disk from disk into HBufferImage. - - @param[in] Offset The offset. - @param[in] Size The size. - @param[in] Recover if is for recover, no information print. - - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageRead ( - IN UINTN Offset, - IN UINTN Size, - IN BOOLEAN Recover - ); - -/** - Save lines in HBufferImage to disk. - - @param[in] Offset The offset. - @param[in] Size The size. - - @retval EFI_LOAD_ERROR A load error occured. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -HMemImageSave ( - IN UINTN Offset, - IN UINTN Size - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c deleted file mode 100644 index e4c099c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c +++ /dev/null @@ -1,262 +0,0 @@ -/** @file - Implementation of various string and line routines - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "HexEditor.h" - -extern BOOLEAN HEditorMouseAction; - -/** - Free a line and it's internal buffer. - - @param[in] Src The line to be freed. -**/ -VOID -HLineFree ( - IN HEFI_EDITOR_LINE *Src - ) -{ - if (Src == NULL) { - return ; - } - - SHELL_FREE_NON_NULL (Src); - -} - -/** - Advance to the next Count lines. - - @param[in] Count The line number to advance. - - @retval NULL An error occured. - @return A pointer to the line after advance. -**/ -HEFI_EDITOR_LINE * -HLineAdvance ( - IN UINTN Count - ) -{ - UINTN Index; - HEFI_EDITOR_LINE *Line; - - Line = HMainEditor.BufferImage->CurrentLine; - if (Line == NULL) { - return NULL; - } - - for (Index = 0; Index < Count; Index++) { - // - // if already last line - // - if (Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead) { - return NULL; - } - - Line = CR (Line->Link.ForwardLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - } - - return Line; -} - -/** - Retreat to the previous Count lines. - - @param[in] Count The line number to retreat. - - @retval NULL An error occured. - @return A pointer to the line after retreat. -**/ -HEFI_EDITOR_LINE * -HLineRetreat ( - IN UINTN Count - ) -{ - UINTN Index; - HEFI_EDITOR_LINE *Line; - - Line = HMainEditor.BufferImage->CurrentLine; - if (Line == NULL) { - return NULL; - } - - for (Index = 0; Index < Count; Index++) { - // - // already the first line - // - if (Line->Link.BackLink == HMainEditor.BufferImage->ListHead) { - return NULL; - } - - Line = CR (Line->Link.BackLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - } - - return Line; -} - -/** - Advance/Retreat lines. - - @param[in] Count The line number to advance/retreat. - >0 : advance - <0: retreat - - @retval NULL An error occured. - @return A pointer to the line after move. -**/ -HEFI_EDITOR_LINE * -HMoveLine ( - IN INTN Count - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN AbsCount; - - // - // difference with MoveCurrentLine - // just return Line - // do not set currentline to Line - // - if (Count <= 0) { - AbsCount = (UINTN)ABS(Count); - Line = HLineRetreat (AbsCount); - } else { - Line = HLineAdvance ((UINTN)Count); - } - - return Line; -} - -/** - Advance/Retreat lines and set CurrentLine in BufferImage to it. - - @param[in] Count The line number to advance/retreat. - >0 : advance - <0: retreat - - @retval NULL An error occured. - @return A pointer to the line after move. -**/ -HEFI_EDITOR_LINE * -HMoveCurrentLine ( - IN INTN Count - ) -{ - HEFI_EDITOR_LINE *Line; - UINTN AbsCount; - - // - // <0: retreat - // >0: advance - // - if (Count <= 0) { - AbsCount = (UINTN)ABS(Count); - Line = HLineRetreat (AbsCount); - } else { - Line = HLineAdvance ((UINTN)Count); - } - - if (Line == NULL) { - return NULL; - } - - HMainEditor.BufferImage->CurrentLine = Line; - - return Line; -} - - -/** - Free all the lines in HBufferImage. - Fields affected: - Lines - CurrentLine - NumLines - ListHead - - @param[in] ListHead The list head. - @param[in] Lines The lines. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFreeLines ( - IN LIST_ENTRY *ListHead, - IN HEFI_EDITOR_LINE *Lines - ) -{ - LIST_ENTRY *Link; - HEFI_EDITOR_LINE *Line; - - // - // release all the lines - // - if (Lines != NULL) { - - Line = Lines; - Link = &(Line->Link); - do { - Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST); - Link = Link->ForwardLink; - HLineFree (Line); - } while (Link != ListHead); - } - - ListHead->ForwardLink = ListHead; - ListHead->BackLink = ListHead; - - return EFI_SUCCESS; -} - -/** - Get the X information for the mouse. - - @param[in] GuidX The change. - - @return the new information. -**/ -INT32 -HGetTextX ( - IN INT32 GuidX - ) -{ - INT32 Gap; - - HMainEditor.MouseAccumulatorX += GuidX; - Gap = (HMainEditor.MouseAccumulatorX * (INT32) HMainEditor.ScreenSize.Column) / (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionX); - HMainEditor.MouseAccumulatorX = (HMainEditor.MouseAccumulatorX * (INT32) HMainEditor.ScreenSize.Column) % (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionX); - HMainEditor.MouseAccumulatorX = HMainEditor.MouseAccumulatorX / (INT32) HMainEditor.ScreenSize.Column; - return Gap; -} - -/** - Get the Y information for the mouse. - - @param[in] GuidY The change. - - @return the new information. -**/ -INT32 -HGetTextY ( - IN INT32 GuidY - ) -{ - INT32 Gap; - - HMainEditor.MouseAccumulatorY += GuidY; - Gap = (HMainEditor.MouseAccumulatorY * (INT32) HMainEditor.ScreenSize.Row) / (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionY); - HMainEditor.MouseAccumulatorY = (HMainEditor.MouseAccumulatorY * (INT32) HMainEditor.ScreenSize.Row) % (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionY); - HMainEditor.MouseAccumulatorY = HMainEditor.MouseAccumulatorY / (INT32) HMainEditor.ScreenSize.Row; - - return Gap; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h deleted file mode 100644 index 738d9e5..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h +++ /dev/null @@ -1,93 +0,0 @@ -/** @file - Definitions for various line and string routines - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_MISC_H_ -#define _LIB_MISC_H_ - -#include "HexEditor.h" - -/** - Advance/Retreat lines. - - @param[in] Count The line number to advance/retreat. - >0 : advance - <0: retreat - - @retval NULL An error occured. - @return A pointer to the line after move. -**/ -HEFI_EDITOR_LINE * -HMoveLine ( - IN INTN Count - ); - -/** - Advance/Retreat lines and set CurrentLine in BufferImage to it. - - @param[in] Count The line number to advance/retreat. - >0 : advance - <0: retreat - - @retval NULL An error occured. - @return A pointer to the line after move. -**/ -HEFI_EDITOR_LINE * -HMoveCurrentLine ( - IN INTN Count - ); - -/** - Free all the lines in HBufferImage. - Fields affected: - Lines - CurrentLine - NumLines - ListHead - - @param[in] ListHead The list head. - @param[in] Lines The lines. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -HFreeLines ( - IN LIST_ENTRY *ListHead, - IN HEFI_EDITOR_LINE *Lines - ); - -/** - Get the X information for the mouse. - - @param[in] GuidX The change. - - @return the new information. -**/ -INT32 -HGetTextX ( - IN INT32 GuidX - ); - -/** - Get the Y information for the mouse. - - @param[in] GuidY The change. - - @return the new information. -**/ -INT32 -HGetTextY ( - IN INT32 GuidY - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c deleted file mode 100644 index bd7677e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c +++ /dev/null @@ -1,409 +0,0 @@ -/** @file - Main file for LoadPciRom shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include -#include -#include -#include - -/** - Connects all available drives and controllers. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The abort mechanism was received. -**/ -EFI_STATUS -LoadPciRomConnectAllDriversToAllControllers ( - VOID - ); - -/** - Command entry point. - - @param[in] RomBar The Rom Base address. - @param[in] RomSize The Rom size. - @param[in] FileName The file name. - - @retval EFI_SUCCESS The command completed successfully. - @retval EFI_INVALID_PARAMETER Command usage error. - @retval EFI_UNSUPPORTED Protocols unsupported. - @retval EFI_OUT_OF_RESOURCES Out of memory. - @retval Other value Unknown error. -**/ -EFI_STATUS -LoadEfiDriversFromRomImage ( - VOID *RomBar, - UINTN RomSize, - CONST CHAR16 *FileName - ); - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-nc", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'loadpcirom' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLoadPciRom ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_SHELL_FILE_INFO *FileList; - UINTN SourceSize; - UINT8 *File1Buffer; - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - BOOLEAN Connect; - CONST CHAR16 *Param; - UINTN ParamCount; - EFI_SHELL_FILE_INFO *Node; - // - // Local variable initializations - // - File1Buffer = NULL; - ShellStatus = SHELL_SUCCESS; - FileList = NULL; - - - // - // verify number of arguments - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"loadpcirom", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"loadpcirom"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetFlag(Package, L"-nc")) { - Connect = FALSE; - } else { - Connect = TRUE; - } - - // - // get a list with each file specified by parameters - // if parameter is a directory then add all the files below it to the list - // - for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ; Param != NULL - ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ){ - Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Param); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - } - if (ShellStatus == SHELL_SUCCESS && FileList != NULL) { - // - // loop through the list and make sure we are not aborting... - // - for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag() - ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link) - ){ - if (EFI_ERROR(Node->Status)){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName); - ShellStatus = SHELL_INVALID_PARAMETER; - continue; - } - if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName); - ShellStatus = SHELL_INVALID_PARAMETER; - continue; - } - SourceSize = (UINTN) Node->Info->FileSize; - File1Buffer = AllocateZeroPool (SourceSize); - if (File1Buffer == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"loadpcirom"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - continue; - } - Status = gEfiShellProtocol->ReadFile(Node->Handle, &SourceSize, File1Buffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = LoadEfiDriversFromRomImage ( - File1Buffer, - SourceSize, - Node->FullName - ); - - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status); - } - FreePool(File1Buffer); - } - } else if (ShellStatus == SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, "loadpcirom"); - ShellStatus = SHELL_NOT_FOUND; - } - if (FileList != NULL && !IsListEmpty(&FileList->Link)) { - Status = ShellCloseFileMetaArg(&FileList); - } - FileList = NULL; - - if (Connect) { - Status = LoadPciRomConnectAllDriversToAllControllers (); - } - } - } - - return (ShellStatus); -} - -/** - Command entry point. - - @param[in] RomBar The Rom Base address. - @param[in] RomSize The Rom size. - @param[in] FileName The file name. - - @retval EFI_SUCCESS The command completed successfully. - @retval EFI_INVALID_PARAMETER Command usage error. - @retval EFI_UNSUPPORTED Protocols unsupported. - @retval EFI_OUT_OF_RESOURCES Out of memory. - @retval Other value Unknown error. -**/ -EFI_STATUS -LoadEfiDriversFromRomImage ( - VOID *RomBar, - UINTN RomSize, - CONST CHAR16 *FileName - ) - -{ - EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader; - PCI_DATA_STRUCTURE *Pcir; - UINTN ImageIndex; - UINTN RomBarOffset; - UINT32 ImageSize; - UINT16 ImageOffset; - EFI_HANDLE ImageHandle; - EFI_STATUS Status; - EFI_STATUS ReturnStatus; - CHAR16 RomFileName[280]; - EFI_DEVICE_PATH_PROTOCOL *FilePath; - BOOLEAN SkipImage; - UINT32 DestinationSize; - UINT32 ScratchSize; - UINT8 *Scratch; - VOID *ImageBuffer; - VOID *DecompressedImageBuffer; - UINT32 ImageLength; - EFI_DECOMPRESS_PROTOCOL *Decompress; - UINT32 InitializationSize; - - ImageIndex = 0; - ReturnStatus = EFI_NOT_FOUND; - RomBarOffset = (UINTN) RomBar; - - do { - - EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (UINTN) RomBarOffset; - - if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_CORRUPT), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex); -// PrintToken (STRING_TOKEN (STR_LOADPCIROM_IMAGE_CORRUPT), HiiHandle, ImageIndex); - return ReturnStatus; - } - - // - // If the pointer to the PCI Data Structure is invalid, no further images can be located. - // The PCI Data Structure must be DWORD aligned. - // - if (EfiRomHeader->PcirOffset == 0 || - (EfiRomHeader->PcirOffset & 3) != 0 || - RomBarOffset - (UINTN)RomBar + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize) { - break; - } - - Pcir = (PCI_DATA_STRUCTURE *) (UINTN) (RomBarOffset + EfiRomHeader->PcirOffset); - // - // If a valid signature is not present in the PCI Data Structure, no further images can be located. - // - if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) { - break; - } - ImageSize = Pcir->ImageLength * 512; - if (RomBarOffset - (UINTN)RomBar + ImageSize > RomSize) { - break; - } - - if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) && - (EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) && - ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) || - (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER))) { - - ImageOffset = EfiRomHeader->EfiImageHeaderOffset; - InitializationSize = EfiRomHeader->InitializationSize * 512; - - if (InitializationSize <= ImageSize && ImageOffset < InitializationSize) { - - ImageBuffer = (VOID *) (UINTN) (RomBarOffset + ImageOffset); - ImageLength = InitializationSize - ImageOffset; - DecompressedImageBuffer = NULL; - - // - // decompress here if needed - // - SkipImage = FALSE; - if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) { - SkipImage = TRUE; - } - - if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) { - Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID**)&Decompress); - ASSERT_EFI_ERROR(Status); - if (EFI_ERROR (Status)) { - SkipImage = TRUE; - } else { - SkipImage = TRUE; - Status = Decompress->GetInfo ( - Decompress, - ImageBuffer, - ImageLength, - &DestinationSize, - &ScratchSize - ); - if (!EFI_ERROR (Status)) { - DecompressedImageBuffer = AllocateZeroPool (DestinationSize); - if (ImageBuffer != NULL) { - Scratch = AllocateZeroPool (ScratchSize); - if (Scratch != NULL) { - Status = Decompress->Decompress ( - Decompress, - ImageBuffer, - ImageLength, - DecompressedImageBuffer, - DestinationSize, - Scratch, - ScratchSize - ); - if (!EFI_ERROR (Status)) { - ImageBuffer = DecompressedImageBuffer; - ImageLength = DestinationSize; - SkipImage = FALSE; - } - - FreePool (Scratch); - } - } - } - } - } - - if (!SkipImage) { - // - // load image and start image - // - UnicodeSPrint (RomFileName, sizeof (RomFileName), L"%s[%d]", FileName, ImageIndex); - FilePath = FileDevicePath (NULL, RomFileName); - - Status = gBS->LoadImage ( - TRUE, - gImageHandle, - FilePath, - ImageBuffer, - ImageLength, - &ImageHandle - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex); -// PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status); - } else { - Status = gBS->StartImage (ImageHandle, NULL, NULL); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_START_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex); -// PrintToken (STRING_TOKEN (STR_LOADPCIROM_START_IMAGE), HiiHandle, ImageIndex, Status); - } else { - ReturnStatus = Status; - } - } - } - - if (DecompressedImageBuffer != NULL) { - FreePool (DecompressedImageBuffer); - } - - } - } - - RomBarOffset = RomBarOffset + ImageSize; - ImageIndex++; - } while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (UINTN) RomBar) < RomSize)); - - return ReturnStatus; -} - -/** - Connects all available drives and controllers. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_ABORTED The abort mechanism was received. -**/ -EFI_STATUS -LoadPciRomConnectAllDriversToAllControllers ( - VOID - ) -{ - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN Index; - - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - for (Index = 0; Index < HandleCount; Index++) { - if (ShellGetExecutionBreakFlag ()) { - Status = EFI_ABORTED; - break; - } - gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - return Status; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c deleted file mode 100644 index d8e849a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c +++ /dev/null @@ -1,410 +0,0 @@ -/** @file - Main file for Mode shell Debug1 function. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which acModeanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -// -// Need full names for Standard-Format Output -// -STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved"; -STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode"; -STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData"; -STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode"; -STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData"; -STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode"; -STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData"; -STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available"; -STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent"; -STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory"; -STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory"; -STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS"; -STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO"; -STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace"; -STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode"; - -// -// Need short names for some memory types -// -STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code"; -STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data"; -STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code"; -STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data"; -STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable"; -STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl"; -STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS"; -STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO"; -STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port"; - -#include "UefiShellDebug1CommandsLib.h" - -typedef struct { - UINT32 Type; - UINT64 NumberOfPages; - LIST_ENTRY Link; -} MEMORY_LENGTH_ENTRY; - -/** - Add the length of the specified type to List. - - @param List A list to hold all pairs of . - @param Type Memory type. - @param NumberOfPages Number of pages. -**/ -VOID -AddMemoryLength ( - LIST_ENTRY *List, - UINT32 Type, - UINT64 NumberOfPages - ) -{ - MEMORY_LENGTH_ENTRY *Entry; - MEMORY_LENGTH_ENTRY *NewEntry; - LIST_ENTRY *Link; - - Entry = NULL; - for (Link = GetFirstNode (List); !IsNull (List, Link); Link = GetNextNode (List, Link)) { - Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link); - if (Entry->Type >= Type) { - break; - } - } - - if ((Entry != NULL) && (Entry->Type == Type)) { - // - // The Entry is the one we look for. - // - NewEntry = Entry; - } else { - // - // The search operation breaks due to: - // 1. Type of every entry < Type --> Insert to tail - // 2. Type of an entry > Type --> Insert to previous of this entry - // - NewEntry = AllocatePool (sizeof (*NewEntry)); - if (NewEntry == NULL) { - return; - } - NewEntry->Type = Type; - NewEntry->NumberOfPages = 0; - InsertTailList (Link, &NewEntry->Link); - } - - NewEntry->NumberOfPages += NumberOfPages; -} - -/** - Function for 'memmap' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMemMap ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN Size; - EFI_MEMORY_DESCRIPTOR *Descriptors; - UINTN MapKey; - UINTN ItemSize; - UINT32 Version; - EFI_MEMORY_DESCRIPTOR *Walker; - UINT64 ReservedPages; - UINT64 LoadCodePages; - UINT64 LoadDataPages; - UINT64 BSCodePages; - UINT64 BSDataPages; - UINT64 RTDataPages; - UINT64 RTCodePages; - UINT64 AvailPages; - UINT64 TotalPages; - UINT64 ReservedPagesSize; - UINT64 LoadCodePagesSize; - UINT64 LoadDataPagesSize; - UINT64 BSCodePagesSize; - UINT64 BSDataPagesSize; - UINT64 RTDataPagesSize; - UINT64 RTCodePagesSize; - UINT64 AvailPagesSize; - UINT64 TotalPagesSize; - UINT64 AcpiReclaimPages; - UINT64 AcpiNvsPages; - UINT64 MmioSpacePages; - UINT64 AcpiReclaimPagesSize; - UINT64 AcpiNvsPagesSize; - UINT64 MmioSpacePagesSize; - UINT64 MmioPortPages; - UINT64 MmioPortPagesSize; - UINT64 UnusableMemoryPages; - UINT64 UnusableMemoryPagesSize; - UINT64 PalCodePages; - UINT64 PalCodePagesSize; - UINT64 PersistentPages; - UINT64 PersistentPagesSize; - BOOLEAN Sfo; - LIST_ENTRY MemoryList; - MEMORY_LENGTH_ENTRY *Entry; - LIST_ENTRY *Link; - - AcpiReclaimPages = 0; - AcpiNvsPages = 0; - MmioSpacePages = 0; - TotalPages = 0; - ReservedPages = 0; - LoadCodePages = 0; - LoadDataPages = 0; - BSCodePages = 0; - BSDataPages = 0; - RTDataPages = 0; - RTCodePages = 0; - AvailPages = 0; - MmioPortPages = 0; - UnusableMemoryPages = 0; - PalCodePages = 0; - PersistentPages = 0; - Size = 0; - Descriptors = NULL; - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - InitializeListHead (&MemoryList); - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version); - if (Status == EFI_BUFFER_TOO_SMALL){ - Size += SIZE_1KB; - Descriptors = AllocateZeroPool(Size); - Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version); - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap"); - ShellStatus = SHELL_ACCESS_DENIED; - } else { - ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION); - - Sfo = ShellCommandLineGetFlag(Package, L"-sfo"); - if (!Sfo) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"memmap"); - } - - for ( Walker = Descriptors - ; (Walker < (EFI_MEMORY_DESCRIPTOR *) ((UINT8*)Descriptors + Size)) && (Walker != NULL) - ; Walker = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *)Walker + ItemSize) - ){ - switch (Walker->Type) { - case EfiReservedMemoryType: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - ReservedPages += Walker->NumberOfPages; - break; - case EfiLoaderCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - LoadCodePages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiLoaderData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - LoadDataPages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiBootServicesCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - BSCodePages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiBootServicesData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - BSDataPages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiRuntimeServicesCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - RTCodePages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiRuntimeServicesData: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - RTDataPages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiConventionalMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiConventionalMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - AvailPages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiPersistentMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - PersistentPages += Walker->NumberOfPages; - TotalPages += Walker->NumberOfPages; - break; - case EfiUnusableMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - UnusableMemoryPages += Walker->NumberOfPages; - break; - case EfiACPIReclaimMemory: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - TotalPages += Walker->NumberOfPages; - AcpiReclaimPages += Walker->NumberOfPages; - break; - case EfiACPIMemoryNVS: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - TotalPages += Walker->NumberOfPages; - AcpiNvsPages += Walker->NumberOfPages; - break; - case EfiMemoryMappedIO: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - MmioSpacePages += Walker->NumberOfPages; - break; - case EfiMemoryMappedIOPortSpace: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMappedIOPortSpace, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - MmioPortPages += Walker->NumberOfPages; - break; - case EfiPalCode: - ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute); - TotalPages += Walker->NumberOfPages; - PalCodePages += Walker->NumberOfPages; - break; - default: - // - // Shell Spec defines the SFO format. - // Do not print the OEM/OS memory usage in the SFO format, to avoid conflict with Shell Spec. - // - if (!Sfo) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_ITEM_OTHER), gShellDebug1HiiHandle, Walker->Type, Walker->PhysicalStart, Walker->PhysicalStart + MultU64x64 (SIZE_4KB, Walker->NumberOfPages) - 1, Walker->NumberOfPages, Walker->Attribute); - } - TotalPages += Walker->NumberOfPages; - AddMemoryLength (&MemoryList, Walker->Type, Walker->NumberOfPages); - break; - } - } - // - // print the summary - // - ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages); - LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages); - LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages); - BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages); - BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages); - RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages); - RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages); - AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages); - TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages); - AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages); - AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages); - MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages); - MmioPortPagesSize = MultU64x64(SIZE_4KB,MmioPortPages); - PalCodePagesSize = MultU64x64(SIZE_4KB,PalCodePages); - PersistentPagesSize = MultU64x64(SIZE_4KB,PersistentPages); - UnusableMemoryPagesSize = MultU64x64(SIZE_4KB,UnusableMemoryPages); - if (!Sfo) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle, - ReservedPages, ReservedPagesSize, - LoadCodePages, LoadCodePagesSize, - LoadDataPages, LoadDataPagesSize, - BSCodePages, BSCodePagesSize, - BSDataPages, BSDataPagesSize, - RTCodePages, RTCodePagesSize, - RTDataPages, RTDataPagesSize, - AcpiReclaimPages, AcpiReclaimPagesSize, - AcpiNvsPages, AcpiNvsPagesSize, - MmioSpacePages, MmioSpacePagesSize, - MmioPortPages, MmioPortPagesSize, - PalCodePages, PalCodePagesSize, - AvailPages, AvailPagesSize, - PersistentPages, PersistentPagesSize - ); - - // - // Print out the total memory usage for OEM/OS types in the order of type. - // - for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); Link = GetNextNode (&MemoryList, Link)) { - Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER), gShellDebug1HiiHandle, - Entry->Type, Entry->NumberOfPages, MultU64x64 (SIZE_4KB, Entry->NumberOfPages) - ); - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM2), gShellDebug1HiiHandle, - DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize - ); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle, - TotalPagesSize, - ReservedPagesSize, - BSCodePagesSize, - BSDataPagesSize, - RTCodePagesSize, - RTDataPagesSize, - LoadCodePagesSize, - LoadDataPagesSize, - AvailPagesSize, - MmioSpacePagesSize, - MmioPortPagesSize, - UnusableMemoryPagesSize, - AcpiReclaimPagesSize, - AcpiNvsPagesSize, - PalCodePagesSize, - PersistentPagesSize - ); - } - } - } - ShellCommandLineFreeVarList (Package); - } - - if (Descriptors != NULL) { - FreePool(Descriptors); - } - - // - // Free the memory list. - // - for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); ) { - Link = RemoveEntryList (Link); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c deleted file mode 100644 index b1d5f05..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c +++ /dev/null @@ -1,637 +0,0 @@ -/** @file - Main file for Mm shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include -#include -#include -#include - -typedef enum { - ShellMmMemory, - ShellMmMemoryMappedIo, - ShellMmIo, - ShellMmPci, - ShellMmPciExpress -} SHELL_MM_ACCESS_TYPE; - -CONST UINT16 mShellMmAccessTypeStr[] = { - STRING_TOKEN (STR_MM_MEM), - STRING_TOKEN (STR_MM_MMIO), - STRING_TOKEN (STR_MM_IO), - STRING_TOKEN (STR_MM_PCI), - STRING_TOKEN (STR_MM_PCIE) -}; - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-mmio", TypeFlag}, - {L"-mem", TypeFlag}, - {L"-io", TypeFlag}, - {L"-pci", TypeFlag}, - {L"-pcie", TypeFlag}, - {L"-n", TypeFlag}, - {L"-w", TypeValue}, - {NULL, TypeMax} - }; - -CONST UINT64 mShellMmMaxNumber[] = { - 0, MAX_UINT8, MAX_UINT16, 0, MAX_UINT32, 0, 0, 0, MAX_UINT64 -}; -CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth[] = { - 0, EfiPciWidthUint8, EfiPciWidthUint16, 0, EfiPciWidthUint32, 0, 0, 0, EfiPciWidthUint64 -}; -CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[] = { - 0, EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, 0, EfiCpuIoWidthUint32, 0, 0, 0, EfiCpuIoWidthUint64 -}; - -/** - Extract the PCI segment, bus, device, function, register from - from a PCI or PCIE format of address.. - - @param[in] PciFormat Whether the address is of PCI format of PCIE format. - @param[in] Address PCI or PCIE address. - @param[out] Segment PCI segment number. - @param[out] Bus PCI bus number. - @param[out] Device PCI device number. - @param[out] Function PCI function number. - @param[out] Register PCI register offset. -**/ -VOID -ShellMmDecodePciAddress ( - IN BOOLEAN PciFormat, - IN UINT64 Address, - OUT UINT32 *Segment, - OUT UINT8 *Bus, - OUT UINT8 *Device, OPTIONAL - OUT UINT8 *Function, OPTIONAL - OUT UINT32 *Register OPTIONAL - ) -{ - if (PciFormat) { - // - // PCI Configuration Space.The address will have the format ssssbbddffrr, - // where ssss = Segment, bb = Bus, dd = Device, ff = Function and rr = Register. - // - *Segment = (UINT32) (RShiftU64 (Address, 32) & 0xFFFF); - *Bus = (UINT8) (((UINT32) Address) >> 24); - - if (Device != NULL) { - *Device = (UINT8) (((UINT32) Address) >> 16); - } - if (Function != NULL) { - *Function = (UINT8) (((UINT32) Address) >> 8); - } - if (Register != NULL) { - *Register = (UINT8) Address; - } - } else { - // - // PCI Express Configuration Space.The address will have the format ssssssbbddffrrr, - // where ssss = Segment, bb = Bus, dd = Device, ff = Function and rrr = Register. - // - *Segment = (UINT32) (RShiftU64 (Address, 36) & 0xFFFF); - *Bus = (UINT8) RShiftU64 (Address, 28); - if (Device != NULL) { - *Device = (UINT8) (((UINT32) Address) >> 20); - } - if (Function != NULL) { - *Function = (UINT8) (((UINT32) Address) >> 12); - } - if (Register != NULL) { - *Register = (UINT32) (Address & 0xFFF); - } - } -} - -/** - Read or write some data from or into the Address. - - @param[in] AccessType Access type. - @param[in] PciRootBridgeIo PciRootBridgeIo instance. - @param[in] CpuIo CpuIo instance. - @param[in] Read TRUE for read, FALSE for write. - @param[in] Addresss The memory location to access. - @param[in] Size The size of Buffer in Width sized units. - @param[in, out] Buffer The buffer to read into or write from. -**/ -VOID -ShellMmAccess ( - IN SHELL_MM_ACCESS_TYPE AccessType, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, - IN EFI_CPU_IO2_PROTOCOL *CpuIo, - IN BOOLEAN Read, - IN UINT64 Address, - IN UINTN Size, - IN OUT VOID *Buffer - ) -{ - EFI_STATUS Status; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM RootBridgeIoMem; - EFI_CPU_IO_PROTOCOL_IO_MEM CpuIoMem; - UINT32 Segment; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT32 Register; - - if (AccessType == ShellMmMemory) { - if (Read) { - CopyMem (Buffer, (VOID *) (UINTN) Address, Size); - } else { - CopyMem ((VOID *) (UINTN) Address, Buffer, Size); - } - } else { - RootBridgeIoMem = NULL; - CpuIoMem = NULL; - switch (AccessType) { - case ShellMmPci: - case ShellMmPciExpress: - ASSERT (PciRootBridgeIo != NULL); - ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register); - if (Read) { - Status = PciRootBridgeIo->Pci.Read ( - PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], - EFI_PCI_ADDRESS (Bus, Device, Function, Register), - 1, Buffer - ); - } else { - Status = PciRootBridgeIo->Pci.Write ( - PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], - EFI_PCI_ADDRESS (Bus, Device, Function, Register), - 1, Buffer - ); - } - ASSERT_EFI_ERROR (Status); - return; - - case ShellMmMemoryMappedIo: - if (PciRootBridgeIo != NULL) { - RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write; - } - if (CpuIo != NULL) { - CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write; - } - break; - - case ShellMmIo: - if (PciRootBridgeIo != NULL) { - RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write; - } - if (CpuIo != NULL) { - CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write; - } - break; - default: - ASSERT (FALSE); - break; - } - - Status = EFI_UNSUPPORTED; - if (RootBridgeIoMem != NULL) { - Status = RootBridgeIoMem (PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], Address, 1, Buffer); - } - if (EFI_ERROR (Status) && (CpuIoMem != NULL)) { - Status = CpuIoMem (CpuIo, mShellMmCpuIoWidth[Size], Address, 1, Buffer); - } - - if (EFI_ERROR (Status)) { - if (AccessType == ShellMmIo) { - switch (Size) { - case 1: - if (Read) { - *(UINT8 *) Buffer = IoRead8 ((UINTN) Address); - } else { - IoWrite8 ((UINTN) Address, *(UINT8 *) Buffer); - } - break; - case 2: - if (Read) { - *(UINT16 *) Buffer = IoRead16 ((UINTN) Address); - } else { - IoWrite16 ((UINTN) Address, *(UINT16 *) Buffer); - } - break; - case 4: - if (Read) { - *(UINT32 *) Buffer = IoRead32 ((UINTN) Address); - } else { - IoWrite32 ((UINTN) Address, *(UINT32 *) Buffer); - } - break; - case 8: - if (Read) { - *(UINT64 *) Buffer = IoRead64 ((UINTN) Address); - } else { - IoWrite64 ((UINTN) Address, *(UINT64 *) Buffer); - } - break; - default: - ASSERT (FALSE); - break; - } - } else { - switch (Size) { - case 1: - if (Read) { - *(UINT8 *) Buffer = MmioRead8 ((UINTN) Address); - } else { - MmioWrite8 ((UINTN) Address, *(UINT8 *) Buffer); - } - break; - case 2: - if (Read) { - *(UINT16 *) Buffer = MmioRead16 ((UINTN) Address); - } else { - MmioWrite16 ((UINTN) Address, *(UINT16 *) Buffer); - } - break; - case 4: - if (Read) { - *(UINT32 *) Buffer = MmioRead32 ((UINTN) Address); - } else { - MmioWrite32 ((UINTN) Address, *(UINT32 *) Buffer); - } - break; - case 8: - if (Read) { - *(UINT64 *) Buffer = MmioRead64 ((UINTN) Address); - } else { - MmioWrite64 ((UINTN) Address, *(UINT64 *) Buffer); - } - break; - default: - ASSERT (FALSE); - break; - } - } - } - } -} - -/** - Find the CpuIo instance and PciRootBridgeIo instance in the platform. - If there are multiple PciRootBridgeIo instances, the instance which manages - the Address is returned. - - @param[in] AccessType Access type. - @param[in] Address Address to access. - @param[out] CpuIo Return the CpuIo instance. - @param[out] PciRootBridgeIo Return the proper PciRootBridgeIo instance. - - @retval TRUE There are PciRootBridgeIo instances in the platform. - @retval FALSE There isn't PciRootBridgeIo instance in the platform. -**/ -BOOLEAN -ShellMmLocateIoProtocol ( - IN SHELL_MM_ACCESS_TYPE AccessType, - IN UINT64 Address, - OUT EFI_CPU_IO2_PROTOCOL **CpuIo, - OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **PciRootBridgeIo - ) -{ - EFI_STATUS Status; - UINTN Index; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Io; - UINT32 Segment; - UINT8 Bus; - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; - - Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **) CpuIo); - if (EFI_ERROR (Status)) { - *CpuIo = NULL; - } - - *PciRootBridgeIo = NULL; - HandleBuffer = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciRootBridgeIoProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) { - return FALSE; - } - - Segment = 0; - Bus = 0; - if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) { - ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, &Segment, &Bus, NULL, NULL, NULL); - } - - // - // Find the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL of the specified segment & bus number - // - for (Index = 0; (Index < HandleCount) && (*PciRootBridgeIo == NULL); Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiPciRootBridgeIoProtocolGuid, - (VOID *) &Io - ); - if (EFI_ERROR (Status)) { - continue; - } - - if ((((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && (Io->SegmentNumber == Segment)) || - ((AccessType == ShellMmIo) || (AccessType == ShellMmMemoryMappedIo)) - ) { - Status = Io->Configuration (Io, (VOID **) &Descriptors); - if (!EFI_ERROR (Status)) { - while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) { - // - // Compare the segment and bus range for PCI/PCIE access - // - if ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) && - ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && - ((Bus >= Descriptors->AddrRangeMin) && (Bus <= Descriptors->AddrRangeMax)) - ) { - *PciRootBridgeIo = Io; - break; - - // - // Compare the address range for MMIO/IO access - // - } else if ((((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) && (AccessType == ShellMmIo)) || - ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && (AccessType == ShellMmMemoryMappedIo)) - ) && ((Address >= Descriptors->AddrRangeMin) && (Address <= Descriptors->AddrRangeMax)) - ) { - *PciRootBridgeIo = Io; - break; - } - Descriptors++; - } - } - } - } - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return TRUE; -} - -/** - Function for 'mm' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMm ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; - EFI_CPU_IO2_PROTOCOL *CpuIo; - UINT64 Address; - UINT64 Value; - SHELL_MM_ACCESS_TYPE AccessType; - UINT64 Buffer; - UINTN Index; - UINTN Size; - BOOLEAN Complete; - CHAR16 *InputStr; - BOOLEAN Interactive; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Temp; - BOOLEAN HasPciRootBridgeIo; - - Value = 0; - Address = 0; - ShellStatus = SHELL_SUCCESS; - InputStr = NULL; - Size = 1; - AccessType = ShellMmMemory; - - // - // Parse arguments - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR (Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", ProblemParam); - FreePool (ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } else { - ASSERT (FALSE); - } - } else { - if (ShellCommandLineGetCount (Package) < 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } else if (ShellCommandLineGetCount (Package) > 3) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } else if (ShellCommandLineGetFlag (Package, L"-w") && ShellCommandLineGetValue (Package, L"-w") == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"mm", L"-w"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } else { - if (ShellCommandLineGetFlag (Package, L"-mmio")) { - AccessType = ShellMmMemoryMappedIo; - if (ShellCommandLineGetFlag (Package, L"-mem") - || ShellCommandLineGetFlag (Package, L"-io") - || ShellCommandLineGetFlag (Package, L"-pci") - || ShellCommandLineGetFlag (Package, L"-pcie") - ) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } else if (ShellCommandLineGetFlag (Package, L"-mem")) { - AccessType = ShellMmMemory; - if (ShellCommandLineGetFlag (Package, L"-io") - || ShellCommandLineGetFlag (Package, L"-pci") - || ShellCommandLineGetFlag (Package, L"-pcie") - ) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } else if (ShellCommandLineGetFlag (Package, L"-io")) { - AccessType = ShellMmIo; - if (ShellCommandLineGetFlag (Package, L"-pci") - || ShellCommandLineGetFlag (Package, L"-pcie") - ) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } else if (ShellCommandLineGetFlag (Package, L"-pci")) { - AccessType = ShellMmPci; - if (ShellCommandLineGetFlag (Package, L"-pcie") - ) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } else if (ShellCommandLineGetFlag (Package, L"-pcie")) { - AccessType = ShellMmPciExpress; - } - } - - // - // Non interactive for a script file or for the specific parameter - // - Interactive = TRUE; - if (gEfiShellProtocol->BatchIsActive () || ShellCommandLineGetFlag (Package, L"-n")) { - Interactive = FALSE; - } - - Temp = ShellCommandLineGetValue (Package, L"-w"); - if (Temp != NULL) { - Size = ShellStrToUintn (Temp); - } - if ((Size != 1) && (Size != 2) && (Size != 4) && (Size != 8)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"mm", Temp, L"-w"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - Temp = ShellCommandLineGetRawValue (Package, 1); - Status = ShellConvertStringToUint64 (Temp, &Address, TRUE, FALSE); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if ((Address & (Size - 1)) != 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_NOT_ALIGNED), gShellDebug1HiiHandle, L"mm", Address); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - // - // locate IO protocol interface - // - HasPciRootBridgeIo = ShellMmLocateIoProtocol (AccessType, Address, &CpuIo, &PciRootBridgeIo); - if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) { - if (!HasPciRootBridgeIo) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"mm"); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - if (PciRootBridgeIo == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm", Address); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - // - // Mode 1: Directly set a value - // - Temp = ShellCommandLineGetRawValue (Package, 2); - if (Temp != NULL) { - Status = ShellConvertStringToUint64 (Temp, &Value, TRUE, FALSE); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if (Value > mShellMmMaxNumber[Size]) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Value); - goto Done; - } - - // - // Mode 2: Directly show a value - // - if (!Interactive) { - if (!gEfiShellProtocol->BatchIsActive ()) { - ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle); - } - ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer); - - if (!gEfiShellProtocol->BatchIsActive ()) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]); - ShellPrintEx (-1, -1, L"\r\n"); - goto Done; - } - - // - // Mode 3: Show or set values in interactive mode - // - Complete = FALSE; - do { - ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer); - ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]); - ShellPrintEx (-1, -1, L" > "); - // - // wait user input to modify - // - if (InputStr != NULL) { - FreePool (InputStr); - InputStr = NULL; - } - ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID**) &InputStr); - - if (InputStr != NULL) { - // - // skip space characters - // - for (Index = 0; InputStr[Index] == ' '; Index++); - - if (InputStr[Index] != CHAR_NULL) { - if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) { - Complete = TRUE; - } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) && - (Buffer <= mShellMmMaxNumber[Size]) - ) { - ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm"); - continue; - } - } - } - - Address += Size; - ShellPrintEx (-1, -1, L"\r\n"); - } while (!Complete); - } - ASSERT (ShellStatus == SHELL_SUCCESS); - -Done: - if (InputStr != NULL) { - FreePool (InputStr); - } - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c deleted file mode 100644 index 03bc0fd..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c +++ /dev/null @@ -1,128 +0,0 @@ -/** @file - Main file for Mode shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which acModeanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" - -/** - Function for 'mode' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMode ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN NewCol; - UINTN NewRow; - UINTN Col; - UINTN Row; - CONST CHAR16 *Temp; - BOOLEAN Done; - INT32 LoopVar; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mode", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mode"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) == 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"mode"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) == 3) { - Temp = ShellCommandLineGetRawValue(Package, 1); - if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - } - NewCol = ShellStrToUintn(Temp); - Temp = ShellCommandLineGetRawValue(Package, 2); - if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - } - NewRow = ShellStrToUintn(Temp); - - for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) { - Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row); - if (EFI_ERROR(Status)) { - continue; - } - if (Col == NewCol && Row == NewRow) { - Status = gST->ConOut->SetMode(gST->ConOut, LoopVar); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, L"mode"); - ShellStatus = SHELL_DEVICE_ERROR; - } else { - // worked fine... - Done = TRUE; - } - break; - } - } - - if (!Done) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle, L"mode"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - - } else if (ShellCommandLineGetCount(Package) == 1) { - // - // print out valid - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_HEAD), gShellDebug1HiiHandle); - for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) { - Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row); - if (EFI_ERROR(Status)) { - continue; - } - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode?L'*':L' '); - } - } - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c deleted file mode 100644 index a553943..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c +++ /dev/null @@ -1,5803 +0,0 @@ -/** @file - Main file for Pci shell Debug1 function. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include -#include -#include -#include -#include "Pci.h" - -// -// Printable strings for Pci class code -// -typedef struct { - CHAR16 *BaseClass; // Pointer to the PCI base class string - CHAR16 *SubClass; // Pointer to the PCI sub class string - CHAR16 *PIFClass; // Pointer to the PCI programming interface string -} PCI_CLASS_STRINGS; - -// -// a structure holding a single entry, which also points to its lower level -// class -// -typedef struct PCI_CLASS_ENTRY_TAG { - UINT8 Code; // Class, subclass or I/F code - CHAR16 *DescText; // Description string - struct PCI_CLASS_ENTRY_TAG *LowerLevelClass; // Subclass or I/F if any -} PCI_CLASS_ENTRY; - -// -// Declarations of entries which contain printable strings for class codes -// in PCI configuration space -// -PCI_CLASS_ENTRY PCIBlankEntry[]; -PCI_CLASS_ENTRY PCISubClass_00[]; -PCI_CLASS_ENTRY PCISubClass_01[]; -PCI_CLASS_ENTRY PCISubClass_02[]; -PCI_CLASS_ENTRY PCISubClass_03[]; -PCI_CLASS_ENTRY PCISubClass_04[]; -PCI_CLASS_ENTRY PCISubClass_05[]; -PCI_CLASS_ENTRY PCISubClass_06[]; -PCI_CLASS_ENTRY PCISubClass_07[]; -PCI_CLASS_ENTRY PCISubClass_08[]; -PCI_CLASS_ENTRY PCISubClass_09[]; -PCI_CLASS_ENTRY PCISubClass_0a[]; -PCI_CLASS_ENTRY PCISubClass_0b[]; -PCI_CLASS_ENTRY PCISubClass_0c[]; -PCI_CLASS_ENTRY PCISubClass_0d[]; -PCI_CLASS_ENTRY PCISubClass_0e[]; -PCI_CLASS_ENTRY PCISubClass_0f[]; -PCI_CLASS_ENTRY PCISubClass_10[]; -PCI_CLASS_ENTRY PCISubClass_11[]; -PCI_CLASS_ENTRY PCISubClass_12[]; -PCI_CLASS_ENTRY PCISubClass_13[]; -PCI_CLASS_ENTRY PCIPIFClass_0100[]; -PCI_CLASS_ENTRY PCIPIFClass_0101[]; -PCI_CLASS_ENTRY PCIPIFClass_0105[]; -PCI_CLASS_ENTRY PCIPIFClass_0106[]; -PCI_CLASS_ENTRY PCIPIFClass_0107[]; -PCI_CLASS_ENTRY PCIPIFClass_0108[]; -PCI_CLASS_ENTRY PCIPIFClass_0109[]; -PCI_CLASS_ENTRY PCIPIFClass_0300[]; -PCI_CLASS_ENTRY PCIPIFClass_0604[]; -PCI_CLASS_ENTRY PCIPIFClass_0609[]; -PCI_CLASS_ENTRY PCIPIFClass_060b[]; -PCI_CLASS_ENTRY PCIPIFClass_0700[]; -PCI_CLASS_ENTRY PCIPIFClass_0701[]; -PCI_CLASS_ENTRY PCIPIFClass_0703[]; -PCI_CLASS_ENTRY PCIPIFClass_0800[]; -PCI_CLASS_ENTRY PCIPIFClass_0801[]; -PCI_CLASS_ENTRY PCIPIFClass_0802[]; -PCI_CLASS_ENTRY PCIPIFClass_0803[]; -PCI_CLASS_ENTRY PCIPIFClass_0904[]; -PCI_CLASS_ENTRY PCIPIFClass_0c00[]; -PCI_CLASS_ENTRY PCIPIFClass_0c03[]; -PCI_CLASS_ENTRY PCIPIFClass_0c07[]; -PCI_CLASS_ENTRY PCIPIFClass_0d01[]; -PCI_CLASS_ENTRY PCIPIFClass_0e00[]; - -// -// Base class strings entries -// -PCI_CLASS_ENTRY gClassStringList[] = { - { - 0x00, - L"Pre 2.0 device", - PCISubClass_00 - }, - { - 0x01, - L"Mass Storage Controller", - PCISubClass_01 - }, - { - 0x02, - L"Network Controller", - PCISubClass_02 - }, - { - 0x03, - L"Display Controller", - PCISubClass_03 - }, - { - 0x04, - L"Multimedia Device", - PCISubClass_04 - }, - { - 0x05, - L"Memory Controller", - PCISubClass_05 - }, - { - 0x06, - L"Bridge Device", - PCISubClass_06 - }, - { - 0x07, - L"Simple Communications Controllers", - PCISubClass_07 - }, - { - 0x08, - L"Base System Peripherals", - PCISubClass_08 - }, - { - 0x09, - L"Input Devices", - PCISubClass_09 - }, - { - 0x0a, - L"Docking Stations", - PCISubClass_0a - }, - { - 0x0b, - L"Processors", - PCISubClass_0b - }, - { - 0x0c, - L"Serial Bus Controllers", - PCISubClass_0c - }, - { - 0x0d, - L"Wireless Controllers", - PCISubClass_0d - }, - { - 0x0e, - L"Intelligent IO Controllers", - PCISubClass_0e - }, - { - 0x0f, - L"Satellite Communications Controllers", - PCISubClass_0f - }, - { - 0x10, - L"Encryption/Decryption Controllers", - PCISubClass_10 - }, - { - 0x11, - L"Data Acquisition & Signal Processing Controllers", - PCISubClass_11 - }, - { - 0x12, - L"Processing Accelerators", - PCISubClass_12 - }, - { - 0x13, - L"Non-Essential Instrumentation", - PCISubClass_13 - }, - { - 0xff, - L"Device does not fit in any defined classes", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -// -// Subclass strings entries -// -PCI_CLASS_ENTRY PCIBlankEntry[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_00[] = { - { - 0x00, - L"All devices other than VGA", - PCIBlankEntry - }, - { - 0x01, - L"VGA-compatible devices", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_01[] = { - { - 0x00, - L"SCSI", - PCIPIFClass_0100 - }, - { - 0x01, - L"IDE controller", - PCIPIFClass_0101 - }, - { - 0x02, - L"Floppy disk controller", - PCIBlankEntry - }, - { - 0x03, - L"IPI controller", - PCIBlankEntry - }, - { - 0x04, - L"RAID controller", - PCIBlankEntry - }, - { - 0x05, - L"ATA controller with ADMA interface", - PCIPIFClass_0105 - }, - { - 0x06, - L"Serial ATA controller", - PCIPIFClass_0106 - }, - { - 0x07, - L"Serial Attached SCSI (SAS) controller ", - PCIPIFClass_0107 - }, - { - 0x08, - L"Non-volatile memory subsystem", - PCIPIFClass_0108 - }, - { - 0x09, - L"Universal Flash Storage (UFS) controller ", - PCIPIFClass_0109 - }, - { - 0x80, - L"Other mass storage controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_02[] = { - { - 0x00, - L"Ethernet controller", - PCIBlankEntry - }, - { - 0x01, - L"Token ring controller", - PCIBlankEntry - }, - { - 0x02, - L"FDDI controller", - PCIBlankEntry - }, - { - 0x03, - L"ATM controller", - PCIBlankEntry - }, - { - 0x04, - L"ISDN controller", - PCIBlankEntry - }, - { - 0x05, - L"WorldFip controller", - PCIBlankEntry - }, - { - 0x06, - L"PICMG 2.14 Multi Computing", - PCIBlankEntry - }, - { - 0x07, - L"InfiniBand controller", - PCIBlankEntry - }, - { - 0x80, - L"Other network controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_03[] = { - { - 0x00, - L"VGA/8514 controller", - PCIPIFClass_0300 - }, - { - 0x01, - L"XGA controller", - PCIBlankEntry - }, - { - 0x02, - L"3D controller", - PCIBlankEntry - }, - { - 0x80, - L"Other display controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */PCIBlankEntry - } -}; - -PCI_CLASS_ENTRY PCISubClass_04[] = { - { - 0x00, - L"Video device", - PCIBlankEntry - }, - { - 0x01, - L"Audio device", - PCIBlankEntry - }, - { - 0x02, - L"Computer Telephony device", - PCIBlankEntry - }, - { - 0x03, - L"Mixed mode device", - PCIBlankEntry - }, - { - 0x80, - L"Other multimedia device", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_05[] = { - { - 0x00, - L"RAM memory controller", - PCIBlankEntry - }, - { - 0x01, - L"Flash memory controller", - PCIBlankEntry - }, - { - 0x80, - L"Other memory controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_06[] = { - { - 0x00, - L"Host/PCI bridge", - PCIBlankEntry - }, - { - 0x01, - L"PCI/ISA bridge", - PCIBlankEntry - }, - { - 0x02, - L"PCI/EISA bridge", - PCIBlankEntry - }, - { - 0x03, - L"PCI/Micro Channel bridge", - PCIBlankEntry - }, - { - 0x04, - L"PCI/PCI bridge", - PCIPIFClass_0604 - }, - { - 0x05, - L"PCI/PCMCIA bridge", - PCIBlankEntry - }, - { - 0x06, - L"NuBus bridge", - PCIBlankEntry - }, - { - 0x07, - L"CardBus bridge", - PCIBlankEntry - }, - { - 0x08, - L"RACEway bridge", - PCIBlankEntry - }, - { - 0x09, - L"Semi-transparent PCI-to-PCI bridge", - PCIPIFClass_0609 - }, - { - 0x0A, - L"InfiniBand-to-PCI host bridge", - PCIBlankEntry - }, - { - 0x0B, - L"Advanced Switching to PCI host bridge", - PCIPIFClass_060b - }, - { - 0x80, - L"Other bridge type", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_07[] = { - { - 0x00, - L"Serial controller", - PCIPIFClass_0700 - }, - { - 0x01, - L"Parallel port", - PCIPIFClass_0701 - }, - { - 0x02, - L"Multiport serial controller", - PCIBlankEntry - }, - { - 0x03, - L"Modem", - PCIPIFClass_0703 - }, - { - 0x04, - L"GPIB (IEEE 488.1/2) controller", - PCIBlankEntry - }, - { - 0x05, - L"Smart Card", - PCIBlankEntry - }, - { - 0x80, - L"Other communication device", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_08[] = { - { - 0x00, - L"PIC", - PCIPIFClass_0800 - }, - { - 0x01, - L"DMA controller", - PCIPIFClass_0801 - }, - { - 0x02, - L"System timer", - PCIPIFClass_0802 - }, - { - 0x03, - L"RTC controller", - PCIPIFClass_0803 - }, - { - 0x04, - L"Generic PCI Hot-Plug controller", - PCIBlankEntry - }, - { - 0x05, - L"SD Host controller", - PCIBlankEntry - }, - { - 0x06, - L"IOMMU", - PCIBlankEntry - }, - { - 0x07, - L"Root Complex Event Collector", - PCIBlankEntry - }, - { - 0x80, - L"Other system peripheral", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_09[] = { - { - 0x00, - L"Keyboard controller", - PCIBlankEntry - }, - { - 0x01, - L"Digitizer (pen)", - PCIBlankEntry - }, - { - 0x02, - L"Mouse controller", - PCIBlankEntry - }, - { - 0x03, - L"Scanner controller", - PCIBlankEntry - }, - { - 0x04, - L"Gameport controller", - PCIPIFClass_0904 - }, - { - 0x80, - L"Other input controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0a[] = { - { - 0x00, - L"Generic docking station", - PCIBlankEntry - }, - { - 0x80, - L"Other type of docking station", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0b[] = { - { - 0x00, - L"386", - PCIBlankEntry - }, - { - 0x01, - L"486", - PCIBlankEntry - }, - { - 0x02, - L"Pentium", - PCIBlankEntry - }, - { - 0x10, - L"Alpha", - PCIBlankEntry - }, - { - 0x20, - L"PowerPC", - PCIBlankEntry - }, - { - 0x30, - L"MIPS", - PCIBlankEntry - }, - { - 0x40, - L"Co-processor", - PCIBlankEntry - }, - { - 0x80, - L"Other processor", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0c[] = { - { - 0x00, - L"IEEE 1394", - PCIPIFClass_0c00 - }, - { - 0x01, - L"ACCESS.bus", - PCIBlankEntry - }, - { - 0x02, - L"SSA", - PCIBlankEntry - }, - { - 0x03, - L"USB", - PCIPIFClass_0c03 - }, - { - 0x04, - L"Fibre Channel", - PCIBlankEntry - }, - { - 0x05, - L"System Management Bus", - PCIBlankEntry - }, - { - 0x06, - L"InfiniBand", - PCIBlankEntry - }, - { - 0x07, - L"IPMI", - PCIPIFClass_0c07 - }, - { - 0x08, - L"SERCOS Interface Standard (IEC 61491)", - PCIBlankEntry - }, - { - 0x09, - L"CANbus", - PCIBlankEntry - }, - { - 0x80, - L"Other bus type", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0d[] = { - { - 0x00, - L"iRDA compatible controller", - PCIBlankEntry - }, - { - 0x01, - L"", - PCIPIFClass_0d01 - }, - { - 0x10, - L"RF controller", - PCIBlankEntry - }, - { - 0x11, - L"Bluetooth", - PCIBlankEntry - }, - { - 0x12, - L"Broadband", - PCIBlankEntry - }, - { - 0x20, - L"Ethernet (802.11a - 5 GHz)", - PCIBlankEntry - }, - { - 0x21, - L"Ethernet (802.11b - 2.4 GHz)", - PCIBlankEntry - }, - { - 0x80, - L"Other type of wireless controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0e[] = { - { - 0x00, - L"I2O Architecture", - PCIPIFClass_0e00 - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_0f[] = { - { - 0x01, - L"TV", - PCIBlankEntry - }, - { - 0x02, - L"Audio", - PCIBlankEntry - }, - { - 0x03, - L"Voice", - PCIBlankEntry - }, - { - 0x04, - L"Data", - PCIBlankEntry - }, - { - 0x80, - L"Other satellite communication controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_10[] = { - { - 0x00, - L"Network & computing Encrypt/Decrypt", - PCIBlankEntry - }, - { - 0x01, - L"Entertainment Encrypt/Decrypt", - PCIBlankEntry - }, - { - 0x80, - L"Other Encrypt/Decrypt", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_11[] = { - { - 0x00, - L"DPIO modules", - PCIBlankEntry - }, - { - 0x01, - L"Performance Counters", - PCIBlankEntry - }, - { - 0x10, - L"Communications synchronization plus time and frequency test/measurement ", - PCIBlankEntry - }, - { - 0x20, - L"Management card", - PCIBlankEntry - }, - { - 0x80, - L"Other DAQ & SP controllers", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_12[] = { - { - 0x00, - L"Processing Accelerator", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCISubClass_13[] = { - { - 0x00, - L"Non-Essential Instrumentation Function", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -// -// Programming Interface entries -// -PCI_CLASS_ENTRY PCIPIFClass_0100[] = { - { - 0x00, - L"SCSI controller", - PCIBlankEntry - }, - { - 0x11, - L"SCSI storage device SOP using PQI", - PCIBlankEntry - }, - { - 0x12, - L"SCSI controller SOP using PQI", - PCIBlankEntry - }, - { - 0x13, - L"SCSI storage device and controller SOP using PQI", - PCIBlankEntry - }, - { - 0x21, - L"SCSI storage device SOP using NVMe", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0101[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"OM-primary", - PCIBlankEntry - }, - { - 0x02, - L"PI-primary", - PCIBlankEntry - }, - { - 0x03, - L"OM/PI-primary", - PCIBlankEntry - }, - { - 0x04, - L"OM-secondary", - PCIBlankEntry - }, - { - 0x05, - L"OM-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x06, - L"PI-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x07, - L"OM/PI-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x08, - L"OM-secondary", - PCIBlankEntry - }, - { - 0x09, - L"OM-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x0a, - L"PI-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x0b, - L"OM/PI-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x0c, - L"OM-secondary", - PCIBlankEntry - }, - { - 0x0d, - L"OM-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x0e, - L"PI-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x0f, - L"OM/PI-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x80, - L"Master", - PCIBlankEntry - }, - { - 0x81, - L"Master, OM-primary", - PCIBlankEntry - }, - { - 0x82, - L"Master, PI-primary", - PCIBlankEntry - }, - { - 0x83, - L"Master, OM/PI-primary", - PCIBlankEntry - }, - { - 0x84, - L"Master, OM-secondary", - PCIBlankEntry - }, - { - 0x85, - L"Master, OM-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x86, - L"Master, PI-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x87, - L"Master, OM/PI-primary, OM-secondary", - PCIBlankEntry - }, - { - 0x88, - L"Master, OM-secondary", - PCIBlankEntry - }, - { - 0x89, - L"Master, OM-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x8a, - L"Master, PI-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x8b, - L"Master, OM/PI-primary, PI-secondary", - PCIBlankEntry - }, - { - 0x8c, - L"Master, OM-secondary", - PCIBlankEntry - }, - { - 0x8d, - L"Master, OM-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x8e, - L"Master, PI-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x8f, - L"Master, OM/PI-primary, OM/PI-secondary", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0105[] = { - { - 0x20, - L"Single stepping", - PCIBlankEntry - }, - { - 0x30, - L"Continuous operation", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0106[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"AHCI", - PCIBlankEntry - }, - { - 0x02, - L"Serial Storage Bus", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0107[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"Obsolete", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0108[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"NVMHCI", - PCIBlankEntry - }, - { - 0x02, - L"NVM Express", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0109[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"UFSHCI", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0300[] = { - { - 0x00, - L"VGA compatible", - PCIBlankEntry - }, - { - 0x01, - L"8514 compatible", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0604[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"Subtractive decode", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0609[] = { - { - 0x40, - L"Primary PCI bus side facing the system host processor", - PCIBlankEntry - }, - { - 0x80, - L"Secondary PCI bus side facing the system host processor", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_060b[] = { - { - 0x00, - L"Custom", - PCIBlankEntry - }, - { - 0x01, - L"ASI-SIG Defined Portal", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0700[] = { - { - 0x00, - L"Generic XT-compatible", - PCIBlankEntry - }, - { - 0x01, - L"16450-compatible", - PCIBlankEntry - }, - { - 0x02, - L"16550-compatible", - PCIBlankEntry - }, - { - 0x03, - L"16650-compatible", - PCIBlankEntry - }, - { - 0x04, - L"16750-compatible", - PCIBlankEntry - }, - { - 0x05, - L"16850-compatible", - PCIBlankEntry - }, - { - 0x06, - L"16950-compatible", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0701[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x01, - L"Bi-directional", - PCIBlankEntry - }, - { - 0x02, - L"ECP 1.X-compliant", - PCIBlankEntry - }, - { - 0x03, - L"IEEE 1284", - PCIBlankEntry - }, - { - 0xfe, - L"IEEE 1284 target (not a controller)", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0703[] = { - { - 0x00, - L"Generic", - PCIBlankEntry - }, - { - 0x01, - L"Hayes-compatible 16450", - PCIBlankEntry - }, - { - 0x02, - L"Hayes-compatible 16550", - PCIBlankEntry - }, - { - 0x03, - L"Hayes-compatible 16650", - PCIBlankEntry - }, - { - 0x04, - L"Hayes-compatible 16750", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0800[] = { - { - 0x00, - L"Generic 8259", - PCIBlankEntry - }, - { - 0x01, - L"ISA", - PCIBlankEntry - }, - { - 0x02, - L"EISA", - PCIBlankEntry - }, - { - 0x10, - L"IO APIC", - PCIBlankEntry - }, - { - 0x20, - L"IO(x) APIC interrupt controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0801[] = { - { - 0x00, - L"Generic 8237", - PCIBlankEntry - }, - { - 0x01, - L"ISA", - PCIBlankEntry - }, - { - 0x02, - L"EISA", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0802[] = { - { - 0x00, - L"Generic 8254", - PCIBlankEntry - }, - { - 0x01, - L"ISA", - PCIBlankEntry - }, - { - 0x02, - L"EISA", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0803[] = { - { - 0x00, - L"Generic", - PCIBlankEntry - }, - { - 0x01, - L"ISA", - PCIBlankEntry - }, - { - 0x02, - L"EISA", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0904[] = { - { - 0x00, - L"Generic", - PCIBlankEntry - }, - { - 0x10, - L"", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0c00[] = { - { - 0x00, - L"", - PCIBlankEntry - }, - { - 0x10, - L"Using 1394 OpenHCI spec", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0c03[] = { - { - 0x00, - L"UHCI", - PCIBlankEntry - }, - { - 0x10, - L"OHCI", - PCIBlankEntry - }, - { - 0x20, - L"EHCI", - PCIBlankEntry - }, - { - 0x30, - L"xHCI", - PCIBlankEntry - }, - { - 0x80, - L"No specific programming interface", - PCIBlankEntry - }, - { - 0xfe, - L"(Not Host Controller)", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0c07[] = { - { - 0x00, - L"SMIC", - PCIBlankEntry - }, - { - 0x01, - L"Keyboard Controller Style", - PCIBlankEntry - }, - { - 0x02, - L"Block Transfer", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0d01[] = { - { - 0x00, - L"Consumer IR controller", - PCIBlankEntry - }, - { - 0x10, - L"UWB Radio controller", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - -PCI_CLASS_ENTRY PCIPIFClass_0e00[] = { - { - 0x00, - L"Message FIFO at offset 40h", - PCIBlankEntry - }, - { - 0x01, - L"", - PCIBlankEntry - }, - { - 0x00, - NULL, - /* null string ends the list */NULL - } -}; - - -/** - Generates printable Unicode strings that represent PCI device class, - subclass and programmed I/F based on a value passed to the function. - - @param[in] ClassCode Value representing the PCI "Class Code" register read from a - PCI device. The encodings are: - bits 23:16 - Base Class Code - bits 15:8 - Sub-Class Code - bits 7:0 - Programming Interface - @param[in, out] ClassStrings Pointer of PCI_CLASS_STRINGS structure, which contains - printable class strings corresponding to ClassCode. The - caller must not modify the strings that are pointed by - the fields in ClassStrings. -**/ -VOID -PciGetClassStrings ( - IN UINT32 ClassCode, - IN OUT PCI_CLASS_STRINGS *ClassStrings - ) -{ - INTN Index; - UINT8 Code; - PCI_CLASS_ENTRY *CurrentClass; - - // - // Assume no strings found - // - ClassStrings->BaseClass = L"UNDEFINED"; - ClassStrings->SubClass = L"UNDEFINED"; - ClassStrings->PIFClass = L"UNDEFINED"; - - CurrentClass = gClassStringList; - Code = (UINT8) (ClassCode >> 16); - Index = 0; - - // - // Go through all entries of the base class, until the entry with a matching - // base class code is found. If reaches an entry with a null description - // text, the last entry is met, which means no text for the base class was - // found, so no more action is needed. - // - while (Code != CurrentClass[Index].Code) { - if (NULL == CurrentClass[Index].DescText) { - return ; - } - - Index++; - } - // - // A base class was found. Assign description, and check if this class has - // sub-class defined. If sub-class defined, no more action is needed, - // otherwise, continue to find description for the sub-class code. - // - ClassStrings->BaseClass = CurrentClass[Index].DescText; - if (NULL == CurrentClass[Index].LowerLevelClass) { - return ; - } - // - // find Subclass entry - // - CurrentClass = CurrentClass[Index].LowerLevelClass; - Code = (UINT8) (ClassCode >> 8); - Index = 0; - - // - // Go through all entries of the sub-class, until the entry with a matching - // sub-class code is found. If reaches an entry with a null description - // text, the last entry is met, which means no text for the sub-class was - // found, so no more action is needed. - // - while (Code != CurrentClass[Index].Code) { - if (NULL == CurrentClass[Index].DescText) { - return ; - } - - Index++; - } - // - // A class was found for the sub-class code. Assign description, and check if - // this sub-class has programming interface defined. If no, no more action is - // needed, otherwise, continue to find description for the programming - // interface. - // - ClassStrings->SubClass = CurrentClass[Index].DescText; - if (NULL == CurrentClass[Index].LowerLevelClass) { - return ; - } - // - // Find programming interface entry - // - CurrentClass = CurrentClass[Index].LowerLevelClass; - Code = (UINT8) ClassCode; - Index = 0; - - // - // Go through all entries of the I/F entries, until the entry with a - // matching I/F code is found. If reaches an entry with a null description - // text, the last entry is met, which means no text was found, so no more - // action is needed. - // - while (Code != CurrentClass[Index].Code) { - if (NULL == CurrentClass[Index].DescText) { - return ; - } - - Index++; - } - // - // A class was found for the I/F code. Assign description, done! - // - ClassStrings->PIFClass = CurrentClass[Index].DescText; - return ; -} - -/** - Print strings that represent PCI device class, subclass and programmed I/F. - - @param[in] ClassCodePtr Points to the memory which stores register Class Code in PCI - configuration space. - @param[in] IncludePIF If the printed string should include the programming I/F part -**/ -VOID -PciPrintClassCode ( - IN UINT8 *ClassCodePtr, - IN BOOLEAN IncludePIF - ) -{ - UINT32 ClassCode; - PCI_CLASS_STRINGS ClassStrings; - - ClassCode = 0; - ClassCode |= (UINT32)ClassCodePtr[0]; - ClassCode |= (UINT32)(ClassCodePtr[1] << 8); - ClassCode |= (UINT32)(ClassCodePtr[2] << 16); - - // - // Get name from class code - // - PciGetClassStrings (ClassCode, &ClassStrings); - - if (IncludePIF) { - // - // Print base class, sub class, and programming inferface name - // - ShellPrintEx (-1, -1, L"%s - %s - %s", - ClassStrings.BaseClass, - ClassStrings.SubClass, - ClassStrings.PIFClass - ); - - } else { - // - // Only print base class and sub class name - // - ShellPrintEx (-1, -1, L"%s - %s", - ClassStrings.BaseClass, - ClassStrings.SubClass - ); - } -} - -/** - This function finds out the protocol which is in charge of the given - segment, and its bus range covers the current bus number. It lookes - each instances of RootBridgeIoProtocol handle, until the one meets the - criteria is found. - - @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles. - @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles. - @param[in] Segment Segment number of device we are dealing with. - @param[in] Bus Bus number of device we are dealing with. - @param[out] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. - @retval EFI_INVALID_PARAMETER Invalid parameter. - -**/ -EFI_STATUS -PciFindProtocolInterface ( - IN EFI_HANDLE *HandleBuf, - IN UINTN HandleCount, - IN UINT16 Segment, - IN UINT16 Bus, - OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev - ); - -/** - This function gets the protocol interface from the given handle, and - obtains its address space descriptors. - - @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle. - @param[out] IoDev Handle used to access configuration space of PCI device. - @param[out] Descriptors Points to the address space descriptors. - - @retval EFI_SUCCESS The command completed successfully -**/ -EFI_STATUS -PciGetProtocolAndResource ( - IN EFI_HANDLE Handle, - OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev, - OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors - ); - -/** - This function get the next bus range of given address space descriptors. - It also moves the pointer backward a node, to get prepared to be called - again. - - @param[in, out] Descriptors Points to current position of a serial of address space - descriptors. - @param[out] MinBus The lower range of bus number. - @param[out] MaxBus The upper range of bus number. - @param[out] IsEnd Meet end of the serial of descriptors. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciGetNextBusRange ( - IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, - OUT UINT16 *MinBus, - OUT UINT16 *MaxBus, - OUT BOOLEAN *IsEnd - ); - -/** - Explain the data in PCI configuration space. The part which is common for - PCI device and bridge is interpreted in this function. It calls other - functions to interpret data unique for device or bridge. - - @param[in] ConfigSpace Data in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. -**/ -VOID -PciExplainPci ( - IN PCI_CONFIG_SPACE *ConfigSpace, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ); - -/** - Explain the device specific part of data in PCI configuration space. - - @param[in] Device Data in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainDeviceData ( - IN PCI_DEVICE_HEADER_TYPE_REGION *Device, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ); - -/** - Explain the bridge specific part of data in PCI configuration space. - - @param[in] Bridge Bridge specific data region in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBridgeData ( - IN PCI_BRIDGE_CONTROL_REGISTER *Bridge, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ); - -/** - Explain the Base Address Register(Bar) in PCI configuration space. - - @param[in] Bar Points to the Base Address Register intended to interpret. - @param[in] Command Points to the register Command. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - @param[in, out] Index The Index. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBar ( - IN UINT32 *Bar, - IN UINT16 *Command, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, - IN OUT UINTN *Index - ); - -/** - Explain the cardbus specific part of data in PCI configuration space. - - @param[in] CardBus CardBus specific region of PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainCardBusData ( - IN PCI_CARDBUS_CONTROL_REGISTER *CardBus, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ); - -/** - Explain each meaningful bit of register Status. The definition of Status is - slightly different depending on the PCI header type. - - @param[in] Status Points to the content of register Status. - @param[in] MainStatus Indicates if this register is main status(not secondary - status). - @param[in] HeaderType Header type of this PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainStatus ( - IN UINT16 *Status, - IN BOOLEAN MainStatus, - IN PCI_HEADER_TYPE HeaderType - ); - -/** - Explain each meaningful bit of register Command. - - @param[in] Command Points to the content of register Command. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainCommand ( - IN UINT16 *Command - ); - -/** - Explain each meaningful bit of register Bridge Control. - - @param[in] BridgeControl Points to the content of register Bridge Control. - @param[in] HeaderType The headertype. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBridgeControl ( - IN UINT16 *BridgeControl, - IN PCI_HEADER_TYPE HeaderType - ); - -/** - Locate capability register block per capability ID. - - @param[in] ConfigSpace Data in PCI configuration space. - @param[in] CapabilityId The capability ID. - - @return The offset of the register block per capability ID. -**/ -UINT8 -LocatePciCapability ( - IN PCI_CONFIG_SPACE *ConfigSpace, - IN UINT8 CapabilityId - ); - -/** - Display Pcie device structure. - - @param[in] PciExpressCap PCI Express capability buffer. - @param[in] ExtendedConfigSpace PCI Express extended configuration space. - @param[in] ExtendedCapability PCI Express extended capability ID to explain. -**/ -VOID -PciExplainPciExpress ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap, - IN UINT8 *ExtendedConfigSpace, - IN CONST UINT16 ExtendedCapability - ); - -/** - Print out information of the capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieCapReg ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device link information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device link control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device link status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device slot information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device slot control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device slot status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device root information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device root capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -/** - Print out information of the device root status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ); - -typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCI_CAPABILITY_PCIEXP *PciExpressCap); - -typedef enum { - FieldWidthUINT8, - FieldWidthUINT16, - FieldWidthUINT32 -} PCIE_CAPREG_FIELD_WIDTH; - -typedef enum { - PcieExplainTypeCommon, - PcieExplainTypeDevice, - PcieExplainTypeLink, - PcieExplainTypeSlot, - PcieExplainTypeRoot, - PcieExplainTypeMax -} PCIE_EXPLAIN_TYPE; - -typedef struct -{ - UINT16 Token; - UINTN Offset; - PCIE_CAPREG_FIELD_WIDTH Width; - PCIE_EXPLAIN_FUNCTION Func; - PCIE_EXPLAIN_TYPE Type; -} PCIE_EXPLAIN_STRUCT; - -PCIE_EXPLAIN_STRUCT PcieExplainList[] = { - { - STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID), - 0x00, - FieldWidthUINT8, - NULL, - PcieExplainTypeCommon - }, - { - STRING_TOKEN (STR_PCIEX_NEXTCAP_PTR), - 0x01, - FieldWidthUINT8, - NULL, - PcieExplainTypeCommon - }, - { - STRING_TOKEN (STR_PCIEX_CAP_REGISTER), - 0x02, - FieldWidthUINT16, - ExplainPcieCapReg, - PcieExplainTypeCommon - }, - { - STRING_TOKEN (STR_PCIEX_DEVICE_CAP), - 0x04, - FieldWidthUINT32, - ExplainPcieDeviceCap, - PcieExplainTypeDevice - }, - { - STRING_TOKEN (STR_PCIEX_DEVICE_CONTROL), - 0x08, - FieldWidthUINT16, - ExplainPcieDeviceControl, - PcieExplainTypeDevice - }, - { - STRING_TOKEN (STR_PCIEX_DEVICE_STATUS), - 0x0a, - FieldWidthUINT16, - ExplainPcieDeviceStatus, - PcieExplainTypeDevice - }, - { - STRING_TOKEN (STR_PCIEX_LINK_CAPABILITIES), - 0x0c, - FieldWidthUINT32, - ExplainPcieLinkCap, - PcieExplainTypeLink - }, - { - STRING_TOKEN (STR_PCIEX_LINK_CONTROL), - 0x10, - FieldWidthUINT16, - ExplainPcieLinkControl, - PcieExplainTypeLink - }, - { - STRING_TOKEN (STR_PCIEX_LINK_STATUS), - 0x12, - FieldWidthUINT16, - ExplainPcieLinkStatus, - PcieExplainTypeLink - }, - { - STRING_TOKEN (STR_PCIEX_SLOT_CAPABILITIES), - 0x14, - FieldWidthUINT32, - ExplainPcieSlotCap, - PcieExplainTypeSlot - }, - { - STRING_TOKEN (STR_PCIEX_SLOT_CONTROL), - 0x18, - FieldWidthUINT16, - ExplainPcieSlotControl, - PcieExplainTypeSlot - }, - { - STRING_TOKEN (STR_PCIEX_SLOT_STATUS), - 0x1a, - FieldWidthUINT16, - ExplainPcieSlotStatus, - PcieExplainTypeSlot - }, - { - STRING_TOKEN (STR_PCIEX_ROOT_CONTROL), - 0x1c, - FieldWidthUINT16, - ExplainPcieRootControl, - PcieExplainTypeRoot - }, - { - STRING_TOKEN (STR_PCIEX_RSVDP), - 0x1e, - FieldWidthUINT16, - ExplainPcieRootCap, - PcieExplainTypeRoot - }, - { - STRING_TOKEN (STR_PCIEX_ROOT_STATUS), - 0x20, - FieldWidthUINT32, - ExplainPcieRootStatus, - PcieExplainTypeRoot - }, - { - 0, - 0, - (PCIE_CAPREG_FIELD_WIDTH)0, - NULL, - PcieExplainTypeMax - } -}; - -// -// Global Variables -// -PCI_CONFIG_SPACE *mConfigSpace = NULL; -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-s", TypeValue}, - {L"-i", TypeFlag}, - {L"-ec", TypeValue}, - {NULL, TypeMax} - }; - -CHAR16 *DevicePortTypeTable[] = { - L"PCI Express Endpoint", - L"Legacy PCI Express Endpoint", - L"Unknown Type", - L"Unknonw Type", - L"Root Port of PCI Express Root Complex", - L"Upstream Port of PCI Express Switch", - L"Downstream Port of PCI Express Switch", - L"PCI Express to PCI/PCI-X Bridge", - L"PCI/PCI-X to PCI Express Bridge", - L"Root Complex Integrated Endpoint", - L"Root Complex Event Collector" -}; - -CHAR16 *L0sLatencyStrTable[] = { - L"Less than 64ns", - L"64ns to less than 128ns", - L"128ns to less than 256ns", - L"256ns to less than 512ns", - L"512ns to less than 1us", - L"1us to less than 2us", - L"2us-4us", - L"More than 4us" -}; - -CHAR16 *L1LatencyStrTable[] = { - L"Less than 1us", - L"1us to less than 2us", - L"2us to less than 4us", - L"4us to less than 8us", - L"8us to less than 16us", - L"16us to less than 32us", - L"32us-64us", - L"More than 64us" -}; - -CHAR16 *ASPMCtrlStrTable[] = { - L"Disabled", - L"L0s Entry Enabled", - L"L1 Entry Enabled", - L"L0s and L1 Entry Enabled" -}; - -CHAR16 *SlotPwrLmtScaleTable[] = { - L"1.0x", - L"0.1x", - L"0.01x", - L"0.001x" -}; - -CHAR16 *IndicatorTable[] = { - L"Reserved", - L"On", - L"Blink", - L"Off" -}; - - -/** - Function for 'pci' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPci ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINT16 Segment; - UINT16 Bus; - UINT16 Device; - UINT16 Func; - UINT64 Address; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev; - EFI_STATUS Status; - PCI_DEVICE_INDEPENDENT_REGION PciHeader; - PCI_CONFIG_SPACE ConfigSpace; - UINTN ScreenCount; - UINTN TempColumn; - UINTN ScreenSize; - BOOLEAN ExplainData; - UINTN Index; - UINTN SizeOfHeader; - BOOLEAN PrintTitle; - UINTN HandleBufSize; - EFI_HANDLE *HandleBuf; - UINTN HandleCount; - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; - UINT16 MinBus; - UINT16 MaxBus; - BOOLEAN IsEnd; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Temp; - UINT64 RetVal; - UINT16 ExtendedCapability; - UINT8 PcieCapabilityPtr; - UINT8 *ExtendedConfigSpace; - UINTN ExtendedConfigSize; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Address = 0; - IoDev = NULL; - HandleBuf = NULL; - Package = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"pci", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - - if (ShellCommandLineGetCount(Package) == 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if (ShellCommandLineGetCount(Package) > 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (ShellCommandLineGetFlag(Package, L"-ec") && ShellCommandLineGetValue(Package, L"-ec") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-ec"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetValue(Package, L"-s") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - // - // Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and - // call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough - // space for handles and call it again. - // - HandleBufSize = sizeof (EFI_HANDLE); - HandleBuf = (EFI_HANDLE *) AllocateZeroPool (HandleBufSize); - if (HandleBuf == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Done; - } - - Status = gBS->LocateHandle ( - ByProtocol, - &gEfiPciRootBridgeIoProtocolGuid, - NULL, - &HandleBufSize, - HandleBuf - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleBuf = ReallocatePool (sizeof (EFI_HANDLE), HandleBufSize, HandleBuf); - if (HandleBuf == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto Done; - } - - Status = gBS->LocateHandle ( - ByProtocol, - &gEfiPciRootBridgeIoProtocolGuid, - NULL, - &HandleBufSize, - HandleBuf - ); - } - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - - HandleCount = HandleBufSize / sizeof (EFI_HANDLE); - // - // Argument Count == 1(no other argument): enumerate all pci functions - // - if (ShellCommandLineGetCount(Package) == 1) { - gST->ConOut->QueryMode ( - gST->ConOut, - gST->ConOut->Mode->Mode, - &TempColumn, - &ScreenSize - ); - - ScreenCount = 0; - ScreenSize -= 4; - if ((ScreenSize & 1) == 1) { - ScreenSize -= 1; - } - - PrintTitle = TRUE; - - // - // For each handle, which decides a segment and a bus number range, - // enumerate all devices on it. - // - for (Index = 0; Index < HandleCount; Index++) { - Status = PciGetProtocolAndResource ( - HandleBuf[Index], - &IoDev, - &Descriptors - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - // - // No document say it's impossible for a RootBridgeIo protocol handle - // to have more than one address space descriptors, so find out every - // bus range and for each of them do device enumeration. - // - while (TRUE) { - Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - - if (IsEnd) { - break; - } - - for (Bus = MinBus; Bus <= MaxBus; Bus++) { - // - // For each devices, enumerate all functions it contains - // - for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) { - // - // For each function, read its configuration space and print summary - // - for (Func = 0; Func <= PCI_MAX_FUNC; Func++) { - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0); - IoDev->Pci.Read ( - IoDev, - EfiPciWidthUint16, - Address, - 1, - &PciHeader.VendorId - ); - - // - // If VendorId = 0xffff, there does not exist a device at this - // location. For each device, if there is any function on it, - // there must be 1 function at Function 0. So if Func = 0, there - // will be no more functions in the same device, so we can break - // loop to deal with the next device. - // - if (PciHeader.VendorId == 0xffff && Func == 0) { - break; - } - - if (PciHeader.VendorId != 0xffff) { - - if (PrintTitle) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle); - PrintTitle = FALSE; - } - - IoDev->Pci.Read ( - IoDev, - EfiPciWidthUint32, - Address, - sizeof (PciHeader) / sizeof (UINT32), - &PciHeader - ); - - ShellPrintHiiEx( - -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P1), gShellDebug1HiiHandle, - IoDev->SegmentNumber, - Bus, - Device, - Func - ); - - PciPrintClassCode (PciHeader.ClassCode, FALSE); - ShellPrintHiiEx( - -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P2), gShellDebug1HiiHandle, - PciHeader.VendorId, - PciHeader.DeviceId, - PciHeader.ClassCode[0] - ); - - ScreenCount += 2; - if (ScreenCount >= ScreenSize && ScreenSize != 0) { - // - // If ScreenSize == 0 we have the console redirected so don't - // block updates - // - ScreenCount = 0; - } - // - // If this is not a multi-function device, we can leave the loop - // to deal with the next device. - // - if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) { - break; - } - } - } - } - } - // - // If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED, - // we assume the bus range is 0~PCI_MAX_BUS. After enumerated all - // devices on all bus, we can leave loop. - // - if (Descriptors == NULL) { - break; - } - } - } - - Status = EFI_SUCCESS; - goto Done; - } - - ExplainData = FALSE; - Segment = 0; - Bus = 0; - Device = 0; - Func = 0; - ExtendedCapability = 0xFFFF; - if (ShellCommandLineGetFlag(Package, L"-i")) { - ExplainData = TRUE; - } - - Temp = ShellCommandLineGetValue(Package, L"-s"); - if (Temp != NULL) { - // - // Input converted to hexadecimal number. - // - if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { - Segment = (UINT16) RetVal; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - // - // The first Argument(except "-i") is assumed to be Bus number, second - // to be Device number, and third to be Func number. - // - Temp = ShellCommandLineGetRawValue(Package, 1); - if (Temp != NULL) { - // - // Input converted to hexadecimal number. - // - if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { - Bus = (UINT16) RetVal; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if (Bus > PCI_MAX_BUS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - Temp = ShellCommandLineGetRawValue(Package, 2); - if (Temp != NULL) { - // - // Input converted to hexadecimal number. - // - if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { - Device = (UINT16) RetVal; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if (Device > PCI_MAX_DEVICE){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - Temp = ShellCommandLineGetRawValue(Package, 3); - if (Temp != NULL) { - // - // Input converted to hexadecimal number. - // - if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { - Func = (UINT16) RetVal; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - if (Func > PCI_MAX_FUNC){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - Temp = ShellCommandLineGetValue (Package, L"-ec"); - if (Temp != NULL) { - // - // Input converted to hexadecimal number. - // - if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { - ExtendedCapability = (UINT16) RetVal; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - // - // Find the protocol interface who's in charge of current segment, and its - // bus range covers the current bus - // - Status = PciFindProtocolInterface ( - HandleBuf, - HandleCount, - Segment, - Bus, - &IoDev - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle, L"pci", - Segment, - Bus - ); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - - Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0); - Status = IoDev->Pci.Read ( - IoDev, - EfiPciWidthUint8, - Address, - sizeof (ConfigSpace), - &ConfigSpace - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, L"pci"); - ShellStatus = SHELL_ACCESS_DENIED; - goto Done; - } - - mConfigSpace = &ConfigSpace; - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_PCI_INFO), - gShellDebug1HiiHandle, - Segment, - Bus, - Device, - Func, - Segment, - Bus, - Device, - Func - ); - - // - // Dump standard header of configuration space - // - SizeOfHeader = sizeof (ConfigSpace.Common) + sizeof (ConfigSpace.NonCommon); - - DumpHex (2, 0, SizeOfHeader, &ConfigSpace); - ShellPrintEx(-1,-1, L"\r\n"); - - // - // Dump device dependent Part of configuration space - // - DumpHex ( - 2, - SizeOfHeader, - sizeof (ConfigSpace) - SizeOfHeader, - ConfigSpace.Data - ); - - ExtendedConfigSpace = NULL; - ExtendedConfigSize = 0; - PcieCapabilityPtr = LocatePciCapability (&ConfigSpace, EFI_PCI_CAPABILITY_ID_PCIEXP); - if (PcieCapabilityPtr != 0) { - ExtendedConfigSize = 0x1000 - EFI_PCIE_CAPABILITY_BASE_OFFSET; - ExtendedConfigSpace = AllocatePool (ExtendedConfigSize); - if (ExtendedConfigSpace != NULL) { - Status = IoDev->Pci.Read ( - IoDev, - EfiPciWidthUint32, - EFI_PCI_ADDRESS (Bus, Device, Func, EFI_PCIE_CAPABILITY_BASE_OFFSET), - ExtendedConfigSize / sizeof (UINT32), - ExtendedConfigSpace - ); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (ExtendedConfigSpace); - } - } - } - - if ((ExtendedConfigSpace != NULL) && !ShellGetExecutionBreakFlag ()) { - // - // Print the PciEx extend space in raw bytes ( 0xFF-0xFFF) - // - ShellPrintEx (-1, -1, L"\r\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\r\n\r\n"); - - DumpHex ( - 2, - EFI_PCIE_CAPABILITY_BASE_OFFSET, - ExtendedConfigSize, - ExtendedConfigSpace - ); - } - - // - // If "-i" appears in command line, interpret data in configuration space - // - if (ExplainData) { - PciExplainPci (&ConfigSpace, Address, IoDev); - if ((ExtendedConfigSpace != NULL) && !ShellGetExecutionBreakFlag ()) { - PciExplainPciExpress ( - (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + PcieCapabilityPtr), - ExtendedConfigSpace, - ExtendedCapability - ); - } - } - } -Done: - if (HandleBuf != NULL) { - FreePool (HandleBuf); - } - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - mConfigSpace = NULL; - return ShellStatus; -} - -/** - This function finds out the protocol which is in charge of the given - segment, and its bus range covers the current bus number. It lookes - each instances of RootBridgeIoProtocol handle, until the one meets the - criteria is found. - - @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles. - @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles. - @param[in] Segment Segment number of device we are dealing with. - @param[in] Bus Bus number of device we are dealing with. - @param[out] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. - @retval EFI_INVALID_PARAMETER Invalid parameter. - -**/ -EFI_STATUS -PciFindProtocolInterface ( - IN EFI_HANDLE *HandleBuf, - IN UINTN HandleCount, - IN UINT16 Segment, - IN UINT16 Bus, - OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev - ) -{ - UINTN Index; - EFI_STATUS Status; - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; - UINT16 MinBus; - UINT16 MaxBus; - BOOLEAN IsEnd; - - // - // Go through all handles, until the one meets the criteria is found - // - for (Index = 0; Index < HandleCount; Index++) { - Status = PciGetProtocolAndResource (HandleBuf[Index], IoDev, &Descriptors); - if (EFI_ERROR (Status)) { - return Status; - } - // - // When Descriptors == NULL, the Configuration() is not implemented, - // so we only check the Segment number - // - if (Descriptors == NULL && Segment == (*IoDev)->SegmentNumber) { - return EFI_SUCCESS; - } - - if ((*IoDev)->SegmentNumber != Segment) { - continue; - } - - while (TRUE) { - Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd); - if (EFI_ERROR (Status)) { - return Status; - } - - if (IsEnd) { - break; - } - - if (MinBus <= Bus && MaxBus >= Bus) { - return EFI_SUCCESS; - } - } - } - - return EFI_NOT_FOUND; -} - -/** - This function gets the protocol interface from the given handle, and - obtains its address space descriptors. - - @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle. - @param[out] IoDev Handle used to access configuration space of PCI device. - @param[out] Descriptors Points to the address space descriptors. - - @retval EFI_SUCCESS The command completed successfully -**/ -EFI_STATUS -PciGetProtocolAndResource ( - IN EFI_HANDLE Handle, - OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev, - OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors - ) -{ - EFI_STATUS Status; - - // - // Get inferface from protocol - // - Status = gBS->HandleProtocol ( - Handle, - &gEfiPciRootBridgeIoProtocolGuid, - (VOID**)IoDev - ); - - if (EFI_ERROR (Status)) { - return Status; - } - // - // Call Configuration() to get address space descriptors - // - Status = (*IoDev)->Configuration (*IoDev, (VOID**)Descriptors); - if (Status == EFI_UNSUPPORTED) { - *Descriptors = NULL; - return EFI_SUCCESS; - - } else { - return Status; - } -} - -/** - This function get the next bus range of given address space descriptors. - It also moves the pointer backward a node, to get prepared to be called - again. - - @param[in, out] Descriptors Points to current position of a serial of address space - descriptors. - @param[out] MinBus The lower range of bus number. - @param[out] MaxBus The upper range of bus number. - @param[out] IsEnd Meet end of the serial of descriptors. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciGetNextBusRange ( - IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, - OUT UINT16 *MinBus, - OUT UINT16 *MaxBus, - OUT BOOLEAN *IsEnd - ) -{ - *IsEnd = FALSE; - - // - // When *Descriptors is NULL, Configuration() is not implemented, so assume - // range is 0~PCI_MAX_BUS - // - if ((*Descriptors) == NULL) { - *MinBus = 0; - *MaxBus = PCI_MAX_BUS; - return EFI_SUCCESS; - } - // - // *Descriptors points to one or more address space descriptors, which - // ends with a end tagged descriptor. Examine each of the descriptors, - // if a bus typed one is found and its bus range covers bus, this handle - // is the handle we are looking for. - // - - while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) { - if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) { - *MinBus = (UINT16) (*Descriptors)->AddrRangeMin; - *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax; - (*Descriptors)++; - return (EFI_SUCCESS); - } - - (*Descriptors)++; - } - - if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) { - *IsEnd = TRUE; - } - - return EFI_SUCCESS; -} - -/** - Explain the data in PCI configuration space. The part which is common for - PCI device and bridge is interpreted in this function. It calls other - functions to interpret data unique for device or bridge. - - @param[in] ConfigSpace Data in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. -**/ -VOID -PciExplainPci ( - IN PCI_CONFIG_SPACE *ConfigSpace, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ) -{ - PCI_DEVICE_INDEPENDENT_REGION *Common; - PCI_HEADER_TYPE HeaderType; - - Common = &(ConfigSpace->Common); - - ShellPrintEx (-1, -1, L"\r\n"); - - // - // Print Vendor Id and Device Id - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_VID_DID), gShellDebug1HiiHandle, - INDEX_OF (&(Common->VendorId)), - Common->VendorId, - INDEX_OF (&(Common->DeviceId)), - Common->DeviceId - ); - - // - // Print register Command - // - PciExplainCommand (&(Common->Command)); - - // - // Print register Status - // - PciExplainStatus (&(Common->Status), TRUE, PciUndefined); - - // - // Print register Revision ID - // - ShellPrintEx(-1, -1, L"\r\n"); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle, - INDEX_OF (&(Common->RevisionID)), - Common->RevisionID - ); - - // - // Print register BIST - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->BIST))); - if ((Common->BIST & BIT7) != 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->BIST); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle); - } - // - // Print register Cache Line Size - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE), - gShellDebug1HiiHandle, - INDEX_OF (&(Common->CacheLineSize)), - Common->CacheLineSize - ); - - // - // Print register Latency Timer - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_LATENCY_TIMER), - gShellDebug1HiiHandle, - INDEX_OF (&(Common->LatencyTimer)), - Common->LatencyTimer - ); - - // - // Print register Header Type - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_HEADER_TYPE), - gShellDebug1HiiHandle, - INDEX_OF (&(Common->HeaderType)), - Common->HeaderType - ); - - if ((Common->HeaderType & BIT7) != 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle); - } - - HeaderType = (PCI_HEADER_TYPE)(UINT8) (Common->HeaderType & 0x7f); - switch (HeaderType) { - case PciDevice: - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle); - break; - - case PciP2pBridge: - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle); - break; - - case PciCardBusBridge: - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle); - HeaderType = PciUndefined; - } - - // - // Print register Class Code - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle); - PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE); - ShellPrintEx (-1, -1, L"\r\n"); -} - -/** - Explain the device specific part of data in PCI configuration space. - - @param[in] Device Data in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainDeviceData ( - IN PCI_DEVICE_HEADER_TYPE_REGION *Device, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ) -{ - UINTN Index; - BOOLEAN BarExist; - EFI_STATUS Status; - UINTN BarCount; - - // - // Print Base Address Registers(Bar). When Bar = 0, this Bar does not - // exist. If these no Bar for this function, print "none", otherwise - // list detail information about this Bar. - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar)); - - BarExist = FALSE; - BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]); - for (Index = 0; Index < BarCount; Index++) { - if (Device->Bar[Index] == 0) { - continue; - } - - if (!BarExist) { - BarExist = TRUE; - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle); - ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------"); - } - - Status = PciExplainBar ( - &(Device->Bar[Index]), - &(mConfigSpace->Common.Command), - Address, - IoDev, - &Index - ); - - if (EFI_ERROR (Status)) { - break; - } - } - - if (!BarExist) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle); - - } else { - ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------"); - } - - // - // Print register Expansion ROM Base Address - // - if ((Device->ExpansionRomBar & BIT0) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ExpansionRomBar))); - - } else { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->ExpansionRomBar)), - Device->ExpansionRomBar - ); - } - // - // Print register Cardbus CIS ptr - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CARDBUS_CIS), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->CISPtr)), - Device->CISPtr - ); - - // - // Print register Sub-vendor ID and subsystem ID - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->SubsystemVendorID)), - Device->SubsystemVendorID - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->SubsystemID)), - Device->SubsystemID - ); - - // - // Print register Capabilities Ptr - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->CapabilityPtr)), - Device->CapabilityPtr - ); - - // - // Print register Interrupt Line and interrupt pin - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_INTERRUPT_LINE), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->InterruptLine)), - Device->InterruptLine - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_INTERRUPT_PIN), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->InterruptPin)), - Device->InterruptPin - ); - - // - // Print register Min_Gnt and Max_Lat - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MIN_GNT), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->MinGnt)), - Device->MinGnt - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MAX_LAT), - gShellDebug1HiiHandle, - INDEX_OF (&(Device->MaxLat)), - Device->MaxLat - ); - - return EFI_SUCCESS; -} - -/** - Explain the bridge specific part of data in PCI configuration space. - - @param[in] Bridge Bridge specific data region in PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBridgeData ( - IN PCI_BRIDGE_CONTROL_REGISTER *Bridge, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ) -{ - UINTN Index; - BOOLEAN BarExist; - UINTN BarCount; - UINT32 IoAddress32; - EFI_STATUS Status; - - // - // Print Base Address Registers. When Bar = 0, this Bar does not - // exist. If these no Bar for this function, print "none", otherwise - // list detail information about this Bar. - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar))); - - BarExist = FALSE; - BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]); - - for (Index = 0; Index < BarCount; Index++) { - if (Bridge->Bar[Index] == 0) { - continue; - } - - if (!BarExist) { - BarExist = TRUE; - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle); - ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------"); - } - - Status = PciExplainBar ( - &(Bridge->Bar[Index]), - &(mConfigSpace->Common.Command), - Address, - IoDev, - &Index - ); - - if (EFI_ERROR (Status)) { - break; - } - } - - if (!BarExist) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle); - } else { - ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------"); - } - - // - // Expansion register ROM Base Address - // - if ((Bridge->ExpansionRomBAR & BIT0) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ExpansionRomBAR))); - - } else { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->ExpansionRomBAR)), - Bridge->ExpansionRomBAR - ); - } - // - // Print Bus Numbers(Primary, Secondary, and Subordinate - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_BUS_NUMBERS), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->PrimaryBus)), - INDEX_OF (&(Bridge->SecondaryBus)), - INDEX_OF (&(Bridge->SubordinateBus)) - ); - - ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n"); - - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus); - - // - // Print register Secondary Latency Timer - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SECONDARY_TIMER), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->SecondaryLatencyTimer)), - Bridge->SecondaryLatencyTimer - ); - - // - // Print register Secondary Status - // - PciExplainStatus (&(Bridge->SecondaryStatus), FALSE, PciP2pBridge); - - // - // Print I/O and memory ranges this bridge forwards. There are 3 resource - // types: I/O, memory, and pre-fetchable memory. For each resource type, - // base and limit address are listed. - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle); - ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n"); - - // - // IO Base & Limit - // - IoAddress32 = (Bridge->IoBaseUpper16 << 16 | Bridge->IoBase << 8); - IoAddress32 &= 0xfffff000; - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_TWO_VARS), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->IoBase)), - IoAddress32 - ); - - IoAddress32 = (Bridge->IoLimitUpper16 << 16 | Bridge->IoLimit << 8); - IoAddress32 |= 0x00000fff; - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32); - - // - // Memory Base & Limit - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MEMORY), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->MemoryBase)), - (Bridge->MemoryBase << 16) & 0xfff00000 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_ONE_VAR), - gShellDebug1HiiHandle, - (Bridge->MemoryLimit << 16) | 0x000fffff - ); - - // - // Pre-fetch-able Memory Base & Limit - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_PREFETCHABLE), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->PrefetchableMemoryBase)), - Bridge->PrefetchableBaseUpper32, - (Bridge->PrefetchableMemoryBase << 16) & 0xfff00000 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_TWO_VARS_2), - gShellDebug1HiiHandle, - Bridge->PrefetchableLimitUpper32, - (Bridge->PrefetchableMemoryLimit << 16) | 0x000fffff - ); - - // - // Print register Capabilities Pointer - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->CapabilityPtr)), - Bridge->CapabilityPtr - ); - - // - // Print register Bridge Control - // - PciExplainBridgeControl (&(Bridge->BridgeControl), PciP2pBridge); - - // - // Print register Interrupt Line & PIN - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->InterruptLine)), - Bridge->InterruptLine - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_INTERRUPT_PIN), - gShellDebug1HiiHandle, - INDEX_OF (&(Bridge->InterruptPin)), - Bridge->InterruptPin - ); - - return EFI_SUCCESS; -} - -/** - Explain the Base Address Register(Bar) in PCI configuration space. - - @param[in] Bar Points to the Base Address Register intended to interpret. - @param[in] Command Points to the register Command. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - @param[in, out] Index The Index. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBar ( - IN UINT32 *Bar, - IN UINT16 *Command, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, - IN OUT UINTN *Index - ) -{ - UINT16 OldCommand; - UINT16 NewCommand; - UINT64 Bar64; - UINT32 OldBar32; - UINT32 NewBar32; - UINT64 OldBar64; - UINT64 NewBar64; - BOOLEAN IsMem; - BOOLEAN IsBar32; - UINT64 RegAddress; - - IsBar32 = TRUE; - Bar64 = 0; - NewBar32 = 0; - NewBar64 = 0; - - // - // According the bar type, list detail about this bar, for example: 32 or - // 64 bits; pre-fetchable or not. - // - if ((*Bar & BIT0) == 0) { - // - // This bar is of memory type - // - IsMem = TRUE; - - if ((*Bar & BIT1) == 0 && (*Bar & BIT2) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle); - - } else if ((*Bar & BIT1) == 0 && (*Bar & BIT2) != 0) { - Bar64 = 0x0; - CopyMem (&Bar64, Bar, sizeof (UINT64)); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32) RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32)); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0ULL)); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle); - IsBar32 = FALSE; - *Index += 1; - - } else { - // - // Reserved - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM_2), gShellDebug1HiiHandle); - } - - if ((*Bar & BIT3) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO), gShellDebug1HiiHandle); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_YES), gShellDebug1HiiHandle); - } - - } else { - // - // This bar is of io type - // - IsMem = FALSE; - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc); - ShellPrintEx (-1, -1, L"I/O "); - } - - // - // Get BAR length(or the amount of resource this bar demands for). To get - // Bar length, first we should temporarily disable I/O and memory access - // of this function(by set bits in the register Command), then write all - // "1"s to this bar. The bar value read back is the amount of resource - // this bar demands for. - // - // - // Disable io & mem access - // - OldCommand = *Command; - NewCommand = (UINT16) (OldCommand & 0xfffc); - RegAddress = Address | INDEX_OF (Command); - IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &NewCommand); - - RegAddress = Address | INDEX_OF (Bar); - - // - // Read after write the BAR to get the size - // - if (IsBar32) { - OldBar32 = *Bar; - NewBar32 = 0xffffffff; - - IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32); - IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32); - IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &OldBar32); - - if (IsMem) { - NewBar32 = NewBar32 & 0xfffffff0; - NewBar32 = (~NewBar32) + 1; - - } else { - NewBar32 = NewBar32 & 0xfffffffc; - NewBar32 = (~NewBar32) + 1; - NewBar32 = NewBar32 & 0x0000ffff; - } - } else { - - OldBar64 = 0x0; - CopyMem (&OldBar64, Bar, sizeof (UINT64)); - NewBar64 = 0xffffffffffffffffULL; - - IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64); - IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64); - IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &OldBar64); - - if (IsMem) { - NewBar64 = NewBar64 & 0xfffffffffffffff0ULL; - NewBar64 = (~NewBar64) + 1; - - } else { - NewBar64 = NewBar64 & 0xfffffffffffffffcULL; - NewBar64 = (~NewBar64) + 1; - NewBar64 = NewBar64 & 0x000000000000ffff; - } - } - // - // Enable io & mem access - // - RegAddress = Address | INDEX_OF (Command); - IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &OldCommand); - - if (IsMem) { - if (IsBar32) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32), gShellDebug1HiiHandle, NewBar32); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_2), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffff0) - 1); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) RShiftU64 (NewBar64, 32)); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) NewBar64); - ShellPrintEx (-1, -1, L" "); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_RSHIFT), - gShellDebug1HiiHandle, - (UINT32) RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32) - ); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1)); - - } - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_3), gShellDebug1HiiHandle, NewBar32); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_4), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffffc) - 1); - } - - return EFI_SUCCESS; -} - -/** - Explain the cardbus specific part of data in PCI configuration space. - - @param[in] CardBus CardBus specific region of PCI configuration space. - @param[in] Address Address used to access configuration space of this PCI device. - @param[in] IoDev Handle used to access configuration space of PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainCardBusData ( - IN PCI_CARDBUS_CONTROL_REGISTER *CardBus, - IN UINT64 Address, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev - ) -{ - BOOLEAN Io32Bit; - PCI_CARDBUS_DATA *CardBusData; - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CARDBUS_SOCKET), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->CardBusSocketReg)), - CardBus->CardBusSocketReg - ); - - // - // Print Secondary Status - // - PciExplainStatus (&(CardBus->SecondaryStatus), FALSE, PciCardBusBridge); - - // - // Print Bus Numbers(Primary bus number, CardBus bus number, and - // Subordinate bus number - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_BUS_NUMBERS_2), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->PciBusNumber)), - INDEX_OF (&(CardBus->CardBusBusNumber)), - INDEX_OF (&(CardBus->SubordinateBusNumber)) - ); - - ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n"); - - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_2), gShellDebug1HiiHandle, CardBus->CardBusBusNumber); - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_3), gShellDebug1HiiHandle, CardBus->SubordinateBusNumber); - - // - // Print CardBus Latency Timer - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CARDBUS_LATENCY), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->CardBusLatencyTimer)), - CardBus->CardBusLatencyTimer - ); - - // - // Print Memory/Io ranges this cardbus bridge forwards - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle); - ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n"); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MEM_3), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->MemoryBase0)), - CardBus->BridgeControl & BIT8 ? L" Prefetchable" : L"Non-Prefetchable", - CardBus->MemoryBase0 & 0xfffff000, - CardBus->MemoryLimit0 | 0x00000fff - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MEM_3), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->MemoryBase1)), - CardBus->BridgeControl & BIT9 ? L" Prefetchable" : L"Non-Prefetchable", - CardBus->MemoryBase1 & 0xfffff000, - CardBus->MemoryLimit1 | 0x00000fff - ); - - Io32Bit = (BOOLEAN) (CardBus->IoBase0 & BIT0); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_IO_2), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->IoBase0)), - Io32Bit ? L" 32 bit" : L" 16 bit", - CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc), - (CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003 - ); - - Io32Bit = (BOOLEAN) (CardBus->IoBase1 & BIT0); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_IO_2), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->IoBase1)), - Io32Bit ? L" 32 bit" : L" 16 bit", - CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc), - (CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003 - ); - - // - // Print register Interrupt Line & PIN - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_3), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBus->InterruptLine)), - CardBus->InterruptLine, - INDEX_OF (&(CardBus->InterruptPin)), - CardBus->InterruptPin - ); - - // - // Print register Bridge Control - // - PciExplainBridgeControl (&(CardBus->BridgeControl), PciCardBusBridge); - - // - // Print some registers in data region of PCI configuration space for cardbus - // bridge. Fields include: Sub VendorId, Subsystem ID, and Legacy Mode Base - // Address. - // - CardBusData = (PCI_CARDBUS_DATA *) ((UINT8 *) CardBus + sizeof (PCI_CARDBUS_CONTROL_REGISTER)); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID_2), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBusData->SubVendorId)), - CardBusData->SubVendorId, - INDEX_OF (&(CardBusData->SubSystemId)), - CardBusData->SubSystemId - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_OPTIONAL), - gShellDebug1HiiHandle, - INDEX_OF (&(CardBusData->LegacyBase)), - CardBusData->LegacyBase - ); - - return EFI_SUCCESS; -} - -/** - Explain each meaningful bit of register Status. The definition of Status is - slightly different depending on the PCI header type. - - @param[in] Status Points to the content of register Status. - @param[in] MainStatus Indicates if this register is main status(not secondary - status). - @param[in] HeaderType Header type of this PCI device. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainStatus ( - IN UINT16 *Status, - IN BOOLEAN MainStatus, - IN PCI_HEADER_TYPE HeaderType - ) -{ - if (MainStatus) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SECONDARY_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status); - } - - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES), gShellDebug1HiiHandle, (*Status & BIT4) != 0); - - // - // Bit 5 is meaningless for CardBus Bridge - // - if (HeaderType == PciCardBusBridge) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE), gShellDebug1HiiHandle, (*Status & BIT5) != 0); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE_2), gShellDebug1HiiHandle, (*Status & BIT5) != 0); - } - - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST_BACK), gShellDebug1HiiHandle, (*Status & BIT7) != 0); - - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MASTER_DATA), gShellDebug1HiiHandle, (*Status & BIT8) != 0); - // - // Bit 9 and bit 10 together decides the DEVSEL timing - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_DEVSEL_TIMING), gShellDebug1HiiHandle); - if ((*Status & BIT9) == 0 && (*Status & BIT10) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST), gShellDebug1HiiHandle); - - } else if ((*Status & BIT9) != 0 && (*Status & BIT10) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEDIUM), gShellDebug1HiiHandle); - - } else if ((*Status & BIT9) == 0 && (*Status & BIT10) != 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SLOW), gShellDebug1HiiHandle); - - } else { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED_2), gShellDebug1HiiHandle); - } - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SIGNALED_TARGET), - gShellDebug1HiiHandle, - (*Status & BIT11) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_RECEIVED_TARGET), - gShellDebug1HiiHandle, - (*Status & BIT12) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_RECEIVED_MASTER), - gShellDebug1HiiHandle, - (*Status & BIT13) != 0 - ); - - if (MainStatus) { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SIGNALED_ERROR), - gShellDebug1HiiHandle, - (*Status & BIT14) != 0 - ); - - } else { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_RECEIVED_ERROR), - gShellDebug1HiiHandle, - (*Status & BIT14) != 0 - ); - } - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_DETECTED_ERROR), - gShellDebug1HiiHandle, - (*Status & BIT15) != 0 - ); - - return EFI_SUCCESS; -} - -/** - Explain each meaningful bit of register Command. - - @param[in] Command Points to the content of register Command. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainCommand ( - IN UINT16 *Command - ) -{ - // - // Print the binary value of register Command - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_COMMAND), gShellDebug1HiiHandle, INDEX_OF (Command), *Command); - - // - // Explain register Command bit by bit - // - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SPACE_ACCESS_DENIED), - gShellDebug1HiiHandle, - (*Command & BIT0) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MEMORY_SPACE), - gShellDebug1HiiHandle, - (*Command & BIT1) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_BEHAVE_BUS_MASTER), - gShellDebug1HiiHandle, - (*Command & BIT2) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MONITOR_SPECIAL_CYCLE), - gShellDebug1HiiHandle, - (*Command & BIT3) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MEM_WRITE_INVALIDATE), - gShellDebug1HiiHandle, - (*Command & BIT4) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_PALETTE_SNOOPING), - gShellDebug1HiiHandle, - (*Command & BIT5) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_ASSERT_PERR), - gShellDebug1HiiHandle, - (*Command & BIT6) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_DO_ADDR_STEPPING), - gShellDebug1HiiHandle, - (*Command & BIT7) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SERR_DRIVER), - gShellDebug1HiiHandle, - (*Command & BIT8) != 0 - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_FAST_BACK_2), - gShellDebug1HiiHandle, - (*Command & BIT9) != 0 - ); - - return EFI_SUCCESS; -} - -/** - Explain each meaningful bit of register Bridge Control. - - @param[in] BridgeControl Points to the content of register Bridge Control. - @param[in] HeaderType The headertype. - - @retval EFI_SUCCESS The command completed successfully. -**/ -EFI_STATUS -PciExplainBridgeControl ( - IN UINT16 *BridgeControl, - IN PCI_HEADER_TYPE HeaderType - ) -{ - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_BRIDGE_CONTROL), - gShellDebug1HiiHandle, - INDEX_OF (BridgeControl), - *BridgeControl - ); - - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_PARITY_ERROR), - gShellDebug1HiiHandle, - (*BridgeControl & BIT0) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SERR_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT1) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_ISA_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT2) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_VGA_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT3) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_MASTER_ABORT), - gShellDebug1HiiHandle, - (*BridgeControl & BIT5) != 0 - ); - - // - // Register Bridge Control has some slight differences between P2P bridge - // and Cardbus bridge from bit 6 to bit 11. - // - if (HeaderType == PciP2pBridge) { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SECONDARY_BUS_RESET), - gShellDebug1HiiHandle, - (*BridgeControl & BIT6) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_FAST_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT7) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_PRIMARY_DISCARD_TIMER), - gShellDebug1HiiHandle, - (*BridgeControl & BIT8)!=0 ? L"2^10" : L"2^15" - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_SECONDARY_DISCARD_TIMER), - gShellDebug1HiiHandle, - (*BridgeControl & BIT9)!=0 ? L"2^10" : L"2^15" - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_DISCARD_TIMER_STATUS), - gShellDebug1HiiHandle, - (*BridgeControl & BIT10) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_DISCARD_TIMER_SERR), - gShellDebug1HiiHandle, - (*BridgeControl & BIT11) != 0 - ); - - } else { - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_CARDBUS_RESET), - gShellDebug1HiiHandle, - (*BridgeControl & BIT6) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_IREQ_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT7) != 0 - ); - ShellPrintHiiEx(-1, -1, NULL, - STRING_TOKEN (STR_PCI2_WRITE_POSTING_ENABLE), - gShellDebug1HiiHandle, - (*BridgeControl & BIT10) != 0 - ); - } - - return EFI_SUCCESS; -} - -/** - Locate capability register block per capability ID. - - @param[in] ConfigSpace Data in PCI configuration space. - @param[in] CapabilityId The capability ID. - - @return The offset of the register block per capability ID, - or 0 if the register block cannot be found. -**/ -UINT8 -LocatePciCapability ( - IN PCI_CONFIG_SPACE *ConfigSpace, - IN UINT8 CapabilityId - ) -{ - UINT8 CapabilityPtr; - EFI_PCI_CAPABILITY_HDR *CapabilityEntry; - - // - // To check the cpability of this device supports - // - if ((ConfigSpace->Common.Status & EFI_PCI_STATUS_CAPABILITY) == 0) { - return 0; - } - - switch ((PCI_HEADER_TYPE)(ConfigSpace->Common.HeaderType & 0x7f)) { - case PciDevice: - CapabilityPtr = ConfigSpace->NonCommon.Device.CapabilityPtr; - break; - case PciP2pBridge: - CapabilityPtr = ConfigSpace->NonCommon.Bridge.CapabilityPtr; - break; - case PciCardBusBridge: - CapabilityPtr = ConfigSpace->NonCommon.CardBus.Cap_Ptr; - break; - default: - return 0; - } - - while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) { - CapabilityEntry = (EFI_PCI_CAPABILITY_HDR *) ((UINT8 *) ConfigSpace + CapabilityPtr); - if (CapabilityEntry->CapabilityID == CapabilityId) { - return CapabilityPtr; - } - - // - // Certain PCI device may incorrectly have capability pointing to itself, - // break to avoid dead loop. - // - if (CapabilityPtr == CapabilityEntry->NextItemPtr) { - break; - } - - CapabilityPtr = CapabilityEntry->NextItemPtr; - } - - return 0; -} - -/** - Print out information of the capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieCapReg ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - CHAR16 *DevicePortType; - - ShellPrintEx (-1, -1, - L" Capability Version(3:0): %E0x%04x%N\r\n", - PciExpressCap->Capability.Bits.Version - ); - if (PciExpressCap->Capability.Bits.DevicePortType < ARRAY_SIZE (DevicePortTypeTable)) { - DevicePortType = DevicePortTypeTable[PciExpressCap->Capability.Bits.DevicePortType]; - } else { - DevicePortType = L"Unknown Type"; - } - ShellPrintEx (-1, -1, - L" Device/PortType(7:4): %E%s%N\r\n", - DevicePortType - ); - // - // 'Slot Implemented' is only valid for: - // a) Root Port of PCI Express Root Complex, or - // b) Downstream Port of PCI Express Switch - // - if (PciExpressCap->Capability.Bits.DevicePortType== PCIE_DEVICE_PORT_TYPE_ROOT_PORT || - PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) { - ShellPrintEx (-1, -1, - L" Slot Implemented(8): %E%d%N\r\n", - PciExpressCap->Capability.Bits.SlotImplemented - ); - } - ShellPrintEx (-1, -1, - L" Interrupt Message Number(13:9): %E0x%05x%N\r\n", - PciExpressCap->Capability.Bits.InterruptMessageNumber - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - UINT8 DevicePortType; - UINT8 L0sLatency; - UINT8 L1Latency; - - DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType; - ShellPrintEx (-1, -1, L" Max_Payload_Size Supported(2:0): "); - if (PciExpressCap->DeviceCapability.Bits.MaxPayloadSize < 6) { - ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceCapability.Bits.MaxPayloadSize + 7)); - } else { - ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); - } - ShellPrintEx (-1, -1, - L" Phantom Functions Supported(4:3): %E%d%N\r\n", - PciExpressCap->DeviceCapability.Bits.PhantomFunctions - ); - ShellPrintEx (-1, -1, - L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\r\n", - PciExpressCap->DeviceCapability.Bits.ExtendedTagField ? 8 : 5 - ); - // - // Endpoint L0s and L1 Acceptable Latency is only valid for Endpoint - // - if (IS_PCIE_ENDPOINT (DevicePortType)) { - L0sLatency = (UINT8)PciExpressCap->DeviceCapability.Bits.EndpointL0sAcceptableLatency; - L1Latency = (UINT8)PciExpressCap->DeviceCapability.Bits.EndpointL1AcceptableLatency; - ShellPrintEx (-1, -1, L" Endpoint L0s Acceptable Latency(8:6): "); - if (L0sLatency < 4) { - ShellPrintEx (-1, -1, L"%EMaximum of %d ns%N\r\n", 1 << (L0sLatency + 6)); - } else { - if (L0sLatency < 7) { - ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L0sLatency - 3)); - } else { - ShellPrintEx (-1, -1, L"%ENo limit%N\r\n"); - } - } - ShellPrintEx (-1, -1, L" Endpoint L1 Acceptable Latency(11:9): "); - if (L1Latency < 7) { - ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L1Latency + 1)); - } else { - ShellPrintEx (-1, -1, L"%ENo limit%N\r\n"); - } - } - ShellPrintEx (-1, -1, - L" Role-based Error Reporting(15): %E%d%N\r\n", - PciExpressCap->DeviceCapability.Bits.RoleBasedErrorReporting - ); - // - // Only valid for Upstream Port: - // a) Captured Slot Power Limit Value - // b) Captured Slot Power Scale - // - if (DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) { - ShellPrintEx (-1, -1, - L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\r\n", - PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitValue - ); - ShellPrintEx (-1, -1, - L" Captured Slot Power Limit Scale(27:26): %E%s%N\r\n", - SlotPwrLmtScaleTable[PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitScale] - ); - } - // - // Function Level Reset Capability is only valid for Endpoint - // - if (IS_PCIE_ENDPOINT (DevicePortType)) { - ShellPrintEx (-1, -1, - L" Function Level Reset Capability(28): %E%d%N\r\n", - PciExpressCap->DeviceCapability.Bits.FunctionLevelReset - ); - } - return EFI_SUCCESS; -} - -/** - Print out information of the device control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" Correctable Error Reporting Enable(0): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.CorrectableError - ); - ShellPrintEx (-1, -1, - L" Non-Fatal Error Reporting Enable(1): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.NonFatalError - ); - ShellPrintEx (-1, -1, - L" Fatal Error Reporting Enable(2): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.FatalError - ); - ShellPrintEx (-1, -1, - L" Unsupported Request Reporting Enable(3): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.UnsupportedRequest - ); - ShellPrintEx (-1, -1, - L" Enable Relaxed Ordering(4): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.RelaxedOrdering - ); - ShellPrintEx (-1, -1, L" Max_Payload_Size(7:5): "); - if (PciExpressCap->DeviceControl.Bits.MaxPayloadSize < 6) { - ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxPayloadSize + 7)); - } else { - ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); - } - ShellPrintEx (-1, -1, - L" Extended Tag Field Enable(8): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.ExtendedTagField - ); - ShellPrintEx (-1, -1, - L" Phantom Functions Enable(9): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.PhantomFunctions - ); - ShellPrintEx (-1, -1, - L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.AuxPower - ); - ShellPrintEx (-1, -1, - L" Enable No Snoop(11): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.NoSnoop - ); - ShellPrintEx (-1, -1, L" Max_Read_Request_Size(14:12): "); - if (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize < 6) { - ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize + 7)); - } else { - ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); - } - // - // Read operation is only valid for PCI Express to PCI/PCI-X Bridges - // - if (PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) { - ShellPrintEx (-1, -1, - L" Bridge Configuration Retry Enable(15): %E%d%N\r\n", - PciExpressCap->DeviceControl.Bits.BridgeConfigurationRetryOrFunctionLevelReset - ); - } - return EFI_SUCCESS; -} - -/** - Print out information of the device status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieDeviceStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" Correctable Error Detected(0): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.CorrectableError - ); - ShellPrintEx (-1, -1, - L" Non-Fatal Error Detected(1): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.NonFatalError - ); - ShellPrintEx (-1, -1, - L" Fatal Error Detected(2): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.FatalError - ); - ShellPrintEx (-1, -1, - L" Unsupported Request Detected(3): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.UnsupportedRequest - ); - ShellPrintEx (-1, -1, - L" AUX Power Detected(4): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.AuxPower - ); - ShellPrintEx (-1, -1, - L" Transactions Pending(5): %E%d%N\r\n", - PciExpressCap->DeviceStatus.Bits.TransactionsPending - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device link information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - CHAR16 *MaxLinkSpeed; - CHAR16 *AspmValue; - - switch (PciExpressCap->LinkCapability.Bits.MaxLinkSpeed) { - case 1: - MaxLinkSpeed = L"2.5 GT/s"; - break; - case 2: - MaxLinkSpeed = L"5.0 GT/s"; - break; - case 3: - MaxLinkSpeed = L"8.0 GT/s"; - break; - default: - MaxLinkSpeed = L"Unknown"; - break; - } - ShellPrintEx (-1, -1, - L" Maximum Link Speed(3:0): %E%s%N\r\n", - MaxLinkSpeed - ); - ShellPrintEx (-1, -1, - L" Maximum Link Width(9:4): %Ex%d%N\r\n", - PciExpressCap->LinkCapability.Bits.MaxLinkWidth - ); - switch (PciExpressCap->LinkCapability.Bits.Aspm) { - case 0: - AspmValue = L"Not"; - break; - case 1: - AspmValue = L"L0s"; - break; - case 2: - AspmValue = L"L1"; - break; - case 3: - AspmValue = L"L0s and L1"; - break; - default: - AspmValue = L"Reserved"; - break; - } - ShellPrintEx (-1, -1, - L" Active State Power Management Support(11:10): %E%s Supported%N\r\n", - AspmValue - ); - ShellPrintEx (-1, -1, - L" L0s Exit Latency(14:12): %E%s%N\r\n", - L0sLatencyStrTable[PciExpressCap->LinkCapability.Bits.L0sExitLatency] - ); - ShellPrintEx (-1, -1, - L" L1 Exit Latency(17:15): %E%s%N\r\n", - L1LatencyStrTable[PciExpressCap->LinkCapability.Bits.L1ExitLatency] - ); - ShellPrintEx (-1, -1, - L" Clock Power Management(18): %E%d%N\r\n", - PciExpressCap->LinkCapability.Bits.ClockPowerManagement - ); - ShellPrintEx (-1, -1, - L" Surprise Down Error Reporting Capable(19): %E%d%N\r\n", - PciExpressCap->LinkCapability.Bits.SurpriseDownError - ); - ShellPrintEx (-1, -1, - L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\r\n", - PciExpressCap->LinkCapability.Bits.DataLinkLayerLinkActive - ); - ShellPrintEx (-1, -1, - L" Link Bandwidth Notification Capability(21): %E%d%N\r\n", - PciExpressCap->LinkCapability.Bits.LinkBandwidthNotification - ); - ShellPrintEx (-1, -1, - L" Port Number(31:24): %E0x%02x%N\r\n", - PciExpressCap->LinkCapability.Bits.PortNumber - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device link control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - UINT8 DevicePortType; - - DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType; - ShellPrintEx (-1, -1, - L" Active State Power Management Control(1:0): %E%s%N\r\n", - ASPMCtrlStrTable[PciExpressCap->LinkControl.Bits.AspmControl] - ); - // - // RCB is not applicable to switches - // - if (!IS_PCIE_SWITCH(DevicePortType)) { - ShellPrintEx (-1, -1, - L" Read Completion Boundary (RCB)(3): %E%d byte%N\r\n", - 1 << (PciExpressCap->LinkControl.Bits.ReadCompletionBoundary + 6) - ); - } - // - // Link Disable is reserved on - // a) Endpoints - // b) PCI Express to PCI/PCI-X bridges - // c) Upstream Ports of Switches - // - if (!IS_PCIE_ENDPOINT (DevicePortType) && - DevicePortType != PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT && - DevicePortType != PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) { - ShellPrintEx (-1, -1, - L" Link Disable(4): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.LinkDisable - ); - } - ShellPrintEx (-1, -1, - L" Common Clock Configuration(6): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.CommonClockConfiguration - ); - ShellPrintEx (-1, -1, - L" Extended Synch(7): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.ExtendedSynch - ); - ShellPrintEx (-1, -1, - L" Enable Clock Power Management(8): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.ClockPowerManagement - ); - ShellPrintEx (-1, -1, - L" Hardware Autonomous Width Disable(9): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.HardwareAutonomousWidthDisable - ); - ShellPrintEx (-1, -1, - L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.LinkBandwidthManagementInterrupt - ); - ShellPrintEx (-1, -1, - L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\r\n", - PciExpressCap->LinkControl.Bits.LinkAutonomousBandwidthInterrupt - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device link status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieLinkStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - CHAR16 *CurLinkSpeed; - - switch (PciExpressCap->LinkStatus.Bits.CurrentLinkSpeed) { - case 1: - CurLinkSpeed = L"2.5 GT/s"; - break; - case 2: - CurLinkSpeed = L"5.0 GT/s"; - break; - case 3: - CurLinkSpeed = L"8.0 GT/s"; - break; - default: - CurLinkSpeed = L"Reserved"; - break; - } - ShellPrintEx (-1, -1, - L" Current Link Speed(3:0): %E%s%N\r\n", - CurLinkSpeed - ); - ShellPrintEx (-1, -1, - L" Negotiated Link Width(9:4): %Ex%d%N\r\n", - PciExpressCap->LinkStatus.Bits.NegotiatedLinkWidth - ); - ShellPrintEx (-1, -1, - L" Link Training(11): %E%d%N\r\n", - PciExpressCap->LinkStatus.Bits.LinkTraining - ); - ShellPrintEx (-1, -1, - L" Slot Clock Configuration(12): %E%d%N\r\n", - PciExpressCap->LinkStatus.Bits.SlotClockConfiguration - ); - ShellPrintEx (-1, -1, - L" Data Link Layer Link Active(13): %E%d%N\r\n", - PciExpressCap->LinkStatus.Bits.DataLinkLayerLinkActive - ); - ShellPrintEx (-1, -1, - L" Link Bandwidth Management Status(14): %E%d%N\r\n", - PciExpressCap->LinkStatus.Bits.LinkBandwidthManagement - ); - ShellPrintEx (-1, -1, - L" Link Autonomous Bandwidth Status(15): %E%d%N\r\n", - PciExpressCap->LinkStatus.Bits.LinkAutonomousBandwidth - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device slot information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" Attention Button Present(0): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.AttentionButton - ); - ShellPrintEx (-1, -1, - L" Power Controller Present(1): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.PowerController - ); - ShellPrintEx (-1, -1, - L" MRL Sensor Present(2): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.MrlSensor - ); - ShellPrintEx (-1, -1, - L" Attention Indicator Present(3): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.AttentionIndicator - ); - ShellPrintEx (-1, -1, - L" Power Indicator Present(4): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.PowerIndicator - ); - ShellPrintEx (-1, -1, - L" Hot-Plug Surprise(5): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.HotPlugSurprise - ); - ShellPrintEx (-1, -1, - L" Hot-Plug Capable(6): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.HotPlugCapable - ); - ShellPrintEx (-1, -1, - L" Slot Power Limit Value(14:7): %E0x%02x%N\r\n", - PciExpressCap->SlotCapability.Bits.SlotPowerLimitValue - ); - ShellPrintEx (-1, -1, - L" Slot Power Limit Scale(16:15): %E%s%N\r\n", - SlotPwrLmtScaleTable[PciExpressCap->SlotCapability.Bits.SlotPowerLimitScale] - ); - ShellPrintEx (-1, -1, - L" Electromechanical Interlock Present(17): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.ElectromechanicalInterlock - ); - ShellPrintEx (-1, -1, - L" No Command Completed Support(18): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.NoCommandCompleted - ); - ShellPrintEx (-1, -1, - L" Physical Slot Number(31:19): %E%d%N\r\n", - PciExpressCap->SlotCapability.Bits.PhysicalSlotNumber - ); - - return EFI_SUCCESS; -} - -/** - Print out information of the device slot control information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" Attention Button Pressed Enable(0): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.AttentionButtonPressed - ); - ShellPrintEx (-1, -1, - L" Power Fault Detected Enable(1): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.PowerFaultDetected - ); - ShellPrintEx (-1, -1, - L" MRL Sensor Changed Enable(2): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.MrlSensorChanged - ); - ShellPrintEx (-1, -1, - L" Presence Detect Changed Enable(3): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.PresenceDetectChanged - ); - ShellPrintEx (-1, -1, - L" Command Completed Interrupt Enable(4): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.CommandCompletedInterrupt - ); - ShellPrintEx (-1, -1, - L" Hot-Plug Interrupt Enable(5): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.HotPlugInterrupt - ); - ShellPrintEx (-1, -1, - L" Attention Indicator Control(7:6): %E%s%N\r\n", - IndicatorTable[ - PciExpressCap->SlotControl.Bits.AttentionIndicator] - ); - ShellPrintEx (-1, -1, - L" Power Indicator Control(9:8): %E%s%N\r\n", - IndicatorTable[PciExpressCap->SlotControl.Bits.PowerIndicator] - ); - ShellPrintEx (-1, -1, L" Power Controller Control(10): %EPower "); - if ( - PciExpressCap->SlotControl.Bits.PowerController) { - ShellPrintEx (-1, -1, L"Off%N\r\n"); - } else { - ShellPrintEx (-1, -1, L"On%N\r\n"); - } - ShellPrintEx (-1, -1, - L" Electromechanical Interlock Control(11): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.ElectromechanicalInterlock - ); - ShellPrintEx (-1, -1, - L" Data Link Layer State Changed Enable(12): %E%d%N\r\n", - PciExpressCap->SlotControl.Bits.DataLinkLayerStateChanged - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device slot status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieSlotStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" Attention Button Pressed(0): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.AttentionButtonPressed - ); - ShellPrintEx (-1, -1, - L" Power Fault Detected(1): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.PowerFaultDetected - ); - ShellPrintEx (-1, -1, - L" MRL Sensor Changed(2): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.MrlSensorChanged - ); - ShellPrintEx (-1, -1, - L" Presence Detect Changed(3): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.PresenceDetectChanged - ); - ShellPrintEx (-1, -1, - L" Command Completed(4): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.CommandCompleted - ); - ShellPrintEx (-1, -1, L" MRL Sensor State(5): %EMRL "); - if ( - PciExpressCap->SlotStatus.Bits.MrlSensor) { - ShellPrintEx (-1, -1, L" Opened%N\r\n"); - } else { - ShellPrintEx (-1, -1, L" Closed%N\r\n"); - } - ShellPrintEx (-1, -1, L" Presence Detect State(6): "); - if ( - PciExpressCap->SlotStatus.Bits.PresenceDetect) { - ShellPrintEx (-1, -1, L"%ECard Present in slot%N\r\n"); - } else { - ShellPrintEx (-1, -1, L"%ESlot Empty%N\r\n"); - } - ShellPrintEx (-1, -1, L" Electromechanical Interlock Status(7): %EElectromechanical Interlock "); - if ( - PciExpressCap->SlotStatus.Bits.ElectromechanicalInterlock) { - ShellPrintEx (-1, -1, L"Engaged%N\r\n"); - } else { - ShellPrintEx (-1, -1, L"Disengaged%N\r\n"); - } - ShellPrintEx (-1, -1, - L" Data Link Layer State Changed(8): %E%d%N\r\n", - PciExpressCap->SlotStatus.Bits.DataLinkLayerStateChanged - ); - return EFI_SUCCESS; -} - -/** - Print out information of the device root information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootControl ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" System Error on Correctable Error Enable(0): %E%d%N\r\n", - PciExpressCap->RootControl.Bits.SystemErrorOnCorrectableError - ); - ShellPrintEx (-1, -1, - L" System Error on Non-Fatal Error Enable(1): %E%d%N\r\n", - PciExpressCap->RootControl.Bits.SystemErrorOnNonFatalError - ); - ShellPrintEx (-1, -1, - L" System Error on Fatal Error Enable(2): %E%d%N\r\n", - PciExpressCap->RootControl.Bits.SystemErrorOnFatalError - ); - ShellPrintEx (-1, -1, - L" PME Interrupt Enable(3): %E%d%N\r\n", - PciExpressCap->RootControl.Bits.PmeInterrupt - ); - ShellPrintEx (-1, -1, - L" CRS Software Visibility Enable(4): %E%d%N\r\n", - PciExpressCap->RootControl.Bits.CrsSoftwareVisibility - ); - - return EFI_SUCCESS; -} - -/** - Print out information of the device root capability information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootCap ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" CRS Software Visibility(0): %E%d%N\r\n", - PciExpressCap->RootCapability.Bits.CrsSoftwareVisibility - ); - - return EFI_SUCCESS; -} - -/** - Print out information of the device root status information. - - @param[in] PciExpressCap The pointer to the structure about the device. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ExplainPcieRootStatus ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - ShellPrintEx (-1, -1, - L" PME Requester ID(15:0): %E0x%04x%N\r\n", - PciExpressCap->RootStatus.Bits.PmeRequesterId - ); - ShellPrintEx (-1, -1, - L" PME Status(16): %E%d%N\r\n", - PciExpressCap->RootStatus.Bits.PmeStatus - ); - ShellPrintEx (-1, -1, - L" PME Pending(17): %E%d%N\r\n", - PciExpressCap->RootStatus.Bits.PmePending - ); - return EFI_SUCCESS; -} - -/** - Function to interpret and print out the link control structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityLinkControl ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_LINK_CONTROL), - gShellDebug1HiiHandle, - Header->RootComplexLinkCapabilities, - Header->RootComplexLinkControl, - Header->RootComplexLinkStatus - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the power budgeting structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityPowerBudgeting ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_POWER), - gShellDebug1HiiHandle, - Header->DataSelect, - Header->Data, - Header->PowerBudgetCapability - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the ACS structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityAcs ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED *Header; - UINT16 VectorSize; - UINT16 LoopCounter; - - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED*)HeaderAddress; - VectorSize = 0; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_ACS), - gShellDebug1HiiHandle, - Header->AcsCapability, - Header->AcsControl - ); - if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(Header)) { - VectorSize = PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(Header); - if (VectorSize == 0) { - VectorSize = 256; - } - for (LoopCounter = 0 ; LoopCounter * 8 < VectorSize ; LoopCounter++) { - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_ACS2), - gShellDebug1HiiHandle, - LoopCounter + 1, - Header->EgressControlVectorArray[LoopCounter] - ); - } - } - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED) + (VectorSize / 8) - 1, - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the latency tolerance reporting structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityLatencyToleranceReporting ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_LAT), - gShellDebug1HiiHandle, - Header->MaxSnoopLatency, - Header->MaxNoSnoopLatency - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the serial number structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilitySerialNumber ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_SN), - gShellDebug1HiiHandle, - Header->SerialNumber - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the RCRB structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityRcrb ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_RCRB), - gShellDebug1HiiHandle, - Header->VendorId, - Header->DeviceId, - Header->RcrbCapabilities, - Header->RcrbControl - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the vendor specific structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityVendorSpecific ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_VEN), - gShellDebug1HiiHandle, - Header->VendorSpecificHeader - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(Header), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the Event Collector Endpoint Association structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityECEA ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_ECEA), - gShellDebug1HiiHandle, - Header->AssociationBitmap - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the ARI structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityAri ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_ARI), - gShellDebug1HiiHandle, - Header->AriCapability, - Header->AriControl - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the DPA structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityDynamicPowerAllocation ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *Header; - UINT8 LinkCount; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_DPA), - gShellDebug1HiiHandle, - Header->DpaCapability, - Header->DpaLatencyIndicator, - Header->DpaStatus, - Header->DpaControl - ); - for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header) + 1 ; LinkCount++) { - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_DPA2), - gShellDebug1HiiHandle, - LinkCount+1, - Header->DpaPowerAllocationArray[LinkCount] - ); - } - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the link declaration structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityLinkDeclaration ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION *Header; - UINT8 LinkCount; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR), - gShellDebug1HiiHandle, - Header->ElementSelfDescription - ); - - for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header) ; LinkCount++) { - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR2), - gShellDebug1HiiHandle, - LinkCount+1, - Header->LinkEntry[LinkCount] - ); - } - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header)-1)*sizeof(UINT32), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the Advanced Error Reporting structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityAer ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_AER), - gShellDebug1HiiHandle, - Header->UncorrectableErrorStatus, - Header->UncorrectableErrorMask, - Header->UncorrectableErrorSeverity, - Header->CorrectableErrorStatus, - Header->CorrectableErrorMask, - Header->AdvancedErrorCapabilitiesAndControl, - Header->HeaderLog[0], - Header->HeaderLog[1], - Header->HeaderLog[2], - Header->HeaderLog[3], - Header->RootErrorCommand, - Header->RootErrorStatus, - Header->ErrorSourceIdentification, - Header->CorrectableErrorSourceIdentification, - Header->TlpPrefixLog[0], - Header->TlpPrefixLog[1], - Header->TlpPrefixLog[2], - Header->TlpPrefixLog[3] - ); - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING), - (VOID *) (HeaderAddress) - ); - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the multicast structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. - @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityMulticast ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, - IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_MULTICAST), - gShellDebug1HiiHandle, - Header->MultiCastCapability, - Header->MulticastControl, - Header->McBaseAddress, - Header->McReceiveAddress, - Header->McBlockAll, - Header->McBlockUntranslated, - Header->McOverlayBar - ); - - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST), - (VOID *) (HeaderAddress) - ); - - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the virtual channel and multi virtual channel structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityVirtualChannel ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY *Header; - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC *CapabilityItem; - UINT32 ItemCount; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_VC_BASE), - gShellDebug1HiiHandle, - Header->ExtendedVcCount, - Header->PortVcCapability1, - Header->PortVcCapability2, - Header->VcArbTableOffset, - Header->PortVcControl, - Header->PortVcStatus - ); - for (ItemCount = 0 ; ItemCount < Header->ExtendedVcCount ; ItemCount++) { - CapabilityItem = &Header->Capability[ItemCount]; - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_VC_ITEM), - gShellDebug1HiiHandle, - ItemCount+1, - CapabilityItem->VcResourceCapability, - CapabilityItem->PortArbTableOffset, - CapabilityItem->VcResourceControl, - CapabilityItem->VcResourceStatus - ); - } - - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY) - + Header->ExtendedVcCount * sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC), - (VOID *) (HeaderAddress) - ); - - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the resizeable bar structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityResizeableBar ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *Header; - UINT32 ItemCount; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR*)HeaderAddress; - - for (ItemCount = 0 ; ItemCount < (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) ; ItemCount++) { - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR), - gShellDebug1HiiHandle, - ItemCount+1, - Header->Capability[ItemCount].ResizableBarCapability, - Header->Capability[ItemCount].ResizableBarControl - ); - } - - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY), - (VOID *) (HeaderAddress) - ); - - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the TPH structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilityTph ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_TPH), - gShellDebug1HiiHandle, - Header->TphRequesterCapability, - Header->TphRequesterControl - ); - DumpHex ( - 8, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->TphStTable - (UINT8*)HeadersBaseAddress), - GET_TPH_TABLE_SIZE(Header), - (VOID *)Header->TphStTable - ); - - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) + GET_TPH_TABLE_SIZE(Header) - sizeof(UINT16), - (VOID *) (HeaderAddress) - ); - - return (EFI_SUCCESS); -} - -/** - Function to interpret and print out the secondary PCIe capability structure - - @param[in] HeaderAddress The Address of this capability header. - @param[in] HeadersBaseAddress The address of all the extended capability headers. - @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. -**/ -EFI_STATUS -PrintInterpretedExtendedCompatibilitySecondary ( - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, - IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCap - ) -{ - CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *Header; - Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE*)HeaderAddress; - - ShellPrintHiiEx( - -1, -1, NULL, - STRING_TOKEN (STR_PCI_EXT_CAP_SECONDARY), - gShellDebug1HiiHandle, - Header->LinkControl3.Uint32, - Header->LaneErrorStatus - ); - DumpHex ( - 8, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->EqualizationControl - (UINT8*)HeadersBaseAddress), - PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL), - (VOID *)Header->EqualizationControl - ); - - DumpHex ( - 4, - EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), - sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE) - sizeof (Header->EqualizationControl) - + PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL), - (VOID *) (HeaderAddress) - ); - - return (EFI_SUCCESS); -} - -/** - Display Pcie extended capability details - - @param[in] HeadersBaseAddress The address of all the extended capability headers. - @param[in] HeaderAddress The address of this capability header. - @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. -**/ -EFI_STATUS -PrintPciExtendedCapabilityDetails( - IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, - IN CONST PCI_EXP_EXT_HDR *HeaderAddress, - IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr - ) -{ - switch (HeaderAddress->CapabilityId){ - case PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID: - return PrintInterpretedExtendedCompatibilityAer(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID: - return PrintInterpretedExtendedCompatibilityLinkControl(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID: - return PrintInterpretedExtendedCompatibilityLinkDeclaration(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID: - return PrintInterpretedExtendedCompatibilitySerialNumber(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID: - return PrintInterpretedExtendedCompatibilityPowerBudgeting(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID: - return PrintInterpretedExtendedCompatibilityAcs(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID: - return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID: - return PrintInterpretedExtendedCompatibilityAri(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID: - return PrintInterpretedExtendedCompatibilityRcrb(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID: - return PrintInterpretedExtendedCompatibilityVendorSpecific(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID: - return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID: - return PrintInterpretedExtendedCompatibilityECEA(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID: - case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID: - return PrintInterpretedExtendedCompatibilityVirtualChannel(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID: - // - // should only be present if PCIE_CAP_DEVICEPORT_TYPE(PciExpressCapPtr->PcieCapReg) == 0100b, 0101b, or 0110b - // - return PrintInterpretedExtendedCompatibilityMulticast(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr); - case PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID: - return PrintInterpretedExtendedCompatibilityResizeableBar(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID: - return PrintInterpretedExtendedCompatibilityTph(HeaderAddress, HeadersBaseAddress); - case PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID: - return PrintInterpretedExtendedCompatibilitySecondary(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr); - default: - ShellPrintEx (-1, -1, - L"Unknown PCIe extended capability ID (%04xh). No interpretation available.\r\n", - HeaderAddress->CapabilityId - ); - return EFI_SUCCESS; - }; - -} - -/** - Display Pcie device structure. - - @param[in] PciExpressCap PCI Express capability buffer. - @param[in] ExtendedConfigSpace PCI Express extended configuration space. - @param[in] ExtendedCapability PCI Express extended capability ID to explain. -**/ -VOID -PciExplainPciExpress ( - IN PCI_CAPABILITY_PCIEXP *PciExpressCap, - IN UINT8 *ExtendedConfigSpace, - IN CONST UINT16 ExtendedCapability - ) -{ - UINT8 DevicePortType; - UINTN Index; - UINT8 *RegAddr; - UINTN RegValue; - PCI_EXP_EXT_HDR *ExtHdr; - - DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType; - - ShellPrintEx (-1, -1, L"\r\nPci Express device capability structure:\r\n"); - - for (Index = 0; PcieExplainList[Index].Type < PcieExplainTypeMax; Index++) { - if (ShellGetExecutionBreakFlag()) { - return; - } - RegAddr = (UINT8 *) PciExpressCap + PcieExplainList[Index].Offset; - switch (PcieExplainList[Index].Width) { - case FieldWidthUINT8: - RegValue = *(UINT8 *) RegAddr; - break; - case FieldWidthUINT16: - RegValue = *(UINT16 *) RegAddr; - break; - case FieldWidthUINT32: - RegValue = *(UINT32 *) RegAddr; - break; - default: - RegValue = 0; - break; - } - ShellPrintHiiEx(-1, -1, NULL, - PcieExplainList[Index].Token, - gShellDebug1HiiHandle, - PcieExplainList[Index].Offset, - RegValue - ); - if (PcieExplainList[Index].Func == NULL) { - continue; - } - switch (PcieExplainList[Index].Type) { - case PcieExplainTypeLink: - // - // Link registers should not be used by - // a) Root Complex Integrated Endpoint - // b) Root Complex Event Collector - // - if (DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT || - DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_EVENT_COLLECTOR) { - continue; - } - break; - case PcieExplainTypeSlot: - // - // Slot registers are only valid for - // a) Root Port of PCI Express Root Complex - // b) Downstream Port of PCI Express Switch - // and when SlotImplemented bit is set in PCIE cap register. - // - if ((DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT && - DevicePortType != PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) || - !PciExpressCap->Capability.Bits.SlotImplemented) { - continue; - } - break; - case PcieExplainTypeRoot: - // - // Root registers are only valid for - // Root Port of PCI Express Root Complex - // - if (DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT) { - continue; - } - break; - default: - break; - } - PcieExplainList[Index].Func (PciExpressCap); - } - - ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace; - while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) { - // - // Process this item - // - if (ExtendedCapability == 0xFFFF || ExtendedCapability == ExtHdr->CapabilityId) { - // - // Print this item - // - PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExtendedConfigSpace, ExtHdr, PciExpressCap); - } - - // - // Advance to the next item if it exists - // - if (ExtHdr->NextCapabilityOffset != 0) { - ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET); - } else { - break; - } - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h deleted file mode 100644 index b470b04..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - Header file for Pci shell Debug1 function. - - Copyright (c) 2013 Hewlett-Packard Development Company, L.P. - Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EFI_SHELL_PCI_H_ -#define _EFI_SHELL_PCI_H_ - -typedef enum { - PciDevice, - PciP2pBridge, - PciCardBusBridge, - PciUndefined -} PCI_HEADER_TYPE; - -#define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace) - -#define IS_PCIE_ENDPOINT(DevicePortType) \ - ((DevicePortType) == PCIE_DEVICE_PORT_TYPE_PCIE_ENDPOINT || \ - (DevicePortType) == PCIE_DEVICE_PORT_TYPE_LEGACY_PCIE_ENDPOINT || \ - (DevicePortType) == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) - -#define IS_PCIE_SWITCH(DevicePortType) \ - ((DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) || \ - (DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT)) - -#pragma pack(1) -// -// Data region after PCI configuration header(for cardbus bridge) -// -typedef struct { - UINT16 SubVendorId; // Subsystem Vendor ID - UINT16 SubSystemId; // Subsystem ID - UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy - // Mode Base Address - // - UINT32 Data[46]; -} PCI_CARDBUS_DATA; - -typedef union { - PCI_DEVICE_HEADER_TYPE_REGION Device; - PCI_BRIDGE_CONTROL_REGISTER Bridge; - PCI_CARDBUS_CONTROL_REGISTER CardBus; -} NON_COMMON_UNION; - -typedef struct { - PCI_DEVICE_INDEPENDENT_REGION Common; - NON_COMMON_UNION NonCommon; - UINT32 Data[48]; -} PCI_CONFIG_SPACE; - -#pragma pack() - -#endif // _PCI_H_ diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c deleted file mode 100644 index 2ffa30b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c +++ /dev/null @@ -1,371 +0,0 @@ -/** @file - Main file for SerMode shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include -#include - -/** - Display information about a serial device by it's handle. - - If HandleValid is FALSE, do all devices. - - @param[in] HandleIdx The handle index for the device. - @param[in] HandleValid TRUE if HandleIdx is valid. - - @retval SHELL_INVALID_PARAMETER A parameter was invalid. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -DisplaySettings ( - IN UINTN HandleIdx, - IN BOOLEAN HandleValid - ) -{ - EFI_SERIAL_IO_PROTOCOL *SerialIo; - UINTN NoHandles; - EFI_HANDLE *Handles; - EFI_STATUS Status; - UINTN Index; - CHAR16 *StopBits; - CHAR16 Parity; - SHELL_STATUS ShellStatus; - - Handles = NULL; - StopBits = NULL; - - ShellStatus = SHELL_SUCCESS; - - Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode"); - return SHELL_INVALID_PARAMETER; - } - - for (Index = 0; Index < NoHandles; Index++) { - if (HandleValid) { - if (ConvertHandleIndexToHandle(HandleIdx) != Handles[Index]) { - continue; - } - } - - Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo); - if (!EFI_ERROR (Status)) { - switch (SerialIo->Mode->Parity) { - case DefaultParity: - - Parity = 'D'; - break; - - case NoParity: - - Parity = 'N'; - break; - - case EvenParity: - - Parity = 'E'; - break; - - case OddParity: - - Parity = 'O'; - break; - - case MarkParity: - - Parity = 'M'; - break; - - case SpaceParity: - - Parity = 'S'; - break; - - default: - - Parity = 'U'; - } - - switch (SerialIo->Mode->StopBits) { - case DefaultStopBits: - - StopBits = L"Default"; - break; - - case OneStopBit: - - StopBits = L"1"; - break; - - case TwoStopBits: - - StopBits = L"2"; - break; - - case OneFiveStopBits: - - StopBits = L"1.5"; - break; - - default: - - StopBits = L"Unknown"; - } - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SERMODE_DISPLAY), - gShellDebug1HiiHandle, - ConvertHandleToHandleIndex (Handles[Index]), - Handles[Index], - SerialIo->Mode->BaudRate, - Parity, - SerialIo->Mode->DataBits, - StopBits - ); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode"); - ShellStatus = SHELL_NOT_FOUND; - break; - } - - if (HandleValid) { - break; - } - } - - if (Index == NoHandles) { - if ((NoHandles != 0 && HandleValid) || 0 == NoHandles) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NOT_FOUND), gShellDebug1HiiHandle, L"sermode"); - ShellStatus = SHELL_NOT_FOUND; - } - } - - return ShellStatus; -} - -/** - Function for 'sermode' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSerMode ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - UINTN Index; - UINTN NoHandles; - EFI_HANDLE *Handles; - EFI_PARITY_TYPE Parity; - EFI_STOP_BITS_TYPE StopBits; - UINTN HandleIdx; - UINTN BaudRate; - UINTN DataBits; - UINTN Value; - EFI_SERIAL_IO_PROTOCOL *SerialIo; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *Temp; - UINT64 Intermediate; - - ShellStatus = SHELL_SUCCESS; - HandleIdx = 0; - Parity = DefaultParity; - Handles = NULL; - NoHandles = 0; - Index = 0; - Package = NULL; - - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"sermode", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) < 6 && ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"sermode"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) > 6) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"sermode"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Temp = ShellCommandLineGetRawValue(Package, 1); - if (Temp != NULL) { - Status = ShellConvertStringToUint64(Temp, &Intermediate, TRUE, FALSE); - HandleIdx = (UINTN)Intermediate; - Temp = ShellCommandLineGetRawValue(Package, 2); - if (Temp == NULL) { - ShellStatus = DisplaySettings (HandleIdx, TRUE); - goto Done; - } - } else { - ShellStatus = DisplaySettings (0, FALSE); - goto Done; - } - Temp = ShellCommandLineGetRawValue(Package, 2); - if (Temp != NULL) { - BaudRate = ShellStrToUintn(Temp); - } else { - ASSERT(FALSE); - BaudRate = 0; - } - Temp = ShellCommandLineGetRawValue(Package, 3); - if (Temp == NULL || StrLen(Temp)>1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - switch(Temp[0]){ - case 'd': - case 'D': - Parity = DefaultParity; - break; - case 'n': - case 'N': - Parity = NoParity; - break; - case 'e': - case 'E': - Parity = EvenParity; - break; - case 'o': - case 'O': - Parity = OddParity; - break; - case 'm': - case 'M': - Parity = MarkParity; - break; - case 's': - case 'S': - Parity = SpaceParity; - break; - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - Temp = ShellCommandLineGetRawValue(Package, 4); - if (Temp != NULL) { - DataBits = ShellStrToUintn(Temp); - } else { - // - // make sure this is some number not in the list below. - // - DataBits = 0; - } - switch (DataBits) { - case 4: - case 7: - case 8: - break; - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - Temp = ShellCommandLineGetRawValue(Package, 5); - Value = ShellStrToUintn(Temp); - switch (Value) { - case 0: - StopBits = DefaultStopBits; - break; - - case 1: - StopBits = OneStopBit; - break; - - case 2: - StopBits = TwoStopBits; - break; - - case 15: - StopBits = OneFiveStopBits; - break; - - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - for (Index = 0; Index < NoHandles; Index++) { - if (ConvertHandleIndexToHandle (HandleIdx) != Handles[Index]) { - continue; - } - - Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo); - if (!EFI_ERROR (Status)) { - Status = SerialIo->SetAttributes ( - SerialIo, - (UINT64) BaudRate, - SerialIo->Mode->ReceiveFifoDepth, - SerialIo->Mode->Timeout, - Parity, - (UINT8) DataBits, - StopBits - ); - if (EFI_ERROR (Status)) { - if (Status == EFI_INVALID_PARAMETER) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_UNSUPPORTED), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); - ShellStatus = SHELL_UNSUPPORTED; - } else if (Status == EFI_DEVICE_ERROR) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_DEV_ERROR), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); - ShellStatus = SHELL_ACCESS_DENIED; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); - ShellStatus = SHELL_ACCESS_DENIED; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index])); - } - break; - } - } - } - } - - if (ShellStatus == SHELL_SUCCESS && Index == NoHandles) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, L"sermode", HandleIdx); - ShellStatus = SHELL_INVALID_PARAMETER; - } - -Done: - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - if (Handles != NULL) { - FreePool (Handles); - } - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c deleted file mode 100644 index 39b6078..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c +++ /dev/null @@ -1,110 +0,0 @@ -/** @file - Main file for SetSize shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" - -/** - Function for 'setsize' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSetSize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Temp1; - UINTN NewSize; - UINTN LoopVar; - SHELL_FILE_HANDLE FileHandle; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"setsize", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setsize"); - ShellStatus = SHELL_INVALID_PARAMETER; - NewSize = 0; - } else { - Temp1 = ShellCommandLineGetRawValue(Package, 1); - if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SIZE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize"); - ShellStatus = SHELL_INVALID_PARAMETER; - NewSize = 0; - } else { - NewSize = ShellStrToUintn(Temp1); - } - } - for (LoopVar = 2 ; LoopVar < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS ; LoopVar++) { - Status = ShellOpenFileByName(ShellCommandLineGetRawValue(Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0); - if (EFI_ERROR(Status)) { - Status = ShellOpenFileByName(ShellCommandLineGetRawValue(Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - } - if (EFI_ERROR(Status) && LoopVar == 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue(Package, LoopVar)); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } else { - Status = FileHandleSetSize(FileHandle, NewSize); - if (Status == EFI_VOLUME_FULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_VOLUME_FULL), gShellDebug1HiiHandle, L"setsize"); - ShellStatus = SHELL_VOLUME_FULL; - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue(Package, LoopVar)); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_DONE), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, LoopVar)); - } - ShellCloseFile(&FileHandle); - } - } - - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c deleted file mode 100644 index 7589252..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c +++ /dev/null @@ -1,475 +0,0 @@ -/** @file - Main file for SetVar shell Debug1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-guid", TypeValue}, - {L"-bs", TypeFlag}, - {L"-rt", TypeFlag}, - {L"-nv", TypeFlag}, - {NULL, TypeMax} - }; - -typedef enum { - DataTypeHexNumber = 0, - DataTypeHexArray = 1, - DataTypeAscii = 2, - DataTypeUnicode = 3, - DataTypeDevicePath = 4, - DataTypeUnKnow = 5 -} DATA_TYPE; - -typedef union { - UINT8 HexNumber8; - UINT16 HexNumber16; - UINT32 HexNumber32; - UINT64 HexNumber64; -} HEX_NUMBER; - -/** - Check if the input is a (potentially empty) string of hexadecimal nibbles. - - @param[in] String The CHAR16 string to check. - - @retval FALSE A character has been found in String for which - ShellIsHexaDecimalDigitCharacter() returned FALSE. - - @retval TRUE Otherwise. (Note that this covers the case when String is - empty.) -**/ -BOOLEAN -IsStringOfHexNibbles ( - IN CONST CHAR16 *String - ) -{ - CONST CHAR16 *Pos; - - for (Pos = String; *Pos != L'\0'; ++Pos) { - if (!ShellIsHexaDecimalDigitCharacter (*Pos)) { - return FALSE; - } - } - return TRUE; -} - -/** - Function to check the TYPE of Data. - - @param[in] Data The Data to be check. - - @retval DATA_TYPE The TYPE of Data. -**/ -DATA_TYPE -TestDataType ( - IN CONST CHAR16 *Data - ) -{ - if (Data[0] == L'0' && (Data[1] == L'x' || Data[1] == L'X')) { - if (IsStringOfHexNibbles (Data+2) && StrLen (Data + 2) <= 16) { - return DataTypeHexNumber; - } else { - return DataTypeUnKnow; - } - } else if (Data[0] == L'H') { - if (IsStringOfHexNibbles (Data + 1) && StrLen (Data + 1) % 2 == 0) { - return DataTypeHexArray; - } else { - return DataTypeUnKnow; - } - } else if (Data[0] == L'S') { - return DataTypeAscii; - } else if (Data[0] == L'L') { - return DataTypeUnicode; - } else if (Data[0] == L'P' || StrnCmp (Data, L"--", 2) == 0) { - return DataTypeDevicePath; - } - - if (IsStringOfHexNibbles (Data) && StrLen (Data) % 2 == 0) { - return DataTypeHexArray; - } - - return DataTypeAscii; -} - -/** - Function to parse the Data by the type of Data, and save in the Buffer. - - @param[in] Data A pointer to a buffer to be parsed. - @param[out] Buffer A pointer to a buffer to hold the return data. - @param[in,out] BufferSize On input, indicates the size of Buffer in bytes. - On output,indicates the size of data return in Buffer. - Or the size in bytes of the buffer needed to obtain. - - @retval EFI_INVALID_PARAMETER The Buffer or BufferSize is NULL. - @retval EFI_BUFFER_TOO_SMALL The Buffer is too small to hold the data. - @retval EFI_OUT_OF_RESOURCES A memory allcation failed. - @retval EFI_SUCCESS The Data parsed successful and save in the Buffer. -**/ -EFI_STATUS -ParseParameterData ( - IN CONST CHAR16 *Data, - OUT VOID *Buffer, - IN OUT UINTN *BufferSize - ) -{ - UINT64 HexNumber; - UINTN HexNumberLen; - UINTN Size; - CHAR8 *AsciiBuffer; - DATA_TYPE DataType; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_STATUS Status; - - HexNumber = 0; - HexNumberLen = 0; - Size = 0; - AsciiBuffer = NULL; - DevPath = NULL; - Status = EFI_SUCCESS; - - if (Data == NULL || BufferSize == NULL) { - return EFI_INVALID_PARAMETER; - } - - DataType = TestDataType (Data); - if (DataType == DataTypeHexNumber) { - // - // hex number - // - StrHexToUint64S (Data + 2, NULL, &HexNumber); - HexNumberLen = StrLen (Data + 2); - if (HexNumberLen >= 1 && HexNumberLen <= 2) { - Size = 1; - } else if (HexNumberLen >= 3 && HexNumberLen <= 4) { - Size = 2; - } else if (HexNumberLen >= 5 && HexNumberLen <= 8) { - Size = 4; - } else if (HexNumberLen >= 9 && HexNumberLen <= 16) { - Size = 8; - } - if (Buffer != NULL && *BufferSize >= Size) { - CopyMem(Buffer, (VOID *)&HexNumber, Size); - } else { - Status = EFI_BUFFER_TOO_SMALL; - } - *BufferSize = Size; - } else if (DataType == DataTypeHexArray) { - // - // hex array - // - if (*Data == L'H') { - Data = Data + 1; - } - - Size = StrLen (Data) / 2; - if (Buffer != NULL && *BufferSize >= Size) { - StrHexToBytes(Data, StrLen (Data), (UINT8 *)Buffer, Size); - } else { - Status = EFI_BUFFER_TOO_SMALL; - } - *BufferSize = Size; - } else if (DataType == DataTypeAscii) { - // - // ascii text - // - if (*Data == L'S') { - Data = Data + 1; - } - AsciiBuffer = AllocateZeroPool (StrSize (Data) / 2); - if (AsciiBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - AsciiSPrint (AsciiBuffer, StrSize (Data) / 2, "%s", (CHAR8 *)Data); - - Size = StrSize (Data) / 2 - 1; - if (Buffer != NULL && *BufferSize >= Size) { - CopyMem (Buffer, AsciiBuffer, Size); - } else { - Status = EFI_BUFFER_TOO_SMALL; - } - *BufferSize = Size; - } - SHELL_FREE_NON_NULL (AsciiBuffer); - } else if (DataType == DataTypeUnicode) { - // - // unicode text - // - if (*Data == L'L') { - Data = Data + 1; - } - Size = StrSize (Data) - sizeof (CHAR16); - if (Buffer != NULL && *BufferSize >= Size) { - CopyMem (Buffer, Data, Size); - } else { - Status = EFI_BUFFER_TOO_SMALL; - } - *BufferSize = Size; - } else if (DataType == DataTypeDevicePath) { - if (*Data == L'P') { - Data = Data + 1; - } else if (StrnCmp (Data, L"--", 2) == 0) { - Data = Data + 2; - } - DevPath = ConvertTextToDevicePath (Data); - if (DevPath == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, L"setvar"); - Status = EFI_INVALID_PARAMETER; - } else { - Size = GetDevicePathSize (DevPath); - if (Buffer != NULL && *BufferSize >= Size) { - CopyMem (Buffer, DevPath, Size); - } else { - Status = EFI_BUFFER_TOO_SMALL; - } - *BufferSize = Size; - } - SHELL_FREE_NON_NULL (DevPath); - } else { - Status = EFI_INVALID_PARAMETER; - } - - return Status; -} - -/** - Function to get each data from parameters. - - @param[in] Package The package of checked values. - @param[out] Buffer A pointer to a buffer to hold the return data. - @param[out] BufferSize Indicates the size of data in bytes return in Buffer. - - @retval EFI_INVALID_PARAMETER Buffer or BufferSize is NULL. - @retval EFI_OUT_OF_RESOURCES A memory allcation failed. - @retval EFI_SUCCESS Get each parameter data was successful. -**/ -EFI_STATUS -GetVariableDataFromParameter ( - IN CONST LIST_ENTRY *Package, - OUT UINT8 **Buffer, - OUT UINTN *BufferSize - ) -{ - CONST CHAR16 *TempData; - UINTN Index; - UINTN TotalSize; - UINTN Size; - UINT8 *BufferWalker; - EFI_STATUS Status; - - TotalSize = 0; - Size = 0; - Status = EFI_SUCCESS; - - if (BufferSize == NULL || Buffer == NULL || ShellCommandLineGetCount (Package) < 3) { - return EFI_INVALID_PARAMETER; - } - - for (Index = 2; Index < ShellCommandLineGetCount (Package); Index++) { - TempData = ShellCommandLineGetRawValue (Package, Index); - ASSERT (TempData != NULL); - - if (TempData[0] != L'=') { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", TempData); - return EFI_INVALID_PARAMETER; - } - - TempData = TempData + 1; - Size = 0; - Status = ParseParameterData (TempData, NULL, &Size); - if (EFI_ERROR (Status)) { - if (Status == EFI_BUFFER_TOO_SMALL) { - // - // We expect return EFI_BUFFER_TOO_SMALL when pass 'NULL' as second parameter to the function ParseParameterData. - // - TotalSize += Size; - } else { - if (Status == EFI_INVALID_PARAMETER) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", TempData); - } else if (Status == EFI_NOT_FOUND) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, L"setvar"); - } - return Status; - } - } - } - - *BufferSize = TotalSize; - *Buffer = AllocateZeroPool (TotalSize); - - if (*Buffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - BufferWalker = *Buffer; - for (Index = 2; Index < ShellCommandLineGetCount (Package); Index++) { - TempData = ShellCommandLineGetRawValue (Package, Index); - TempData = TempData + 1; - - Size = TotalSize; - Status = ParseParameterData (TempData, (VOID *)BufferWalker, &Size); - if (!EFI_ERROR (Status)) { - BufferWalker = BufferWalker + Size; - TotalSize = TotalSize - Size; - } else { - return Status; - } - } - } - - return EFI_SUCCESS; -} - -/** - Function for 'setvar' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSetVar ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - RETURN_STATUS RStatus; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *VariableName; - EFI_GUID Guid; - CONST CHAR16 *StringGuid; - UINT32 Attributes; - VOID *Buffer; - UINTN Size; - UINTN LoopVar; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Buffer = NULL; - Size = 0; - Attributes = 0; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"setvar", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else if (ShellCommandLineCheckDuplicate (Package,&ProblemParam) != EFI_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DUPLICATE), gShellDebug1HiiHandle, L"setvar", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setvar"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - VariableName = ShellCommandLineGetRawValue(Package, 1); - if (!ShellCommandLineGetFlag(Package, L"-guid")){ - CopyGuid(&Guid, &gEfiGlobalVariableGuid); - } else { - StringGuid = ShellCommandLineGetValue(Package, L"-guid"); - RStatus = StrToGuid (StringGuid, &Guid); - if (RETURN_ERROR (RStatus) || (StringGuid[GUID_STRING_LENGTH] != L'\0')) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", StringGuid); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - - if (ShellCommandLineGetCount(Package) == 2) { - // - // Display - // - Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = AllocateZeroPool(Size); - Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer); - } - if (!EFI_ERROR(Status) && Buffer != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_SETVAR_PRINT), gShellDebug1HiiHandle, &Guid, VariableName, Size); - for (LoopVar = 0; LoopVar < Size; LoopVar++) { - ShellPrintEx(-1, -1, L"%02x ", ((UINT8*)Buffer)[LoopVar]); - } - ShellPrintEx(-1, -1, L"\r\n"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_GET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName); - ShellStatus = SHELL_ACCESS_DENIED; - } - } else { - // - // Create, Delete or Modify. - // - Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = AllocateZeroPool(Size); - Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer); - } - if (EFI_ERROR(Status) || Buffer == NULL) { - // - // Creating a new variable. determine attributes from command line. - // - Attributes = 0; - if (ShellCommandLineGetFlag(Package, L"-bs")) { - Attributes |= EFI_VARIABLE_BOOTSERVICE_ACCESS; - } - if (ShellCommandLineGetFlag(Package, L"-rt")) { - Attributes |= EFI_VARIABLE_RUNTIME_ACCESS | - EFI_VARIABLE_BOOTSERVICE_ACCESS; - } - if (ShellCommandLineGetFlag(Package, L"-nv")) { - Attributes |= EFI_VARIABLE_NON_VOLATILE; - } - } - SHELL_FREE_NON_NULL(Buffer); - - Size = 0; - Status = GetVariableDataFromParameter(Package, (UINT8 **)&Buffer, &Size); - if (!EFI_ERROR(Status)) { - Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, Size, Buffer); - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName); - ShellStatus = SHELL_ACCESS_DENIED; - } else { - ASSERT(ShellStatus == SHELL_SUCCESS); - } - } - } - ShellCommandLineFreeVarList (Package); - } - - if (Buffer != NULL) { - FreePool(Buffer); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c deleted file mode 100644 index 7ada7d8..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c +++ /dev/null @@ -1,407 +0,0 @@ -/** @file - Module for clarifying the content of the smbios structure element info. - - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "PrintInfo.h" -#include "QueryTable.h" -#include "EventLogInfo.h" - -/** - Function to display system event log access information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySELAccessMethod ( - IN CONST UINT8 Key, - IN CONST UINT8 Option - ) -{ - // - // Print prompt - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - - // - // Print value info - // - switch (Key) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle); - break; - - case 4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle); - break; - - default: - if (Key <= 0x7f) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle); - } - } -} - -/** - Function to display system event log status information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySELLogStatus ( - UINT8 Key, - UINT8 Option - ) -{ - // - // Print prompt - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - - // - // Print value info - // - if ((Key & 0x01) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle); - } - - if ((Key & 0x02) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle); - } - - if ((Key & 0xFC) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC); - } -} - -/** - Function to display system event log header format information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySysEventLogHeaderFormat ( - UINT8 Key, - UINT8 Option - ) -{ - // - // Print prompt - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - - // - // Print value info - // - if (Key == 0x00) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle); - } else if (Key == 0x01) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle); - } else if (Key <= 0x7f) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle); - } -} - -/** - Display the header information for SEL log items. - - @param[in] Key The information key. - @param[in] Option The option index. -**/ -VOID -DisplaySELLogHeaderLen ( - UINT8 Key, - UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F); - - // - // The most-significant bit of the field specifies - // whether (0) or not (1) the record has been read - // - if ((Key & 0x80) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle); - } -} - -/** - Display the header information for type 1 items. - - @param[in] LogHeader The buffer with the information. -**/ -VOID -DisplaySysEventLogHeaderType1 ( - IN UINT8 *LogHeader - ) -{ - LOG_HEADER_TYPE1_FORMAT *Header; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle); - - // - // Print Log Header Type1 Format info - // - Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader); - - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED), - gShellDebug1HiiHandle, - Header->OEMReserved[0], - Header->OEMReserved[1], - Header->OEMReserved[2], - Header->OEMReserved[3], - Header->OEMReserved[4] - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED), - gShellDebug1HiiHandle, - Header->OEMReserved[0], - Header->OEMReserved[1], - Header->OEMReserved[2] - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision); -} - -/** - Function to display system event log header information. - - @param[in] LogHeaderFormat Format identifier. - @param[in] LogHeader Format informcation. -**/ -VOID -DisplaySysEventLogHeader ( - UINT8 LogHeaderFormat, - UINT8 *LogHeader - ) -{ - // - // Print prompt - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle); - - // - // Print value info - // - if (LogHeaderFormat == 0x00) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle); - } else if (LogHeaderFormat == 0x01) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle); - DisplaySysEventLogHeaderType1 (LogHeader); - } else if (LogHeaderFormat <= 0x7f) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle); - } -} - -/** - Display the El Vdf information. - - @param[in] ElVdfType The information type. - @param[in] VarData The information buffer. -**/ -VOID -DisplayElVdfInfo ( - UINT8 ElVdfType, - UINT8 *VarData - ) -{ - UINT16 *Word; - UINT32 *Dword; - - // - // Display Type Name - // - DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL); - - // - // Display Type description - // - switch (ElVdfType) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle); - break; - - case 1: - Word = (UINT16 *) (VarData + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word); - break; - - case 2: - Dword = (UINT32 *) (VarData + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); - break; - - case 3: - Word = (UINT16 *) (VarData + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word); - // - // Followed by a multiple-event counter - // - Dword = (UINT32 *) (VarData + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); - break; - - case 4: - Dword = (UINT32 *) (VarData + 1); - DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL); - Dword++; - DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL); - break; - - case 5: - Dword = (UINT32 *) (VarData + 1); - DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL); - break; - - case 6: - Dword = (UINT32 *) (VarData + 1); - DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL); - // - // Followed by a multiple-event counter - // - Dword = (UINT32 *) (VarData + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); - break; - - default: - if (ElVdfType <= 0x7F) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle); - } - } -} - -/** - Function to display system event log data. - - @param[in] LogData The data information. - @param[in] LogAreaLength Length of the data. -**/ -VOID -DisplaySysEventLogData ( - UINT8 *LogData, - UINT16 LogAreaLength - ) -{ - LOG_RECORD_FORMAT *Log; - UINT8 ElVdfType; - // - // Event Log Variable Data Format Types - // - UINTN Offset; - - // - // Print prompt - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle); - - // - // Print Log info - // - Offset = 0; - Log = (LOG_RECORD_FORMAT *) LogData; - while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) { - // - // Get a Event Log Record - // - Log = (LOG_RECORD_FORMAT *) (LogData + Offset); - - if (Log != NULL) { - // - // Display Event Log Record Information - // - DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL); - DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL); - - Offset += Log->Length; - // - // Display Log Header Date/Time Fields - // These fields contain the BCD representation of the date and time - // (as read from CMOS) of the occurrence of the event - // So Print as hex and represent decimal - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle); - if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) { - Print (L"19"); - } else if (Log != NULL && Log->Year <= 79) { - Print (L"20"); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle); - continue; - } - - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS), - gShellDebug1HiiHandle, - Log->Year, - Log->Month, - Log->Day, - Log->Hour, - Log->Minute, - Log->Second - ); - - // - // Display Variable Data Format - // - if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) { - continue; - } - - ElVdfType = Log->LogVariableData[0]; - DisplayElVdfInfo (ElVdfType, Log->LogVariableData); - } - } -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h deleted file mode 100644 index 5b7f439..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h +++ /dev/null @@ -1,112 +0,0 @@ -/** @file - Module to clarify system event log of smbios structure. - - Copyright (c) 2005-2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SMBIOS_EVENT_LOG_INFO_H_ -#define _SMBIOS_EVENT_LOG_INFO_H_ - -#define END_OF_LOG 0xFF - -#pragma pack(1) - -typedef struct { - UINT8 Type; - UINT8 Length; - UINT8 Year; - UINT8 Month; - UINT8 Day; - UINT8 Hour; - UINT8 Minute; - UINT8 Second; - UINT8 LogVariableData[1]; -} LOG_RECORD_FORMAT; - -typedef struct { - UINT8 OEMReserved[5]; - UINT8 Metw; // Multiple Event Time Window - UINT8 Meci; // Multiple Event Count Increment - UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address - UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index - UINT8 StartingOffset; // CMOS Checksum - Starting Offset - UINT8 ByteCount; // CMOS Checksum - Byte Count - UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset - UINT8 Reserved[3]; - UINT8 HeaderRevision; -} LOG_HEADER_TYPE1_FORMAT; - -#pragma pack() -// -// System Event Log (Type 15) -// - -/** - Function to display system event log access information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySELAccessMethod ( - IN CONST UINT8 Key, - IN CONST UINT8 Option - ); - -/** - Function to display system event log status information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySELLogStatus ( - UINT8 Key, - UINT8 Option - ); - -/** - Function to display system event log header format information. - - @param[in] Key Additional information to print. - @param[in] Option Whether to print the additional information. -**/ -VOID -DisplaySysEventLogHeaderFormat ( - UINT8 Key, - UINT8 Option - ); - -/** - Function to display system event log header information. - - @param[in] LogHeaderFormat Format identifier. - @param[in] LogHeader Format informcation. -**/ -VOID -DisplaySysEventLogHeader ( - UINT8 LogHeaderFormat, - UINT8 *LogHeader - ); - -/** - Function to display system event log data. - - @param[in] LogData The data information. - @param[in] LogAreaLength Length of the data. -**/ -VOID -DisplaySysEventLogData ( - UINT8 *LogData, - UINT16 LogAreaLength - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c deleted file mode 100644 index f31b940..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c +++ /dev/null @@ -1,373 +0,0 @@ -/** @file - API for SMBIOS table. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include "UefiShellDebug1CommandsLib.h" -#include -#include "LibSmbiosView.h" -#include "SmbiosView.h" - -STATIC UINT8 mInit = 0; -STATIC UINT8 m64Init = 0; -STATIC SMBIOS_TABLE_ENTRY_POINT *mSmbiosTable = NULL; -STATIC SMBIOS_TABLE_3_0_ENTRY_POINT *mSmbios64BitTable = NULL; -STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct; -STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct; -STATIC SMBIOS_STRUCTURE_POINTER m_Smbios64BitStruct; -STATIC SMBIOS_STRUCTURE_POINTER *mSmbios64BitStruct = &m_Smbios64BitStruct; - -/** - Init the SMBIOS VIEW API's environment. - - @retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib. -**/ -EFI_STATUS -LibSmbiosInit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // Init only once - // - if (mInit == 1) { - return EFI_SUCCESS; - } - // - // Get SMBIOS table from System Configure table - // - Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID**)&mSmbiosTable); - - if (mSmbiosTable == NULL) { - return EFI_NOT_FOUND; - } - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status); - return Status; - } - // - // Init SMBIOS structure table address - // - mSmbiosStruct->Raw = (UINT8 *) (UINTN) (mSmbiosTable->TableAddress); - - mInit = 1; - return EFI_SUCCESS; -} - -/** - Init the SMBIOS VIEW API's environment. - - @retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib. -**/ -EFI_STATUS -LibSmbios64BitInit ( - VOID - ) -{ - EFI_STATUS Status; - - // - // Init only once - // - if (m64Init == 1) { - return EFI_SUCCESS; - } - // - // Get SMBIOS table from System Configure table - // - Status = GetSystemConfigurationTable (&gEfiSmbios3TableGuid, (VOID**)&mSmbios64BitTable); - - if (mSmbios64BitTable == NULL) { - return EFI_NOT_FOUND; - } - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status); - return Status; - } - // - // Init SMBIOS structure table address - // - mSmbios64BitStruct->Raw = (UINT8 *) (UINTN) (mSmbios64BitTable->TableAddress); - - m64Init = 1; - return EFI_SUCCESS; -} - -/** - Cleanup the Smbios information. -**/ -VOID -LibSmbiosCleanup ( - VOID - ) -{ - // - // Release resources - // - if (mSmbiosTable != NULL) { - mSmbiosTable = NULL; - } - - mInit = 0; -} - -/** - Cleanup the Smbios information. -**/ -VOID -LibSmbios64BitCleanup ( - VOID - ) -{ - // - // Release resources - // - if (mSmbios64BitTable != NULL) { - mSmbios64BitTable = NULL; - } - - m64Init = 0; -} - -/** - Get the entry point structure for the table. - - @param[out] EntryPointStructure The pointer to populate. -**/ -VOID -LibSmbiosGetEPS ( - OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure - ) -{ - // - // return SMBIOS Table address - // - *EntryPointStructure = mSmbiosTable; -} - -/** - Get the entry point structure for the table. - - @param[out] EntryPointStructure The pointer to populate. -**/ -VOID -LibSmbios64BitGetEPS ( - OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure - ) -{ - // - // return SMBIOS Table address - // - *EntryPointStructure = mSmbios64BitTable; -} - -/** - Return SMBIOS string for the given string number. - - @param[in] Smbios Pointer to SMBIOS structure. - @param[in] StringNumber String number to return. -1 is used to skip all strings and - point to the next SMBIOS structure. - - @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 -**/ -CHAR8* -LibGetSmbiosString ( - IN SMBIOS_STRUCTURE_POINTER *Smbios, - IN UINT16 StringNumber - ) -{ - UINT16 Index; - CHAR8 *String; - - ASSERT (Smbios != NULL); - - // - // Skip over formatted section - // - String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length); - - // - // Look through unformated section - // - for (Index = 1; Index <= StringNumber; Index++) { - if (StringNumber == Index) { - return String; - } - // - // Skip string - // - for (; *String != 0; String++); - String++; - - if (*String == 0) { - // - // If double NULL then we are done. - // Return pointer to next structure in Smbios. - // if you pass in a -1 you will always get here - // - Smbios->Raw = (UINT8 *)++String; - return NULL; - } - } - - return NULL; -} - -/** - Get SMBIOS structure for the given Handle, - Handle is changed to the next handle or 0xFFFF when the end is - reached or the handle is not found. - - @param[in, out] Handle 0xFFFF: get the first structure - Others: get a structure according to this value. - @param[out] Buffer The pointer to the pointer to the structure. - @param[out] Length Length of the structure. - - @retval DMI_SUCCESS Handle is updated with next structure handle or - 0xFFFF(end-of-list). - - @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or - 0xFFFF(end-of-list). -**/ -EFI_STATUS -LibGetSmbiosStructure ( - IN OUT UINT16 *Handle, - OUT UINT8 **Buffer, - OUT UINT16 *Length - ) -{ - SMBIOS_STRUCTURE_POINTER Smbios; - SMBIOS_STRUCTURE_POINTER SmbiosEnd; - UINT8 *Raw; - - if (*Handle == INVALID_HANDLE) { - *Handle = mSmbiosStruct->Hdr->Handle; - return DMI_INVALID_HANDLE; - } - - if ((Buffer == NULL) || (Length == NULL)) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle); - return DMI_INVALID_HANDLE; - } - - *Length = 0; - Smbios.Hdr = mSmbiosStruct->Hdr; - SmbiosEnd.Raw = Smbios.Raw + mSmbiosTable->TableLength; - while (Smbios.Raw < SmbiosEnd.Raw) { - if (Smbios.Hdr->Handle == *Handle) { - Raw = Smbios.Raw; - // - // Walk to next structure - // - LibGetSmbiosString (&Smbios, (UINT16) (-1)); - // - // Length = Next structure head - this structure head - // - *Length = (UINT16) (Smbios.Raw - Raw); - *Buffer = Raw; - // - // update with the next structure handle. - // - if (Smbios.Raw < SmbiosEnd.Raw) { - *Handle = Smbios.Hdr->Handle; - } else { - *Handle = INVALID_HANDLE; - } - return DMI_SUCCESS; - } - // - // Walk to next structure - // - LibGetSmbiosString (&Smbios, (UINT16) (-1)); - } - - *Handle = INVALID_HANDLE; - return DMI_INVALID_HANDLE; -} - -/** - Get SMBIOS structure for the given Handle, - Handle is changed to the next handle or 0xFFFF when the end is - reached or the handle is not found. - - @param[in, out] Handle 0xFFFF: get the first structure - Others: get a structure according to this value. - @param[out] Buffer The pointer to the pointer to the structure. - @param[out] Length Length of the structure. - - @retval DMI_SUCCESS Handle is updated with next structure handle or - 0xFFFF(end-of-list). - - @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or - 0xFFFF(end-of-list). -**/ -EFI_STATUS -LibGetSmbios64BitStructure ( - IN OUT UINT16 *Handle, - OUT UINT8 **Buffer, - OUT UINT16 *Length - ) -{ - SMBIOS_STRUCTURE_POINTER Smbios; - SMBIOS_STRUCTURE_POINTER SmbiosEnd; - UINT8 *Raw; - - if (*Handle == INVALID_HANDLE) { - *Handle = mSmbios64BitStruct->Hdr->Handle; - return DMI_INVALID_HANDLE; - } - - if ((Buffer == NULL) || (Length == NULL)) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle); - return DMI_INVALID_HANDLE; - } - - *Length = 0; - Smbios.Hdr = mSmbios64BitStruct->Hdr; - - SmbiosEnd.Raw = Smbios.Raw + mSmbios64BitTableLength; - while (Smbios.Raw < SmbiosEnd.Raw) { - if (Smbios.Hdr->Handle == *Handle) { - Raw = Smbios.Raw; - // - // Walk to next structure - // - LibGetSmbiosString (&Smbios, (UINT16) (-1)); - // - // Length = Next structure head - this structure head - // - *Length = (UINT16) (Smbios.Raw - Raw); - *Buffer = Raw; - // - // update with the next structure handle. - // - if (Smbios.Raw < SmbiosEnd.Raw) { - *Handle = Smbios.Hdr->Handle; - } else { - *Handle = INVALID_HANDLE; - } - return DMI_SUCCESS; - } - // - // Walk to next structure - // - LibGetSmbiosString (&Smbios, (UINT16) (-1)); - } - - *Handle = INVALID_HANDLE; - return DMI_INVALID_HANDLE; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h deleted file mode 100644 index 29a9ae4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h +++ /dev/null @@ -1,159 +0,0 @@ -/** @file - API for SMBIOS Plug and Play functions, access to SMBIOS table and structures. - - Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _LIB_SMBIOS_VIEW_H_ -#define _LIB_SMBIOS_VIEW_H_ - -#include - -#define DMI_SUCCESS 0x00 -#define DMI_UNKNOWN_FUNCTION 0x81 -#define DMI_FUNCTION_NOT_SUPPORTED 0x82 -#define DMI_INVALID_HANDLE 0x83 -#define DMI_BAD_PARAMETER 0x84 -#define DMI_INVALID_SUBFUNCTION 0x85 -#define DMI_NO_CHANGE 0x86 -#define DMI_ADD_STRUCTURE_FAILED 0x87 -#define DMI_READ_ONLY 0x8D -#define DMI_LOCK_NOT_SUPPORTED 0x90 -#define DMI_CURRENTLY_LOCKED 0x91 -#define DMI_INVALID_LOCK 0x92 - -#define INVALID_HANDLE (UINT16) (-1) - -#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val) - -#define EFI_SMBIOSERR_FAILURE EFI_SMBIOSERR (1) -#define EFI_SMBIOSERR_STRUCT_NOT_FOUND EFI_SMBIOSERR (2) -#define EFI_SMBIOSERR_TYPE_UNKNOWN EFI_SMBIOSERR (3) -#define EFI_SMBIOSERR_UNSUPPORTED EFI_SMBIOSERR (4) - -/** - Init the SMBIOS VIEW API's environment for the 32-bit table.. - - @retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib. -**/ -EFI_STATUS -LibSmbiosInit ( - VOID - ); - -/** - Init the SMBIOS VIEW API's environment for the 64-bit table.. - - @retval EFI_SUCCESS Successful to init the SMBIOS VIEW Lib. -**/ -EFI_STATUS -LibSmbios64BitInit ( - VOID - ); - -/** - Cleanup the Smbios information. -**/ -VOID -LibSmbiosCleanup ( - VOID - ); - -/** - Cleanup the Smbios information. -**/ -VOID -LibSmbios64BitCleanup ( - VOID - ); - -/** - Get the entry point structure for the table. - - @param[out] EntryPointStructure The pointer to populate. -**/ -VOID -LibSmbiosGetEPS ( - OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure - ); - -/** - Get the entry point structure for the 64-bit table. - - @param[out] EntryPointStructure The pointer to populate. -**/ -VOID -LibSmbios64BitGetEPS ( - OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure - ); - -/** - Return SMBIOS string for the given string number. - - @param[in] Smbios Pointer to SMBIOS structure. - @param[in] StringNumber String number to return. -1 is used to skip all strings and - point to the next SMBIOS structure. - - @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 -**/ -CHAR8* -LibGetSmbiosString ( - IN SMBIOS_STRUCTURE_POINTER *Smbios, - IN UINT16 StringNumber - ); - -/** - Get SMBIOS structure for the given Handle, - Handle is changed to the next handle or 0xFFFF when the end is - reached or the handle is not found. - - @param[in, out] Handle 0xFFFF: get the first structure - Others: get a structure according to this value. - @param[out] Buffer The pointer to the pointer to the structure. - @param[out] Length Length of the structure. - - @retval DMI_SUCCESS Handle is updated with next structure handle or - 0xFFFF(end-of-list). - - @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or - 0xFFFF(end-of-list). -**/ -EFI_STATUS -LibGetSmbiosStructure ( - IN OUT UINT16 *Handle, - OUT UINT8 **Buffer, - OUT UINT16 *Length - ); - -/** - Get SMBIOS structure for the given Handle in 64-bit table, - Handle is changed to the next handle or 0xFFFF when the end is - reached or the handle is not found. - - @param[in, out] Handle 0xFFFF: get the first structure - Others: get a structure according to this value. - @param[out] Buffer The pointer to the pointer to the structure. - @param[out] Length Length of the structure. - - @retval DMI_SUCCESS Handle is updated with next structure handle or - 0xFFFF(end-of-list). - - @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or - 0xFFFF(end-of-list). -**/ -EFI_STATUS -LibGetSmbios64BitStructure ( - IN OUT UINT16 *Handle, - OUT UINT8 **Buffer, - OUT UINT16 *Length - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c deleted file mode 100644 index 7f236b3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ /dev/null @@ -1,3427 +0,0 @@ -/** @file - Module for clarifying the content of the smbios structure element information. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "PrintInfo.h" -#include "LibSmbiosView.h" -#include "QueryTable.h" -#include "EventLogInfo.h" - - -// -// Get the certain bit of 'value' -// -#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit)) - -// -// Check if above or equal to version -// -#define AE_SMBIOS_VERSION(MajorVersion, MinorVersion) \ - (SmbiosMajorVersion > (MajorVersion) || (SmbiosMajorVersion == (MajorVersion) && SmbiosMinorVersion >= (MinorVersion))) - -// -////////////////////////////////////////////////////////// -// Macros of print structure element, simplify coding. -// -#define PRINT_PENDING_STRING(pStruct, type, element) \ - do { \ - CHAR8 *StringBuf; \ - StringBuf = LibGetSmbiosString ((pStruct), (pStruct->type->element)); \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \ - } while (0); - -#define PRINT_SMBIOS_STRING(pStruct, stringnumber, element) \ - do { \ - CHAR8 *StringBuf; \ - StringBuf = LibGetSmbiosString ((pStruct), (stringnumber)); \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \ - } while (0); - -#define PRINT_STRUCT_VALUE(pStruct, type, element) \ - do { \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \ - } while (0); - -#define PRINT_STRUCT_VALUE_H(pStruct, type, element) \ - do { \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintEx(-1,-1,L": 0x%x\n", (pStruct->type->element)); \ - } while (0); - -#define PRINT_STRUCT_VALUE_LH(pStruct, type, element) \ - do { \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintEx(-1,-1,L": 0x%lx\n", (pStruct->type->element)); \ - } while (0); - -#define PRINT_BIT_FIELD(pStruct, type, element, size) \ - do { \ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \ - DumpHex (0, 0, size, &(pStruct->type->element)); \ - } while (0); - -#define PRINT_SMBIOS_BIT_FIELD(pStruct, startaddress, element, size) \ - do { \ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \ - ShellPrintEx(-1,-1,L"%a",#element); \ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \ - DumpHex (0, 0, size, startaddress); \ - } while (0); - -// -///////////////////////////////////////// -// - -/** - Copy Length of Src buffer to Dest buffer, - add a NULL termination to Dest buffer. - - @param[in, out] Dest Destination buffer head. - @param[in] Src Source buffer head. - @param[in] Length Length of buffer to be copied. -**/ -VOID -MemToString ( - IN OUT VOID *Dest, - IN VOID *Src, - IN UINTN Length - ) -{ - UINT8 *SrcBuffer; - UINT8 *DestBuffer; - SrcBuffer = (UINT8 *) Src; - DestBuffer = (UINT8 *) Dest; - // - // copy byte by byte - // - while ((Length--)!=0) { - *DestBuffer++ = *SrcBuffer++; - } - // - // append a NULL terminator - // - *DestBuffer = '\0'; -} - -// -////////////////////////////////////////////// -// -// Functions below is to show the information -// - -/** - Print the info of EPS(Entry Point Structure). - - @param[in] SmbiosTable Pointer to the SMBIOS table entry point. - @param[in] Option Display option. -**/ -VOID -SmbiosPrintEPSInfo ( - IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable, - IN UINT8 Option - ) -{ - UINT8 Anchor[5]; - UINT8 InAnchor[6]; - - if (SmbiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle); - return ; - } - - if (Option == SHOW_NONE) { - return ; - } - - if (Option >= SHOW_NORMAL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle); - MemToString (Anchor, SmbiosTable->AnchorString, 4); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM), - gShellDebug1HiiHandle, - SmbiosTable->EntryPointStructureChecksum - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION), - gShellDebug1HiiHandle, - SmbiosTable->MajorVersion, - SmbiosTable->MinorVersion - ); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT), - gShellDebug1HiiHandle, - SmbiosTable->NumberOfSmbiosStructures - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength); - - } - // - // If SHOW_ALL, also print followings. - // - if (Option >= SHOW_DETAIL) { - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION), - gShellDebug1HiiHandle, - SmbiosTable->EntryPointRevision - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision); - // - // Since raw data is not string, add a NULL terminater. - // - MemToString (InAnchor, SmbiosTable->IntermediateAnchorString, 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle); - DumpHex (2, 0, 5, SmbiosTable->FormattedArea); - } - - Print (L"\n"); -} - -/** - Print the info of 64-bit EPS(Entry Point Structure). - - @param[in] SmbiosTable Pointer to the SMBIOS table entry point. - @param[in] Option Display option. -**/ -VOID -Smbios64BitPrintEPSInfo ( - IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable, - IN UINT8 Option - ) -{ - UINT8 Anchor[5]; - - if (SmbiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle); - return ; - } - - if (Option == SHOW_NONE) { - return ; - } - - if (Option >= SHOW_NORMAL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN), gShellDebug1HiiHandle); - - MemToString (Anchor, SmbiosTable->AnchorString, 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor); - - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM), - gShellDebug1HiiHandle, - SmbiosTable->EntryPointStructureChecksum - ); - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength); - - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION), - gShellDebug1HiiHandle, - SmbiosTable->MajorVersion, - SmbiosTable->MinorVersion - ); - - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DOCREV), - gShellDebug1HiiHandle, - SmbiosTable->DocRev - ); - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_MAX_SIZE), gShellDebug1HiiHandle, SmbiosTable->TableMaximumSize); - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress); - - } - // - // If SHOW_ALL, also print followings. - // - if (Option >= SHOW_DETAIL) { - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION), - gShellDebug1HiiHandle, - SmbiosTable->EntryPointRevision - ); - } - - Print (L"\n"); -} - -/** - This function print the content of the structure pointed by Struct. - - @param[in] Struct Point to the structure to be printed. - @param[in] Option Print option of information detail. - - @retval EFI_SUCCESS Successfully Printing this function. - @retval EFI_INVALID_PARAMETER Invalid Structure. - @retval EFI_UNSUPPORTED Unsupported. -**/ -EFI_STATUS -SmbiosPrintStructure ( - IN SMBIOS_STRUCTURE_POINTER *Struct, - IN UINT8 Option - ) -{ - UINT8 Index; - UINT8 *Buffer; - - if (Struct == NULL) { - return EFI_INVALID_PARAMETER; - } - - if (Option == SHOW_NONE) { - return EFI_SUCCESS; - } - - Buffer = (UINT8 *) (UINTN) (Struct->Raw); - - // - // Display structure header - // - DisplayStructureTypeInfo (Struct->Hdr->Type, SHOW_DETAIL); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, Struct->Hdr->Length); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, Struct->Hdr->Handle); - - if (Option == SHOW_OUTLINE) { - return EFI_SUCCESS; - } - - switch (Struct->Hdr->Type) { - // - // BIOS Information (Type 0) - // - case 0: - PRINT_PENDING_STRING (Struct, Type0, Vendor); - PRINT_PENDING_STRING (Struct, Type0, BiosVersion); - PRINT_STRUCT_VALUE_H (Struct, Type0, BiosSegment); - PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1)); - - DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type0->BiosCharacteristics)), Option); - - if (Struct->Hdr->Length > 0x12) { - DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option); - } - if (Struct->Hdr->Length > 0x13) { - DisplayBiosCharacteristicsExt2 (Struct->Type0->BIOSCharacteristicsExtensionBytes[1], Option); - } - - if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x14)) { - PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMajorRelease); - PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMinorRelease); - PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMajorRelease); - PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMinorRelease); - } - if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x18)) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTENDED_BIOS_SIZE), - gShellDebug1HiiHandle, - Struct->Type0->ExtendedBiosSize.Size, - (Struct->Type0->ExtendedBiosSize.Unit == 0x0) ? L"MB": L"GB" - ); - } - break; - - // - // System Information (Type 1) - // - case 1: - PRINT_PENDING_STRING (Struct, Type1, Manufacturer); - PRINT_PENDING_STRING (Struct, Type1, ProductName); - PRINT_PENDING_STRING (Struct, Type1, Version); - PRINT_PENDING_STRING (Struct, Type1, SerialNumber); - PRINT_BIT_FIELD (Struct, Type1, Uuid, 16); - DisplaySystemWakeupType (Struct->Type1->WakeUpType, Option); - if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x19)) { - PRINT_PENDING_STRING (Struct, Type1, SKUNumber); - PRINT_PENDING_STRING (Struct, Type1, Family); - } - - break; - - // - // Baseboard Information (Type 2) - // - case 2: - PRINT_PENDING_STRING (Struct, Type2, Manufacturer); - PRINT_PENDING_STRING (Struct, Type2, ProductName); - PRINT_PENDING_STRING (Struct, Type2, Version); - PRINT_PENDING_STRING (Struct, Type2, SerialNumber); - if (Struct->Hdr->Length > 0x8) { - PRINT_PENDING_STRING (Struct, Type2, AssetTag); - DisplayBaseBoardFeatureFlags (*(UINT8 *) &Struct->Type2->FeatureFlag, Option); - PRINT_PENDING_STRING (Struct, Type2, LocationInChassis); - PRINT_STRUCT_VALUE_H (Struct, Type2, ChassisHandle); - DisplayBaseBoardBoardType (Struct->Type2->BoardType, Option); - } - break; - - // - // System Enclosure (Type 3) - // - case 3: - PRINT_PENDING_STRING (Struct, Type3, Manufacturer); - PRINT_STRUCT_VALUE (Struct, Type3, Type); - DisplaySystemEnclosureType (Struct->Type3->Type, Option); - PRINT_PENDING_STRING (Struct, Type3, Version); - PRINT_PENDING_STRING (Struct, Type3, SerialNumber); - PRINT_PENDING_STRING (Struct, Type3, AssetTag); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle); - DisplaySystemEnclosureStatus (Struct->Type3->BootupState, Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle); - DisplaySystemEnclosureStatus (Struct->Type3->PowerSupplyState, Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle); - DisplaySystemEnclosureStatus (Struct->Type3->ThermalState, Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle); - DisplaySESecurityStatus (Struct->Type3->SecurityStatus, Option); - if (AE_SMBIOS_VERSION (0x2, 0x3)) { - if (Struct->Hdr->Length > 0xD) { - PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4); - } - if (Struct->Hdr->Length > 0x11) { - PRINT_STRUCT_VALUE (Struct, Type3, Height); - } - if (Struct->Hdr->Length > 0x12) { - PRINT_STRUCT_VALUE (Struct, Type3, NumberofPowerCords); - } - } - if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) { - if (Struct->Hdr->Length > (0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength))) { - PRINT_SMBIOS_STRING (Struct, Buffer[0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength)], SKUNumber); - } - } - break; - - // - // Processor Information (Type 4) - // - case 4: - PRINT_SMBIOS_STRING (Struct, Struct->Type4->Socket, SocketDesignation) - DisplayProcessorType (Struct->Type4->ProcessorType, Option); - if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x28) && - (Struct->Type4->ProcessorFamily == 0xFE)) { - // - // Get family from ProcessorFamily2 field - // - DisplayProcessorFamily2 (Struct->Type4->ProcessorFamily2, Option); - } else { - DisplayProcessorFamily (Struct->Type4->ProcessorFamily, Option); - } - PRINT_PENDING_STRING (Struct, Type4, ProcessorManufacture); - PRINT_BIT_FIELD (Struct, Type4, ProcessorId, 8); - PRINT_PENDING_STRING (Struct, Type4, ProcessorVersion); - DisplayProcessorVoltage (*(UINT8 *) &(Struct->Type4->Voltage), Option); - PRINT_STRUCT_VALUE (Struct, Type4, ExternalClock); - PRINT_STRUCT_VALUE (Struct, Type4, MaxSpeed); - PRINT_STRUCT_VALUE (Struct, Type4, CurrentSpeed); - DisplayProcessorStatus (Struct->Type4->Status, Option); - DisplayProcessorUpgrade (Struct->Type4->ProcessorUpgrade, Option); - PRINT_STRUCT_VALUE_H (Struct, Type4, L1CacheHandle); - PRINT_STRUCT_VALUE_H (Struct, Type4, L2CacheHandle); - PRINT_STRUCT_VALUE_H (Struct, Type4, L3CacheHandle); - if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0x20)) { - PRINT_PENDING_STRING (Struct, Type4, SerialNumber); - PRINT_PENDING_STRING (Struct, Type4, AssetTag); - PRINT_PENDING_STRING (Struct, Type4, PartNumber); - } - if (AE_SMBIOS_VERSION (0x2, 0x5) && (Struct->Hdr->Length > 0x23)) { - PRINT_STRUCT_VALUE (Struct, Type4, CoreCount); - PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount); - PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount); - DisplayProcessorCharacteristics (Struct->Type4->ProcessorCharacteristics, Option); - } - if ((SmbiosMajorVersion >= 0x3) && (Struct->Hdr->Length > 0x2A)) { - PRINT_STRUCT_VALUE (Struct, Type4, CoreCount2); - PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount2); - PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount2); - } - break; - - // - // Memory Controller Information (Type 5) - // - case 5: - { - UINT8 SlotNum; - SlotNum = Struct->Type5->AssociatedMemorySlotNum; - - DisplayMcErrorDetectMethod (Struct->Type5->ErrDetectMethod, Option); - DisplayMcErrorCorrectCapability (*(UINT8 *) &(Struct->Type5->ErrCorrectCapability), Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle); - DisplayMcInterleaveSupport (Struct->Type5->SupportInterleave, Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle); - DisplayMcInterleaveSupport (Struct->Type5->CurrentInterleave, Option); - DisplayMaxMemoryModuleSize (Struct->Type5->MaxMemoryModuleSize, SlotNum, Option); - DisplayMcMemorySpeeds (*(UINT16 *) &(Struct->Type5->SupportSpeed), Option); - DisplayMmMemoryType (Struct->Type5->SupportMemoryType, Option); - DisplayMemoryModuleVoltage (Struct->Type5->MemoryModuleVoltage, Option); - PRINT_STRUCT_VALUE (Struct, Type5, AssociatedMemorySlotNum); - // - // According to SMBIOS Specification, offset 0x0F - // - DisplayMemoryModuleConfigHandles ((UINT16 *) (&Buffer[0x0F]), SlotNum, Option); - DisplayMcErrorCorrectCapability (Buffer[0x0F + 2 * SlotNum], Option); - } - break; - - // - // Memory Module Information (Type 6) - // - case 6: - PRINT_PENDING_STRING (Struct, Type6, SocketDesignation); - DisplayMmBankConnections (Struct->Type6->BankConnections, Option); - PRINT_STRUCT_VALUE (Struct, Type6, CurrentSpeed); - DisplayMmMemoryType (*(UINT16 *) &(Struct->Type6->CurrentMemoryType), Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle); - DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->InstalledSize), Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle); - DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->EnabledSize), Option); - DisplayMmErrorStatus (Struct->Type6->ErrorStatus, Option); - break; - - // - // Cache Information (Type 7) - // - case 7: - PRINT_PENDING_STRING (Struct, Type7, SocketDesignation); - DisplayCacheConfiguration (Struct->Type7->CacheConfiguration, Option); - PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize); - PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize); - PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType); - PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType); - DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type7->CurrentSRAMType)), Option); - PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed); - DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option); - DisplayCacheSystemCacheType (Struct->Type7->SystemCacheType, Option); - DisplayCacheAssociativity (Struct->Type7->Associativity, Option); - if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x13)) { - PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize2); - PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize2); - } - break; - - // - // Port Connector Information (Type 8) - // - case 8: - PRINT_PENDING_STRING (Struct, Type8, InternalReferenceDesignator); - Print (L"Internal "); - DisplayPortConnectorType (Struct->Type8->InternalConnectorType, Option); - PRINT_PENDING_STRING (Struct, Type8, ExternalReferenceDesignator); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle); - DisplayPortConnectorType (Struct->Type8->ExternalConnectorType, Option); - DisplayPortType (Struct->Type8->PortType, Option); - break; - - // - // System Slots (Type 9) - // - case 9: - { - MISC_SLOT_PEER_GROUP *PeerGroupPtr; - UINT8 PeerGroupCount; - - PRINT_PENDING_STRING (Struct, Type9, SlotDesignation); - DisplaySystemSlotType (Struct->Type9->SlotType, Option); - DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option); - DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option); - DisplaySystemSlotLength (Struct->Type9->SlotLength, Option); - DisplaySystemSlotId ( - Struct->Type9->SlotID, - Struct->Type9->SlotType, - Option - ); - DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option); - DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option); - if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) { - PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum); - PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum); - PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum); - } - if (AE_SMBIOS_VERSION (0x3, 0x2)) { - if (Struct->Hdr->Length > 0x11) { - PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth); - } - if (Struct->Hdr->Length > 0x12) { - PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount); - - PeerGroupCount = Struct->Type9->PeerGroupingCount; - PeerGroupPtr = Struct->Type9->PeerGroups; - for (Index = 0; Index < PeerGroupCount; Index++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].SegmentGroupNum); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].BusNum); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].DevFuncNum); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, PeerGroupPtr[Index].DataBusWidth); - } - } - } - } - break; - - // - // On Board Devices Information (Type 10) - // - case 10: - { - UINTN NumOfDevice; - NumOfDevice = (Struct->Type10->Hdr.Length - sizeof (SMBIOS_STRUCTURE)) / (2 * sizeof (UINT8)); - for (Index = 0; Index < NumOfDevice; Index++) { - ShellPrintEx(-1,-1,(((Struct->Type10->Device[Index].DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n"); - DisplayOnboardDeviceTypes ((Struct->Type10->Device[Index].DeviceType) & 0x7F, Option); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle); - ShellPrintEx(-1,-1,L"%a\n",LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString)); - } - } - break; - - // - // Oem Strings (Type 11) - // - case 11: - PRINT_STRUCT_VALUE (Struct, Type11, StringCount); - for (Index = 1; Index <= Struct->Type11->StringCount; Index++) { - ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index)); - } - break; - - // - // System Configuration Options (Type 12) - // - case 12: - PRINT_STRUCT_VALUE (Struct, Type12, StringCount); - for (Index = 1; Index <= Struct->Type12->StringCount; Index++) { - ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index)); - } - break; - - // - // BIOS Language Information (Type 13) - // - case 13: - PRINT_STRUCT_VALUE (Struct, Type13, InstallableLanguages); - PRINT_STRUCT_VALUE (Struct, Type13, Flags); - PRINT_BIT_FIELD (Struct, Type13, Reserved, 15); - PRINT_PENDING_STRING (Struct, Type13, CurrentLanguages); - break; - - // - // Group Associations (Type 14) - // - case 14: - { - UINT8 NumOfItem; - NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3; - PRINT_PENDING_STRING (Struct, Type14, GroupName); - for (Index = 0; Index < NumOfItem; Index++) { - ShellPrintEx(-1,-1,L"ItemType %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemType); - ShellPrintEx(-1,-1,L"ItemHandle %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemHandle); - } - } - break; - - // - // System Event Log (Type 15) - // - case 15: - { - EVENT_LOG_TYPE *Ptr; - UINT8 Count; - UINT8 *AccessMethodAddress; - - PRINT_STRUCT_VALUE_H (Struct, Type15, LogAreaLength); - PRINT_STRUCT_VALUE_H (Struct, Type15, LogHeaderStartOffset); - PRINT_STRUCT_VALUE_H (Struct, Type15, LogDataStartOffset); - DisplaySELAccessMethod (Struct->Type15->AccessMethod, Option); - PRINT_STRUCT_VALUE_H (Struct, Type15, AccessMethodAddress); - DisplaySELLogStatus (Struct->Type15->LogStatus, Option); - PRINT_STRUCT_VALUE_H (Struct, Type15, LogChangeToken); - DisplaySysEventLogHeaderFormat (Struct->Type15->LogHeaderFormat, Option); - PRINT_STRUCT_VALUE_H (Struct, Type15, NumberOfSupportedLogTypeDescriptors); - PRINT_STRUCT_VALUE_H (Struct, Type15, LengthOfLogTypeDescriptor); - - Count = Struct->Type15->NumberOfSupportedLogTypeDescriptors; - if (Count > 0) { - Ptr = Struct->Type15->EventLogTypeDescriptors; - - // - // Display all Event Log type descriptors supported by system - // - for (Index = 0; Index < Count; Index++, Ptr++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1); - DisplaySELTypes (Ptr->LogType, Option); - DisplaySELVarDataFormatType (Ptr->DataFormatType, Option); - } - - if (Option >= SHOW_DETAIL) { - switch (Struct->Type15->AccessMethod) { - case 03: - AccessMethodAddress = (UINT8 *) (UINTN) (Struct->Type15->AccessMethodAddress); - break; - - case 00: - case 01: - case 02: - case 04: - default: - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED), - gShellDebug1HiiHandle, - Struct->Type15->AccessMethod - ); - return EFI_UNSUPPORTED; - } - // - // Display Event Log Header - // - // Starting offset (or index) within the nonvolatile storage - // of the event-log's header, from the Access Method Address - // - DisplaySysEventLogHeader ( - Struct->Type15->LogHeaderFormat, - AccessMethodAddress + Struct->Type15->LogHeaderStartOffset - ); - - // - // Display all Event Log data - // - // Starting offset (or index) within the nonvolatile storage - // of the event-log's first data byte, from the Access Method Address(0x14) - // - DisplaySysEventLogData ( - AccessMethodAddress + Struct->Type15->LogDataStartOffset, - (UINT16) - ( - Struct->Type15->LogAreaLength - - (Struct->Type15->LogDataStartOffset - Struct->Type15->LogHeaderStartOffset) - ) - ); - } - - } - } - break; - - // - // Physical Memory Array (Type 16) - // - case 16: - DisplayPMALocation (Struct->Type16->Location, Option); - DisplayPMAUse (Struct->Type16->Use, Option); - DisplayPMAErrorCorrectionTypes ( - Struct->Type16->MemoryErrorCorrection, - Option - ); - PRINT_STRUCT_VALUE_H (Struct, Type16, MaximumCapacity); - PRINT_STRUCT_VALUE_H (Struct, Type16, MemoryErrorInformationHandle); - PRINT_STRUCT_VALUE_H (Struct, Type16, NumberOfMemoryDevices); - if (AE_SMBIOS_VERSION (0x2, 0x7) && Struct->Hdr->Length > 0xF) { - PRINT_STRUCT_VALUE_LH (Struct, Type16, ExtendedMaximumCapacity); - } - break; - - // - // Memory Device (Type 17) - // - case 17: - PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryArrayHandle); - PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryErrorInformationHandle); - PRINT_STRUCT_VALUE (Struct, Type17, TotalWidth); - PRINT_STRUCT_VALUE (Struct, Type17, DataWidth); - PRINT_STRUCT_VALUE (Struct, Type17, Size); - DisplayMemoryDeviceFormFactor (Struct->Type17->FormFactor, Option); - PRINT_STRUCT_VALUE_H (Struct, Type17, DeviceSet); - PRINT_PENDING_STRING (Struct, Type17, DeviceLocator); - PRINT_PENDING_STRING (Struct, Type17, BankLocator); - DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option); - DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type17->TypeDetail)), Option); - PRINT_STRUCT_VALUE_H (Struct, Type17, Speed); - PRINT_PENDING_STRING (Struct, Type17, Manufacturer); - PRINT_PENDING_STRING (Struct, Type17, SerialNumber); - PRINT_PENDING_STRING (Struct, Type17, AssetTag); - PRINT_PENDING_STRING (Struct, Type17, PartNumber); - if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x1B)) { - PRINT_STRUCT_VALUE_H (Struct, Type17, Attributes); - } - if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x1C)) { - PRINT_STRUCT_VALUE (Struct, Type17, ExtendedSize); - PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredMemoryClockSpeed); - } - if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) { - PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage); - PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage); - PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage); - } - if (AE_SMBIOS_VERSION (0x3, 0x2)) { - if (Struct->Hdr->Length > 0x28) { - DisplayMemoryDeviceMemoryTechnology (Struct->Type17->MemoryTechnology, Option); - DisplayMemoryDeviceMemoryOperatingModeCapability (Struct->Type17->MemoryOperatingModeCapability.Uint16, Option); - PRINT_PENDING_STRING (Struct, Type17, FirwareVersion); - PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleManufacturerID); - PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleProductID); - PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerManufacturerID); - PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerProductID); - } - if (Struct->Hdr->Length > 0x34) { - PRINT_STRUCT_VALUE_H (Struct, Type17, NonVolatileSize); - } - if (Struct->Hdr->Length > 0x3C) { - PRINT_STRUCT_VALUE_H (Struct, Type17, VolatileSize); - } - if (Struct->Hdr->Length > 0x44) { - PRINT_STRUCT_VALUE_H (Struct, Type17, CacheSize); - } - if (Struct->Hdr->Length > 0x4C) { - PRINT_STRUCT_VALUE_H (Struct, Type17, LogicalSize); - } - } - break; - - // - // 32-bit Memory Error Information (Type 18) - // - case 18: - DisplayMemoryErrorType (Struct->Type18->ErrorType, Option); - DisplayMemoryErrorGranularity ( - Struct->Type18->ErrorGranularity, - Option - ); - DisplayMemoryErrorOperation (Struct->Type18->ErrorOperation, Option); - PRINT_STRUCT_VALUE_H (Struct, Type18, VendorSyndrome); - PRINT_STRUCT_VALUE_H (Struct, Type18, MemoryArrayErrorAddress); - PRINT_STRUCT_VALUE_H (Struct, Type18, DeviceErrorAddress); - PRINT_STRUCT_VALUE_H (Struct, Type18, ErrorResolution); - break; - - // - // Memory Array Mapped Address (Type 19) - // - case 19: - PRINT_STRUCT_VALUE_H (Struct, Type19, StartingAddress); - PRINT_STRUCT_VALUE_H (Struct, Type19, EndingAddress); - PRINT_STRUCT_VALUE_H (Struct, Type19, MemoryArrayHandle); - PRINT_STRUCT_VALUE_H (Struct, Type19, PartitionWidth); - if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) { - PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress); - PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress); - } - break; - - // - // Memory Device Mapped Address (Type 20) - // - case 20: - PRINT_STRUCT_VALUE_H (Struct, Type20, StartingAddress); - PRINT_STRUCT_VALUE_H (Struct, Type20, EndingAddress); - PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryDeviceHandle); - PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryArrayMappedAddressHandle); - PRINT_STRUCT_VALUE_H (Struct, Type20, PartitionRowPosition); - PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavePosition); - PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavedDataDepth); - if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) { - PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress); - PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress); - } - break; - - // - // Built-in Pointing Device (Type 21) - // - case 21: - DisplayPointingDeviceType (Struct->Type21->Type, Option); - DisplayPointingDeviceInterface (Struct->Type21->Interface, Option); - PRINT_STRUCT_VALUE (Struct, Type21, NumberOfButtons); - break; - - // - // Portable Battery (Type 22) - // - case 22: - PRINT_PENDING_STRING (Struct, Type22, Location); - PRINT_PENDING_STRING (Struct, Type22, Manufacturer); - PRINT_PENDING_STRING (Struct, Type22, ManufactureDate); - PRINT_PENDING_STRING (Struct, Type22, SerialNumber); - PRINT_PENDING_STRING (Struct, Type22, DeviceName); - DisplayPBDeviceChemistry ( - Struct->Type22->DeviceChemistry, - Option - ); - PRINT_STRUCT_VALUE_H (Struct, Type22, DeviceCapacity); - PRINT_STRUCT_VALUE_H (Struct, Type22, DesignVoltage); - PRINT_PENDING_STRING (Struct, Type22, SBDSVersionNumber); - PRINT_STRUCT_VALUE_H (Struct, Type22, MaximumErrorInBatteryData); - PRINT_STRUCT_VALUE_H (Struct, Type22, SBDSSerialNumber); - DisplaySBDSManufactureDate ( - Struct->Type22->SBDSManufactureDate, - Option - ); - PRINT_PENDING_STRING (Struct, Type22, SBDSDeviceChemistry); - PRINT_STRUCT_VALUE_H (Struct, Type22, DesignCapacityMultiplier); - PRINT_STRUCT_VALUE_H (Struct, Type22, OEMSpecific); - break; - - // - // System Reset (Type 23) - // - case 23: - DisplaySystemResetCapabilities ( - Struct->Type23->Capabilities, - Option - ); - PRINT_STRUCT_VALUE_H (Struct, Type23, ResetCount); - PRINT_STRUCT_VALUE_H (Struct, Type23, ResetLimit); - PRINT_STRUCT_VALUE_H (Struct, Type23, TimerInterval); - PRINT_STRUCT_VALUE_H (Struct, Type23, Timeout); - break; - - // - // Hardware Security (Type 24) - // - case 24: - DisplayHardwareSecuritySettings ( - Struct->Type24->HardwareSecuritySettings, - Option - ); - break; - - // - // System Power Controls (Type 25) - // - case 25: - PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMonth); - PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnDayOfMonth); - PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnHour); - PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMinute); - PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnSecond); - break; - - // - // Voltage Probe (Type 26) - // - case 26: - PRINT_PENDING_STRING (Struct, Type26, Description); - DisplayVPLocation (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option); - DisplayVPStatus (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option); - PRINT_STRUCT_VALUE_H (Struct, Type26, MaximumValue); - PRINT_STRUCT_VALUE_H (Struct, Type26, MinimumValue); - PRINT_STRUCT_VALUE_H (Struct, Type26, Resolution); - PRINT_STRUCT_VALUE_H (Struct, Type26, Tolerance); - PRINT_STRUCT_VALUE_H (Struct, Type26, Accuracy); - PRINT_STRUCT_VALUE_H (Struct, Type26, OEMDefined); - PRINT_STRUCT_VALUE_H (Struct, Type26, NominalValue); - break; - - // - // Cooling Device (Type 27) - // - case 27: - PRINT_STRUCT_VALUE_H (Struct, Type27, TemperatureProbeHandle); - DisplayCoolingDeviceStatus (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option); - DisplayCoolingDeviceType (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option); - PRINT_STRUCT_VALUE_H (Struct, Type27, CoolingUnitGroup); - PRINT_STRUCT_VALUE_H (Struct, Type27, OEMDefined); - PRINT_STRUCT_VALUE_H (Struct, Type27, NominalSpeed); - if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xE)) { - PRINT_PENDING_STRING (Struct, Type27, Description); - } - break; - - // - // Temperature Probe (Type 28) - // - case 28: - PRINT_PENDING_STRING (Struct, Type28, Description); - DisplayTemperatureProbeStatus (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option); - DisplayTemperatureProbeLoc (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option); - PRINT_STRUCT_VALUE_H (Struct, Type28, MaximumValue); - PRINT_STRUCT_VALUE_H (Struct, Type28, MinimumValue); - PRINT_STRUCT_VALUE_H (Struct, Type28, Resolution); - PRINT_STRUCT_VALUE_H (Struct, Type28, Tolerance); - PRINT_STRUCT_VALUE_H (Struct, Type28, Accuracy); - PRINT_STRUCT_VALUE_H (Struct, Type28, OEMDefined); - PRINT_STRUCT_VALUE_H (Struct, Type28, NominalValue); - break; - - // - // Electrical Current Probe (Type 29) - // - case 29: - PRINT_PENDING_STRING (Struct, Type29, Description); - DisplayECPStatus (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option); - DisplayECPLoc (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option); - PRINT_STRUCT_VALUE_H (Struct, Type29, MaximumValue); - PRINT_STRUCT_VALUE_H (Struct, Type29, MinimumValue); - PRINT_STRUCT_VALUE_H (Struct, Type29, Resolution); - PRINT_STRUCT_VALUE_H (Struct, Type29, Tolerance); - PRINT_STRUCT_VALUE_H (Struct, Type29, Accuracy); - PRINT_STRUCT_VALUE_H (Struct, Type29, OEMDefined); - PRINT_STRUCT_VALUE_H (Struct, Type29, NominalValue); - break; - - // - // Out-of-Band Remote Access (Type 30) - // - case 30: - PRINT_PENDING_STRING (Struct, Type30, ManufacturerName); - DisplayOBRAConnections (Struct->Type30->Connections, Option); - break; - - // - // Boot Integrity Services (BIS) Entry Point (Type 31) - // - case 31: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle); - break; - - // - // System Boot Information (Type 32) - // - case 32: - PRINT_BIT_FIELD (Struct, Type32, Reserved, 6); - DisplaySystemBootStatus (Struct->Type32->BootStatus, Option); - break; - - // - // 64-Bit Memory Error Information (Type 33) - // - case 33: - DisplayMemoryErrorType (Struct->Type33->ErrorType, Option); - DisplayMemoryErrorGranularity ( - Struct->Type33->ErrorGranularity, - Option - ); - DisplayMemoryErrorOperation (Struct->Type33->ErrorOperation, Option); - PRINT_STRUCT_VALUE_H (Struct, Type33, VendorSyndrome); - PRINT_STRUCT_VALUE_LH (Struct, Type33, MemoryArrayErrorAddress); - PRINT_STRUCT_VALUE_LH (Struct, Type33, DeviceErrorAddress); - PRINT_STRUCT_VALUE_H (Struct, Type33, ErrorResolution); - break; - - // - // Management Device (Type 34) - // - case 34: - PRINT_PENDING_STRING (Struct, Type34, Description); - DisplayMDType (Struct->Type34->Type, Option); - PRINT_STRUCT_VALUE_H (Struct, Type34, Address); - DisplayMDAddressType (Struct->Type34->AddressType, Option); - break; - - // - // Management Device Component (Type 35) - // - case 35: - PRINT_PENDING_STRING (Struct, Type35, Description); - PRINT_STRUCT_VALUE_H (Struct, Type35, ManagementDeviceHandle); - PRINT_STRUCT_VALUE_H (Struct, Type35, ComponentHandle); - PRINT_STRUCT_VALUE_H (Struct, Type35, ThresholdHandle); - break; - - // - // Management Device Threshold Data (Type 36) - // - case 36: - PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonCritical); - PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonCritical); - PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdCritical); - PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdCritical); - PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonRecoverable); - PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonRecoverable); - break; - - // - // Memory Channel (Type 37) - // - case 37: - { - UINT8 Count; - MEMORY_DEVICE *Ptr; - DisplayMemoryChannelType (Struct->Type37->ChannelType, Option); - PRINT_STRUCT_VALUE_H (Struct, Type37, MaximumChannelLoad); - PRINT_STRUCT_VALUE_H (Struct, Type37, MemoryDeviceCount); - - Count = Struct->Type37->MemoryDeviceCount; - Ptr = Struct->Type37->MemoryDevice; - for (Index = 0; Index < Count; Index++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr[Index].DeviceLoad); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr[Index].DeviceHandle); - } - } - break; - - // - // IPMI Device Information (Type 38) - // - case 38: - DisplayIPMIDIBMCInterfaceType (Struct->Type38->InterfaceType, Option); - PRINT_STRUCT_VALUE_H (Struct, Type38, IPMISpecificationRevision); - PRINT_STRUCT_VALUE_H (Struct, Type38, I2CSlaveAddress); - PRINT_STRUCT_VALUE_H (Struct, Type38, NVStorageDeviceAddress); - PRINT_STRUCT_VALUE_LH (Struct, Type38, BaseAddress); - break; - - // - // System Power Supply (Type 39) - // - case 39: - PRINT_STRUCT_VALUE_H (Struct, Type39, PowerUnitGroup); - PRINT_PENDING_STRING (Struct, Type39, Location); - PRINT_PENDING_STRING (Struct, Type39, DeviceName); - PRINT_PENDING_STRING (Struct, Type39, Manufacturer); - PRINT_PENDING_STRING (Struct, Type39, SerialNumber); - PRINT_PENDING_STRING (Struct, Type39, AssetTagNumber); - PRINT_PENDING_STRING (Struct, Type39, ModelPartNumber); - PRINT_PENDING_STRING (Struct, Type39, RevisionLevel); - PRINT_STRUCT_VALUE_H (Struct, Type39, MaxPowerCapacity); - DisplaySPSCharacteristics ( - *(UINT16 *) &(Struct->Type39->PowerSupplyCharacteristics), - Option - ); - PRINT_STRUCT_VALUE_H (Struct, Type39, InputVoltageProbeHandle); - PRINT_STRUCT_VALUE_H (Struct, Type39, CoolingDeviceHandle); - PRINT_STRUCT_VALUE_H (Struct, Type39, InputCurrentProbeHandle); - break; - - // - // Additional Information (Type 40) - // - case 40: - { - UINT8 NumberOfEntries; - UINT8 EntryLength; - ADDITIONAL_INFORMATION_ENTRY *Entries; - - EntryLength = 0; - Entries = Struct->Type40->AdditionalInfoEntries; - NumberOfEntries = Struct->Type40->NumberOfAdditionalInformationEntries; - - PRINT_STRUCT_VALUE_H (Struct, Type40, NumberOfAdditionalInformationEntries); - - for (Index = 0; Index < NumberOfEntries; Index++) { - EntryLength = Entries->EntryLength; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset); - PRINT_SMBIOS_STRING (Struct, Entries->EntryString, String); - PRINT_SMBIOS_BIT_FIELD (Struct, Entries->Value, Value, EntryLength - 5); - Entries = (ADDITIONAL_INFORMATION_ENTRY *) ((UINT8 *)Entries + EntryLength); - } - } - break; - - // - // Onboard Devices Extended Information (Type 41) - // - case 41: - PRINT_PENDING_STRING (Struct, Type41, ReferenceDesignation); - ShellPrintEx(-1,-1,(((Struct->Type41->DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n"); - DisplayOnboardDeviceTypes ((Struct->Type41->DeviceType) & 0x7F, Option); - PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceTypeInstance); - PRINT_STRUCT_VALUE_H (Struct, Type41, SegmentGroupNum); - PRINT_STRUCT_VALUE_H (Struct, Type41, BusNum); - PRINT_STRUCT_VALUE_H (Struct, Type41, DevFuncNum); - break; - - // - // Management Controller Host Interface (Type 42) - // - case 42: - DisplayMCHostInterfaceType (Struct->Type42->InterfaceType, Option); - if (AE_SMBIOS_VERSION (0x3, 0x2)) { - PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceTypeSpecificDataLength); - PRINT_BIT_FIELD (Struct, Type42, InterfaceTypeSpecificData, Struct->Type42->InterfaceTypeSpecificDataLength); - } - break; - - // - // TPM Device (Type 43) - // - case 43: - PRINT_BIT_FIELD (Struct, Type43, VendorID, 4); - PRINT_STRUCT_VALUE_H (Struct, Type43, MajorSpecVersion); - PRINT_STRUCT_VALUE_H (Struct, Type43, MinorSpecVersion); - PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion1); - PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion2); - PRINT_PENDING_STRING (Struct, Type43, Description); - DisplayTpmDeviceCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type43->Characteristics)), Option); - PRINT_STRUCT_VALUE_H (Struct, Type43, OemDefined); - break; - - // - // Inactive (Type 126) - // - case 126: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle); - break; - - // - // End-of-Table (Type 127) - // - case 127: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle); - break; - } - - return EFI_SUCCESS; -} - -/** - Display BIOS Information (Type 0) information. - - @param[in] Chara The information bits. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristics ( - IN UINT64 Chara, - IN UINT8 Option - ) -{ - // - // Print header - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle); - // - // print option - // - PRINT_INFO_OPTION (Chara, Option); - - // - // Check all the bits and print information - // This function does not use Table because table of bits - // are designed not to deal with UINT64 - // - if (BIT (Chara, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 6) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 8) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 9) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 10) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 11) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 12) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 13) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 14) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 15) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FORM_CD_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 16) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 17) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 18) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 19) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 20) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 21) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 22) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 23) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 24) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 25) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 26) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 27) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 28) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 29) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 30) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 31) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle); - } - // - // Just print the Reserved - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle); -} - -/** - Display Bios Characteristice extensions1 information. - - @param[in] Byte1 The information. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristicsExt1 ( - IN UINT8 Byte1, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (Byte1, Option); - - // - // check bit and print - // - if (BIT (Byte1, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 6) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Byte1, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle); - } -} - -/** - Display Bios Characteristice extensions2 information. - - @param[in] byte2 The information. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristicsExt2 ( - IN UINT8 byte2, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (byte2, Option); - - if (BIT (byte2, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle); - } - - if (BIT (byte2, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle); - } - - if (AE_SMBIOS_VERSION (0x2, 0x4)) { - if (BIT (byte2, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST), gShellDebug1HiiHandle); - } - if (AE_SMBIOS_VERSION (0x2, 0x7)) { - if (BIT (byte2, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT), gShellDebug1HiiHandle); - } - if (BIT (byte2, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE), gShellDebug1HiiHandle); - } - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 5); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 3); - } - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 2); - } -} - -/** - Display Processor Information (Type 4) information. - - @param[in] Family The family value. - @param[in] Option The option value. -**/ -VOID -DisplayProcessorFamily ( - UINT8 Family, - UINT8 Option - ) -{ - // - // Print prompt message - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (Family, Option); - - // - // Use switch to check - // - switch (Family) { - case 0x01: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle); - break; - - case 0x02: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - - case 0x03: - Print (L"8086\n"); - break; - - case 0x04: - Print (L"80286\n"); - break; - - case 0x05: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle); - break; - - case 0x06: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle); - break; - - case 0x07: - Print (L"8087\n"); - break; - - case 0x08: - Print (L"80287\n"); - break; - - case 0x09: - Print (L"80387\n"); - break; - - case 0x0A: - Print (L"80487\n"); - break; - - case 0x0B: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x0C: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle); - break; - - case 0x0D: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle); - break; - - case 0x0E: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle); - break; - - case 0x0F: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle); - break; - - case 0x10: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle); - break; - - case 0x11: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle); - break; - - case 0x12: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x13: - Print (L"M2 Family\n"); - break; - - case 0x14: - Print (L"Intel Celeron M\n"); - break; - - case 0x15: - Print (L"Intel Pentium 4 HT\n"); - break; - - case 0x18: - Print (L"AMD Duron\n"); - break; - - case 0x19: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x1A: - Print (L"K6 Family\n"); - break; - - case 0x1B: - Print (L"K6-2\n"); - break; - - case 0x1C: - Print (L"K6-3\n"); - break; - - case 0x1D: - Print (L"AMD Althon Processor Family\n"); - break; - - case 0x1E: - Print (L"AMD 29000 Family\n"); - break; - - case 0x1F: - Print (L"K6-2+\n"); - break; - - case 0x20: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x21: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle); - break; - - case 0x22: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle); - break; - - case 0x23: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle); - break; - - case 0x24: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle); - break; - - case 0x25: - Print (L"Power PC 620\n"); - break; - - case 0x26: - Print (L"Power PC 704\n"); - break; - - case 0x27: - Print (L"Power PC 750\n"); - break; - - case 0x28: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle); - break; - - case 0x29: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle); - break; - - case 0x2A: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle); - break; - - case 0x2B: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle); - break; - - case 0x2C: - Print (L"Intel(R) Core(TM) M processor\n"); - break; - - case 0x2D: - Print (L"Intel(R) Core(TM) m3 processor\n"); - break; - - case 0x2E: - Print (L"Intel(R) Core(TM) m5 processor\n"); - break; - - case 0x2F: - Print (L"Intel(R) Core(TM) m7 processor\n"); - break; - - case 0x30: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle); - break; - - case 0x31: - Print (L"Alpha 21064\n"); - break; - - case 0x32: - Print (L"Alpha 21066\n"); - break; - - case 0x33: - Print (L"Alpha 21164\n"); - break; - - case 0x34: - Print (L"Alpha 21164PC\n"); - break; - - case 0x35: - Print (L"Alpha 21164a\n"); - break; - - case 0x36: - Print (L"Alpha 21264\n"); - break; - - case 0x37: - Print (L"Alpha 21364\n"); - break; - - case 0x38: - Print (L"AMD Turion II Ultra Dual-Core Mobile M Processor Family\n"); - break; - - case 0x39: - Print (L"AMD Turion II Dual-Core Mobile M Processor Family\n"); - break; - - case 0x3A: - Print (L"AMD Althon II Dual-Core M Processor Family\n"); - break; - - case 0x3B: - Print (L"AMD Opteron 6100 Series Processor\n"); - break; - - case 0x3C: - Print (L"AMD Opteron 4100 Series Processor\n"); - break; - - case 0x3D: - Print (L"AMD Opteron 6200 Series Processor\n"); - break; - - case 0x3E: - Print (L"AMD Opteron 4200 Series Processor\n"); - break; - - case 0x3F: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES), gShellDebug1HiiHandle); - break; - - case 0x40: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x41: - Print (L"MIPS R4000\n"); - break; - - case 0x42: - Print (L"MIPS R4200\n"); - break; - - case 0x43: - Print (L"MIPS R4400\n"); - break; - - case 0x44: - Print (L"MIPS R4600\n"); - break; - - case 0x45: - Print (L"MIPS R10000\n"); - break; - - case 0x46: - Print (L"AMD C-Series Processor\n"); - break; - - case 0x47: - Print (L"AMD E-Series Processor\n"); - break; - - case 0x48: - Print (L"AMD A-Series Processor\n"); - break; - - case 0x49: - Print (L"AMD G-Series Processor\n"); - break; - - case 0x4A: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES), gShellDebug1HiiHandle); - break; - - case 0x4B: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES), gShellDebug1HiiHandle); - break; - - case 0x4C: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES), gShellDebug1HiiHandle); - break; - - case 0x4D: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES), gShellDebug1HiiHandle); - break; - - case 0x4E: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES), gShellDebug1HiiHandle); - break; - - case 0x4F: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES), gShellDebug1HiiHandle); - break; - - case 0x50: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x51: - Print (L"SuperSparc\n"); - break; - - case 0x52: - Print (L"microSparc II\n"); - break; - - case 0x53: - Print (L"microSparc IIep\n"); - break; - - case 0x54: - Print (L"UltraSparc\n"); - break; - - case 0x55: - Print (L"UltraSparc II\n"); - break; - - case 0x56: - Print (L"UltraSparcIIi\n"); - break; - - case 0x57: - Print (L"UltraSparcIII\n"); - break; - - case 0x58: - Print (L"UltraSparcIIIi\n"); - break; - - case 0x60: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x61: - Print (L"68xx\n"); - break; - - case 0x62: - Print (L"68000\n"); - break; - - case 0x63: - Print (L"68010\n"); - break; - - case 0x64: - Print (L"68020\n"); - break; - - case 0x65: - Print (L"68030\n"); - break; - - case 0x66: - Print (L"AMD Athlon(TM) X4 Quad-Core Processor Family\n"); - break; - - case 0x67: - Print (L"AMD Opteron(TM) X1000 Series Processor\n"); - break; - - case 0x68: - Print (L"AMD Opteron(TM) X2000 Series APU\n"); - break; - - case 0x69: - Print (L"AMD Opteron(TM) A-Series Processor\n"); - break; - - case 0x6A: - Print (L"AMD Opteron(TM) X3000 Series APU\n"); - break; - - case 0x6B: - Print (L"AMD Zen Processor Family\n"); - break; - - case 0x70: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x78: - Print (L"Crusoe TM5000\n"); - break; - - case 0x79: - Print (L"Crusoe TM3000\n"); - break; - - case 0x7A: - Print (L"Efficeon TM8000\n"); - break; - - case 0x80: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle); - break; - - case 0x82: - Print (L"Itanium\n"); - break; - - case 0x83: - Print (L"AMD Athlon64\n"); - break; - - case 0x84: - Print (L"AMD Opteron\n"); - break; - - case 0x85: - Print (L"AMD Sempron\n"); - break; - - case 0x86: - Print (L"AMD Turion64 Mobile\n"); - break; - - case 0x87: - Print (L"Dual-Core AMD Opteron\n"); - break; - - case 0x88: - Print (L"AMD Athlon 64X2 DualCore\n"); - break; - - case 0x89: - Print (L"AMD Turion 64X2 Mobile\n"); - break; - - case 0x8A: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0x8B: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle); - break; - - case 0x8C: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0x8D: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0x8E: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0x8F: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0x90: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle); - break; - - case 0x91: - Print (L"PA-RISC 8500\n"); - break; - - case 0x92: - Print (L"PA-RISC 8000\n"); - break; - - case 0x93: - Print (L"PA-RISC 7300LC\n"); - break; - - case 0x94: - Print (L"PA-RISC 7200\n"); - break; - - case 0x95: - Print (L"PA-RISC 7100LC\n"); - break; - - case 0x96: - Print (L"PA-RISC 7100\n"); - break; - - case 0xA0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle); - break; - - case 0xA1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xA2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xA4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA8: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xA9: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xAA: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xAB: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xAC: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xAD: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xAE: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xAF: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle); - break; - - case 0xB0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle); - break; - - case 0xB1: - Print (L"Pentium III Processorwith Intel SpeedStep Technology\n"); - break; - - case 0xB2: - Print (L"Pentium 4 processor\n"); - break; - - case 0xB3: - Print (L"Intel Xeon Processor\n"); - break; - - case 0xB4: - Print (L"AS400 Family\n"); - break; - - case 0xB5: - Print (L"Intel Xeon processor MP\n"); - break; - - case 0xB6: - Print (L"AMD Althon XP Processor Family\n"); - break; - - case 0xB7: - Print (L"AMD Althon MP Promcessor Family\n"); - break; - - case 0xB8: - Print (L"Intel Itanium 2 processor\n"); - break; - - case 0xB9: - Print (L"Intel Penium M processor\n"); - break; - - case 0xBA: - Print (L"Intel Celeron D processor\n"); - break; - - case 0xBB: - Print (L"Intel Pentium D processor\n"); - break; - - case 0xBC: - Print (L"Intel Pentium Processor Extreme Edition\n"); - break; - - case 0xBD: - Print (L"Intel Core Solo Processor\n"); - break; - - case 0xBF: - Print (L"Intel Core 2 Duo Processor\n"); - break; - - case 0xC0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle); - break; - - case 0xC1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle); - break; - - case 0xC2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle); - break; - - case 0xC3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle); - break; - - case 0xC4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle); - break; - - case 0xC5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle); - break; - - case 0xC6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle); - break; - - case 0xC7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xC8: - Print (L"IBM 390\n"); - break; - - case 0xC9: - Print (L"G4\n"); - break; - - case 0xCA: - Print (L"G5\n"); - break; - - case 0xCB: - Print (L"G6\n"); - break; - - case 0xCC: - Print (L"zArchitecture\n"); - break; - - case 0xCD: - Print (L"Intel Core i5 processor\n"); - break; - - case 0xCE: - Print (L"Intel Core i3 processor\n"); - break; - - case 0xCF: - Print (L"Intel Core i9 processor\n"); - break; - - case 0xD2: - Print (L"ViaC7M\n"); - break; - - case 0xD3: - Print (L"ViaC7D\n"); - break; - - case 0xD4: - Print (L"ViaC7\n"); - break; - - case 0xD5: - Print (L"Eden\n"); - break; - - case 0xD6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle); - break; - - case 0xD7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xD8: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xDA: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xDB: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xDD: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xDE: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xDF: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle); - break; - - case 0xE0: - Print (L"Multi-Core Intel Xeon processor 3400 Series\n"); - break; - - case 0xE4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES), gShellDebug1HiiHandle); - break; - - case 0xE5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II), gShellDebug1HiiHandle); - break; - - - case 0xE6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle); - break; - - case 0xE7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle); - break; - - case 0xE8: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle); - break; - - case 0xE9: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle); - break; - - case 0xEA: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle); - break; - - case 0xEB: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle); - break; - - case 0xEC: - Print (L"AMD Phenom II Processor Family\n"); - break; - - case 0xED: - Print (L"AMD Althon II Processor Family\n"); - break; - - case 0xEE: - Print (L"Six-Core AMD Opteron Processor Family\n"); - break; - - case 0xEF: - Print (L"AMD Sempron M Processor Family\n"); - break; - - case 0xFA: - Print (L"i860\n"); - break; - - case 0xFB: - Print (L"i960\n"); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); - } - // - // end switch - // -} - -/** - Display processor family information. - - @param[in] Family2 The family value. - @param[in] Option The option value. -**/ -VOID -DisplayProcessorFamily2 ( - IN UINT16 Family2, - IN UINT8 Option - ) -{ - // - // Print prompt message - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle); - - // - // Print option - // - PRINT_INFO_OPTION (Family2, Option); - - // - // Use switch to check - // - switch (Family2) { - case 0x100: - Print (L"ARMv7\n"); - break; - - case 0x101: - Print (L"ARMv8\n"); - break; - - case 0x104: - Print (L"SH-3\n"); - break; - - case 0x105: - Print (L"SH-4\n"); - break; - - case 0x118: - Print (L"ARM\n"); - break; - - case 0x119: - Print (L"StrongARM\n"); - break; - - case 0x12C: - Print (L"6x86\n"); - break; - - case 0x12D: - Print (L"MediaGX\n"); - break; - - case 0x12E: - Print (L"MII\n"); - break; - - case 0x140: - Print (L"WinChip\n"); - break; - - case 0x15E: - Print (L"DSP\n"); - break; - - case 0x1F4: - Print (L"Video Processor\n"); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); - } - -} - -/** - Display processor voltage information. - - @param[in] Voltage The Voltage. - Bit 7 Set to 0, indicating 'legacy' mode for processor voltage - Bits 6:4 Reserved, must be zero - Bits 3:0 Voltage Capability. - A Set bit indicates that the voltage is supported. - Bit 0 - 5V - Bit 1 - 3.3V - Bit 2 - 2.9V - Bit 3 - Reserved, must be zero. - - Note: - Setting of multiple bits indicates the socket is configurable - If bit 7 is set to 1, the remaining seven bits of the field are set to - contain the processor's current voltage times 10. - For example, the field value for a processor voltage of 1.8 volts would be - 92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h. - - @param[in] Option The option. -**/ -VOID -DisplayProcessorVoltage ( - IN UINT8 Voltage, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (Voltage, Option); - - if (BIT (Voltage, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80)); - } else { - if (BIT (Voltage, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle); - } - - if (BIT (Voltage, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Voltage, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle); - } - // - // check the reserved zero bits: - // - if (BIT (Voltage, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle); - } - - if (BIT (Voltage, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); - } - - if (BIT (Voltage, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle); - } - - if (BIT (Voltage, 6) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle); - } - } -} - -/** - Display processor information. - - @param[in] Status The status. -Bit 7 Reserved, must be 0 -Bit 6 CPU Socket Populated - 1 - CPU Socket Populated - 0 - CPU Socket Unpopulated -Bits 5:3 Reserved, must be zero -Bits 2:0 CPU Status - 0h - Unknown - 1h - CPU Enabled - 2h - CPU Disabled by User via BIOS Setup - 3h - CPU Disabled By BIOS (POST Error) - 4h - CPU is Idle, waiting to be enabled. - 5-6h - Reserved - 7h - Other - - @param[in] Option The option -**/ -VOID -DisplayProcessorStatus ( - IN UINT8 Status, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - - if (BIT (Status, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (Status, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (Status, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (Status, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle); - } - // - // Check BIT 6 - // - if (BIT (Status, 6) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle); - } - // - // Check BITs 2:0 - // - switch (Status & 0x07) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle); - break; - - case 4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle); - break; - - case 7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); - } -} - -/** - Display information about Memory Controller Information (Type 5). - - @param[in] Size Memory size. - @param[in] SlotNum Which slot is this about. - @param[in] Option Option for the level of detail output required. -**/ -VOID -DisplayMaxMemoryModuleSize ( - IN UINT8 Size, - IN UINT8 SlotNum, - IN UINT8 Option - ) -{ - UINTN MaxSize; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle); - // - // MaxSize is determined by follow formula - // - MaxSize = (UINTN) 1 << Size; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize); - - if (Option >= SHOW_DETAIL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum); - } -} - -/** - Display information about memory configuration handles. - - @param[in] Handles The buffer of handles to output info on. - @param[in] SlotNum The number of handles in the above buffer. - @param[in] Option Option for the level of detail output required. -**/ -VOID -DisplayMemoryModuleConfigHandles ( - IN UINT16 *Handles, - IN UINT8 SlotNum, - IN UINT8 Option - ) -{ - UINT8 Index; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum); - - if (Option >= SHOW_DETAIL) { - // - // No handle, Handles is INVALID. - // - if (SlotNum == 0) { - return ; - } - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle); - for (Index = 0; Index < SlotNum; Index++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]); - } - } -} - -/** - Display Memory Module Information (Type 6). - - @param[in] BankConnections - @param[in] Option -**/ -VOID -DisplayMmBankConnections ( - IN UINT8 BankConnections, - IN UINT8 Option - ) -{ - UINT8 High; - UINT8 Low; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (BankConnections, Option); - - // - // Divide it to high and low - // - High = (UINT8) (BankConnections & 0xF0); - Low = (UINT8) (BankConnections & 0x0F); - if (High != 0xF) { - if (Low != 0xF) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High); - } - } else { - if (Low != 0xF) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle); - } - } -} - -/** - Display memory informcation. - - Bits 0:6 Size (n), - where 2**n is the size in MB with three special-case values: - 7Dh Not determinable (Installed Size only) - 7Eh Module is installed, but no memory has been enabled - 7Fh Not installed - Bit 7 Defines whether the memory module has a single- (0) - or double-bank (1) connection. - - @param[in] Size - The size - @param[in] Option - The option -**/ -VOID -DisplayMmMemorySize ( - IN UINT8 Size, - IN UINT8 Option - ) -{ - UINT8 Value; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (Size, Option); - - // - // Get the low bits(0-6 bit) - // - Value = (UINT8) (Size & 0x7F); - if (Value == 0x7D) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle); - } else if (Value == 0x7E) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle); - } else if (Value == 0x7F) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value); - } - - if (BIT (Size, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle); - } -} - -/** - Display Cache Configuration. - - @param[in] CacheConfiguration Cache Configuration. -Bits 15:10 Reserved, must be 0 -Bits 9:8 Operational Mode - 0h - Write Through - 1h - Write Back - 2h - Varies with Memory Address - 3h - Unknown -Bit 7 Enabled/Disabled - 1 - Enabled - 0 - Disabled -Bits 6:5 Location - 0h - Internal - 1h - External - 2h - Reserved - 3h - Unknown -Bit 4 Reserved, must be zero -Bit 3 Cache Socketed - 1 - Socketed - 0 - Unsocketed -Bits 2:0 Cache Level - 1 through 8 (For example, an L1 cache would - use value 000b and an L3 cache would use 010b.) - - @param[in] Option The option -**/ -VOID -DisplayCacheConfiguration ( - IN UINT16 CacheConfiguration, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (CacheConfiguration, Option); - - if (BIT (CacheConfiguration, 15) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 14) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 13) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 12) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 11) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 10) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO), gShellDebug1HiiHandle); - } else if (BIT (CacheConfiguration, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); - } - - // - // Check BITs 9:8 - // - switch ((CacheConfiguration & 0x300) >> 8) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } - - // - // Check BIT 7 - // - if (BIT (CacheConfiguration, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); - } - - // - // Check BITs 6:5 - // - switch ((CacheConfiguration & 0x60) >> 5) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } - - // - // Check BIT 3 - // - if (BIT (CacheConfiguration, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED), gShellDebug1HiiHandle); - } - - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL), gShellDebug1HiiHandle, (CacheConfiguration & 0x07) + 1); -} - -/** - The Slot ID field of the System Slot structure provides a mechanism to - correlate the physical attributes of the slot to its logical access method - (which varies based on the Slot Type field). - - @param[in] SlotId - The slot ID - @param[in] SlotType - The slot type - @param[in] Option - The Option -**/ -VOID -DisplaySystemSlotId ( - IN UINT16 SlotId, - IN UINT8 SlotType, - IN UINT8 Option - ) -{ - // - // Display slot type first - // - DisplaySystemSlotType (SlotType, Option); - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle); - // - // print option - // - PRINT_INFO_OPTION (SlotType, Option); - - switch (SlotType) { - // - // Slot Type: MCA - // - case 0x04: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle); - if (SlotId > 0 && SlotId < 15) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle); - } - break; - - // - // EISA - // - case 0x05: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle); - if (SlotId > 0 && SlotId < 15) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle); - } - break; - - // - // Slot Type: PCI - // - case 0x06: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); - break; - - // - // PCMCIA - // - case 0x07: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId); - break; - - // - // Slot Type: PCI-E - // - case 0xA5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); - break; - - default: - if ((SlotType >= 0x0E && SlotType <= 0x12) || (SlotType >= 0xA6 && SlotType <= 0xB6)){ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle); - } - } -} - -/** - Display System Boot Information (Type 32) information. - - @param[in] Parameter The parameter. - @param[in] Option The options. -**/ -VOID -DisplaySystemBootStatus ( - IN UINT8 Parameter, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle); - // - // Print option - // - PRINT_INFO_OPTION (Parameter, Option); - - // - // Check value and print - // - if (Parameter == 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle); - } else if (Parameter == 1) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle); - } else if (Parameter == 2) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle); - } else if (Parameter == 3) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle); - } else if (Parameter == 4) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle); - } else if (Parameter == 5) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle); - } else if (Parameter == 6) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle); - } else if (Parameter == 7) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle); - } else if (Parameter == 8) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle); - } else if (Parameter >= 9 && Parameter <= 127) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle); - } else if (Parameter >= 128 && Parameter <= 191) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle); - } else if (Parameter >= 192) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle); - } -} - -/** - Display Portable Battery (Type 22) information. - - The date the cell pack was manufactured, in packed format: - Bits 15:9 Year, biased by 1980, in the range 0 to 127. - Bits 8:5 Month, in the range 1 to 12. - Bits 4:0 Date, in the range 1 to 31. - For example, 01 February 2000 would be identified as - 0010 1000 0100 0001b (0x2841). - - @param[in] Date The date - @param[in] Option The option -**/ -VOID -DisplaySBDSManufactureDate ( - IN UINT16 Date, - IN UINT8 Option - ) -{ - UINTN Day; - UINTN Month; - UINTN Year; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Date, Option); - // - // Print date - // - Day = Date & 0x001F; - Month = (Date & 0x01E0) >> 5; - Year = ((Date & 0xFE00) >> 9) + 1980; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year); - -} - -/** - Display System Reset (Type 23) information. - - -Identifies the system-reset capabilities for the system. - Bits 7:6 Reserved for future assignment via this specification, set to 00b. - Bit 5 System contains a watchdog timer, either True (1) or False (0). - Bits 4:3 Boot Option on Limit. - Identifies the system action to be taken when the Reset Limit is reached, one of: - 00b Reserved, do not use. - 01b Operating system - 10b System utilities - 11b Do not rebootBits - 2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of: - 00b Reserved, do not use. - 01b Operating system - 10b System utilities - 11b Do not reboot - Bit 0 Status. - 1b The system reset is enabled by the user - 0b The system reset is not enabled by the user - - @param[in] Reset Reset - @param[in] Option The option -**/ -VOID -DisplaySystemResetCapabilities ( - IN UINT8 Reset, - IN UINT8 Option - ) -{ - UINTN Temp; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Reset, Option); - - // - // Check reserved bits 7:6 - // - if ((Reset & 0xC0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle); - } - // - // Watch dog - // - if (BIT (Reset, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle); - } - // - // Boot Option on Limit - // - Temp = (Reset & 0x18) >> 3; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT_BITS), gShellDebug1HiiHandle); - break; - } - // - // Boot Option - // - Temp = (Reset & 0x06) >> 1; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle); - break; - } - // - // Reset enable flag - // - if ((Reset & 0x01) != 0) { - Print (L"The system reset is enabled by the user\n"); - } else { - Print (L"The system reset is disabled by the user\n"); - } -} - -/** - Display Hardware Security (Type 24) information. - - -Identifies the password and reset status for the system: - -Bits 7:6 Power-on Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown -Bits 5:4 Keyboard Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown -Bits 3:2 Administrator Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown -Bits 1:0 Front Panel Reset Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown - - @param[in] Settings The device settings. - @param[in] Option The device options. -**/ -VOID -DisplayHardwareSecuritySettings ( - IN UINT8 Settings, - IN UINT8 Option - ) -{ - UINTN Temp; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Settings, Option); - - // - // Power-on Password Status - // - Temp = (Settings & 0xC0) >> 6; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } - // - // Keyboard Password Status - // - Temp = (Settings & 0x30) >> 4; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } - // - // Administrator Password Status - // - Temp = (Settings & 0x0C) >> 2; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } - // - // Front Panel Reset Status - // - Temp = Settings & 0x3; - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle); - switch (Temp) { - case 0: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); - break; - - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - } -} - -/** - Display Out-of-Band Remote Access (Type 30) information. - - @param[in] Connections The device characteristics. - @param[in] Option The device options. -**/ -VOID -DisplayOBRAConnections ( - IN UINT8 Connections, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Connections, Option); - - // - // Check reserved bits 7:2 - // - if ((Connections & 0xFC) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle); - } - // - // Outbound Connection - // - if (BIT (Connections, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle); - } - // - // Inbound Connection - // - if (BIT (Connections, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle); - } -} - -/** - Display System Power Supply (Type 39) information. - - @param[in] Characteristics The device characteristics. - @param[in] Option The device options. -**/ -VOID -DisplaySPSCharacteristics ( - IN UINT16 Characteristics, - IN UINT8 Option - ) -{ - UINTN Temp; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Characteristics, Option); - - // - // Check reserved bits 15:14 - // - if ((Characteristics & 0xC000) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle); - } - // - // Bits 13:10 - DMTF Power Supply Type - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle); - Temp = (Characteristics & 0x1C00) >> 10; - switch (Temp) { - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle); - break; - - case 4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle); - break; - - case 5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle); - break; - - case 6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle); - break; - - case 7: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle); - break; - - case 8: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle); - } - // - // Bits 9:7 - Status - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle); - Temp = (Characteristics & 0x380) >> 7; - switch (Temp) { - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle); - break; - - case 4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle); - break; - - case 5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle); - } - // - // Bits 6:3 - DMTF Input Voltage Range Switching - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle); - Temp = (Characteristics & 0x78) >> 3; - switch (Temp) { - case 1: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); - break; - - case 2: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); - break; - - case 3: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle); - break; - - case 4: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle); - break; - - case 5: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle); - break; - - case 6: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle); - break; - - default: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle); - break; - } - // - // Power supply is unplugged from the wall - // - if (BIT (Characteristics, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle); - } - // - // Power supply is present - // - if (BIT (Characteristics, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle); - } - // - // hot replaceable - // - if (BIT (Characteristics, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle); - } -} - -/** - Display TPM Device (Type 43) Characteristics. - - @param[in] Chara The information bits. - @param[in] Option The optional information. -**/ -VOID -DisplayTpmDeviceCharacteristics ( - IN UINT64 Chara, - IN UINT8 Option - ) -{ - // - // Print header - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR), gShellDebug1HiiHandle); - // - // print option - // - PRINT_INFO_OPTION (Chara, Option); - - // - // Check all the bits and print information - // This function does not use Table because table of bits - // are designed not to deal with UINT64 - // - if (BIT (Chara, 0) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 1) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); - } - if (BIT (Chara, 2) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 3) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW), gShellDebug1HiiHandle); - } - - if (BIT (Chara, 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM), gShellDebug1HiiHandle); - } - - // - // Just print the Reserved - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_06_63), gShellDebug1HiiHandle); - -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h deleted file mode 100644 index 3a5aa0a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h +++ /dev/null @@ -1,436 +0,0 @@ -/** @file - Module to clarify the element info of the smbios structure. - - Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
- (C) Copyright 2017 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SMBIOS_PRINT_INFO_H_ -#define _SMBIOS_PRINT_INFO_H_ - -#include - -extern UINT8 SmbiosMajorVersion; -extern UINT8 SmbiosMinorVersion; - -#define SHOW_NONE 0x00 -#define SHOW_OUTLINE 0x01 -#define SHOW_NORMAL 0x02 -#define SHOW_DETAIL 0x03 -// -// SHOW_ALL: WaitEnter() not wait input. -// -#define SHOW_ALL 0x04 -#define SHOW_STATISTICS 0x05 - -#define AS_UINT16(pData) (*((UINT16 *) pData)) -#define AS_UINT32(pData) (*((UINT32 *) pData)) -#define AS_UINT64(pData) (*((UINT64 *) pData)) - -/** - Print the info of EPS(Entry Point Structure). - - @param[in] SmbiosTable Pointer to the SMBIOS table entry point. - @param[in] Option Display option. -**/ -VOID -SmbiosPrintEPSInfo ( - IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable, - IN UINT8 Option - ); - -/** - Print the info of 64-bit EPS(Entry Point Structure). - - @param[in] SmbiosTable Pointer to the SMBIOS table entry point. - @param[in] Option Display option. -**/ -VOID -Smbios64BitPrintEPSInfo ( - IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable, - IN UINT8 Option - ); - -/** - This function print the content of the structure pointed by Struct. - - @param[in] Struct Point to the structure to be printed. - @param[in] Option Print option of information detail. - - @retval EFI_SUCCESS Successfully Printing this function. - @retval EFI_INVALID_PARAMETER Invalid Structure. - @retval EFI_UNSUPPORTED Unsupported. -**/ -EFI_STATUS -SmbiosPrintStructure ( - IN SMBIOS_STRUCTURE_POINTER *Struct, - IN UINT8 Option - ); - -/** - Display BIOS Information (Type 0) information. - - @param[in] Chara The information bits. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristics ( - IN UINT64 Chara, - IN UINT8 Option - ); - -/** - Display Bios Characteristice extensions1 information. - - @param[in] Byte1 The information. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristicsExt1 ( - IN UINT8 Byte1, - IN UINT8 Option - ); - -/** - Display Bios Characteristice extensions2 information. - - @param[in] Byte2 The information. - @param[in] Option The optional information. -**/ -VOID -DisplayBiosCharacteristicsExt2 ( - IN UINT8 Byte2, - IN UINT8 Option - ); - -/** - Display Processor Information (Type 4) information. - - @param[in] Family The family value. - @param[in] Option The option value. -**/ -VOID -DisplayProcessorFamily ( - UINT8 Family, - UINT8 Option - ); - -/** - Display processor family information. - - @param[in] Family2 The family value. - @param[in] Option The option value. -**/ -VOID -DisplayProcessorFamily2 ( - IN UINT16 Family2, - IN UINT8 Option - ); - -/** - Display processor voltage information. - - @param[in] Voltage The Voltage. - Bit 7 Set to 0, indicating 'legacy' mode for processor voltage - Bits 6:4 Reserved, must be zero - Bits 3:0 Voltage Capability. - A Set bit indicates that the voltage is supported. - Bit 0 - 5V - Bit 1 - 3.3V - Bit 2 - 2.9V - Bit 3 - Reserved, must be zero. - - Note: - Setting of multiple bits indicates the socket is configurable - If bit 7 is set to 1, the remaining seven bits of the field are set to - contain the processor's current voltage times 10. - For example, the field value for a processor voltage of 1.8 volts would be - 92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h. - - @param[in] Option The option. -**/ -VOID -DisplayProcessorVoltage ( - IN UINT8 Voltage, - IN UINT8 Option - ); - -/** - Display processor information. - - @param[in] Status The status. -Bit 7 Reserved, must be 0 -Bit 6 CPU Socket Populated - 1 - CPU Socket Populated - 0 - CPU Socket Unpopulated -Bits 5:3 Reserved, must be zero -Bits 2:0 CPU Status - 0h - Unknown - 1h - CPU Enabled - 2h - CPU Disabled by User via BIOS Setup - 3h - CPU Disabled By BIOS (POST Error) - 4h - CPU is Idle, waiting to be enabled. - 5-6h - Reserved - 7h - Other - - @param[in] Option The option -**/ -VOID -DisplayProcessorStatus ( - IN UINT8 Status, - IN UINT8 Option - ); - -/** - Display information about Memory Controller Information (Type 5). - - @param[in] Size Memory size. - @param[in] SlotNum Which slot is this about. - @param[in] Option Option for the level of detail output required. -**/ -VOID -DisplayMaxMemoryModuleSize ( - IN UINT8 Size, - IN UINT8 SlotNum, - IN UINT8 Option - ); - -/** - Display information about memory configuration handles. - - @param[in] Handles The buffer of handles to output info on. - @param[in] SlotNum The number of handles in the above buffer. - @param[in] Option Option for the level of detail output required. -**/ -VOID -DisplayMemoryModuleConfigHandles ( - IN UINT16 *Handles, - IN UINT8 SlotNum, - IN UINT8 Option - ); - -/** - Display Memory Module Information (Type 6). - - @param[in] BankConnections - @param[in] Option -**/ -VOID -DisplayMmBankConnections ( - IN UINT8 BankConnections, - IN UINT8 Option - ); - -/** - Display memory informcation. - - Bits 0:6 Size (n), - where 2**n is the size in MB with three special-case values: - 7Dh Not determinable (Installed Size only) - 7Eh Module is installed, but no memory has been enabled - 7Fh Not installed - Bit 7 Defines whether the memory module has a single- (0) - or double-bank (1) connection. - - @param[in] Size - The size - @param[in] Option - The option -**/ -VOID -DisplayMmMemorySize ( - IN UINT8 Size, - IN UINT8 Option - ); - -/** - Display Cache Configuration. - - @param[in] CacheConfiguration Cache Configuration. -Bits 15:10 Reserved, must be 0 -Bits 9:8 Operational Mode - 0h - Write Through - 1h - Write Back - 2h - Varies with Memory Address - 3h - Unknown -Bit 7 Enabled/Disabled - 1 - Enabled - 0 - Disabled -Bits 6:5 Location - 0h - Internal - 1h - External - 2h - Reserved - 3h - Unknown -Bit 4 Reserved, must be zero -Bit 3 Cache Socketed - 1 - Socketed - 0 - Unsocketed -Bits 2:0 Cache Level - 1 through 8 (For example, an L1 cache would - use value 000b and an L3 cache would use 010b.) - - @param[in] Option The option -**/ -VOID -DisplayCacheConfiguration ( - IN UINT16 CacheConfiguration, - IN UINT8 Option - ); - -/** - The Slot ID field of the System Slot structure provides a mechanism to - correlate the physical attributes of the slot to its logical access method - (which varies based on the Slot Type field). - - @param[in] SlotId - The slot ID - @param[in] SlotType - The slot type - @param[in] Option - The Option -**/ -VOID -DisplaySystemSlotId ( - IN UINT16 SlotId, - IN UINT8 SlotType, - IN UINT8 Option - ); - -/** - Display Portable Battery (Type 22) information. - - The date the cell pack was manufactured, in packed format: - Bits 15:9 Year, biased by 1980, in the range 0 to 127. - Bits 8:5 Month, in the range 1 to 12. - Bits 4:0 Date, in the range 1 to 31. - For example, 01 February 2000 would be identified as - 0010 1000 0100 0001b (0x2841). - - @param[in] Date The date - @param[in] Option The option -**/ -VOID -DisplaySBDSManufactureDate ( - IN UINT16 Date, - IN UINT8 Option - ); - -/** - Display System Reset (Type 23) information. - - Routine Description: - Identifies the system-reset capabilities for the system. - Bits 7:6 Reserved for future assignment via this specification, set to 00b. - Bit 5 System contains a watchdog timer, either True (1) or False (0). - Bits 4:3 Boot Option on Limit. - Identifies the system action to be taken when the Reset Limit is reached, one of: - 00b Reserved, do not use. - 01b Operating system - 10b System utilities - 11b Do not rebootBits - 2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of: - 00b Reserved, do not use. - 01b Operating system - 10b System utilities - 11b Do not reboot - Bit 0 Status. - 1b The system reset is enabled by the user - 0b The system reset is not enabled by the user - - @param[in] Reset Reset - @param[in] Option The option -**/ -VOID -DisplaySystemResetCapabilities ( - IN UINT8 Reset, - IN UINT8 Option - ); - -/** - Display Hardware Security (Type 24) information. - - Routine Description: - Identifies the password and reset status for the system: - - Bits 7:6 Power-on Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown - Bits 5:4 Keyboard Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown - Bits 3:2 Administrator Password Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown - Bits 1:0 Front Panel Reset Status, one of: - 00b Disabled - 01b Enabled - 10b Not Implemented - 11b Unknown - - @param[in] Settings The device settings. - @param[in] Option The device options. -**/ -VOID -DisplayHardwareSecuritySettings ( - IN UINT8 Settings, - IN UINT8 Option - ); - -/** - Display Out-of-Band Remote Access (Type 30) information. - - @param[in] Connections The device characteristics. - @param[in] Option The device options. -**/ -VOID -DisplayOBRAConnections ( - IN UINT8 Connections, - IN UINT8 Option - ); - -/** - Display System Boot Information (Type 32) information. - - @param[in] Parameter The parameter. - @param[in] Option The options. -**/ -VOID -DisplaySystemBootStatus ( - IN UINT8 Parameter, - IN UINT8 Option - ); - -/** - Display System Power Supply (Type 39) information. - - @param[in] Characteristics The device characteristics. - @param[in] Option The device options. -**/ -VOID -DisplaySPSCharacteristics ( - IN UINT16 Characteristics, - IN UINT8 Option - ); - -/** - Display TPM Device (Type 43) Characteristics. - - @param[in] Chara The information bits. - @param[in] Option The optional information. -**/ -VOID -DisplayTpmDeviceCharacteristics ( - IN UINT64 Chara, - IN UINT8 Option - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c deleted file mode 100644 index 1036626..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c +++ /dev/null @@ -1,4723 +0,0 @@ -/** @file - Build a table, each item is (Key, Info) pair. - And give a interface of query a string out of a table. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "QueryTable.h" -#include "PrintInfo.h" - -TABLE_ITEM SystemWakeupTypeTable[] = { - { - 0x0, - L" Reserved" - }, - { - 0x1, - L" Other" - }, - { - 0x2, - L" Unknown" - }, - { - 0x3, - L" APM Timer" - }, - { - 0x4, - L" Modem Ring" - }, - { - 0x5, - L" LAN Remote" - }, - { - 0x6, - L" Power Switch" - }, - { - 0x7, - L" AC Power Restored" - } -}; - -TABLE_ITEM BaseBoardFeatureFlagsTable[] = { - { - 0, - L" Hosting board" - }, - { - 1, - L" Requires at least one daughter board or auxiliary card" - }, - { - 2, - L" Removable" - }, - { - 3, - L" Replaceable" - }, - { - 4, - L" Hot swappable" - } -}; - -TABLE_ITEM BaseBoardBoardTypeTable[] = { - { - 0x01, - L" Unknown" - }, - { - 0x02, - L" Other" - }, - { - 0x03, - L" Server Blade" - }, - { - 0x04, - L" Connectivity Switch" - }, - { - 0x05, - L" System Management Module" - }, - { - 0x06, - L" Processor Module" - }, - { - 0x07, - L" I/O Module" - }, - { - 0x08, - L" Memory Module" - }, - { - 0x09, - L" Daughter board" - }, - { - 0x0A, - L" Motherboard" - }, - { - 0x0B, - L" Processor/Memory Module" - }, - { - 0x0C, - L" Processor/IO Module" - }, - { - 0x0D, - L" Interconnect Board" - } -}; - -TABLE_ITEM SystemEnclosureTypeTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Desktop" - }, - { - 0x04, - L" Low Profile Desktop" - }, - { - 0x05, - L" Pizza Box" - }, - { - 0x06, - L" Mini Tower" - }, - { - 0x07, - L" Tower" - }, - { - 0x08, - L" Portable" - }, - { - 0x09, - L" Laptop" - }, - { - 0x0A, - L" Notebook" - }, - { - 0x0B, - L" Hand Held" - }, - { - 0x0C, - L" Docking Station" - }, - { - 0x0D, - L" All in One" - }, - { - 0x0E, - L" Sub Notebook" - }, - { - 0x0F, - L" Space-saving" - }, - { - 0x10, - L" Main Server Chassis" - }, - { - 0x11, - L" Expansion Chassis" - }, - { - 0x12, - L" SubChassis" - }, - { - 0x13, - L" Sub Notebook" - }, - { - 0x14, - L" Bus Expansion Chassis" - }, - { - 0x15, - L" Peripheral Chassis" - }, - { - 0x16, - L" RAID Chassis" - }, - { - 0x17, - L" Rack Mount Chassis" - }, - { - 0x18, - L" Sealed-case PC" - }, - { - 0x19, - L" Multi-system Chassis" - }, - { - 0x1A, - L" CompactPCI" - }, - { - 0x1B, - L" AdvancedTCA" - }, - { - 0x1C, - L" Blade" - }, - { - 0x1D, - L" Blade Enclosure" - }, - { - 0x1E, - L" Tablet" - }, - { - 0x1F, - L" Convertible" - }, - { - 0x20, - L" Detachable" - }, - { - 0x21, - L" IoT Gateway" - }, - { - 0x22, - L" Embedded PC" - }, - { - 0x23, - L" Mini PC" - }, - { - 0x24, - L" Stick PC" - }, -}; - -TABLE_ITEM SystemEnclosureStatusTable[] = { - { - 0x1, - L" Other" - }, - { - 0x2, - L" Unknown" - }, - { - 0x3, - L" Safe" - }, - { - 0x4, - L" Warning" - }, - { - 0x5, - L" Critical" - }, - { - 0x6, - L" Non-recoverable" - } -}; - -TABLE_ITEM SESecurityStatusTable[] = { - { - 0x1, - L" Other" - }, - { - 0x2, - L" Unknown" - }, - { - 0x3, - L" None" - }, - { - 0x4, - L" External interface locked out" - }, - { - 0x5, - L" External interface enabled" - } -}; - -TABLE_ITEM ProcessorTypeTable[] = { - { - 0x1, - L" Other" - }, - { - 0x2, - L" Unknown" - }, - { - 0x3, - L" Central Processor" - }, - { - 0x4, - L" Math Processor" - }, - { - 0x5, - L" DSP Processor" - }, - { - 0x6, - L" Video Processor " - }, -}; - -TABLE_ITEM ProcessorUpgradeTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"Daughter Board" - }, - { - 0x04, - L"ZIF Socket" - }, - { - 0x05, - L"Replaceable Piggy Back" - }, - { - 0x06, - L"None" - }, - { - 0x07, - L"LIF Socket" - }, - { - 0x08, - L"Slot 1" - }, - { - 0x09, - L"Slot 2" - }, - { - 0x0A, - L"370-pin socket" - }, - { - 0x0B, - L"Slot A" - }, - { - 0x0C, - L"Slot M" - }, - { - 0x0D, - L"Socket 423" - }, - { - 0x0E, - L"Socket A" - }, - { - 0x0F, - L"Socket 478" - }, - { - 0x10, - L"Socket 754" - }, - { - 0x11, - L"Socket 940" - }, - { - 0x12, - L"Socket 939" - }, - { - 0x13, - L"Socket mPGA604" - }, - { - 0x14, - L"Socket LGA771" - }, - { - 0x15, - L"Socket LGA775" - }, - { - 0x16, - L"Socket S1" - }, - { - 0x17, - L"Socket AM2" - }, - { - 0x18, - L"Socket F" - }, - { - 0x19, - L"Socket LGA1366" - }, - { - 0x1A, - L"Socket G34" - }, - { - 0x1B, - L"Socket AM3" - }, - { - 0x1C, - L"Socket C32" - }, - { - 0x1D, - L"Socket LGA1156" - }, - { - 0x1E, - L"Socket LGA1567" - }, - { - 0x1F, - L"Socket PGA988A" - }, - { - 0x20, - L"Socket BGA1288" - }, - { - 0x21, - L"Socket rPGA988B" - }, - { - 0x22, - L"Socket BGA1023" - }, - { - 0x23, - L"Socket BGA1224" - }, - { - 0x24, - L"Socket LGA1155" - }, - { - 0x25, - L"Socket LGA1356" - }, - { - 0x26, - L"Socket LGA2011" - }, - { - 0x27, - L"Socket FS1" - }, - { - 0x28, - L"Socket FS2" - }, - { - 0x29, - L"Socket FM1" - }, - { - 0x2A, - L"Socket FM2" - }, - { - 0x2B, - L"Socket LGA2011-3" - }, - { - 0x2C, - L"Socket LGA1356-3" - }, - { - 0x2D, - L"Socket LGA1150" - }, - { - 0x2E, - L"Socket BGA1168" - }, - { - 0x2F, - L"Socket BGA1234" - }, - { - 0x30, - L"Socket BGA1364" - }, - { - 0x31, - L"Socket AM4" - }, - { - 0x32, - L"Socket LGA1151" - }, - { - 0x33, - L"Socket BGA1356" - }, - { - 0x34, - L"Socket BGA1440" - }, - { - 0x35, - L"Socket BGA1515" - }, - { - 0x36, - L"Socket LGA3647-1" - }, - { - 0x37, - L"Socket SP3" - }, - { - 0x38, - L"Socket SP3r2" - }, - { - 0x39, - L"Socket LGA2066" - }, - { - 0x3A, - L"Socket BGA1392" - }, - { - 0x3B, - L"Socket BGA1510" - }, - { - 0x3C, - L"Socket BGA1528" - } -}; - -TABLE_ITEM ProcessorCharacteristicsTable[] = { - { - 1, - L" Unknown" - }, - { - 2, - L" 64-bit Capable" - }, - { - 3, - L" Multi-Core" - }, - { - 4, - L" Hardware Thread" - }, - { - 5, - L" Execute Protection" - }, - { - 6, - L" Enhanced Virtualization" - }, - { - 7, - L" Power/Performance Control" - } -}; - - -TABLE_ITEM McErrorDetectMethodTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"None" - }, - { - 0x04, - L"8-bit Parity" - }, - { - 0x05, - L"32-bit ECC" - }, - { - 0x06, - L"64-bit ECC" - }, - { - 0x07, - L"128-bit ECC" - }, - { - 0x08, - L"CRC" - }, -}; - -TABLE_ITEM McErrorCorrectCapabilityTable[] = { - { - 0, - L"Other" - }, - { - 1, - L"Unknown" - }, - { - 2, - L"None" - }, - { - 3, - L"Single Bit Error Correcting" - }, - { - 4, - L"Double Bit Error Correcting" - }, - { - 5, - L"Error Scrubbing" - }, -}; - -TABLE_ITEM McInterleaveSupportTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"One Way Interleave" - }, - { - 0x04, - L"Two Way Interleave" - }, - { - 0x05, - L"Four Way Interleave" - }, - { - 0x06, - L"Eight Way Interleave" - }, - { - 0x07, - L"Sixteen Way Interleave" - } -}; - -TABLE_ITEM McMemorySpeedsTable[] = { - { - 0, - L" Other" - }, - { - 1, - L" Unknown" - }, - { - 2, - L" 70ns" - }, - { - 3, - L" 60ns" - }, - { - 4, - L" 50ns" - }, -}; - -TABLE_ITEM MemoryModuleVoltageTable[] = { - { - 0, - L" 5V" - }, - { - 1, - L" 3.3V" - }, - { - 2, - L" 2.9V" - }, -}; - -TABLE_ITEM MmMemoryTypeTable[] = { - { - 0, - L" Other" - }, - { - 1, - L" Unknown" - }, - { - 2, - L" Standard" - }, - { - 3, - L" Fast Page Mode" - }, - { - 4, - L" EDO" - }, - { - 5, - L" Parity" - }, - { - 6, - L" ECC " - }, - { - 7, - L" SIMM" - }, - { - 8, - L" DIMM" - }, - { - 9, - L" Burst EDO" - }, - { - 10, - L" SDRAM" - } -}; - -TABLE_ITEM MmErrorStatusTable[] = { - { - 0, - L" Uncorrectable errors received" - }, - { - 1, - L" Correctable errors received" - }, - { - 2, - L" Error Status obtained from the event log" - } -}; - -TABLE_ITEM CacheSRAMTypeTable[] = { - { - 0, - L" Other" - }, - { - 1, - L" Unknown" - }, - { - 2, - L" Non-Burst" - }, - { - 3, - L" Burst" - }, - { - 4, - L" Pipeline Burst" - }, - { - 5, - L" Synchronous" - }, - { - 6, - L" Asynchronous" - }, -}; - -TABLE_ITEM CacheErrCorrectingTypeTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"None" - }, - { - 0x04, - L"Parity" - }, - { - 0x05, - L"Single-bit ECC" - }, - { - 0x06, - L"Multi-bit ECC" - } -}; - -TABLE_ITEM CacheSystemCacheTypeTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"Instruction" - }, - { - 0x04, - L"Data" - }, - { - 0x05, - L"Unified" - } -}; - -TABLE_ITEM CacheAssociativityTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"Direct Mapped" - }, - { - 0x04, - L"2-way Set-Associative" - }, - { - 0x05, - L"4-way Set-Associative" - }, - { - 0x06, - L"Fully Associative" - }, - { - 0x07, - L"8-way Set-Associative" - }, - { - 0x08, - L"16-way Set-Associative" - }, - { - 0x09, - L"12-way Set-Associative" - }, - { - 0x0A, - L"24-way Set-Associative" - }, - { - 0x0B, - L"32-way Set-Associative" - }, - { - 0x0C, - L"48-way Set-Associative" - }, - { - 0x0D, - L"64-way Set-Associative" - }, - { - 0x0E, - L"20-way Set-Associative" - } -}; - -TABLE_ITEM PortConnectorTypeTable[] = { - { - 0x00, - L"None" - }, - { - 0x01, - L"Centronics" - }, - { - 0x02, - L"Mini Centronics" - }, - { - 0x03, - L"Proprietary" - }, - { - 0x04, - L"DB-25 pin male" - }, - { - 0x05, - L"DB-25 pin female" - }, - { - 0x06, - L"DB-15 pin male" - }, - { - 0x07, - L"DB-15 pin female" - }, - { - 0x08, - L"DB-9 pin male" - }, - { - 0x09, - L"DB-9 pin female" - }, - { - 0x0A, - L"RJ-11" - }, - { - 0x0B, - L"RJ-45" - }, - { - 0x0C, - L"50 Pin MiniSCSI" - }, - { - 0x0D, - L"Mini-DIN" - }, - { - 0x0E, - L"Micro-DIN" - }, - { - 0x0F, - L"PS/2" - }, - { - 0x10, - L"Infrared" - }, - { - 0x11, - L"HP-HIL" - }, - { - 0x12, - L"Access Bus (USB)" - }, - { - 0x13, - L"SSA SCSI" - }, - { - 0x14, - L"Circular DIN-8 male" - }, - { - 0x15, - L"Circular DIN-8 female" - }, - { - 0x16, - L"On Board IDE" - }, - { - 0x17, - L"On Board Floppy" - }, - { - 0x18, - L"9 Pin Dual Inline (pin 10 cut)" - }, - { - 0x19, - L"25 Pin Dual Inline (pin 26 cut)" - }, - { - 0x1A, - L"50 Pin Dual Inline" - }, - { - 0x1B, - L"68 Pin Dual Inline" - }, - { - 0x1C, - L"On Board Sound Input from CD-ROM" - }, - { - 0x1D, - L"Mini-Centronics Type-14" - }, - { - 0x1E, - L"Mini-Centronics Type-26" - }, - { - 0x1F, - L"Mini-jack (headphones)" - }, - { - 0x20, - L"BNC" - }, - { - 0x21, - L"1394" - }, - { - 0x22, - L"SAS/SATA Plug Receptacle" - }, - { - 0x23, - L"USB Type-C Receptacle" - }, - { - 0xA0, - L"PC-98" - }, - { - 0xA1, - L"PC-98Hireso" - }, - { - 0xA2, - L"PC-H98" - }, - { - 0xA3, - L"PC-98Note" - }, - { - 0xA4, - L"PC-98Full" - }, - { - 0xFF, - L"Other" - }, -}; - -TABLE_ITEM PortTypeTable[] = { - { - 0x00, - L"None" - }, - { - 0x01, - L"Parallel Port XT/AT Compatible" - }, - { - 0x02, - L"Parallel Port PS/2" - }, - { - 0x03, - L"Parallel Port ECP" - }, - { - 0x04, - L"Parallel Port EPP" - }, - { - 0x05, - L"Parallel Port ECP/EPP" - }, - { - 0x06, - L"Serial Port XT/AT Compatible" - }, - { - 0x07, - L"Serial Port 16450 Compatible" - }, - { - 0x08, - L"Serial Port 16550 Compatible" - }, - { - 0x09, - L"Serial Port 16550A Compatible" - }, - { - 0x0A, - L"SCSI Port" - }, - { - 0x0B, - L"MIDI Port" - }, - { - 0x0C, - L"Joy Stick Port" - }, - { - 0x0D, - L"Keyboard Port" - }, - { - 0x0E, - L"Mouse Port" - }, - { - 0x0F, - L"SSA SCSI" - }, - { - 0x10, - L"USB" - }, - { - 0x11, - L"FireWire (IEEE P1394)" - }, - { - 0x12, - L"PCMCIA Type II" - }, - { - 0x13, - L"PCMCIA Type II" - }, - { - 0x14, - L"PCMCIA Type III" - }, - { - 0x15, - L"Cardbus" - }, - { - 0x16, - L"Access Bus Port" - }, - { - 0x17, - L"SCSI II" - }, - { - 0x18, - L"SCSI Wide" - }, - { - 0x19, - L"PC-98" - }, - { - 0x1A, - L"PC-98-Hireso" - }, - { - 0x1B, - L"PC-H98" - }, - { - 0x1C, - L"Video Port" - }, - { - 0x1D, - L"Audio Port" - }, - { - 0x1E, - L"Modem Port" - }, - { - 0x1F, - L"Network Port" - }, - { - 0x20, - L"SATA Port" - }, - { - 0x21, - L"SAS Port" - }, - { - 0x22, - L"Multi-Function Display Port (MFDP)" - }, - { - 0x23, - L"Thunderbolt" - }, - { - 0xA0, - L"8251 Compatible" - }, - { - 0xA1, - L"8251 FIFO Compatible" - }, - { - 0xFF, - L"Other " - }, -}; - -TABLE_ITEM SystemSlotTypeTable[] = { - { - 0x01, - L"Other" - }, - { - 0x02, - L"Unknown" - }, - { - 0x03, - L"ISA" - }, - { - 0x04, - L"MCA" - }, - { - 0x05, - L"EISA" - }, - { - 0x06, - L"PCI" - }, - { - 0x07, - L"PC Card (PCMCIA)" - }, - { - 0x08, - L"VL-VESA" - }, - { - 0x09, - L"Proprietary" - }, - { - 0x0A, - L"Processor Card Slot" - }, - { - 0x0B, - L"Proprietary Memory Card Slot" - }, - { - 0x0C, - L"I/O Riser Card Slot" - }, - { - 0x0D, - L"NuBus" - }, - { - 0x0E, - L"PCI - 66MHz Capable" - }, - { - 0x0F, - L"AGP" - }, - { - 0x10, - L"AGP 2X" - }, - { - 0x11, - L"AGP 4X" - }, - { - 0x12, - L"PCI-X" - }, - { - 0x13, - L"AGP 8X" - }, - { - 0x14, - L"M.2 Socket 1-DP (Mechanical Key A)" - }, - { - 0x15, - L"M.2 Socket 1-SD (Mechanical Key E)" - }, - { - 0x16, - L"M.2 Socket 2 (Mechanical Key B)" - }, - { - 0x17, - L"M.2 Socket 3 (Mechanical Key M)" - }, - { - 0x18, - L"MXM Type I" - }, - { - 0x19, - L"MXM Type II" - }, - { - 0x1A, - L"MXM Type III (standard connector)" - }, - { - 0x1B, - L"MXM Type III (HE connector)" - }, - { - 0x1C, - L"MXM Type IV" - }, - { - 0x1D, - L"MXM 3.0 Type A" - }, - { - 0x1E, - L"MXM 3.0 Type B" - }, - { - 0x1F, - L"PCI Express Gen 2 SFF-8639" - }, - { - 0x20, - L"PCI Express Gen 3 SFF-8639" - }, - { - 0x21, - L"PCI Express Mini 52-pin (CEM spec. 2.0) with bottom-side keep-outs" - }, - { - 0x22, - L"PCI Express Mini 52-pin (CEM spec. 2.0) without bottom-side keep-outs" - }, - { - 0x23, - L"PCI Express Mini 76-pin (CEM spec. 2.0) Corresponds to Display-Mini card" - }, - { - 0xA0, - L"PC-98/C20 " - }, - { - 0xA1, - L"PC-98/C24 " - }, - { - 0xA2, - L"PC-98/E " - }, - { - 0xA3, - L"PC-98/Local Bus " - }, - { - 0xA4, - L"PC-98/Card " - }, - { - 0xA5, - L"PCI Express " - }, - { - 0xA6, - L"PCI Express X1" - }, - { - 0xA7, - L"PCI Express X2" - }, - { - 0xA8, - L"PCI Express X4" - }, - { - 0xA9, - L"PCI Express X8" - }, - { - 0xAA, - L"PCI Express X16" - }, - { - 0xAB, - L"PCI Express Gen 2" - }, - { - 0xAC, - L"PCI Express Gen 2 X1" - }, - { - 0xAD, - L"PCI Express Gen 2 X2" - }, - { - 0xAE, - L"PCI Express Gen 2 X4" - }, - { - 0xAF, - L"PCI Express Gen 2 X8" - }, - { - 0xB0, - L"PCI Express Gen 2 X16" - }, - { - 0xB1, - L"PCI Express Gen 3" - }, - { - 0xB2, - L"PCI Express Gen 3 X1" - }, - { - 0xB3, - L"PCI Express Gen 3 X2" - }, - { - 0xB4, - L"PCI Express Gen 3 X4" - }, - { - 0xB5, - L"PCI Express Gen 3 X8" - }, - { - 0xB6, - L"PCI Express Gen 3 X16" - } -}; - -TABLE_ITEM SystemSlotDataBusWidthTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" 8 bit" - }, - { - 0x04, - L" 16 bit" - }, - { - 0x05, - L" 32 bit" - }, - { - 0x06, - L" 64 bit" - }, - { - 0x07, - L" 128 bit" - }, - { - 0x08, - L" 1x or x1" - }, - { - 0x09, - L" 2x or x2" - }, - { - 0x0A, - L" 4x or x4" - }, - { - 0x0B, - L" 8x or x8" - }, - { - 0x0C, - L" 12x or x12" - }, - { - 0x0D, - L" 16x or x16" - }, - { - 0x0E, - L" 32x or x32" - } -}; - -TABLE_ITEM SystemSlotCurrentUsageTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Available" - }, - { - 0x04, - L" In use" - }, - { - 0x05, - L" Unavailable" - } -}; - -TABLE_ITEM SystemSlotLengthTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Short length" - }, - { - 0x04, - L" Long Length" - }, -}; - -TABLE_ITEM SlotCharacteristics1Table[] = { - { - 0, - L" Characteristics Unknown" - }, - { - 1, - L" Provides 5.0 Volts" - }, - { - 2, - L" Provides 3.3 Volts" - }, - { - 3, - L" Slot's opening is shared with another slot, e.g. PCI/EISA shared slot." - }, - - { - 4, - L" PC Card slot supports PC Card-16" - }, - { - 5, - L" PC Card slot supports CardBus" - }, - { - 6, - L" PC Card slot supports Zoom Video " - }, - { - 7, - L" PC Card slot supports Modem Ring Resume " - } -}; - -TABLE_ITEM SlotCharacteristics2Table[] = { - { - 0, - L" PCI slot supports Power Management Enable (PME#) signal" - }, - { - 1, - L" Slot supports hot-plug devices" - }, - { - 2, - L" PCI slot supports SMBus signal" - }, - { - 3, - L" PCIe slot supports bifurcation" - } -}; - -TABLE_ITEM OnboardDeviceTypesTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Video" - }, - { - 0x04, - L" SCSI Controller" - }, - { - 0x05, - L" Ethernet" - }, - { - 0x06, - L" Token Ring" - }, - { - 0x07, - L" Sound" - }, - { - 0x08, - L" Pata Controller" - }, - { - 0x09, - L" Sata Controller" - }, - { - 0x0A, - L" Sas Controller" - }, -}; - -TABLE_ITEM SELTypesTable[] = { - { - 0x00, - L" Reserved." - }, - { - 0x01, - L" Single-bit ECC memory error" - }, - { - 0x02, - L" Multi-bit ECC memory error" - }, - { - 0x03, - L" Parity memory error" - }, - { - 0x04, - L" Bus time-out" - }, - { - 0x05, - L" I/O Channel Check" - }, - { - 0x06, - L" Software NMI" - }, - { - 0x07, - L" POST Memory Resize" - }, - { - 0x08, - L" POST Error" - }, - { - 0x09, - L" PCI Parity Error" - }, - { - 0x0A, - L" PCI System Error" - }, - { - 0x0B, - L" CPU Failure" - }, - { - 0x0C, - L" EISA FailSafe Timer time-out" - }, - { - 0x0D, - L" Correctable memory log disabled" - }, - { - 0x0E, - L" Logging disabled for a specific Event Type" - }, - { - 0x0F, - L" Reserved" - }, - { - 0x10, - L" System Limit Exceeded" - }, - { - 0x11, - L" Asynchronous hardware timer expired and issued a system reset" - }, - { - 0x12, - L" System configuration information" - }, - { - 0x13, - L" Hard-disk information" - }, - { - 0x14, - L" System reconfigured" - }, - { - 0x15, - L" Uncorrectable CPU-complex error" - }, - { - 0x16, - L" Log Area Reset/Cleared" - }, - { - 0x17, - L" System boot" - }, - { - 0x7F18, - L" Unused by SMBIOS specification" - }, - { - 0xFE80, - L" System and OEM specified" - }, - { - 0xFF, - L" End-of-log" - }, -}; - -TABLE_ITEM SELVarDataFormatTypeTable[] = { - { - 0x00, - L" None " - }, - { - 0x01, - L" Handle " - }, - { - 0x02, - L" Multiple-Event " - }, - { - 0x03, - L" Multiple-Event Handle " - }, - { - 0x04, - L" POST Results Bitmap " - }, - // - // Defined below - // - { - 0x05, - L" System Management Type" - }, - // - // Defined below - // - { - 0x06, - L" Multiple-Event System Management Type " - }, - { - 0x7F07, - L" Unused " - }, - { - 0xFF80, - L" OEM assigned " - }, -}; - -TABLE_ITEM PostResultsBitmapDw1Table[] = { - { - 0, - L" Channel 2 Timer error " - }, - { - 1, - L" Master PIC (8259 #1) error " - }, - { - 2, - L" Slave PIC (8259 #2) error " - }, - { - 3, - L" CMOS Battery Failure " - }, - { - 4, - L" CMOS System Options Not Set " - }, - { - 5, - L" CMOS Checksum Error " - }, - { - 6, - L" CMOS Configuration Error " - }, - { - 7, - L" Mouse and Keyboard Swapped " - }, - { - 8, - L" Keyboard Locked " - }, - { - 9, - L" Keyboard Not Functional " - }, - { - 10, - L" Keyboard Controller Not Functional " - }, - { - 11, - L" CMOS Memory Size Different " - }, - { - 12, - L" Memory Decreased in Size " - }, - { - 13, - L" Cache Memory Error " - }, - { - 14, - L" Floppy Drive 0 Error " - }, - { - 15, - L" Floppy Drive 1 Error " - }, - { - 16, - L" Floppy Controller Failure " - }, - { - 17, - L" Number of ATA Drives Reduced Error " - }, - { - 18, - L" CMOS Time Not Set " - }, - { - 19, - L" DDC Monitor Configuration Change " - }, - { - 20, - L" Reserved, set to 0 " - }, - { - 21, - L" Reserved, set to 0 " - }, - { - 22, - L" Reserved, set to 0 " - }, - { - 23, - L" Reserved, set to 0 " - }, - { - 24, - L" Second DWORD has valid data " - }, - { - 25, - L" Reserved, set to 0 " - }, - { - 26, - L" Reserved, set to 0 " - }, - { - 27, - L" Reserved, set to 0 " - }, - { - 28, - L" Normally 0; available for OEM assignment " - }, - { - 29, - L" Normally 0; available for OEM assignment " - }, - { - 30, - L" Normally 0; available for OEM assignment " - }, - { - 31, - L" Normally 0; available for OEM assignment " - }, -}; - -TABLE_ITEM PostResultsBitmapDw2Table[] = { - { - 0, - L" Normally 0; available for OEM assignment " - }, - { - 1, - L" Normally 0; available for OEM assignment " - }, - { - 2, - L" Normally 0; available for OEM assignment " - }, - { - 3, - L" Normally 0; available for OEM assignment " - }, - { - 4, - L" Normally 0; available for OEM assignment " - }, - { - 5, - L" Normally 0; available for OEM assignment " - }, - { - 6, - L" Normally 0; available for OEM assignment " - }, - { - 7, - L" PCI Memory Conflict " - }, - { - 8, - L" PCI I/O Conflict " - }, - { - 9, - L" PCI IRQ Conflict " - }, - { - 10, - L" PNP Memory Conflict " - }, - { - 11, - L" PNP 32 bit Memory Conflict " - }, - { - 12, - L" PNP I/O Conflict " - }, - { - 13, - L" PNP IRQ Conflict " - }, - { - 14, - L" PNP DMA Conflict " - }, - { - 15, - L" Bad PNP Serial ID Checksum " - }, - { - 16, - L" Bad PNP Resource Data Checksum " - }, - { - 17, - L" Static Resource Conflict " - }, - { - 18, - L" NVRAM Checksum Error, NVRAM Cleared " - }, - { - 19, - L" System Board Device Resource Conflict " - }, - { - 20, - L" Primary Output Device Not Found " - }, - { - 21, - L" Primary Input Device Not Found " - }, - { - 22, - L" Primary Boot Device Not Found " - }, - { - 23, - L" NVRAM Cleared By Jumper " - }, - { - 24, - L" NVRAM Data Invalid, NVRAM Cleared " - }, - { - 25, - L" FDC Resource Conflict " - }, - { - 26, - L" Primary ATA Controller Resource Conflict " - }, - { - 27, - L" Secondary ATA Controller Resource Conflict " - }, - { - 28, - L" Parallel Port Resource Conflict " - }, - { - 29, - L" Serial Port 1 Resource Conflict " - }, - { - 30, - L" Serial Port 2 Resource Conflict " - }, - { - 31, - L" Audio Resource Conflict " - }, -}; - -TABLE_ITEM SELSysManagementTypesTable[] = { - { - 0x01, - L" +2.5V Out of range, #2 " - }, - { - 0x02, - L" +3.3V Out of range " - }, - { - 0x03, - L" +5V Out of range " - }, - { - 0x04, - L" -5V Out of range " - }, - { - 0x05, - L" +12V Out of range " - }, - { - 0x06, - L" -12V Out of range " - }, - { - 0x0F07, - L" Reserved for future out-of-range voltage levels " - }, - { - 0x10, - L" System board temperature out of range " - }, - { - 0x11, - L" Processor #1 temperature out of range " - }, - { - 0x12, - L" Processor #2 temperature out of range " - }, - { - 0x13, - L" Processor #3 temperature out of range " - }, - { - 0x14, - L" Processor #4 temperature out of range " - }, - { - 0x1F15, - L" Reserved for future out-of-range temperatures" - }, - { - 0x2720, - L" Fan n (n = 0 to 7) Out of range " - }, - { - 0x2F28, - L" Reserved for future assignment via this specification " - }, - { - 0x30, - L" Chassis secure switch activated " - }, -}; - -TABLE_ITEM PMALocationTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" System board or motherboard" - }, - { - 0x04, - L" ISA add-on card" - }, - { - 0x05, - L" EISA add-on card" - }, - { - 0x06, - L" PCI add-on card" - }, - { - 0x07, - L" MCA add-on card" - }, - { - 0x08, - L" PCMCIA add-on card" - }, - { - 0x09, - L" Proprietary add-on card" - }, - { - 0x0A, - L" NuBus" - }, - { - 0xA0, - L" PC-98/C20 add-on card" - }, - { - 0xA1, - L" PC-98/C24 add-on card" - }, - { - 0xA2, - L" PC-98/E add-on card" - }, - { - 0xA3, - L" PC-98/Local bus add-on card" - } -}; - -TABLE_ITEM PMAUseTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" System memory" - }, - { - 0x04, - L" Video memory" - }, - { - 0x05, - L" Flash memory" - }, - { - 0x06, - L" Non-volatile RAM" - }, - { - 0x07, - L" Cache memory" - } -}; - -TABLE_ITEM PMAErrorCorrectionTypesTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" None" - }, - { - 0x04, - L" Parity" - }, - { - 0x05, - L" Single-bit ECC" - }, - { - 0x06, - L" Multi-bit ECC" - }, - { - 0x07, - L" CRC" - } -}; - -TABLE_ITEM MemoryDeviceFormFactorTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" SIMM" - }, - { - 0x04, - L" SIP" - }, - { - 0x05, - L" Chip" - }, - { - 0x06, - L" DIP" - }, - { - 0x07, - L" ZIP" - }, - { - 0x08, - L" Proprietary Card" - }, - { - 0x09, - L" DIMM" - }, - { - 0x0A, - L" TSOP" - }, - { - 0x0B, - L" Row of chips" - }, - { - 0x0C, - L" RIMM" - }, - { - 0x0D, - L" SODIMM" - }, - { - 0x0E, - L" SRIMM" - }, - { - 0x0F, - L" FB-DIMM" - } -}; - -TABLE_ITEM MemoryDeviceTypeTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" DRAM" - }, - { - 0x04, - L" EDRAM" - }, - { - 0x05, - L" VRAM" - }, - { - 0x06, - L" SRAM" - }, - { - 0x07, - L" RAM" - }, - { - 0x08, - L" ROM" - }, - { - 0x09, - L" FLASH" - }, - { - 0x0A, - L" EEPROM" - }, - { - 0x0B, - L" FEPROM" - }, - { - 0x0C, - L" EPROM" - }, - { - 0x0D, - L" CDRAM" - }, - { - 0x0E, - L" 3DRAM" - }, - { - 0x0F, - L" SDRAM" - }, - { - 0x10, - L" SGRAM" - }, - { - 0x11, - L" RDRAM" - }, - { - 0x12, - L" DDR" - }, - { - 0x13, - L" DDR2" - }, - { - 0x14, - L" DDR2 FB-DIMM" - }, - { - 0x18, - L" DDR3" - }, - { - 0x19, - L" FBD2" - }, - { - 0x1A, - L" DDR4" - }, - { - 0x1B, - L" LPDDR" - }, - { - 0x1C, - L" LPDDR2" - }, - { - 0x1D, - L" LPDDR3" - }, - { - 0x1E, - L" LPDDR4" - }, - { - 0x1F, - L" Logical non-volatile device" - } -}; - -TABLE_ITEM MemoryDeviceTypeDetailTable[] = { - { - 1, - L" Other" - }, - { - 2, - L" Unknown" - }, - { - 3, - L" Fast-paged" - }, - { - 4, - L" Static column" - }, - { - 5, - L" Pseudo-STATIC" - }, - { - 6, - L" RAMBUS " - }, - { - 7, - L" Synchronous" - }, - { - 8, - L" CMOS" - }, - { - 9, - L" EDO" - }, - { - 10, - L" Window DRAM" - }, - { - 11, - L" Cache DRAM" - }, - { - 12, - L" Non-volatile" - }, - { - 13, - L" Registered(Buffered)" - }, - { - 14, - L" Unbuffered(Unregistered)" - } -}; - -TABLE_ITEM MemoryDeviceMemoryTechnologyTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" DRAM" - }, - { - 0x04, - L" NVDIMM-N" - }, - { - 0x05, - L" NVDIMM-F" - }, - { - 0x06, - L" NVDIMM-P" - }, - { - 0x07, - L" Intel persistent memory" - } -}; - -TABLE_ITEM MemoryDeviceMemoryOperatingModeCapabilityTable[] = { - { - 1, - L" Other" - }, - { - 2, - L" Unknown" - }, - { - 3, - L" Volatile memory" - }, - { - 4, - L" Byte-accessible persistent memory" - }, - { - 5, - L" Block-accessible persistent memory" - } -}; - - -TABLE_ITEM MemoryErrorTypeTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" OK" - }, - { - 0x04, - L" Bad read" - }, - { - 0x05, - L" Parity error" - }, - { - 0x06, - L" Single-bit error" - }, - { - 0x07, - L" Double-bit error" - }, - { - 0x08, - L" Multi-bit error" - }, - { - 0x09, - L" Nibble error" - }, - { - 0x0A, - L" Checksum error" - }, - { - 0x0B, - L" CRC error" - }, - { - 0x0C, - L" Corrected single-bit error" - }, - { - 0x0D, - L" Corrected error" - }, - { - 0x0E, - L" Uncorrectable error" - }, -}; - -TABLE_ITEM MemoryErrorGranularityTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Device level" - }, - { - 0x04, - L" Memory partition level" - }, -}; - -TABLE_ITEM MemoryErrorOperationTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Read" - }, - { - 0x04, - L" Write" - }, - { - 0x05, - L" Partial Write" - }, -}; - -TABLE_ITEM PointingDeviceTypeTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Mouse" - }, - { - 0x04, - L" Track Ball" - }, - { - 0x05, - L" Track Point" - }, - { - 0x06, - L" Glide Point" - }, - { - 0x07, - L" Touch Pad" - }, -}; - -TABLE_ITEM PointingDeviceInterfaceTable[] = { - { - 0x01, - L" Other" - }, - { - 0x02, - L" Unknown" - }, - { - 0x03, - L" Serial" - }, - { - 0x04, - L" PS/2" - }, - { - 0x05, - L" Infrared" - }, - { - 0x06, - L" HP-HIL" - }, - { - 0x07, - L" Bus mouse" - }, - { - 0x08, - L" ADB(Apple Desktop Bus" - }, - { - 0xA0, - L" Bus mouse DB-9" - }, - { - 0xA1, - L" Bus mouse mirco-DIN" - }, - { - 0xA2, - L" USB" - }, -}; - -TABLE_ITEM PBDeviceChemistryTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" Lead Acid " - }, - { - 0x04, - L" Nickel Cadmium " - }, - { - 0x05, - L" Nickel metal hydride " - }, - { - 0x06, - L" Lithium-ion " - }, - { - 0x07, - L" Zinc air " - }, - { - 0x08, - L" Lithium Polymer " - }, -}; - -TABLE_ITEM VPLocationTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" OK " - }, - { - 0x04, - L" Non-critical " - }, - { - 0x05, - L" Critical " - }, - { - 0x06, - L" Non-recoverable " - }, -}; - -TABLE_ITEM VPStatusTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" Processor " - }, - { - 0x04, - L" Disk " - }, - { - 0x05, - L" Peripheral Bay " - }, - { - 0x06, - L" System Management Module " - }, - { - 0x07, - L" Motherboard " - }, - { - 0x08, - L" Memory Module " - }, - { - 0x09, - L" Processor Module " - }, - { - 0x0A, - L" Power Unit " - }, - { - 0x0B, - L" Add-in Card " - }, -}; - -TABLE_ITEM CoolingDeviceStatusTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" OK " - }, - { - 0x04, - L" Non-critical " - }, - { - 0x05, - L" Critical " - }, - { - 0x06, - L" Non-recoverable " - }, -}; - -TABLE_ITEM CoolingDeviceTypeTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" Fan " - }, - { - 0x04, - L" Centrifugal Blower " - }, - { - 0x05, - L" Chip Fan " - }, - { - 0x06, - L" Cabinet Fan " - }, - { - 0x07, - L" Power Supply Fan " - }, - { - 0x08, - L" Heat Pipe " - }, - { - 0x09, - L" Integrated Refrigeration " - }, - { - 0x10, - L" Active Cooling " - }, - { - 0x11, - L" Passive Cooling " - }, -}; - -TABLE_ITEM TemperatureProbeStatusTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" OK " - }, - { - 0x04, - L" Non-critical " - }, - { - 0x05, - L" Critical " - }, - { - 0x06, - L" Non-recoverable " - }, -}; - -TABLE_ITEM TemperatureProbeLocTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" Processor " - }, - { - 0x04, - L" Disk " - }, - { - 0x05, - L" Peripheral Bay " - }, - { - 0x06, - L" System Management Module " - }, - { - 0x07, - L" Motherboard " - }, - { - 0x08, - L" Memory Module " - }, - { - 0x09, - L" Processor Module " - }, - { - 0x0A, - L" Power Unit " - }, - { - 0x0B, - L" Add-in Card " - }, -}; - -TABLE_ITEM ECPStatusTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" OK " - }, - { - 0x04, - L" Non-critical " - }, - { - 0x05, - L" Critical " - }, - { - 0x06, - L" Non-recoverable " - }, -}; - -TABLE_ITEM ECPLocTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" Processor " - }, - { - 0x04, - L" Disk " - }, - { - 0x05, - L" Peripheral Bay " - }, - { - 0x06, - L" System Management Module " - }, - { - 0x07, - L" Motherboard " - }, - { - 0x08, - L" Memory Module " - }, - { - 0x09, - L" Processor Module " - }, - { - 0x0A, - L" Power Unit " - }, - { - 0x0B, - L" Add-in Card " - }, -}; - -TABLE_ITEM MDTypeTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" National Semiconductor LM75 " - }, - { - 0x04, - L" National Semiconductor LM78 " - }, - { - 0x05, - L" National Semiconductor LM79 " - }, - { - 0x06, - L" National Semiconductor LM80 " - }, - { - 0x07, - L" National Semiconductor LM81 " - }, - { - 0x08, - L" Analog Devices ADM9240 " - }, - { - 0x09, - L" Dallas Semiconductor DS1780 " - }, - { - 0x0A, - L" Maxim 1617 " - }, - { - 0x0B, - L" Genesys GL518SM " - }, - { - 0x0C, - L" Winbond W83781D " - }, - { - 0x0D, - L" Holtek HT82H791 " - }, -}; - -TABLE_ITEM MDAddressTypeTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" I/O Port " - }, - { - 0x04, - L" Memory " - }, - { - 0x05, - L" SM Bus " - }, -}; - -TABLE_ITEM MemoryChannelTypeTable[] = { - { - 0x01, - L" Other " - }, - { - 0x02, - L" Unknown " - }, - { - 0x03, - L" RamBus " - }, - { - 0x04, - L" SyncLink " - }, -}; - -TABLE_ITEM IPMIDIBMCInterfaceTypeTable[] = { - { - 0x00, - L" Unknown " - }, - { - 0x01, - L" KCS: Keyboard Controller Style " - }, - { - 0x02, - L" SMIC: Server Management Interface Chip " - }, - { - 0x03, - L" BT: Block Transfer " - }, - { - 0x04, - L" SSIF: SMBus System Interface " - }, - { - 0xFF05, - L" Reserved for future assignment by this specification " - }, -}; - -TABLE_ITEM MCHostInterfaceTypeTable[] = { - { - 0x3F00, - L" MCTP Host Interface " - }, - { - 0x40, - L" Network Host Interface " - }, - { - 0xF0, - L" OEM defined " - }, -}; - - -TABLE_ITEM StructureTypeInfoTable[] = { - { - 0, - L" BIOS Information" - }, - { - 1, - L" System Information" - }, - { - 2, - L" Base Board Information" - }, - { - 3, - L" System Enclosure" - }, - { - 4, - L" Processor Information" - }, - { - 5, - L" Memory Controller Information " - }, - { - 6, - L" Memory Module Information " - }, - { - 7, - L" Cache Information " - }, - { - 8, - L" Port Connector Information " - }, - { - 9, - L" System Slots " - }, - { - 10, - L" On Board Devices Information " - }, - { - 11, - L" OEM Strings" - }, - { - 12, - L" System Configuration Options " - }, - { - 13, - L" BIOS Language Information " - }, - { - 14, - L" Group Associations " - }, - { - 15, - L" System Event Log " - }, - { - 16, - L" Physical Memory Array " - }, - { - 17, - L" Memory Device " - }, - { - 18, - L" 32-bit Memory Error Information " - }, - { - 19, - L" Memory Array Mapped Address " - }, - { - 20, - L" Memory Device Mapped Address " - }, - { - 21, - L" Built-in Pointing Device " - }, - { - 22, - L" Portable Battery " - }, - { - 23, - L" System Reset " - }, - { - 24, - L" Hardware Security " - }, - { - 25, - L" System Power Controls " - }, - { - 26, - L" Voltage Probe " - }, - { - 27, - L" Cooling Device " - }, - { - 28, - L" Temperature Probe " - }, - { - 29, - L" Electrical Current Probe " - }, - { - 30, - L" Out-of-Band Remote Access " - }, - { - 31, - L" Boot Integrity Services (BIS) Entry Point" - }, - { - 32, - L" System Boot Information " - }, - { - 33, - L" 64-bit Memory Error Information " - }, - { - 34, - L" Management Device " - }, - { - 35, - L" Management Device Component " - }, - { - 36, - L" Management Device Threshold Data " - }, - { - 37, - L" Memory Channel " - }, - { - 38, - L" IPMI Device Information " - }, - { - 39, - L" System Power Supply" - }, - { - 40, - L" Additional Information" - }, - { - 41, - L" Onboard Devices Extended Information" - }, - { - 42, - L" Management Controller Host Interface" - }, - { - 43, - L" TPM Device" - }, - { - 0x7E, - L" Inactive" - }, - { - 0x7F, - L" End-of-Table " - }, -}; - - -/** - Given a table and a Key, return the responding info. - - Notes: - Table[Index].Key is change from UINT8 to UINT16, - in order to deal with "0xaa - 0xbb". - - For example: - DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option) - has a item: - "0x07-0x7F, Unused" - Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07. - Then all the Key Value between Low and High gets the same string - L"Unused". - - @param[in] Table The begin address of table. - @param[in] Number The number of table items. - @param[in] Key The query Key. - @param[in, out] Info Input as empty buffer; output as data buffer. - @param[in] InfoLen The max number of characters for Info. - - @return the found Key and Info is valid. - @retval QUERY_TABLE_UNFOUND and Info should be NULL. -**/ -UINT8 -QueryTable ( - IN TABLE_ITEM *Table, - IN UINTN Number, - IN UINT8 Key, - IN OUT CHAR16 *Info, - IN UINTN InfoLen - ) -{ - UINTN Index; - // - // High byte and Low byte of word - // - UINT8 High; - UINT8 Low; - - for (Index = 0; Index < Number; Index++) { - High = (UINT8) (Table[Index].Key >> 8); - Low = (UINT8) (Table[Index].Key & 0x00FF); - - // - // Check if Key is in the range - // or if Key == Value in the table - // - if ((High > Low && Key >= Low && Key <= High) - || (Table[Index].Key == Key)) { - StrnCpyS (Info, InfoLen, Table[Index].Info, InfoLen - 1); - StrnCatS (Info, InfoLen, L"\n", InfoLen - 1 - StrLen(Info)); - return Key; - } - } - - StrCpyS (Info, InfoLen, L"Undefined Value\n"); - return QUERY_TABLE_UNFOUND; -} - -/** - Given a table of bit info and a Key, return the responding info to the Key. - - @param[in] Table Point to a table which maintains a map of 'bit' to 'message'. - @param[in] Number Number of table items. - @param[in] Bits The Key of query the bit map information. -**/ -VOID -PrintBitsInfo ( - IN TABLE_ITEM *Table, - IN UINTN Number, - IN UINT32 Bits - ) -{ - // - // Get certain bit of 'Value': - // -#define BIT(Value, bit) ((Value) & ((UINT32) 1) << (bit)) - // - // Clear certain bit of 'Value': - // -#define CLR_BIT(Value, bit) ((Value) -= (BIT (Value, bit))) - - UINTN Index; - UINT32 Value; - BOOLEAN FirstInfo; - - FirstInfo = TRUE; - Value = Bits; - // - // query the table and print information - // - for (Index = 0; Index < Number; Index++) { - if (BIT (Value, Table[Index].Key) != 0) { - if (!FirstInfo) { - // - // If it is not first info, print the separator first. - // - Print (L" | "); - } - Print (Table[Index].Info); - - FirstInfo = FALSE; - // - // clear the bit, for reserved bits test - // - CLR_BIT (Value, Table[Index].Key); - } - } - - // - // There is no any info if FirstInfo is still TRUE. - // - if (FirstInfo) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle); - } - - if (Value != 0) { - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_BITS_SET), - gShellDebug1HiiHandle, - Value - ); - } - - Print (L"\n"); -} -// -// ////////////////////////////////////////////////////////////////// -// -// Following uses QueryTable functions to simplify the coding. -// QueryTable(), PrintBitsInfo() -// -// -#define PRINT_TABLE_ITEM(Table, Key) \ - do { \ - UINTN Num; \ - CHAR16 Info[66]; \ - Num = sizeof (Table) / sizeof (TABLE_ITEM); \ - ZeroMem (Info, sizeof (Info)); \ - QueryTable (Table, Num, Key, Info, sizeof(Info)/sizeof(Info[0])); \ - Print (Info); \ - } while (0); - -#define PRINT_BITS_INFO(Table, bits) \ - do { \ - UINTN Num; \ - Num = sizeof (Table) / sizeof (TABLE_ITEM); \ - PrintBitsInfo (Table, Num, (UINT32) bits); \ - } while (0); - -/** - Display System Information (Type 1) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemWakeupType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (SystemWakeupTypeTable, Type); -} - -/** - Display Base Board (Type 2) Feature Flags. - - @param[in] FeatureFlags The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayBaseBoardFeatureFlags ( - IN UINT8 FeatureFlags, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (FeatureFlags, Option); - PRINT_BITS_INFO (BaseBoardFeatureFlagsTable, FeatureFlags); -} - -/** - Display Base Board (Type 2) Board Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayBaseBoardBoardType( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (BaseBoardBoardTypeTable, Type); -} - -/** - Display System Enclosure (Type 3) Enclosure Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemEnclosureType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - // - // query table and print info - // - PRINT_TABLE_ITEM (SystemEnclosureTypeTable, Type); - - if (BIT (Type, 7) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle); - } -} - -/** - Display System Enclosure (Type 3) Enclosure Status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemEnclosureStatus ( - IN UINT8 Status, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (SystemEnclosureStatusTable, Status); -} - -/** - Display System Enclosure (Type 3) Security Status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySESecurityStatus ( - IN UINT8 Status, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (SESecurityStatusTable, Status); -} - -/** - Display Processor Information (Type 4) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (ProcessorTypeTable, Type); -} - -/** - Display Processor Information (Type 4) Upgrade. - - @param[in] Upgrade The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorUpgrade ( - IN UINT8 Upgrade, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Upgrade, Option); - PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade); -} - -/** - Display Processor Information (Type 4) Characteristics. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorCharacteristics ( - IN UINT16 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_BITS_INFO (ProcessorCharacteristicsTable, Type); -} - -/** - Display Memory Controller Information (Type 5) method. - - @param[in] Method The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcErrorDetectMethod ( - IN UINT8 Method, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Method, Option); - PRINT_TABLE_ITEM (McErrorDetectMethodTable, Method); -} - -/** - Display Memory Controller Information (Type 5) Capability. - - @param[in] Capability The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcErrorCorrectCapability ( - IN UINT8 Capability, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Capability, Option); - PRINT_BITS_INFO (McErrorCorrectCapabilityTable, Capability); -} - -/** - Display Memory Controller Information (Type 5) Support. - - @param[in] Support The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcInterleaveSupport ( - IN UINT8 Support, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Support, Option); - PRINT_TABLE_ITEM (McInterleaveSupportTable, Support); -} - -/** - Display Memory Controller Information (Type 5) speeds. - - @param[in] Speed The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcMemorySpeeds ( - IN UINT16 Speed, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Speed, Option); - PRINT_BITS_INFO (McMemorySpeedsTable, Speed); -} - -/** - Display Memory Controller Information (Type 5) voltage. - - @param[in] Voltage The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryModuleVoltage ( - IN UINT8 Voltage, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Voltage, Option); - PRINT_BITS_INFO (MemoryModuleVoltageTable, Voltage); -} - -/** - Display Memory Module Information (Type 6) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMmMemoryType ( - IN UINT16 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_BITS_INFO (MmMemoryTypeTable, Type); -} - -/** - Display Memory Module Information (Type 6) status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMmErrorStatus ( - IN UINT8 Status, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_BITS_INFO (MmErrorStatusTable, Status); -} - -/** - Display Cache Information (Type 7) SRAM Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheSRAMType ( - IN UINT16 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION ((UINT8) Type, Option); - PRINT_BITS_INFO (CacheSRAMTypeTable, (UINT8) Type); -} - -/** - Display Cache Information (Type 7) correcting Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheErrCorrectingType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (CacheErrCorrectingTypeTable, Type); -} - -/** - Display Cache Information (Type 7) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheSystemCacheType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (CacheSystemCacheTypeTable, Type); -} - -/** - Display Cache Information (Type 7) Associativity. - - @param[in] Associativity The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheAssociativity ( - IN UINT8 Associativity, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Associativity, Option); - PRINT_TABLE_ITEM (CacheAssociativityTable, Associativity); -} - -/** - Display Port Connector Information (Type 8) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPortConnectorType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (PortConnectorTypeTable, Type); -} - -/** - Display Port Connector Information (Type 8) port type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPortType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (PortTypeTable, Type); -} - -/** - Display System Slots (Type 9) slot type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (SystemSlotTypeTable, Type); -} - -/** - Display System Slots (Type 9) data bus width. - - @param[in] Width The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotDataBusWidth ( - IN UINT8 Width, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Width, Option); - PRINT_TABLE_ITEM (SystemSlotDataBusWidthTable, Width); -} - -/** - Display System Slots (Type 9) usage information. - - @param[in] Usage The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotCurrentUsage ( - IN UINT8 Usage, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Usage, Option); - PRINT_TABLE_ITEM (SystemSlotCurrentUsageTable, Usage); -} - -/** - Display System Slots (Type 9) slot length. - - @param[in] Length The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotLength ( - IN UINT8 Length, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Length, Option); - PRINT_TABLE_ITEM (SystemSlotLengthTable, Length); -} - -/** - Display System Slots (Type 9) characteristics. - - @param[in] Chara1 The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySlotCharacteristics1 ( - IN UINT8 Chara1, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Chara1, Option); - PRINT_BITS_INFO (SlotCharacteristics1Table, Chara1); -} - -/** - Display System Slots (Type 9) characteristics. - - @param[in] Chara2 The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySlotCharacteristics2 ( - IN UINT8 Chara2, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Chara2, Option); - PRINT_BITS_INFO (SlotCharacteristics2Table, Chara2); -} - -/** - Display On Board Devices Information (Type 10) types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayOnboardDeviceTypes ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (OnboardDeviceTypesTable, Type); -} - -/** - Display System Event Log (Type 15) types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELTypes ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (SELTypesTable, Type); -} - -/** - Display System Event Log (Type 15) format type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELVarDataFormatType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (SELVarDataFormatTypeTable, Type); -} - -/** - Display System Event Log (Type 15) dw1. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPostResultsBitmapDw1 ( - IN UINT32 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_BITS_INFO (PostResultsBitmapDw1Table, Key); -} - -/** - Display System Event Log (Type 15) dw2. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPostResultsBitmapDw2 ( - IN UINT32 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_BITS_INFO (PostResultsBitmapDw2Table, Key); -} - -/** - Display System Event Log (Type 15) type. - - @param[in] SMType The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELSysManagementTypes ( - IN UINT32 SMType, - IN UINT8 Option - ) -{ - UINT8 Temp; - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (SMType, Option); - - // - // Deal with wide range Value - // - if (SMType >= 0x80000000) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED), gShellDebug1HiiHandle); - } else if (SMType >= 0x00020000) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); - } else if (SMType >= 0x00010000) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE), gShellDebug1HiiHandle); - } else if (SMType >= 0x31) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); - } else { - // - // Deal with One byte data - // - Temp = (UINT8) (SMType & 0x3F); - PRINT_TABLE_ITEM (SELSysManagementTypesTable, Temp); - } -} - -/** - Display Physical Memory Array (Type 16) Location. - - @param[in] Location The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMALocation ( - IN UINT8 Location, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Location, Option); - PRINT_TABLE_ITEM (PMALocationTable, Location); -} - -/** - Display Physical Memory Array (Type 16) Use. - - @param[in] Use The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMAUse ( - IN UINT8 Use, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Use, Option); - PRINT_TABLE_ITEM (PMAUseTable, Use); -} - -/** - Display Physical Memory Array (Type 16) Types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMAErrorCorrectionTypes ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (PMAErrorCorrectionTypesTable, Type); -} - -/** - Display Memory Device (Type 17) form factor. - - @param[in] FormFactor The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceFormFactor ( - IN UINT8 FormFactor, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (FormFactor, Option); - PRINT_TABLE_ITEM (MemoryDeviceFormFactorTable, FormFactor); -} - -/** - Display Memory Device (Type 17) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (MemoryDeviceTypeTable, Type); -} - -/** - Display Memory Device (Type 17) details. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceTypeDetail ( - IN UINT16 Para, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Para, Option); - PRINT_BITS_INFO (MemoryDeviceTypeDetailTable, Para); -} - -/** - Display Memory Device (Type 17) memory technology. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceMemoryTechnology ( - IN UINT8 Para, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Para, Option); - PRINT_TABLE_ITEM (MemoryDeviceMemoryTechnologyTable, Para); -} - -/** - Display Memory Device (Type 17) memory operating mode capability. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceMemoryOperatingModeCapability ( - IN UINT16 Para, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Para, Option); - PRINT_BITS_INFO (MemoryDeviceMemoryOperatingModeCapabilityTable, Para); -} - -/** - Display 32-bit Memory Error Information (Type 18) type. - - @param[in] ErrorType The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorType ( - IN UINT8 ErrorType, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (ErrorType, Option); - PRINT_TABLE_ITEM (MemoryErrorTypeTable, ErrorType); -} - -/** - Display 32-bit Memory Error Information (Type 18) error granularity. - - @param[in] Granularity The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorGranularity ( - IN UINT8 Granularity, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Granularity, Option); - PRINT_TABLE_ITEM (MemoryErrorGranularityTable, Granularity); -} - -/** - Display 32-bit Memory Error Information (Type 18) error information. - - @param[in] Operation The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorOperation ( - IN UINT8 Operation, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Operation, Option); - PRINT_TABLE_ITEM (MemoryErrorOperationTable, Operation); -} - -/** - Display Built-in Pointing Device (Type 21) type information. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPointingDeviceType ( - IN UINT8 Type, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (PointingDeviceTypeTable, Type); -} - -/** - Display Built-in Pointing Device (Type 21) information. - - @param[in] Interface The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPointingDeviceInterface ( - IN UINT8 Interface, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Interface, Option); - PRINT_TABLE_ITEM (PointingDeviceInterfaceTable, Interface); -} - -/** - Display Portable Battery (Type 22) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPBDeviceChemistry ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (PBDeviceChemistryTable, Key); -} - -/** - Display Voltage Probe (Type 26) location information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayVPLocation ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Loc; - - Loc = (UINT8) ((Key & 0xE0) >> 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Loc, Option); - PRINT_TABLE_ITEM (VPLocationTable, Loc); -} - -/** - Display Voltage Probe (Type 26) status ype information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayVPStatus ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Status; - - Status = (UINT8) (Key & 0x1F); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (VPStatusTable, Status); -} - -/** - Display Cooling (Type 27) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCoolingDeviceStatus ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Status; - - Status = (UINT8) ((Key & 0xE0) >> 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (CoolingDeviceStatusTable, Status); -} - -/** - Display Cooling (Type 27) type information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCoolingDeviceType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Type; - - Type = (UINT8) (Key & 0x1F); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Type, Option); - PRINT_TABLE_ITEM (CoolingDeviceTypeTable, Type); -} - -/** - Display Temperature Probe (Type 28) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayTemperatureProbeStatus ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Status; - - Status = (UINT8) ((Key & 0xE0) >> 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (TemperatureProbeStatusTable, Status); -} - -/** - Display Temperature Probe (Type 28) location information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayTemperatureProbeLoc ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Loc; - - Loc = (UINT8) (Key & 0x1F); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Loc, Option); - PRINT_TABLE_ITEM (TemperatureProbeLocTable, Loc); -} - -/** - Display Electrical Current Probe (Type 29) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayECPStatus ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Status; - - Status = (UINT8) ((Key & 0xE0) >> 5); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Status, Option); - PRINT_TABLE_ITEM (ECPStatusTable, Status); -} - -/** - Display Type 29 information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayECPLoc ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - UINT8 Loc; - - Loc = (UINT8) (Key & 0x1F); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Loc, Option); - PRINT_TABLE_ITEM (ECPLocTable, Loc); -} - -/** - Display Management Device (Type 34) Type. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMDType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (MDTypeTable, Key); -} - -/** - Display Management Device (Type 34) Address Type. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMDAddressType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (MDAddressTypeTable, Key); -} - -/** - Display Memory Channel (Type 37) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryChannelType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (MemoryChannelTypeTable, Key); -} - -/** - Display IPMI Device Information (Type 38) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayIPMIDIBMCInterfaceType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (IPMIDIBMCInterfaceTypeTable, Key); -} - -/** - Display Management Controller Host Interface (Type 42) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMCHostInterfaceType ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MC_HOST_INTERFACE_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (MCHostInterfaceTypeTable, Key); -} - -/** - Display the structure type information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayStructureTypeInfo ( - IN UINT8 Key, - IN UINT8 Option - ) -{ - // - // display - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE), gShellDebug1HiiHandle); - PRINT_INFO_OPTION (Key, Option); - PRINT_TABLE_ITEM (StructureTypeInfoTable, Key); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h deleted file mode 100644 index e67872c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h +++ /dev/null @@ -1,818 +0,0 @@ -/** @file - Build a table, each item is (key, info) pair. - and give a interface of query a string out of a table. - - Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SMBIOS_QUERY_TABLE_H_ -#define _SMBIOS_QUERY_TABLE_H_ - -#define QUERY_TABLE_UNFOUND 0xFF - -typedef struct TABLE_ITEM { - UINT16 Key; - CHAR16 *Info; -} TABLE_ITEM; - -// -// Print info by option -// -#define PRINT_INFO_OPTION(Value, Option) \ - do { \ - if (Option == SHOW_NONE) { \ - return ; \ - } \ - if (Option < SHOW_DETAIL) { \ - Print (L"0x%x\n", Value); \ - return ; \ - } \ - } while (0); - -/** - Given a table and a Key, return the responding info. - - Notes: - Table[Index].Key is change from UINT8 to UINT16, - in order to deal with "0xaa - 0xbb". - - For example: - DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option) - has a item: - "0x07-0x7F, Unused" - Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07. - Then all the Key Value between Low and High gets the same string - L"Unused". - - @param[in] Table The begin address of table. - @param[in] Number The number of table items. - @param[in] Key The query Key. - @param[in, out] Info Input as empty buffer; output as data buffer. - @param[in] InfoLen The max number of characters for Info. - - @return the found Key and Info is valid. - @retval QUERY_TABLE_UNFOUND and Info should be NULL. -**/ -UINT8 -QueryTable ( - IN TABLE_ITEM *Table, - IN UINTN Number, - IN UINT8 Key, - IN OUT CHAR16 *Info, - IN UINTN InfoLen - ); - -/** - Display the structure type information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayStructureTypeInfo ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display System Information (Type 1) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemWakeupType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Base Board (Type 2) Feature Flags. - - @param[in] FeatureFlags The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayBaseBoardFeatureFlags ( - IN UINT8 FeatureFlags, - IN UINT8 Option - ); - -/** - Display Base Board (Type 2) Board Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayBaseBoardBoardType( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Enclosure (Type 3) Enclosure Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemEnclosureType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Enclosure (Type 3) Enclosure Status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemEnclosureStatus ( - IN UINT8 Status, - IN UINT8 Option - ); - -/** - Display System Enclosure (Type 3) Security Status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySESecurityStatus ( - IN UINT8 Status, - IN UINT8 Option - ) -; - -/** - Display Processor Information (Type 4) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Processor Information (Type 4) Upgrade. - - @param[in] Upgrade The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorUpgrade ( - IN UINT8 Upgrade, - IN UINT8 Option - ); - -/** - Display Processor Information (Type 4) Characteristics. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayProcessorCharacteristics ( - IN UINT16 Type, - IN UINT8 Option - ); - -/** - Display Memory Controller Information (Type 5) method. - - @param[in] Method The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcErrorDetectMethod ( - IN UINT8 Method, - IN UINT8 Option - ); - -/** - Display Memory Controller Information (Type 5) Capability. - - @param[in] Capability The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcErrorCorrectCapability ( - IN UINT8 Capability, - IN UINT8 Option - ); - -/** - Display Memory Controller Information (Type 5) Support. - - @param[in] Support The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcInterleaveSupport ( - IN UINT8 Support, - IN UINT8 Option - ); - -/** - Display Memory Controller Information (Type 5) speeds. - - @param[in] Speed The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMcMemorySpeeds ( - IN UINT16 Speed, - IN UINT8 Option - ); - -/** - Display Memory Controller Information (Type 5) voltage. - - @param[in] Voltage The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryModuleVoltage ( - IN UINT8 Voltage, - IN UINT8 Option - ); - -/** - Display Memory Module Information (Type 6) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMmMemoryType ( - IN UINT16 Type, - IN UINT8 Option - ); - -/** - Display Memory Module Information (Type 6) status. - - @param[in] Status The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMmErrorStatus ( - IN UINT8 Status, - IN UINT8 Option - ); - -/** - Display Cache Information (Type 7) SRAM Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheSRAMType ( - IN UINT16 Type, - IN UINT8 Option - ); - -/** - Display Cache Information (Type 7) correcting Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheErrCorrectingType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Cache Information (Type 7) Type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheSystemCacheType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Cache Information (Type 7) Associativity. - - @param[in] Associativity The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCacheAssociativity ( - IN UINT8 Associativity, - IN UINT8 Option - ); - -/** - Display Port Connector Information (Type 8) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPortConnectorType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Port Connector Information (Type 8) port type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPortType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) slot type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) data bus width. - - @param[in] Width The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotDataBusWidth ( - IN UINT8 Width, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) usage information. - - @param[in] Usage The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotCurrentUsage ( - IN UINT8 Usage, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) slot length. - - @param[in] Length The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySystemSlotLength ( - IN UINT8 Length, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) characteristics. - - @param[in] Chara1 The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySlotCharacteristics1 ( - IN UINT8 Chara1, - IN UINT8 Option - ); - -/** - Display System Slots (Type 9) characteristics. - - @param[in] Chara2 The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySlotCharacteristics2 ( - IN UINT8 Chara2, - IN UINT8 Option - ); - -/** - Display On Board Devices Information (Type 10) types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayOnboardDeviceTypes ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Event Log (Type 15) types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELTypes ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Event Log (Type 15) format type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELVarDataFormatType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display System Event Log (Type 15) dw1. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPostResultsBitmapDw1 ( - IN UINT32 Key, - IN UINT8 Option - ); - -/** - Display System Event Log (Type 15) dw2. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPostResultsBitmapDw2 ( - IN UINT32 Key, - IN UINT8 Option - ); - -/** - Display System Event Log (Type 15) type. - - @param[in] SMType The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplaySELSysManagementTypes ( - IN UINT32 SMType, - IN UINT8 Option - ); - -/** - Display Physical Memory Array (Type 16) Location. - - @param[in] Location The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMALocation ( - IN UINT8 Location, - IN UINT8 Option - ); - -/** - Display Physical Memory Array (Type 16) Use. - - @param[in] Use The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMAUse ( - IN UINT8 Use, - IN UINT8 Option - ); - -/** - Display Physical Memory Array (Type 16) Types. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPMAErrorCorrectionTypes ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Memory Device (Type 17) form factor. - - @param[in] FormFactor The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceFormFactor ( - IN UINT8 FormFactor, - IN UINT8 Option - ); - -/** - Display Memory Device (Type 17) type. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Memory Device (Type 17) details. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceTypeDetail ( - IN UINT16 Para, - IN UINT8 Option - ); - -/** - Display Memory Device (Type 17) memory technology. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceMemoryTechnology ( - IN UINT8 Para, - IN UINT8 Option - ); - -/** - Display Memory Device (Type 17) memory operating mode capability. - - @param[in] Para The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryDeviceMemoryOperatingModeCapability ( - IN UINT16 Para, - IN UINT8 Option - ); - -/** - Display 32-bit Memory Error Information (Type 18) type. - - @param[in] ErrorType The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorType ( - IN UINT8 ErrorType, - IN UINT8 Option - ); - -/** - Display 32-bit Memory Error Information (Type 18) error granularity. - - @param[in] Granularity The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorGranularity ( - IN UINT8 Granularity, - IN UINT8 Option - ); - -/** - Display 32-bit Memory Error Information (Type 18) error information. - - @param[in] Operation The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryErrorOperation ( - IN UINT8 Operation, - IN UINT8 Option - ); - -/** - Display Built-in Pointing Device (Type 21) type information. - - @param[in] Type The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPointingDeviceType ( - IN UINT8 Type, - IN UINT8 Option - ); - -/** - Display Built-in Pointing Device (Type 21) information. - - @param[in] Interface The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPointingDeviceInterface ( - IN UINT8 Interface, - IN UINT8 Option - ); - -/** - Display Portable Battery (Type 22) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayPBDeviceChemistry ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Voltage Probe (Type 26) location information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayVPLocation ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Voltage Probe (Type 26) status ype information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayVPStatus ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Cooling (Type 27) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCoolingDeviceStatus ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Cooling (Type 27) type information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayCoolingDeviceType ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Temperature Probe (Type 28) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayTemperatureProbeStatus ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Temperature Probe (Type 28) location information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayTemperatureProbeLoc ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Electrical Current Probe (Type 29) status information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayECPStatus ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Electrical Current Probe (Type 29) location information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayECPLoc ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Management Device (Type 34) Type. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMDType ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Management Device (Type 34) Address Type. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMDAddressType ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Memory Channel (Type 37) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMemoryChannelType ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display IPMI Device Information (Type 38) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayIPMIDIBMCInterfaceType ( - IN UINT8 Key, - IN UINT8 Option - ); - -/** - Display Management Controller Host Interface (Type 42) information. - - @param[in] Key The key of the structure. - @param[in] Option The optional information. -**/ -VOID -DisplayMCHostInterfaceType ( - IN UINT8 Key, - IN UINT8 Option - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c deleted file mode 100644 index 9a0aa21..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c +++ /dev/null @@ -1,1005 +0,0 @@ -/** @file - Tools of clarify the content of the smbios table. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include "LibSmbiosView.h" -#include "SmbiosView.h" -#include "PrintInfo.h" -#include "QueryTable.h" - -UINT8 gShowType = SHOW_DETAIL; -STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL; -STATIC STRUCTURE_STATISTICS *mSmbios64BitStatisticsTable = NULL; - -UINT8 SmbiosMajorVersion; -UINT8 SmbiosMinorVersion; - -UINTN mNumberOfSmbios64BitStructures; -UINTN mSmbios64BitTableLength; - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-t", TypeValue}, - {L"-h", TypeValue}, - {L"-s", TypeFlag}, - {L"-a", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'smbiosview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSmbiosView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINT8 StructType; - UINT16 StructHandle; - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_STATUS Status2; - BOOLEAN RandomView; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Temp; - - mStatisticsTable = NULL; - mSmbios64BitStatisticsTable = NULL; - Package = NULL; - ShellStatus = SHELL_SUCCESS; - - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"smbiosview", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetValue(Package, L"-t") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-t"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetValue(Package, L"-h") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-h"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ( - (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-h")) || - (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-s")) || - (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-a")) || - (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-s")) || - (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-a")) || - (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-a")) - ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - - // - // Init Lib - // - Status1 = LibSmbiosInit (); - Status2 = LibSmbios64BitInit (); - if (EFI_ERROR (Status1) && EFI_ERROR (Status2)) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle); - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - - StructType = STRUCTURE_TYPE_RANDOM; - RandomView = TRUE; - - Temp = ShellCommandLineGetValue(Package, L"-t"); - if (Temp != NULL) { - StructType = (UINT8) ShellStrToUintn (Temp); - } - - if (ShellCommandLineGetFlag(Package, L"-a")) { - gShowType = SHOW_ALL; - } - - if (!EFI_ERROR (Status1)) { - // - // Initialize the StructHandle to be the first handle - // - StructHandle = INVALID_HANDLE; - LibGetSmbiosStructure (&StructHandle, NULL, NULL); - - Temp = ShellCommandLineGetValue(Package, L"-h"); - if (Temp != NULL) { - RandomView = FALSE; - StructHandle = (UINT16) ShellStrToUintn(Temp); - } - // - // build statistics table - // - Status = InitSmbiosTableStatistics (); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - - if (ShellCommandLineGetFlag(Package, L"-s")) { - Status = DisplayStatisticsTable (SHOW_DETAIL); - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - goto Show64Bit; - } - - // - // Show SMBIOS structure information - // - Status = SMBiosView (StructType, StructHandle, gShowType, RandomView); - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - } - -Show64Bit: - if (!EFI_ERROR (Status2)) { - // - // build statistics table - // - Status = InitSmbios64BitTableStatistics (); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - // - // Initialize the StructHandle to be the first handle - // - StructHandle = INVALID_HANDLE; - LibGetSmbios64BitStructure (&StructHandle, NULL, NULL); - - Temp = ShellCommandLineGetValue(Package, L"-h"); - if (Temp != NULL) { - RandomView = FALSE; - StructHandle = (UINT16) ShellStrToUintn(Temp); - } - - if (ShellCommandLineGetFlag(Package, L"-s")) { - Status = DisplaySmbios64BitStatisticsTable (SHOW_DETAIL); - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - goto Done; - } - - // - // Show SMBIOS structure information - // - Status = SMBios64View (StructType, StructHandle, gShowType, RandomView); - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - } - } - } -Done: - // - // Release resources - // - if (mStatisticsTable != NULL) { - // - // Release statistics table - // - FreePool (mStatisticsTable); - mStatisticsTable = NULL; - } - - if (mSmbios64BitStatisticsTable != NULL) { - // - // Release statistics table - // - FreePool (mSmbios64BitStatisticsTable); - mSmbios64BitStatisticsTable = NULL; - } - - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - - LibSmbiosCleanup (); - LibSmbios64BitCleanup (); - - return ShellStatus; -} - -/** - Query all structures Data from SMBIOS table and Display - the information to users as required display option. - - @param[in] QueryType Structure type to view. - @param[in] QueryHandle Structure handle to view. - @param[in] Option Display option: none,outline,normal,detail. - @param[in] RandomView Support for -h parameter. - - @retval EFI_SUCCESS print is successful. - @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. -**/ -EFI_STATUS -SMBiosView ( - IN UINT8 QueryType, - IN UINT16 QueryHandle, - IN UINT8 Option, - IN BOOLEAN RandomView - ) -{ - UINT16 Handle; - UINT8 *Buffer; - UINT16 Length; - UINTN Index; - - SMBIOS_STRUCTURE_POINTER SmbiosStruct; - SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; - - SMBiosTable = NULL; - LibSmbiosGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_BAD_BUFFER_SIZE; - } - - if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) { - // - // Have got SMBIOS table - // - SmbiosPrintEPSInfo (SMBiosTable, Option); - - SmbiosMajorVersion = SMBiosTable->MajorVersion; - SmbiosMinorVersion = SMBiosTable->MinorVersion; - - ShellPrintEx(-1,-1,L"=========================================================\n"); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle); - - if (QueryType == STRUCTURE_TYPE_RANDOM) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType); - } - - if (RandomView) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle); - } - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle); - ShellPrintEx(-1,-1,GetShowTypeString (gShowType)); - ShellPrintEx(-1,-1,L"\n\n"); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - - // - // Searching and display structure info - // - Handle = QueryHandle; - for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) { - // - // if reach the end of table, break.. - // - if (Handle == INVALID_HANDLE) { - break; - } - // - // handle then point to the next! - // - if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { - break; - } - - SmbiosStruct.Raw = Buffer; - - // - // if QueryType==Random, print this structure. - // if QueryType!=Random, but Hdr->Type==QueryType, also print it. - // only if QueryType != Random and Hdr->Type != QueryType, skiped it. - // - if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) { - continue; - } - - ShellPrintEx(-1,-1,L"\n=========================================================\n"); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT), - gShellDebug1HiiHandle, - SmbiosStruct.Hdr->Type, - SmbiosStruct.Hdr->Handle - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length); - // - // Addr of structure in structure in table - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer); - DumpHex (0, 0, Length, Buffer); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - - if (gShowType != SHOW_NONE) { - // - // Print structure information - // - SmbiosPrintStructure (&SmbiosStruct, gShowType); - ShellPrintEx(-1,-1,L"\n"); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - } - if (!RandomView) { - break; - } - // - // Support Execution Interrupt. - // - if (ShellGetExecutionBreakFlag ()) { - return EFI_ABORTED; - } - } - - ShellPrintEx(-1,-1,L"\n=========================================================\n"); - return EFI_SUCCESS; - } - - return EFI_BAD_BUFFER_SIZE; -} - -/** - Query all structures Data from SMBIOS table and Display - the information to users as required display option. - - @param[in] QueryType Structure type to view. - @param[in] QueryHandle Structure handle to view. - @param[in] Option Display option: none,outline,normal,detail. - @param[in] RandomView Support for -h parameter. - - @retval EFI_SUCCESS print is successful. - @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. -**/ -EFI_STATUS -SMBios64View ( - IN UINT8 QueryType, - IN UINT16 QueryHandle, - IN UINT8 Option, - IN BOOLEAN RandomView - ) -{ - UINT16 Handle; - UINT8 *Buffer; - UINT16 Length; - UINTN Index; - SMBIOS_STRUCTURE_POINTER SmbiosStruct; - SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable; - - SMBiosTable = NULL; - LibSmbios64BitGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_BAD_BUFFER_SIZE; - } - - if (CompareMem (SMBiosTable->AnchorString, "_SM3_", 5) == 0) { - // - // Have got SMBIOS table - // - Smbios64BitPrintEPSInfo (SMBiosTable, Option); - - SmbiosMajorVersion = SMBiosTable->MajorVersion; - SmbiosMinorVersion = SMBiosTable->MinorVersion; - - ShellPrintEx(-1,-1,L"=========================================================\n"); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle); - - if (QueryType == STRUCTURE_TYPE_RANDOM) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType); - } - - if (RandomView) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle); - } else { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle); - } - - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle); - ShellPrintEx(-1,-1,GetShowTypeString (gShowType)); - ShellPrintEx(-1,-1,L"\n\n"); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - - // - // Searching and display structure info - // - Handle = QueryHandle; - for (Index = 0; Index < mNumberOfSmbios64BitStructures; Index++) { - // - // if reach the end of table, break.. - // - if (Handle == INVALID_HANDLE) { - break; - } - // - // handle then point to the next! - // - if (LibGetSmbios64BitStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { - break; - } - - SmbiosStruct.Raw = Buffer; - - // - // if QueryType==Random, print this structure. - // if QueryType!=Random, but Hdr->Type==QueryType, also print it. - // only if QueryType != Random and Hdr->Type != QueryType, skiped it. - // - if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) { - continue; - } - - ShellPrintEx(-1,-1,L"\n=========================================================\n"); - ShellPrintHiiEx(-1,-1,NULL, - STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT), - gShellDebug1HiiHandle, - SmbiosStruct.Hdr->Type, - SmbiosStruct.Hdr->Handle - ); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length); - // - // Addr of structure in structure in table - // - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer); - DumpHex (0, 0, Length, Buffer); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - - if (gShowType != SHOW_NONE) { - // - // Print structure information - // - SmbiosPrintStructure (&SmbiosStruct, gShowType); - ShellPrintEx(-1,-1,L"\n"); - -/* - // - // Get internal commands, such as change options. - // - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } -*/ - } - if (!RandomView) { - break; - } - // - // Support Execution Interrupt. - // - if (ShellGetExecutionBreakFlag ()) { - return EFI_ABORTED; - } - } - - ShellPrintEx(-1,-1,L"\n=========================================================\n"); - return EFI_SUCCESS; - } - - return EFI_BAD_BUFFER_SIZE; -} - -/** - Function to initialize the global mStatisticsTable object. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -InitSmbiosTableStatistics ( - VOID - ) -{ - UINT16 Handle; - UINT8 *Buffer; - UINT16 Length; - UINT16 Offset; - UINT16 Index; - - SMBIOS_STRUCTURE_POINTER SmbiosStruct; - SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; - STRUCTURE_STATISTICS *StatisticsPointer; - - SMBiosTable = NULL; - LibSmbiosGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_NOT_FOUND; - } - - if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle); - return EFI_INVALID_PARAMETER; - } - // - // Allocate memory to mStatisticsTable - // - if (mStatisticsTable != NULL) { - FreePool (mStatisticsTable); - mStatisticsTable = NULL; - } - - mStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS)); - - if (mStatisticsTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle); - return EFI_OUT_OF_RESOURCES; - } - - Offset = 0; - StatisticsPointer = mStatisticsTable; - - // - // search from the first one - // - Handle = INVALID_HANDLE; - LibGetSmbiosStructure (&Handle, NULL, NULL); - for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) { - // - // If reach the end of table, break.. - // - if (Handle == INVALID_HANDLE) { - break; - } - // - // After LibGetSmbiosStructure(), handle then point to the next! - // - if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { - break; - } - - SmbiosStruct.Raw = Buffer; - - // - // general statistics - // - StatisticsPointer->Index = Index; - StatisticsPointer->Type = SmbiosStruct.Hdr->Type; - StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle; - StatisticsPointer->Length = Length; - StatisticsPointer->Addr = Offset; - - Offset = (UINT16) (Offset + Length); - - StatisticsPointer = &mStatisticsTable[Index]; - } - - return EFI_SUCCESS; -} - -/** - @param[in] Smbios64EntryPoint SMBIOS 64-bit entry point. - @param[out] NumberOfSmbios64Structures The number of structures in 64-bit SMBIOS table. - @param[out] Smbios64TableLength The total length of 64-bit SMBIOS table. - - @retval EFI_SUCCESS Calculation was successful. -**/ -EFI_STATUS -CalculateSmbios64BitStructureCountAndLength ( - SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios64EntryPoint, - UINTN *NumberOfSmbios64Structures, - UINTN *Smbios64TableLength -) -{ - SMBIOS_STRUCTURE_POINTER Smbios; - UINT8 *Raw; - - *Smbios64TableLength = 0; - *NumberOfSmbios64Structures = 0; - - Smbios.Raw = (UINT8 *)(UINTN)(Smbios64EntryPoint->TableAddress); - while (TRUE) { - if (Smbios.Hdr->Type == 127) { - // - // Reach the end of table type 127 - // - (*NumberOfSmbios64Structures)++; - (*Smbios64TableLength) += sizeof (SMBIOS_STRUCTURE); - return EFI_SUCCESS; - } - - Raw = Smbios.Raw; - // - // Walk to next structure - // - LibGetSmbiosString (&Smbios, (UINT16) (-1)); - // - // Length = Next structure head - this structure head - // - (*Smbios64TableLength) += ((UINTN) Smbios.Raw - (UINTN) Raw); - if ((*Smbios64TableLength) > Smbios64EntryPoint->TableMaximumSize) { - // - // The actual table length exceeds maximum table size, - // There should be something wrong with SMBIOS table. - // - return EFI_INVALID_PARAMETER; - } - (*NumberOfSmbios64Structures)++; - } -} - -/** - Function to initialize the global mSmbios64BitStatisticsTable object. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -InitSmbios64BitTableStatistics ( - VOID - ) -{ - UINT16 Handle; - UINT8 *Buffer; - UINT16 Length; - UINT16 Offset; - UINT16 Index; - EFI_STATUS Status; - SMBIOS_STRUCTURE_POINTER SmbiosStruct; - SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable; - STRUCTURE_STATISTICS *StatisticsPointer; - - SMBiosTable = NULL; - LibSmbios64BitGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_NOT_FOUND; - } - - if (CompareMem (SMBiosTable->AnchorString, "_SM3_", 5) != 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle); - return EFI_INVALID_PARAMETER; - } - // - // Allocate memory to mSmbios64BitStatisticsTable - // - if (mSmbios64BitStatisticsTable != NULL) { - FreePool (mSmbios64BitStatisticsTable); - mSmbios64BitStatisticsTable = NULL; - } - // - // Calculate number of smbios structures - // - Status = CalculateSmbios64BitStructureCountAndLength (SMBiosTable, &mNumberOfSmbios64BitStructures, &mSmbios64BitTableLength); - if ((EFI_ERROR (Status)) || (mSmbios64BitTableLength > SMBiosTable->TableMaximumSize)) { - return EFI_INVALID_PARAMETER; - } - - mSmbios64BitStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (mNumberOfSmbios64BitStructures * sizeof (STRUCTURE_STATISTICS)); - - if (mSmbios64BitStatisticsTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle); - return EFI_OUT_OF_RESOURCES; - } - - Offset = 0; - StatisticsPointer = mSmbios64BitStatisticsTable; - - // - // search from the first one - // - Handle = INVALID_HANDLE; - LibGetSmbios64BitStructure (&Handle, NULL, NULL); - for (Index = 1; Index <= mNumberOfSmbios64BitStructures; Index++) { - // - // If reach the end of table, break.. - // - if (Handle == INVALID_HANDLE) { - break; - } - // - // After LibGetSmbios64BitStructure(), handle then point to the next! - // - if (LibGetSmbios64BitStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { - break; - } - - SmbiosStruct.Raw = Buffer; - - // - // general statistics - // - StatisticsPointer->Index = Index; - StatisticsPointer->Type = SmbiosStruct.Hdr->Type; - StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle; - StatisticsPointer->Length = Length; - StatisticsPointer->Addr = Offset; - - Offset = (UINT16) (Offset + Length); - - StatisticsPointer = &mSmbios64BitStatisticsTable[Index]; - } - - return EFI_SUCCESS; -} - -/** - Function to display the global mStatisticsTable object. - - @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -DisplayStatisticsTable ( - IN UINT8 Option - ) -{ - UINTN Index; - UINTN Num; - STRUCTURE_STATISTICS *StatisticsPointer; - SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; - - SMBiosTable = NULL; - if (Option < SHOW_OUTLINE) { - return EFI_SUCCESS; - } - // - // display EPS information firstly - // - LibSmbiosGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_UNSUPPORTED; - } - - ShellPrintEx(-1,-1,L"\n============================================================\n"); - SmbiosPrintEPSInfo (SMBiosTable, Option); - - if (Option < SHOW_NORMAL) { - return EFI_SUCCESS; - } - - if (mStatisticsTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle); - return EFI_NOT_FOUND; - } - - ShellPrintEx(-1,-1,L"============================================================\n"); - StatisticsPointer = &mStatisticsTable[0]; - Num = SMBiosTable->NumberOfSmbiosStructures; - // - // display statistics table content - // - for (Index = 1; Index <= Num; Index++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle); - if (Option >= SHOW_DETAIL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length); - } - - ShellPrintEx(-1,-1,L"\n"); - StatisticsPointer = &mStatisticsTable[Index]; -/* - // - // Display 20 lines and wait for a page break - // - if (Index % 20 == 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle); - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } - } -*/ - } - - return EFI_SUCCESS; -} - -/** - Function to display the global mSmbios64BitStatisticsTable object. - - @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -DisplaySmbios64BitStatisticsTable ( - IN UINT8 Option - ) -{ - UINTN Index; - UINTN Num; - STRUCTURE_STATISTICS *StatisticsPointer; - SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable; - - SMBiosTable = NULL; - if (Option < SHOW_OUTLINE) { - return EFI_SUCCESS; - } - // - // display EPS information firstly - // - LibSmbios64BitGetEPS (&SMBiosTable); - if (SMBiosTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); - return EFI_UNSUPPORTED; - } - - ShellPrintEx(-1,-1,L"\n============================================================\n"); - Smbios64BitPrintEPSInfo (SMBiosTable, Option); - - if (Option < SHOW_NORMAL) { - return EFI_SUCCESS; - } - - if (mSmbios64BitStatisticsTable == NULL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle); - return EFI_NOT_FOUND; - } - - ShellPrintEx(-1,-1,L"============================================================\n"); - StatisticsPointer = &mSmbios64BitStatisticsTable[0]; - Num = mNumberOfSmbios64BitStructures; - // - // display statistics table content - // - for (Index = 1; Index <= Num; Index++) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle); - if (Option >= SHOW_DETAIL) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length); - } - - ShellPrintEx(-1,-1,L"\n"); - StatisticsPointer = &mSmbios64BitStatisticsTable[Index]; -/* - // - // Display 20 lines and wait for a page break - // - if (Index % 20 == 0) { - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle); - Status = WaitEnter (); - if (EFI_ERROR (Status)) { - if (Status == EFI_ABORTED) { - return EFI_SUCCESS; - } - - return Status; - } - } -*/ - } - - return EFI_SUCCESS; -} - -/** - function to return a string of the detail level. - - @param[in] ShowType The detail level whose name is desired in clear text. - - @return A pointer to a string representing the ShowType (or 'undefined type' if not known). -**/ -CHAR16 * -GetShowTypeString ( - UINT8 ShowType - ) -{ - // - // show type - // - switch (ShowType) { - - case SHOW_NONE: - return L"SHOW_NONE"; - - case SHOW_OUTLINE: - return L"SHOW_OUTLINE"; - - case SHOW_NORMAL: - return L"SHOW_NORMAL"; - - case SHOW_DETAIL: - return L"SHOW_DETAIL"; - - case SHOW_ALL: - return L"SHOW_ALL"; - - default: - return L"Undefined type"; - } -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h deleted file mode 100644 index 559fedf..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h +++ /dev/null @@ -1,129 +0,0 @@ -/** @file - Tools of clarify the content of the smbios table. - - Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _SMBIOS_VIEW_H_ -#define _SMBIOS_VIEW_H_ - -#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE -#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF - -typedef struct { - UINT16 Index; - UINT8 Type; - UINT16 Handle; - UINT16 Addr; // offset from table head - UINT16 Length; // total structure length -} STRUCTURE_STATISTICS; - -/** - Query all structures Data from SMBIOS table and Display - the information to users as required display option. - - @param[in] QueryType Structure type to view. - @param[in] QueryHandle Structure handle to view. - @param[in] Option Display option: none,outline,normal,detail. - @param[in] RandomView Support for -h parameter. - - @retval EFI_SUCCESS print is successful. - @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. -**/ -EFI_STATUS -SMBiosView ( - IN UINT8 QueryType, - IN UINT16 QueryHandle, - IN UINT8 Option, - IN BOOLEAN RandomView - ); - -/** - Query all structures Data from SMBIOS table and Display - the information to users as required display option. - - @param[in] QueryType Structure type to view. - @param[in] QueryHandle Structure handle to view. - @param[in] Option Display option: none,outline,normal,detail. - @param[in] RandomView Support for -h parameter. - - @retval EFI_SUCCESS print is successful. - @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. -**/ -EFI_STATUS -SMBios64View ( - IN UINT8 QueryType, - IN UINT16 QueryHandle, - IN UINT8 Option, - IN BOOLEAN RandomView - ); - -/** - Function to initialize the global mStatisticsTable object. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -InitSmbiosTableStatistics ( - VOID - ); - -/** - Function to initialize the global mSmbios64BitStatisticsTable object. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -InitSmbios64BitTableStatistics ( - VOID - ); - -/** - Function to display the global mStatisticsTable object. - - @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -DisplayStatisticsTable ( - IN UINT8 Option - ); - -/** - Function to display the global mSmbios64BitStatisticsTable object. - - @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. - - @retval EFI_SUCCESS print is successful. -**/ -EFI_STATUS -DisplaySmbios64BitStatisticsTable ( - IN UINT8 Option - ); - -/** - function to return a string of the detail level. - - @param[in] ShowType The detail level whose name is desired in clear text. - - @return A pointer to a string representing the ShowType (or 'undefined type' if not known). -**/ -CHAR16* -GetShowTypeString ( - UINT8 ShowType - ); - -extern UINT8 gShowType; - -extern UINTN mSmbios64BitTableLength; - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni deleted file mode 100644 index ebdebda..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni +++ /dev/null @@ -1,506 +0,0 @@ -// /** -// -// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
-// (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellDebug1CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 Debug1 profile SmBiosView command -// -// -// **/ -/=# -#langdef en-US "english" -#string STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD #language en-US "Access method: " -#string STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT #language en-US "Indexed I/O: 1 8-bit index port, 1 8-bit data port\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS #language en-US "Indexed I/O: 2 8-bit index ports, 1 8-bit data port\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT #language en-US "Indexed I/O: 1 16-bit index port, 1 8-bit data port\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS #language en-US "Memory-mapped physical 32-bit address\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL #language en-US "Available via General-Purpose NonVolatile Data functions\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN #language en-US "Available for future assignment via this specification\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM #language en-US "BIOS Vendor/OEM-specific \r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS #language en-US "Log Status: " -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID #language en-US "Log area valid\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL #language en-US "Log area full\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL #language en-US "Log area not full\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO #language en-US "Reserved bits not zero - 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT #language en-US "Log Header Format: \r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER #language en-US "No Header\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER #language en-US "Type 1 log header\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE #language en-US "Available for future\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR #language en-US "BIOS Vendor/OEM-specific format\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN #language en-US "Log Header Len: " -#string STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D #language en-US " %d\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ #language en-US "This record has been read\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ #language en-US "This record has not been read\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG #language en-US "System Event Log Header Type1 Format:\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED #language en-US "OEM Reserved:\r\n0x%x 0x%x 0x%x 0x%x 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME #language en-US "Multiple Event Time Window: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT #language en-US "Multiple Event Count Increment: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS #language en-US "Pre-boot Event Log Reset - CMOS Address: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX #language en-US "Pre-boot Event Log Reset - CMOS Bit Index: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF #language en-US "CMOS Checksum - Starting Offset: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT #language en-US "CMOS Checksum - Byte Count: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED #language en-US "Reserved: 0x%x 0x%x 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION #language en-US "HeaderRevision: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER #language en-US "\r\nLog Header: " -#string STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN #language en-US "Available for future assignment via this specification\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT #language en-US "No standard format data is available\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC #language en-US "SMBIOS structure associated with the hardware element that failed\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE #language en-US "Structure handle = 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER #language en-US "multiple-event counter: 0x%x\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN #language en-US "Unused, available for assignment by this specification\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM #language en-US "Available for system- and OEM-specific assignments\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2 #language en-US "\r\nSystem Event Log records:\r\n" -#string STR_SMBIOSVIEW_EVENTLOGINFO_DATE #language en-US "Date/Time: " -#string STR_SMBIOSVIEW_EVENTLOGINFO_ERROR #language en-US "error" -#string STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS #language en-US "%02x/%02x/%02x, %x:%x:%x\r\n" -#string STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE #language en-US "Cannot get SMBIOS Table\r\n" -#string STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR #language en-US "Get SMBIOS Table error - %r\r\n" -#string STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC #language en-US " Get SMBIOS Structure, no buffer or length specified!\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DUMP #language en-US "Dump " -#string STR_SMBIOSVIEW_PRINTINFO_SIZE #language en-US "\r\nsize=%d:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL #language en-US "SMBiosTable is NULL!\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN #language en-US "%HSMBIOS Entry Point Structure:%N\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN #language en-US "%HSMBIOS 3.0 (64-bit) Entry Point Structure:%N\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION #language en-US "SMBIOS BCD Revision: 0x%x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DOCREV #language en-US "SMBIOS Docrev: 0x%x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT #language en-US "Number of Structures: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE #language en-US "Max Struct size: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR #language en-US "Table Address: 0x%p\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH #language en-US "Table Length: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TABLE_MAX_SIZE #language en-US "Table Max Size: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR #language en-US "Anchor String: %a\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM #language en-US "EPS Checksum: 0x%x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN #language en-US "Entry Point Len: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_VERSION #language en-US "Version: %d.%d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MAJOR_VERSION #language en-US "Major version: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MINOR_VERSION #language en-US "Minor version: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION #language en-US "Entry Point revision: 0x%x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA_NONE #language en-US "Formatted Area: None\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA #language en-US "Formatted Area: \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR #language en-US "Inter Anchor: %a\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM #language en-US "Inter Checksum: 0x%x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN #language en-US "Format part Len : %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE #language en-US "Structure Handle: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE #language en-US "Bootup state " -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE #language en-US "Power Supply State " -#string STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE #language en-US "Thermal state " -#string STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS #language en-US "Security Status " -#string STR_SMBIOSVIEW_PRINTINFO_SUPOPRT #language en-US "Support " -#string STR_SMBIOSVIEW_PRINTINFO_CURRENT #language en-US "Current " -#string STR_SMBIOSVIEW_PRINTINFO_INSTALLED #language en-US "Installed " -#string STR_SMBIOSVIEW_PRINTINFO_ENABLED #language en-US "Enabled " -#string STR_SMBIOSVIEW_PRINTINFO_EXTERNAL #language en-US "External " -#string STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS #language en-US "Peer Groups %d:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM #language en-US " SegmentGroup Num: 0x%04x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BUS_NUM #language en-US " Bus Num: 0x%02x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM #language en-US " DevFunc Num: 0x%02x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH #language en-US " DataBus Width: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DESC_STRING #language en-US "Description String: " -#string STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT #language en-US "Supported Event Log Type Descriptors %d:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED #language en-US "Access Method %d has not supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31 #language en-US "This structure is Type31, reserved by BIS (Boot Integrity Services)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE #language en-US "Memory Device %d:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD #language en-US "Device Load: 0x%02x," -#string STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE #language en-US "Device Handle: 0x%04x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT #language en-US "Inactive structure --- Needn't interpret it.\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE #language en-US "This structure indicates the End-of-table!\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED #language en-US "Structure Type undefined!\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR #language en-US "BIOS Characteristics: \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT #language en-US "Reserved bit\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT #language en-US "Unknown bit\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED #language en-US "BIOS Characteristics Not Supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED #language en-US "ISA is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED #language en-US "MSA is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED #language en-US "EISA is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED #language en-US "PCI is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED #language en-US "PC Card(PCMCIA) is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED #language en-US "Plug and play is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED #language en-US "APM is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE #language en-US "BIOS is Upgradeable(FLASH)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING #language en-US "BIOS shadowing is allowed\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED #language en-US "VL-VESA is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT #language en-US "ESCD support is available\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BOOT_FORM_CD_SUPPORTED #language en-US "Boot form CD is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED #language en-US "Selectable Boot is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED #language en-US "BIOS ROM is socketed\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD #language en-US "Boot From PC Card(PCMCIA)is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER #language en-US "EDD (Enhanced Disk Driver) Specification is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC #language en-US "Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5\",1k Bytes/Sector, 360 RPM) is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA #language en-US "Int 13h - Japanese Floppy for Toshiba 1.2mn (3.5\", 360 RPM) is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED #language en-US "Int 13h - 5.25\"/360KB Floppy Services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB #language en-US "Int 13h - 5.25\"/1.2MB Floppy services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_720_KB #language en-US "Int 13h - 3.5\"/720KB Floppy services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB #language en-US "Int 13h - 3.5\"/2.88MB Floppy services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT #language en-US "Int 5h, Print screen Services is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT #language en-US "Int 9h, 8042 Keyboard services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT #language en-US "Int 14h, Serial Services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT #language en-US "Int 17h, Printer services are supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT #language en-US "Int 10h, CGA/Mono Video services are supported2\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98 #language en-US "NEC PC-98\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BITS_32_47 #language en-US " Bits 32:47 are reserved for BIOS Vendor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BITS_48_64 #language en-US " Bits 48:64 are reserved for System Vendor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION #language en-US "BIOS Characteristics Extension Byte1:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED #language en-US "ACPI supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED #language en-US "USB Legacy is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED #language en-US "AGP is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED #language en-US "I2O boot is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED #language en-US "LS-120 boot is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE #language en-US "ATAPI ZIP Drive boot is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED #language en-US "1394 boot is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED #language en-US "Smart battery supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2 #language en-US "BIOS Characteristics Extension Byte2:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP #language en-US "BIOS Boot Specification supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT #language en-US "Function key-initiated Network Service boot supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST #language en-US "Enable Targeted Content Distribution\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT #language en-US "UEFI Specification is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE #language en-US "The SMBIOS table describes a virtual machine\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE #language en-US " Bits %d:7 are reserved for future assignment\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY #language en-US "Processor Family: " -#string STR_SMBIOSVIEW_PRINTINFO_OTHER #language en-US "Other\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UNKNOWN #language en-US "Unknown\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR #language en-US "Intel386(TM) Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR #language en-US "Intel486(TM) Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY #language en-US "Pentium(R) Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC #language en-US "Pentium(R) Pro processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC #language en-US "Pentium(R) II processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX #language en-US "Pentium(R) processor with MMX(TM) technology\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC #language en-US "Celeron(TM) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC #language en-US "Pentium(R) II Xeon(TM) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC #language en-US "Pentium(R) III Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY #language en-US "M1 Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY #language en-US "K5 Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY #language en-US "Power PC Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601 #language en-US "Power PC 601\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603 #language en-US "Power PC 603\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS #language en-US "Power PC 603+\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604 #language en-US "Power PC 604\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2 #language en-US "Alpha Family 2\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO #language en-US "Intel(R) Core(TM) Duo processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE #language en-US "Intel(R) Core(TM) Duo mobile processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE #language en-US "Intel(R) Core(TM) Solo mobile processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM #language en-US "Intel(R) Atom(TM) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE #language en-US "Quad-Core AMD Opteron(TM) Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION #language en-US "Third-Generation AMD Opteron(TM) Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE #language en-US "AMD Phenom(TM) FX Quad-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE #language en-US "AMD Phenom(TM) X4 Quad-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE #language en-US "AMD Phenom(TM) X2 Dual-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE #language en-US "AMD Athlon(TM) X2 Dual-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 3200 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 3000 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 5300 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 5100 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 5000 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor LV\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor ULV\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 7100 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 5400 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 5200 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 7200 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 7300 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 7400 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE #language en-US "Multi-Core Intel(R) Xeon(R) processor 7400 Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO #language en-US "Intel(R) Core(TM)2 Solo processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME #language en-US "Intel(R) Core(TM)2 Extreme processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD #language en-US "Intel(R) Core(TM)2 Quad processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME_MOBILE #language en-US "Intel(R) Core(TM)2 Extreme mobile processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE #language en-US "Intel(R) Core(TM)2 Duo mobile processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE #language en-US "Intel(R) Core(TM)2 Solo mobile processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7 #language en-US "Intel(R) Core(TM) i7 processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE #language en-US "Dual-Core Intel(R) Celeron(R) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE #language en-US "Multi-Core Intel(R) Xeon(R) processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 3xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 3xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 5xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 5xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE #language en-US "Dual-Core Intel(R) Xeon(R) processor 7xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE #language en-US "Quad-Core Intel(R) Xeon(R) processor 7xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE #language en-US "Multi-Core Intel(R) Xeon(R) processor 7xxx Series\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES #language en-US "AMD Opteron(TM) 3000 Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II #language en-US "AMD Sempron(TM) II Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES #language en-US "AMD FX(TM) Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES #language en-US "AMD Z-Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES #language en-US "AMD R-Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES #language en-US "AMD Opteron(TM) 4300 Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES #language en-US "AMD Opteron(TM) 6300 Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES #language en-US "AMD Opteron(TM) 3300 Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES #language en-US "AMD FirePro(TM) Series Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE #language en-US "Embedded AMD Opteron(TM) Quad-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE #language en-US "AMD Phenom(TM) Triple-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE #language en-US "AMD Turion(TM) Ultra Dual-Core Mobile Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE #language en-US "AMD Turion(TM) Dual-Core Mobile Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE #language en-US "AMD Athlon(TM) Dual-Core Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI #language en-US "AMD Sempron(TM) SI Processor Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY #language en-US "MIPS Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY #language en-US "SPARC Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY #language en-US "68040 Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY #language en-US "Hobbit Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_WEITEK #language en-US "Weitek\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY #language en-US "PA-RISC Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY #language en-US "V30 Family\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON #language en-US "Pentium(R) III Xeon(TM) Processor\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_M1 #language en-US "Reserved for specific M1 versions\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_K5 #language en-US "Reserved for specific K5 versions\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_PENTIUM #language en-US "Reserved for specific Pentium(R) Processor versions\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY #language en-US "Undefined processor family and type\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PROC_INFO #language en-US "Processor Information - Voltage:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE #language en-US "Processor current voltage = (%d/10)V\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED #language en-US " 5V is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED #language en-US " 3.3V is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED #language en-US " 2.9V is supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO #language en-US "Error, reserved BIT 3 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO #language en-US "Error, reserved BIT 4 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO #language en-US "Error, reserved BIT 5 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO #language en-US "Error, reserved BIT 6 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO #language en-US "Error, reserved BIT 7 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO #language en-US "Error, reserved BIT 10 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO #language en-US "Error, reserved BIT 11 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO #language en-US "Error, reserved BIT 12 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO #language en-US "Error, reserved BIT 13 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO #language en-US "Error, reserved BIT 14 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO #language en-US "Error, reserved BIT 15 must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS #language en-US "Processor Status:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED #language en-US "CPU Socket Populated\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED #language en-US "CPU Socket Unpopulated Bits\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED #language en-US "CPU Enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER #language en-US "CPU Disabled by User via BIOS Setup\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS #language en-US "CPU Disabled By BIOS (POST Error)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE #language en-US "CPU is Idle, waiting to be enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_OTHERS #language en-US "Others\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RESERVED #language en-US "Reserved\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM #language en-US "The size of the largest memory module supported (per slot): " -#string STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB #language en-US "%d * %d = %d MB\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM #language en-US "The maximum amount of memory supported by this controller: " -#string STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED #language en-US "There are %d Handles controlled by this controller\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED #language en-US "Handles' List controlled by this controller:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_HANDLE #language en-US "Handle%d: 0x%04x\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS #language en-US "Bank Connections:" -#string STR_SMBIOSVIEW_PRINTINFO_BANK_RAS #language en-US "Banks %d & %d(RAS# %d & %d)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2 #language en-US "Bank %d(RAS# %d)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED #language en-US "No banks connected\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE #language en-US "Memory Size:" -#string STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE #language en-US " Memory Size Not determinable (Installed Size only)\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED #language en-US " Module is installed, but no memory has been enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED #language en-US " Not installed\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE #language en-US " Memory Size: %d MB\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK #language en-US "The memory module has a Double-bank connection\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK #language en-US "The memory module has a Single-bank connection\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SLOT_ID #language en-US " Slot Id:" -#string STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN #language en-US " the logical Micro Channel slot number is:" -#string STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D #language en-US " %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15 #language en-US " error, not 1-15.\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM #language en-US " the logical EISA slot number is:" -#string STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM #language en-US " Identifies the Adapter Number is: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT #language en-US " the value present in the Slot Number field of the PCI Interrupt Routing table entry that is associated with this slot is: %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID #language en-US " undefined Slot Id\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION #language en-US "Cache Configuration:\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH #language en-US "Write Through\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK #language en-US "Write Back\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR #language en-US "Varies with Memory Address\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL #language en-US "Internal\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL #language en-US "External\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED #language en-US "Socketed\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED #language en-US "Not Socketed\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL #language en-US "Level %d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS #language en-US "System Boot Status: " -#string STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED #language en-US " No errors detected" -#string STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA #language en-US " No bootable media" -#string STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM #language en-US " The \"normal\" unable to load operating system." -#string STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED #language en-US " Firmware-detected hardware problem, including \"unknown\" failure types." -#string STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM #language en-US " Operating system-detected hardware failure." -#string STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT #language en-US " User-requested boot, usually via a keystroke" -#string STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION #language en-US " System security violation" -#string STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE #language en-US " Previously-requested image. " -#string STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER #language en-US " A system watchdog timer expired, causing the system to reboot." -#string STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT #language en-US " Reserved for future assignment via this specification. " -#string STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC #language en-US " Vendor/OEM-specific implementations. The Vendor/OEM identifier is the \"Manufacturer\" string found in the System Identification structure." -#string STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION #language en-US "Product-specific implementations. The product identifier is formed by the concatenation of the \"Manufacturer\" and \"Product Name\" strings found in the System Information structure." -#string STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE #language en-US "Error value\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE #language en-US "SBDS Manufacture Date: " -#string STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR #language en-US "%02d/%02d/%4d\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES #language en-US "System Reset Capabilities: " -#string STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO #language en-US "Bits 7:6 are reserved bits, must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2 #language en-US "System contains a watchdog timer\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER #language en-US "System does not contain a watchdog timer\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT #language en-US "Boot Option on Limit: " -#string STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2 #language en-US "Operating system\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL #language en-US "System utilities\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT_BITS #language en-US "Do not reboot Bits\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION #language en-US "Boot Option :" -#string STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT #language en-US "Do not reboot\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET #language en-US "Hardware Security Settings: \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD #language en-US "Power-on Password Status: " -#string STR_SMBIOSVIEW_PRINTINFO_DISABLED #language en-US "Disabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE #language en-US "Enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED #language en-US "Not Implemented\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD #language en-US "Keyboard Password Status: " -#string STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS #language en-US "Administrator Password Status: " -#string STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET #language en-US "Front Panel Reset Status: " -#string STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS #language en-US "Connections: " -#string STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2 #language en-US "Bits 7:2 are reserved bits, must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED #language en-US "Outbound Connection Enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED #language en-US "Outbound Connection Disabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED #language en-US "Inbound Connection Enabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED #language en-US "Inbound Connection Disabled\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR #language en-US "Power Supply Characteristics: \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD #language en-US "Bits 15:14 are reserved bits, must be zero\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TYPE #language en-US "Type - " -#string STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE #language en-US " Other\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_LINEAR #language en-US " Linear\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_SWITCHING #language en-US " Switching\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BATTERY #language en-US " Battery\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UPS #language en-US " UPS\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CONVERTER #language en-US " Converter\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_REGULATOR #language en-US " Regulator\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RESERVED_2 #language en-US " Reserved \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH #language en-US " Status - " -#string STR_SMBIOSVIEW_PRINTINFO_OK #language en-US " OK\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL #language en-US " Non-critical\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY #language en-US " Critical, power supply has failed and has been taken off-line\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_UNDEFINED #language en-US " Undefined \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE #language en-US "Input Voltage Range Switching - " -#string STR_SMBIOSVIEW_PRINTINFO_MANUAL #language en-US " Manual\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH #language en-US " Auto-switch\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE #language en-US " Wide range\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE #language en-US " Not applicable\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_RESERVED_3 #language en-US " Reserved \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED #language en-US "Power supply is unplugged from the wall\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED #language en-US "Power supply is plugged from the wall\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT #language en-US "Power supply is present\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT #language en-US "Power supply is not present\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE #language en-US "Power supply is hot replaceable\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE #language en-US "Power supply is not hot replaceable\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE #language en-US "BiosSize: %d KB\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_EXTENDED_BIOS_SIZE #language en-US "ExtendedBiosSize: %d %s\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_NO_INFO #language en-US "No Info" -#string STR_SMBIOSVIEW_QUERYTABLE_RSVD_BITS_SET #language en-US "\r\nIt also has reserved bits set 1 --- reserved bits: 0x%x" -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE #language en-US "System Wakeup Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS #language en-US "Base Board Feature Flags:" -#string STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE #language en-US "Base Board Board Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE #language en-US "System Enclosure or Chassis Types:" -#string STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT #language en-US "Chassis Lock present\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS #language en-US "System Enclosure or Chassis Status: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY #language en-US "System Enclosure or Chassis Security Status: " -#string STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE #language en-US "Processor Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE #language en-US "Processor Upgrade: " -#string STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS #language en-US "Processor Characteristics: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD #language en-US "Memory Controller Error DetectMethod:" -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY #language en-US "Memory Controller Error Correct Capability:\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT #language en-US "Memory Controller Interleave Support:" -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED #language en-US "Memory Controller Memory Speed:" -#string STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES #language en-US "The required voltages for each memory module sockets:\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE #language en-US "Memory Module Memory Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS #language en-US "Memory Module Error Status: " -#string STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE #language en-US "Cache SRAM Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING #language en-US "Cache Error Correcting Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE #language en-US "Cache System Cache Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY #language en-US "Cache Associativity:" -#string STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE #language en-US "Port Connector Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE #language en-US "Port Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE #language en-US "System Slot Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA #language en-US "System Slot Data Bus Width: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE #language en-US "System Slot Current Usage: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH #language en-US "System Slot Length: " -#string STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS #language en-US "Slot characteristics 1: " -#string STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2 #language en-US "Slot characteristics 2: " -#string STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE #language en-US "Onboard Device Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE #language en-US "System Event Log Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT #language en-US "Event Log Variable Data Format Types: " -#string STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP #language en-US "POST Results Bitmap - First DWORD:\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD #language en-US "POST Results Bitmap - Second DWORD:\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES #language en-US "System Management Types: " -#string STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED #language en-US "OEM assigned\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN #language en-US "Reserved for future assignment via this specification\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE #language en-US "A system-management probe or cooling device is out-of-range\r\n" -#string STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION #language en-US "Physical Memory Array Location: " -#string STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE #language en-US "Physical Memory Array Use: " -#string STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR #language en-US "Physical Memory Array Error Correction Types: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR #language en-US "Memory Device - Form Factor: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE #language en-US "Memory Device - Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL #language en-US "Memory Device - Type Detail: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY #language en-US "Memory Device - Memory Technology: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA #language en-US "Memory Device - Memory Operating Mode Capability: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO #language en-US "32-bit Memory Error Information - Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY #language en-US "Memory Error - Error granularity: " -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP #language en-US "Memory Error - Error Operation: " -#string STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE #language en-US "Pointing Device - Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE #language en-US "Pointing Device - Interface:" -#string STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM #language en-US "Portable Battery - Device Chemistry:" -#string STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC #language en-US "Voltage Probe - Location:" -#string STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS #language en-US "Voltage Probe - Status:" -#string STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS #language en-US "Cooling Device - Status: " -#string STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE #language en-US "Cooling Device - Type: " -#string STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE #language en-US "Temperature Probe - Status:" -#string STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS #language en-US "Electrical Current Probe - Status:" -#string STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC #language en-US "Electrical Current Probe - Location:" -#string STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE #language en-US "Management Device Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE #language en-US "Management Device - Address Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE #language en-US "Memory Channel Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE #language en-US "BMC Interface Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_MC_HOST_INTERFACE_TYPE #language en-US "MC Host Interface Type:" -#string STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE #language en-US "Structure Type:" -#string STR_SMBIOSVIEW_SMBIOSVIEW_ONE_VAR_ARGV #language en-US "%s " -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND #language en-US "Query Structure, conditions are:\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM #language en-US "QueryType = Random \r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE #language en-US "QueryType = %d\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM #language en-US "QueryHandle = Random\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE #language en-US "QueryHandle = 0x%x\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE #language en-US "ShowType = " -#string STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT #language en-US "Type=%d, Handle=0x%x\r\nDump Structure as:\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH #language en-US "Index=%d,Length=0x%x," -#string STR_SMBIOSVIEW_SMBIOSVIEW_ADDR #language en-US "Addr=0x%p\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN #language en-US "Entry Length: 0x%x\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE #language en-US "Referenced Handle: 0x%x\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET #language en-US "Referenced Offset: 0x%x\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_Q #language en-US "\r\n%HEnter%N to continue, %H:q%N to exit, %H:[0-3]%N to change mode, %H/?%N for help\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_UTILITY #language en-US " SMBIOS Utility ---- smbiosview HELP Information\r\n\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_USAGE #language en-US "Usage:\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_HSMBIOSVIEW #language en-US "%Hsmbiosview [-t type] | [-h handle] | [-s] | [-a]%N\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_EXAMPLES #language en-US "Examples:\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOW_STAT_INFO #language en-US "%H>smbiosview -s %N - Show statistics information\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOW_ALL_STRUCT_TYPE #language en-US "%H>smbiosview -t 8 %N - Show all structures of type=8\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOW_STRUCT_HANDLE #language en-US "%H>smbiosview -h 25 %N - Show structure of handle=0x25\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOW_ALL_OUTPUT_TO_FILE #language en-US "%H>smbiosview -a > 1.log%N - Show all and output to file 1.log\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_INTERNAL_COMMANDS #language en-US "Internal commands:\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_QUIT_SMBIOSVIEW #language en-US "%H:q%N -------- quit smbiosview\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CHANGE_DISPLAY_NONE #language en-US "%H:0%N -------- Change smbiosview display NONE info\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CHANGE_DISPLAY_OUTLINE #language en-US "%H:1%N -------- Change smbiosview display OUTLINE info\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CHANGE_DISPLAY_NORMAL #language en-US "%H:2%N -------- Change smbiosview display NORMAL info\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CHANGE_DISPLAY_DETAIL #language en-US "%H:3%N -------- Change smbiosview display DETAIL info\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SHOW_HELP #language en-US "%H/?%N -------- Show help\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_INDEX #language en-US "Index=%04d " -#string STR_SMBIOSVIEW_SMBIOSVIEW_TYPE #language en-US "Type=%03d " -#string STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE #language en-US "Handle=0x%04x " -#string STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET #language en-US "Offset=0x%04x " -#string STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH #language en-US "Length=0x%04x" -#string STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE #language en-US "Press Enter to continue..\r\n" -#string STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT #language en-US "smbiosview: No buffer specified when get structure\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_NOT_SPEC #language en-US "SmbiosView: Type # not specified\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE_NOT_SPEC #language en-US "SmbiosView: Handle # not specified\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_UNKNOWN_FLAG #language en-US "\r\nSmbiosView: Unknown flag\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE #language en-US "SmbiosView: Cannot access SMBIOS table\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_UNKNOWN_INTERNAL_COMMAND #language en-US "\r\nSmbiosView: Unknown internal command\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE #language en-US "SmbiosView: SMBIOS table damaged\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM #language en-US "SmbiosView: Out of memory\r\n" -#string STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS #language en-US "SmbiosView: Cannot access statistics table\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR #language en-US "TPM Device Characteristics: \r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED #language en-US "TPM Device Characteristics Not Supported\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU #language en-US "Family configurable via firmware update\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW #language en-US "Family configurable via platform software support\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM #language en-US "Family configurable via OEM proprietary mechanism\r\n" -#string STR_SMBIOSVIEW_PRINTINFO_BITS_06_63 #language en-US "Bits 6:63 are reserved\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c deleted file mode 100644 index 19a4a72..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c +++ /dev/null @@ -1,427 +0,0 @@ -/** @file - Main file for NULL named library for debug1 profile shell command functions. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDebug1CommandsLib.h" -#include - -STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; -EFI_HANDLE gShellDebug1HiiHandle = NULL; - -/** - Gets the debug file name. This will be used if HII is not working. - - @retval NULL No file is available. - @return The NULL-terminated filename to get help from. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameDebug1 ( - VOID - ) -{ - return (mFileName); -} - -/** - Constructor for the Shell Debug1 Commands library. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -UefiShellDebug1CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // check our bit of the profiles mask - // - if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) { - return (EFI_SUCCESS); - } - - // - // install the HII stuff. - // - gShellDebug1HiiHandle = HiiAddPackages (&gShellDebug1HiiGuid, gImageHandle, UefiShellDebug1CommandsLibStrings, NULL); - if (gShellDebug1HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handlers that are always installed - // - ShellCommandRegisterCommandName(L"setsize", ShellCommandRunSetSize , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETSIZE) ); - ShellCommandRegisterCommandName(L"comp", ShellCommandRunComp , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_COMP) ); - ShellCommandRegisterCommandName(L"mode", ShellCommandRunMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MODE) ); - ShellCommandRegisterCommandName(L"memmap", ShellCommandRunMemMap , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MEMMAP) ); - ShellCommandRegisterCommandName(L"eficompress", ShellCommandRunEfiCompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFICOMPRESS) ); - ShellCommandRegisterCommandName(L"efidecompress", ShellCommandRunEfiDecompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFIDCOMPRESS) ); - ShellCommandRegisterCommandName(L"dmem", ShellCommandRunDmem , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMEM) ); - ShellCommandRegisterCommandName(L"loadpcirom", ShellCommandRunLoadPciRom , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD_PCI_ROM) ); - ShellCommandRegisterCommandName(L"mm", ShellCommandRunMm , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MM) ); - ShellCommandRegisterCommandName(L"setvar", ShellCommandRunSetVar , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETVAR) ); - ShellCommandRegisterCommandName(L"sermode", ShellCommandRunSerMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SERMODE) ); - ShellCommandRegisterCommandName(L"pci", ShellCommandRunPci , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_PCI) ); - ShellCommandRegisterCommandName(L"smbiosview", ShellCommandRunSmbiosView , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SMBIOSVIEW) ); - ShellCommandRegisterCommandName(L"dmpstore", ShellCommandRunDmpStore , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMPSTORE) ); - ShellCommandRegisterCommandName(L"dblk", ShellCommandRunDblk , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DBLK) ); - ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) ); - ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) ); - - ShellCommandRegisterAlias(L"dmem", L"mem"); - - BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1"); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -UefiShellDebug1CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellDebug1HiiHandle != NULL) { - HiiRemovePackages(gShellDebug1HiiHandle); - } - - BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable); - return (EFI_SUCCESS); -} - - -/** - Function returns a system configuration table that is stored in the - EFI System Table based on the provided GUID. - - @param[in] TableGuid A pointer to the table's GUID type. - @param[in, out] Table On exit, a pointer to a system configuration table. - - @retval EFI_SUCCESS A configuration table matching TableGuid was found. - @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found. -**/ -EFI_STATUS -GetSystemConfigurationTable ( - IN EFI_GUID *TableGuid, - IN OUT VOID **Table - ) -{ - UINTN Index; - ASSERT (Table != NULL); - - for (Index = 0; Index < gST->NumberOfTableEntries; Index++) { - if (CompareGuid (TableGuid, &(gST->ConfigurationTable[Index].VendorGuid))) { - *Table = gST->ConfigurationTable[Index].VendorTable; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - Clear the line at the specified Row. - - @param[in] Row The row number to be cleared ( start from 1 ) - @param[in] LastCol The last printable column. - @param[in] LastRow The last printable row. -**/ -VOID -EditorClearLine ( - IN UINTN Row, - IN UINTN LastCol, - IN UINTN LastRow - ) -{ - UINTN Col; - CHAR16 Line[200]; - - if (Row == 0) { - Row = 1; - } - - // - // prepare a blank line - // If max column is larger, split to multiple prints. - // - SetMem16 (Line, sizeof (Line), L' '); - Line[ARRAY_SIZE (Line) - 1] = CHAR_NULL; - - for (Col = 1; Col <= LastCol; Col += ARRAY_SIZE (Line) - 1) { - if (Col + ARRAY_SIZE (Line) - 1 > LastCol) { - if (Row == LastRow) { - // - // if CHAR_NULL is still at position LastCol, it will cause first line error - // - Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL; - } else { - Line[LastCol % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL; - } - } - - // - // print out the blank line - // - ShellPrintEx ((INT32) Col - 1, (INT32) Row - 1, Line); - } -} - -/** - Determine if the character is valid for a filename. - - @param[in] Ch The character to test. - - @retval TRUE The character is valid. - @retval FALSE The character is not valid. -**/ -BOOLEAN -IsValidFileNameChar ( - IN CONST CHAR16 Ch - ) -{ - // - // See if there are any illegal characters within the name - // - if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') { - return FALSE; - } - - return TRUE; -} - -/** - Check if file name has illegal characters. - - @param Name The filename to check. - - @retval TRUE The filename is ok. - @retval FALSE The filename is not ok. -**/ -BOOLEAN -IsValidFileName ( - IN CONST CHAR16 *Name - ) -{ - - UINTN Index; - UINTN Len; - - // - // check the length of Name - // - for (Len = 0, Index = StrLen (Name) - 1; Index + 1 != 0; Index--, Len++) { - if (Name[Index] == '\\' || Name[Index] == ':') { - break; - } - } - - if (Len == 0 || Len > 255) { - return FALSE; - } - // - // check whether any char in Name not appears in valid file name char - // - for (Index = 0; Index < StrLen (Name); Index++) { - if (!IsValidFileNameChar (Name[Index])) { - return FALSE; - } - } - - return TRUE; -} - -/** - Find a filename that is valid (not taken) with the given extension. - - @param[in] Extension The file extension. - - @retval NULL Something went wrong. - @return the valid filename. -**/ -CHAR16 * -EditGetDefaultFileName ( - IN CONST CHAR16 *Extension - ) -{ - EFI_STATUS Status; - UINTN Suffix; - CHAR16 *FileNameTmp; - - Suffix = 0; - - do { - FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension); - - // - // after that filename changed to path - // - Status = ShellFileExists (FileNameTmp); - - if (Status == EFI_NOT_FOUND) { - return FileNameTmp; - } - - FreePool (FileNameTmp); - FileNameTmp = NULL; - Suffix++; - } while (Suffix != 0); - - FreePool (FileNameTmp); - return NULL; -} - -/** - Read a file into an allocated buffer. The buffer is the responsibility - of the caller to free. - - @param[in] FileName The filename of the file to open. - @param[out] Buffer Upon successful return, the pointer to the - address of the allocated buffer. - @param[out] BufferSize If not NULL, then the pointer to the size - of the allocated buffer. - @param[out] ReadOnly Upon successful return TRUE if the file is - read only. FALSE otherwise. - - @retval EFI_NOT_FOUND The filename did not represent a file in the - file system. - @retval EFI_SUCCESS The file was read into the buffer. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR The file read operation failed. - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @retval EFI_INVALID_PARAMETER FileName was NULL. - @retval EFI_INVALID_PARAMETER FileName was a directory. -**/ -EFI_STATUS -ReadFileIntoBuffer ( - IN CONST CHAR16 *FileName, - OUT VOID **Buffer, - OUT UINTN *BufferSize OPTIONAL, - OUT BOOLEAN *ReadOnly - ) -{ - VOID *InternalBuffer; - UINTN FileSize; - SHELL_FILE_HANDLE FileHandle; - BOOLEAN CreateFile; - EFI_STATUS Status; - EFI_FILE_INFO *Info; - - InternalBuffer = NULL; - FileSize = 0; - FileHandle = NULL; - CreateFile = FALSE; - Status = EFI_SUCCESS; - Info = NULL; - - if (FileName == NULL || Buffer == NULL || ReadOnly == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // try to open the file - // - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0); - - if (!EFI_ERROR(Status)) { - ASSERT(CreateFile == FALSE); - if (FileHandle == NULL) { - return EFI_LOAD_ERROR; - } - - Info = ShellGetFileInfo(FileHandle); - - if (Info->Attribute & EFI_FILE_DIRECTORY) { - FreePool (Info); - return EFI_INVALID_PARAMETER; - } - - if (Info->Attribute & EFI_FILE_READ_ONLY) { - *ReadOnly = TRUE; - } else { - *ReadOnly = FALSE; - } - // - // get file size - // - FileSize = (UINTN) Info->FileSize; - - FreePool (Info); - } else if (Status == EFI_NOT_FOUND) { - // - // file not exists. add create and try again - // - Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR (Status)) { - return Status; - } else { - // - // it worked. now delete it and move on with the name (now validated) - // - Status = ShellDeleteFile (&FileHandle); - if (Status == EFI_WARN_DELETE_FAILURE) { - Status = EFI_ACCESS_DENIED; - } - if (EFI_ERROR (Status)) { - return Status; - } - } - // - // file doesn't exist, so set CreateFile to TRUE and can't be read-only - // - CreateFile = TRUE; - *ReadOnly = FALSE; - } - - // - // the file exists - // - if (!CreateFile) { - // - // allocate buffer to read file - // - InternalBuffer = AllocateZeroPool (FileSize); - if (InternalBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // - // read file into InternalBuffer - // - Status = ShellReadFile (FileHandle, &FileSize, InternalBuffer); - ShellCloseFile(&FileHandle); - FileHandle = NULL; - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL (InternalBuffer); - return EFI_LOAD_ERROR; - } - } - *Buffer = InternalBuffer; - if (BufferSize != NULL) { - *BufferSize = FileSize; - } - return (EFI_SUCCESS); - -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h deleted file mode 100644 index 35e4405..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h +++ /dev/null @@ -1,383 +0,0 @@ -/** @file - Main file for NULL named library for Profile1 shell command functions. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_ -#define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_ - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -extern EFI_HANDLE gShellDebug1HiiHandle; - -/** - Function returns a system configuration table that is stored in the - EFI System Table based on the provided GUID. - - @param[in] TableGuid A pointer to the table's GUID type. - @param[in, out] Table On exit, a pointer to a system configuration table. - - @retval EFI_SUCCESS A configuration table matching TableGuid was found. - @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found. -**/ -EFI_STATUS -GetSystemConfigurationTable ( - IN EFI_GUID *TableGuid, - IN OUT VOID **Table - ); - -/** - Function for 'setsize' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSetSize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'comp' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunComp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'mode' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMode ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'memmap' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMemMap ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'compress' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEfiCompress ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'decompress' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEfiDecompress ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'dmem' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDmem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'loadpcirom' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLoadPciRom ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'mm' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMm ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'setvar' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSetVar ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'sermode' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSerMode ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'bcfg' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunBcfg ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'pci' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPci ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'smbiosview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSmbiosView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'dmpstore' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDmpStore ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'dblk' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDblk ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'edit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEdit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'hexedit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunHexEdit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Clear the line at the specified Row. - - @param[in] Row The row number to be cleared ( start from 1 ) - @param[in] LastCol The last printable column. - @param[in] LastRow The last printable row. -**/ -VOID -EditorClearLine ( - IN UINTN Row, - IN UINTN LastCol, - IN UINTN LastRow - ); - -/** - Check if file name has illegal characters. - - @param Name The filename to check. - - @retval TRUE The filename is ok. - @retval FALSE The filename is not ok. -**/ -BOOLEAN -IsValidFileName ( - IN CONST CHAR16 *Name - ); - -/** - Find a filename that is valid (not taken) with the given extension. - - @param[in] Extension The file extension. - - @retval NULL Something went wrong. - @return the valid filename. -**/ -CHAR16 * -EditGetDefaultFileName ( - IN CONST CHAR16 *Extension - ); - -/** - Read a file into an allocated buffer. The buffer is the responsibility - of the caller to free. - - @param[in] FileName The filename of the file to open. - @param[out] Buffer Upon successful return, the pointer to the - address of the allocated buffer. - @param[out] BufferSize If not NULL, then the pointer to the size - of the allocated buffer. - @param[out] ReadOnly Upon successful return TRUE if the file is - read only. FALSE otherwise. - - @retval EFI_NOT_FOUND The filename did not represent a file in the - file system. Directories cannot be read with - this method. - @retval EFI_SUCCESS The file was read into the buffer. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_LOAD_ERROR The file read operation failed. - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @retval EFI_INVALID_PARAMETER FileName was NULL. - @retval EFI_INVALID_PARAMETER FileName was a directory. -**/ -EFI_STATUS -ReadFileIntoBuffer ( - IN CONST CHAR16 *FileName, - OUT VOID **Buffer, - OUT UINTN *BufferSize OPTIONAL, - OUT BOOLEAN *ReadOnly - ); - -#endif diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf deleted file mode 100644 index bfaba9a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ /dev/null @@ -1,137 +0,0 @@ -## @file -# Provides shell Debug1 profile functions -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellDebug1CommandsLib - FILE_GUID = 90330D51-A99B-4cc8-A2EB-AE22542A3F45 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.2 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = UefiShellDebug1CommandsLibConstructor - DESTRUCTOR = UefiShellDebug1CommandsLibDestructor - -[Sources] - SetSize.c - Comp.c - Mode.c - MemMap.c - Compress.h - Compress.c - EfiCompress.c - EfiDecompress.c - Dmem.c - LoadPciRom.c - Mm.c - SetVar.c - SerMode.c - Pci.c - Pci.h - DmpStore.c - Dblk.c - SmbiosView/EventLogInfo.c - SmbiosView/EventLogInfo.h - SmbiosView/PrintInfo.c - SmbiosView/QueryTable.c - SmbiosView/SmbiosView.c - SmbiosView/SmbiosViewStrings.uni - SmbiosView/LibSmbiosView.c - SmbiosView/PrintInfo.h - SmbiosView/LibSmbiosView.h - SmbiosView/QueryTable.h - SmbiosView/SmbiosView.h - UefiShellDebug1CommandsLib.c - UefiShellDebug1CommandsLib.h - UefiShellDebug1CommandsLib.uni - -## Files shared by both editors - EditTitleBar.h - EditTitleBar.c - EditInputBar.h - EditInputBar.c - EditStatusBar.h - EditStatusBar.c - EditMenuBar.h - EditMenuBar.c - -## Files specific to the text editor - Edit/Edit.c - Edit/TextEditor.h - Edit/TextEditorTypes.h - Edit/FileBuffer.h - Edit/FileBuffer.c - Edit/MainTextEditor.h - Edit/MainTextEditor.c - Edit/Misc.h - Edit/Misc.c - Edit/TextEditStrings.uni - -## Files specific to the HEX editor - HexEdit/BufferImage.h - HexEdit/BufferImage.c - HexEdit/Clipboard.h - HexEdit/Clipboard.c - HexEdit/DiskImage.h - HexEdit/DiskImage.c - HexEdit/FileImage.h - HexEdit/FileImage.c - HexEdit/HexEdit.c - HexEdit/HexEditor.h - HexEdit/HexEditorTypes.h - HexEdit/HexeditStrings.uni - HexEdit/MainHexEditor.h - HexEdit/MainHexEditor.c - HexEdit/MemImage.h - HexEdit/MemImage.c - HexEdit/Misc.h - HexEdit/Misc.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - IoLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - SortLib - PrintLib - BcfgCommandLib - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Protocols] - gEfiPciRootBridgeIoProtocolGuid ## SOMETIMES_CONSUMES - gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES - gEfiSimplePointerProtocolGuid ## SOMETIMES_CONSUMES - gEfiCpuIo2ProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## GUID - gEfiSmbiosTableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiSmbios3TableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiMpsTableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiSalSystemTableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable - gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable - gShellDebug1HiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni deleted file mode 100644 index 1c135bc..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni +++ /dev/null @@ -1,1178 +0,0 @@ -// /** -// -// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellDebug1CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 Debug1 profile commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_NO_MEM #language en-US "%H%s%N: Memory is not available.\r\n" -#string STR_GEN_BOOT_ONLY #language en-US "%H%s%N: Boot must be selected for hot key options.\r\n" -#string STR_GEN_FIND_FAIL #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" - -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n" -#string STR_GEN_DUPLICATE #language en-US "%H%s%N: Duplicate flag - '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments.\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments.\r\n" -#string STR_GEN_NO_DRIVER_BOOT #language en-US "%H%s%N: Driver or Boot must be selected.\r\n" -#string STR_GEN_PCIRBIO_NF #language en-US "%H%s%N: Protocol - PciRootBridgeIo not found.\r\n" -#string STR_GEN_PCIRBIO_ER #language en-US "%H%s%N: Problem accessing the data using Protocol - PciRootBridgeIo\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_PARAM_INV_HEX #language en-US "%H%s%N: Invalid parameter - '%H%s%N'. Must be hexadecimal.\r\n" -#string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags conflict with - '%H%s%N' and '%H%s%N'\r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful.\r\n" -#string STR_GEN_MAP_PROTOCOL #language en-US "%H%s%N: Mapped device '%B%s%N' does not have protocol %B%s%N\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_FILE_DELETE_FAIL #language en-US "%H%s%N: Cannot delete file - '%H%s%N'\r\n" -#string STR_GEN_NO_CWD #language en-US "%H%s%N: Current directory not specified.\r\n" -#string STR_GEN_FILE_IS_DIRECTORY #language en-US "%H%s%N: The file '%H%s%N' is a directory.\r\n" -#string STR_GEN_SFO_HEADER #language en-US "ShellCommand,"%s"\r\n" - - -#string STR_FILE_OPEN_FAIL #language en-US "Unable to open file on '%B%s%N' with: %r.\r\n" -#string STR_FILE_FIND_FAIL #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_FILE_NOT_DIR #language en-US "%H%s%N: Directories are not permitted - '%H%s%N'\r\n" -#string STR_SIZE_NOT_SPEC #language en-US "%H%s%N: A valid size must be specified\r\n" -#string STR_FILE_NOT_SPEC #language en-US "%H%s%N: File not specified\r\n" -#string STR_FILE_WRITE_FAIL #language en-US "%H%s%N: Write file error - '%H%s%N'\r\n" -#string STR_FILE_READ_FAIL #language en-US "%H%s%N: Read file error - '%H%s%N'\r\n" -#string STR_VOLUME_FULL #language en-US "%H%s%N: The volume is full\r\n" - -#string STR_SET_SIZE_FAIL #language en-US "%H%s%N: Unable to change size on '%B%s%N'\r\n" -#string STR_SET_SIZE_DONE #language en-US "Size changed on '%B%s%N'.\r\n" - -#string STR_DBLK_HEADER #language en-US "LBA %016LX Size %08x bytes BlkIo %0x\r\n" - -#string STR_COMP_HEADER #language en-US "Compare %s to %s.\r\n" -#string STR_COMP_DIFFERENCE_POINT #language en-US "Difference #% 2u:\r\n" -#string STR_COMP_END_OF_FILE #language en-US " " - -#string STR_COMP_FOOTER_FAIL #language en-US "[difference(s) encountered] \r\n" -#string STR_COMP_FOOTER_PASS #language en-US "[no differences encountered]\r\n" - -#string STR_MODE_SET_FAIL #language en-US "%H%s%N: Unable to change the mode.\r\n" -#string STR_MODE_NO_MATCH #language en-US "%H%s%N: No matching mode found to set\r\n" -#string STR_MODE_LIST_HEAD #language en-US "Available modes for console output device.\r\n" -#string STR_MODE_LIST_ITEM #language en-US " Col % 5d Row % 5d %c\r\n" - -#string STR_MEMMAP_GET_FAILED #language en-US "%H%s%N: Unable to get memory map\r\n" -#string STR_MEMMAP_LIST_HEAD #language en-US "Type Start End # Pages Attributes\r\n" -#string STR_MEMMAP_LIST_ITEM #language en-US "% -10s %016LX-%016LX %016LX %016LX\r\n" -#string STR_MEMMAP_LIST_ITEM_OTHER #language en-US "%08x %016LX-%016LX %016LX %016LX\r\n" -#string STR_MEMMAP_LIST_SUMM #language en-US " \r\n" - " Reserved : %,14ld Pages (%,ld Bytes)\r\n" - " LoaderCode: %,14ld Pages (%,ld Bytes)\r\n" - " LoaderData: %,14ld Pages (%,ld Bytes)\r\n" - " BS_Code : %,14ld Pages (%,ld Bytes)\r\n" - " BS_Data : %,14ld Pages (%,ld Bytes)\r\n" - " RT_Code : %,14ld Pages (%,ld Bytes)\r\n" - " RT_Data : %,14ld Pages (%,ld Bytes)\r\n" - " ACPI_Recl : %,14ld Pages (%,ld Bytes)\r\n" - " ACPI_NVS : %,14ld Pages (%,ld Bytes)\r\n" - " MMIO : %,14ld Pages (%,ld Bytes)\r\n" - " MMIO_Port : %,14ld Pages (%,ld Bytes)\r\n" - " PalCode : %,14ld Pages (%,ld Bytes)\r\n" - " Available : %,14ld Pages (%,ld Bytes)\r\n" - " Persistent: %,14ld Pages (%,ld Bytes)\r\n" -#string STR_MEMMAP_LIST_SUMM_OTHER #language en-US " %08x : %,14ld Pages (%,ld Bytes)\r\n" -#string STR_MEMMAP_LIST_SUMM2 #language en-US " -------------- \r\n" - "Total Memory: %,14ld MB (%,ld Bytes)\r\n" -#string STR_MEMMAP_LIST_ITEM_SFO #language en-US "MemoryMap,"%s","%LX","%LX","%LX","%LX"\r\n" -#string STR_MEMMAP_LIST_SUMM_SFO #language en-US "MemoryMapSummary,"%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld","%Ld"\r\n" - -#string STR_EFI_COMPRESS_FAIL #language en-US "Unable to compress: %r.\r\n" -#string STR_EFI_DECOMPRESS_FAIL #language en-US "Unable to decompress: %r.\r\n" -#string STR_EFI_DECOMPRESS_NOPE #language en-US "The file does not appear to be a compressed file. Cannot continue. \"%H%s%N\"\r\n" - -#string STR_DMEM_HEADER_ROW #language en-US "Memory Address %016LX %X Bytes\r\n" -#string STR_DMEM_MMIO_HEADER_ROW #language en-US "Memory Mapped IO Address %016LX %X Bytes\r\n" -#string STR_DMEM_DATA_ROW #language en-US "%08X: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x *%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c*\r\n" -#string STR_DMEM_SYSTEM_TABLE #language en-US "\r\nValid EFI Header at Address %016Lx\r\n" - "---------------------------------------------\r\n" - "System: Table Structure size %08x revision %08x\r\n" - "ConIn (%016LX) ConOut (%016LX) StdErr (%016LX)\r\n" - "Runtime Services %016LX\r\n" - "Boot Services %016LX\r\n" - "SAL System Table %016LX\r\n" - "ACPI Table %016LX\r\n" - "ACPI 2.0 Table %016LX\r\n" - "MPS Table %016LX\r\n" - "SMBIOS Table %016LX\r\n" - -#string STR_LOAD_PCI_ROM_RES #language en-US "Image '%B%s%N' load result: %r\r\n" -#string STR_LOADPCIROM_CORRUPT #language en-US "%H%s%N: File '%B%s%N' Image %d is corrupt.\r\n" -#string STR_LOADPCIROM_LOAD_FAIL #language en-US "%H%s%N: File '%B%s%N' Image %d unable to load.\r\n" -#string STR_LOADPCIROM_START_FAIL #language en-US "%H%s%N: File '%B%s%N' Image %d unable to start.\r\n" - -#string STR_MM_NOT_ALIGNED #language en-US "%H%s%N: Address parameter %016LX is not aligned.\r\n" -#string STR_MM_PCIE_ADDRESS_RANGE #language en-US "%H%s%N: Address parameter %016LX is not a valid PCI/PCIE address.\r\n" -#string STR_MM_MMIO #language en-US "%HMMIO%N" -#string STR_MM_IO #language en-US "%HIO%N" -#string STR_MM_PCI #language en-US "%HPCI%N" -#string STR_MM_MEM #language en-US "%HMEM%N" -#string STR_MM_PCIE #language en-US "%HPCIE%N" -#string STR_MM_ADDRESS #language en-US " 0x%016lx : " -#string STR_MM_BUF #language en-US "0x%0*lx" -#string STR_MM_ERROR #language en-US "%H%s%N: Input had incorrect format\r\n" - -#string STR_SETVAR_PRINT #language en-US "%g - %s - %04x Bytes\r\n" -#string STR_SETVAR_ERROR_SET #language en-US "%H%s%N: Unable to set - %H%g%N - %H%s%N\r\n" -#string STR_SETVAR_ERROR_GET #language en-US "%H%s%N: Unable to get - %H%g%N - %H%s%N\r\n" -#string STR_SETVAR_ERROR_DPFT #language en-US "%H%s%N: DevicePathFromText conversion was not successful.\r\n" - -#string STR_SERMODE_NO_FOUND #language en-US "%H%s%N: No serial ports found.\r\n" -#string STR_SERMODE_NOT_FOUND #language en-US "%H%s%N: No serial port or specified serial port found.\r\n" -#string STR_SERMODE_BAD_HANDLE #language en-US "%H%s%N: Handle %H%02x%N is not a serial device handle.\r\n" -#string STR_SERMODE_SET_HANDLE #language en-US "Mode set on handle %H%02x%N successfully.\r\n" -#string STR_SERMODE_SET_FAIL #language en-US "%H%s%N: Mode change on handle %H%02x%N was not successful.\r\n" -#string STR_SERMODE_DISPLAY #language en-US "%x(%08x) - (%ld, %c, %d, %s)\r\n" -#string STR_SERMODE_SET_UNSUPPORTED #language en-US "%H%s%N: One or more of the new settings is not supported on handle %H%02x%N.\r\n" -#string STR_SERMODE_SET_DEV_ERROR #language en-US "%H%s%N: The serial device on handle %H%02x%N is not functioning correctly.\r\n" - -#string STR_PCI_HANDLE_CFG_ERR #language en-US "%H%s%N: Handle protocol or configuration error.\r\n" -#string STR_PCI_BUS_RANGE_ERR #language en-US "%H%s%N: Get next bus range error.\r\n" -#string STR_PCI_NO_FIND #language en-US "%H%s%N: Cannot find protocol interface for segment %x, bus %x.\r\n" -#string STR_PCI_NO_CFG #language en-US "%H%s%N: Cannot read configuration data.\r\n" -#string STR_PCI_INFO #language en-US "%H PCI Segment %02x Bus %02x Device %02x Func %02x%N [EFI %02x%02x%02x%02x00]\r\n" -#string STR_PCI_TITLE #language en-US " Seg Bus Dev Func\r\n" - " --- --- --- ----\r\n" -#string STR_PCI_LINE_P1 #language en-US " %E%02x %02x %02x %02x ==> %N" -#string STR_PCI_LINE_P2 #language en-US "\r\n Vendor %04x Device %04x Prog Interface %x\r\n" -#string STR_PCIEX_CAPABILITY_CAPID #language en-US "CapID(%2x): %E%02x%N" -#string STR_PCIEX_NEXTCAP_PTR #language en-US " NextCap Ptr(%2x): %E%02x%N\r\n" -#string STR_PCIEX_CAP_REGISTER #language en-US "Cap Register(%2x): %E%04x%N\r\n" -#string STR_PCIEX_DEVICE_CAP #language en-US "Device Capabilities(%2x): %E%08x%N\r\n" -#string STR_PCIEX_DEVICE_CONTROL #language en-US "Device Control(%2x): %E%04x%N\r\n" -#string STR_PCIEX_DEVICE_STATUS #language en-US "Device Status(%2x): %E%04x%N\r\n" -#string STR_PCIEX_LINK_CAPABILITIES #language en-US "Link Capabilities(%2x): %E%08x%N\r\n" -#string STR_PCIEX_LINK_CONTROL #language en-US "Link Control(%2x): %E%04x%N\r\n" -#string STR_PCIEX_LINK_STATUS #language en-US "Link Status(%2x): %E%04x%N\r\n" -#string STR_PCIEX_SLOT_CAPABILITIES #language en-US "Slot Capabilities(%2x): %E%08x%N\r\n" -#string STR_PCIEX_SLOT_CONTROL #language en-US "Slot Control(%2x): %E%04x%N\r\n" -#string STR_PCIEX_SLOT_STATUS #language en-US "Slot Status(%2x): %E%04x%N\r\n" -#string STR_PCIEX_ROOT_CONTROL #language en-US "Root Control(%2x): %E%04x%N\r\n" -#string STR_PCIEX_RSVDP #language en-US "Root Capabilities(%2x): %E%04x%N\r\n" -#string STR_PCIEX_ROOT_STATUS #language en-US "Root Status(%2x): %E%08x%N\r\n" -#string STR_PCI_LINE_VID_DID #language en-US "Vendor ID(%x): %E%04x%N Device ID(%x): %E%04x%N\r\n" -#string STR_PCI_LINE_RID #language en-US "Revision ID(%x): %E%02x%N " -#string STR_PCI_LINE_BIST #language en-US "BIST(%02x): " -#string STR_PCI_LINE_CAP #language en-US "Capable,Return: %E%02x%N\r\n" -#string STR_PCI_LINE_CAP_NO #language en-US " Incapable\r\n" -#string STR_PCI2_CACHE_LINE_SIZE #language en-US "Cache Line Size(%x): %E%02x%N " -#string STR_PCI2_LATENCY_TIMER #language en-US "Latency Timer(%x): %E%02x%N\r\n" -#string STR_PCI2_HEADER_TYPE #language en-US "Header Type(%02x): %E%02x%N, " -#string STR_PCI2_MULTI_FUNCTION #language en-US "Multi-function, " -#string STR_PCI2_SINGLE_FUNCTION #language en-US "Single function, " -#string STR_PCI2_PCI_DEVICE #language en-US "PCI device\r\n" -#string STR_PCI2_P2P_BRIDGE #language en-US "P2P bridge\r\n" -#string STR_PCI2_CARDBUS_BRIDGE #language en-US "CardBus bridge\r\n" -#string STR_PCI2_RESERVED #language en-US "Reserved\r\n" -#string STR_PCI2_CLASS #language en-US "Class: " -#string STR_PCI2_BASE_ADDR #language en-US "Base Address Registers(%x):\r\n" -#string STR_PCI2_START_TYPE #language en-US " Start_Address Type Space Prefetchable? Size Limit\r\n" -#string STR_PCI2_NONE #language en-US " (None)" -#string STR_PCI2_EXPANSION_ROM_DISABLED #language en-US "\r\nExpansion ROM Disabled(%x)\r\n\r\n" -#string STR_PCI2_EXPANSION_ROM_BASE #language en-US "\r\nExpansion ROM Base Address(%x): %E%08x%N\r\n\r\n" -#string STR_PCI2_CARDBUS_CIS #language en-US "Cardbus CIS ptr(%x): %E%08x%N\r\n" -#string STR_PCI2_SUB_VENDOR_ID #language en-US "Sub VendorID(%x): %E%04x%N " -#string STR_PCI2_SUBSYSTEM_ID #language en-US "Subsystem ID(%x): %E%04x%N\r\n" -#string STR_PCI2_CAPABILITIES_PTR #language en-US "Capabilities Ptr(%x): %E%02x%N\r\n" -#string STR_PCI2_INTERRUPT_LINE #language en-US "Interrupt Line(%x): %E%02x%N " -#string STR_PCI2_INTERRUPT_PIN #language en-US "Interrupt Pin(%x): %E%02x%N\r\n" -#string STR_PCI2_MIN_GNT #language en-US "Min_Gnt(%x): %E%02x%N " -#string STR_PCI2_MAX_LAT #language en-US "Max_Lat(%x): %E%02x%N\r\n" -#string STR_PCI2_BASE_ADDRESS #language en-US "Base Address Registers(%x):" -#string STR_PCI2_START_TYPE_2 #language en-US " Start_Address Type Space Prefetchable? Size Limit\r\n" -#string STR_PCI2_NO_EXPANSION_ROM #language en-US "\r\nNo Expansion ROM(%x) " -#string STR_PCI2_EXPANSION_ROM_BASE_2 #language en-US "\r\nExpansion ROM Base Address(%x): %E%08x%N\r\n" -#string STR_PCI2_BUS_NUMBERS #language en-US "\r\n\r\n(Bus Numbers) Primary(%x) Secondary(%x) Subordinate(%x)\r\n" -#string STR_PCI2_BRIDGE #language en-US " %E%02x%N" -#string STR_PCI2_SECONDARY_TIMER #language en-US "\r\nSecondary Latency Timer(%x): %E%02x%N\n\n" -#string STR_PCI2_CARDBUS_LATENCY #language en-US "\r\nCardBus Latency Timer(%x): %E%02x%N\r\n" -#string STR_PCI2_RESOURCE_TYPE_2 #language en-US "\r\nResource Type Type Base Limit\r\n" -#string STR_PCI2_MEM_3 #language en-US "Mem(%x) %s %E%08x%N %E%08x%N\r\n" -#string STR_PCI2_IO_2 #language en-US "I/O(%x) %s %E%08x%N %E%08x%N\r\n" -#string STR_PCI2_INTERRUPT_LINE_3 #language en-US "\r\nInterrupt Line(%x): %E%02x%N Interrupt Pin(%x): %E%02x%N\r\n" -#string STR_PCI2_SUB_VENDOR_ID_2 #language en-US "\r\nSub VendorID(%x): %E%04x%N Subsystem ID(%x): %E%04x%N\r\n" -#string STR_PCI2_OPTIONAL #language en-US "Optional 16-Bit PC Card legacy Mode Base Address(%x): %E%08x%N\r\n" -#string STR_PCI2_STATUS #language en-US "Status(%x): %E%04x%N\r\n" -#string STR_PCI2_SECONDARY_STATUS #language en-US "Secondary Status(%2x): %E%4x%N\r\n" -#string STR_PCI2_NEW_CAPABILITIES #language en-US " (04)New Capabilities linked list: %E%d%N" -#string STR_PCI2_66_CAPABLE #language en-US " (05)66MHz Capable: %EN/A%N\r\n" -#string STR_PCI2_66_CAPABLE_2 #language en-US " (05)66MHz Capable: %E%d%N\r\n" -#string STR_PCI2_FAST_BACK #language en-US " (07)Fast Back-to-Back Capable: %E%d%N" -#string STR_PCI2_NO #language en-US "No " -#string STR_PCI2_YES #language en-US "YES " -#string STR_PCI2_ONE_VAR_4 #language en-US "\r\n %E%04x%N " -#string STR_PCI2_NEWBAR_32 #language en-US " %08x " -#string STR_PCI2_NEWBAR_32_2 #language en-US " %08x" -#string STR_PCI2_RSHIFT #language en-US "%08x" -#string STR_PCI2_NEWBAR_32_3 #language en-US "%04x " -#string STR_PCI2_NEWBAR_32_4 #language en-US "%04x" -#string STR_PCI2_CARDBUS_SOCKET #language en-US "\r\nCardBus Socket Registers/ExCA Base Address Register(%x): %E%8x%N\r\n\r\n" -#string STR_PCI2_BUS_NUMBERS_2 #language en-US "\r\n(Bus Numbers) Pci(%x) CardBus(%x) Subordinate(%x)\r\n" -#string STR_PCI2_CARDBUS #language en-US " %E%02x%N" -#string STR_PCI2_CARDBUS_2 #language en-US " %E%02x%N" -#string STR_PCI2_CARDBUS_3 #language en-US " %E%02x%N\r\n" -#string STR_PCI2_MASTER_DATA #language en-US " (08)Master Data Parity Error: %E%d%N\r\n" -#string STR_PCI2_DEVSEL_TIMING #language en-US " (09)DEVSEL timing: " -#string STR_PCI2_FAST #language en-US "%E Fast%N" -#string STR_PCI2_MEDIUM #language en-US "%E Medium%N" -#string STR_PCI2_SLOW #language en-US "%E Slow%N" -#string STR_PCI2_RESERVED_2 #language en-US "%EReserved%N" -#string STR_PCI2_SIGNALED_TARGET #language en-US " (11)Signaled Target Abort: %E%d%N\r\n" -#string STR_PCI2_RECEIVED_TARGET #language en-US " (12)Received Target Abort: %E%d%N" -#string STR_PCI2_RECEIVED_MASTER #language en-US " (13)Received Master Abort: %E%d%N\r\n" -#string STR_PCI2_SIGNALED_ERROR #language en-US " (14)Signaled System Error: %E%d%N" -#string STR_PCI2_RECEIVED_ERROR #language en-US " (14)Received System Error: %E%d%N" -#string STR_PCI2_DETECTED_ERROR #language en-US " (15)Detected Parity Error: %E%d%N\r\n" -#string STR_PCI2_COMMAND #language en-US "Command(%x): %E%04x%N\r\n" -#string STR_PCI2_SPACE_ACCESS_DENIED #language en-US " (00)I/O space access enabled: %E%d%N" -#string STR_PCI2_MEMORY_SPACE #language en-US " (01)Memory space access enabled: %E%d%N\r\n" -#string STR_PCI2_BEHAVE_BUS_MASTER #language en-US " (02)Behave as bus master: %E%d%N" -#string STR_PCI2_MONITOR_SPECIAL_CYCLE #language en-US " (03)Monitor special cycle enabled: %E%d%N\r\n" -#string STR_PCI2_MEM_WRITE_INVALIDATE #language en-US " (04)Mem Write & Invalidate enabled: %E%d%N" -#string STR_PCI2_PALETTE_SNOOPING #language en-US " (05)Palette snooping is enabled: %E%d%N\r\n" -#string STR_PCI2_ASSERT_PERR #language en-US " (06)Assert PERR# when parity error: %E%d%N" -#string STR_PCI2_DO_ADDR_STEPPING #language en-US " (07)Do address/data stepping: %E%d%N\r\n" -#string STR_PCI2_SERR_DRIVER #language en-US " (08)SERR# driver enabled: %E%d%N" -#string STR_PCI2_FAST_BACK_2 #language en-US " (09)Fast back-to-back transact...: %E%d%N\r\n\r\n" -#string STR_PCI2_BRIDGE_CONTROL #language en-US "Bridge Control(%x) %E%04x%N\r\n" -#string STR_PCI2_PARITY_ERROR #language en-US " (00)Parity Error Response: %E%d%N" -#string STR_PCI2_SERR_ENABLE #language en-US " (01)SERR# Enable: %E%d%N\r\n" -#string STR_PCI2_ISA_ENABLE #language en-US " (02)ISA Enable: %E%d%N" -#string STR_PCI2_RESOURCE_TYPE #language en-US "\r\nResource Type Base Limit\r\n" -#string STR_PCI2_TWO_VARS #language en-US "I/O(%x) %E%08x%N" -#string STR_PCI2_ONE_VAR #language en-US " %E%08x%N\r\n" -#string STR_PCI2_MEMORY #language en-US "Memory(%x) %E%08x%N" -#string STR_PCI2_PREFETCHABLE #language en-US "Prefetchable Memory(%x) %E%08x%08x%N" -#string STR_PCI2_TWO_VARS_2 #language en-US " %E%08x%08x%N\r\n" -#string STR_PCI2_CAPABILITIES_PTR_2 #language en-US "\r\nCapabilities Ptr(%x): %E%02x%N \r\n\r\n" -#string STR_PCI2_INTERRUPT_LINE_2 #language en-US "\r\nInterrupt Line(%x) %E%02x%N " -#string STR_PCI2_BAR #language en-US "\r\n %E%08x%N " -#string STR_PCI2_MEM #language en-US "Mem " -#string STR_PCI2_32_BITS #language en-US "32 bits " -#string STR_PCI2_ONE_VAR_2 #language en-US "\r\n %E%08x" -#string STR_PCI2_ONE_VAR_3 #language en-US "%08x%N " -#string STR_PCI2_64_BITS #language en-US "64 bits " -#string STR_PCI2_MEM_2 #language en-US "Mem " -#string STR_PCI2_VGA_ENABLE #language en-US " (03)VGA Enable: %E%d%N\r\n" -#string STR_PCI2_MASTER_ABORT #language en-US " (05)Master Abort Mode: %E%d%N" -#string STR_PCI2_SECONDARY_BUS_RESET #language en-US " (06)Secondary Bus Reset: %E%d%N\r\n" -#string STR_PCI2_FAST_ENABLE #language en-US " (07)Fast Back-to-Back Enable: %E%d%N" -#string STR_PCI2_PRIMARY_DISCARD_TIMER #language en-US " (08)Primary Discard Timer: %E%s%N\r\n" -#string STR_PCI2_SECONDARY_DISCARD_TIMER #language en-US " (09)Secondary Discard Timer: %E%s%N" -#string STR_PCI2_DISCARD_TIMER_STATUS #language en-US " (10)Discard Timer Status: %E%d%N\r\n" -#string STR_PCI2_DISCARD_TIMER_SERR #language en-US " (11)Discard Timer SERR# Enable: %E%d%N\r\n" -#string STR_PCI2_CARDBUS_RESET #language en-US " (06)CardBus Reset: %E%d%N\r\n" -#string STR_PCI2_IREQ_ENABLE #language en-US " (07)IREQ/INT Enable: %E%d%N" -#string STR_PCI2_WRITE_POSTING_ENABLE #language en-US " (10)Write Posting Enable: %E%d%N\r\n" -#string STR_PCI_EXT_CAP_AER #language en-US " Advanced Error Reporting\r\n" - " UncorrectableErrorStatus %08x\r\n" - " UncorrectableErrorMask %08x\r\n" - " UncorrectableErrorSeverity %08x\r\n" - " CorrectableErrorStatus %08x\r\n" - " CorrectableErrorMask %08x\r\n" - " AdvancedErrorCapAndControl %08x\r\n" - " HeaderLog1 %08x\r\n" - " HeaderLog2 %08x\r\n" - " HeaderLog3 %08x\r\n" - " HeaderLog4 %08x\r\n" - " RootErrorCommand %08x\r\n" - " RootErrorStatus %08x\r\n" - " ErrorSourceIdentification %04x\r\n" - " CorrectableErrorSourceIden %04x\r\n" - " TlpPrefixLog1 %08x\r\n" - " TlpPrefixLog2 %08x\r\n" - " TlpPrefixLog3 %08x\r\n" - " TlpPrefixLog4 %08x\r\n" -#string STR_PCI_EXT_CAP_LINK_CONTROL #language en-US " Link Control\r\n" - " RootComplexLinkCapabilities %08x\r\n" - " RootComplexLinkControl %04x\r\n" - " RootComplexLinkStatus %04x\r\n" -#string STR_PCI_EXT_CAP_LINK_DECLAR #language en-US " Link Declaration\r\n" - " ElementSelfDescription %08x\r\n" -#string STR_PCI_EXT_CAP_LINK_DECLAR2 #language en-US " LinkEntry[%x] %08x\r\n" -#string STR_PCI_EXT_CAP_SN #language en-US " Serial Number\r\n" - " SerialNumber %L16x\r\n" -#string STR_PCI_EXT_CAP_POWER #language en-US " Power Budgeting\r\n" - " DataSelect %02x\r\n" - " Data %08x\r\n" - " PowerBudgetCapability %02x\r\n" -#string STR_PCI_EXT_CAP_ACS #language en-US " ACS\r\n" - " CapabilityRegister %04x\r\n" - " ControlRegister %04x\r\n" -#string STR_PCI_EXT_CAP_ACS2 #language en-US " EgressControlVectorByte[%x] %02x\r\n" -#string STR_PCI_EXT_CAP_LAT #language en-US " Latency Tolerance Reporting\r\n" - " MaxSnoopLatency %04x\r\n" - " MaxNoSnoopLatency %04x\r\n" -#string STR_PCI_EXT_CAP_ARI #language en-US " ARI\r\n" - " AriCapability %04x\r\n" - " AriControl %04x\r\n" -#string STR_PCI_EXT_CAP_RCRB #language en-US " RCRB\r\n" - " VendorId %04x\r\n" - " DeviceId %04x\r\n" - " RcrbCapabilities %04x\r\n" - " RcrbControl %04x\r\n" -#string STR_PCI_EXT_CAP_VEN #language en-US " VendorSpecific\r\n" - " VendorSpecificHeader %04x\r\n" -#string STR_PCI_EXT_CAP_DPA #language en-US " DPA\r\n" - " DpaCapability %04x\r\n" - " DpaLatencyIndicator %04x\r\n" - " DpaStatus %04x\r\n" - " DpaControl %04x\r\n" -#string STR_PCI_EXT_CAP_DPA2 #language en-US " DpaPowerAllocationArray[%x] %02x\r\n" -#string STR_PCI_EXT_CAP_ECEA #language en-US " Event Collector Endpoint Association\r\n" - " AssociationBitmap %04x\r\n" -#string STR_PCI_EXT_CAP_VC_BASE #language en-US " Virtual (Multi) Channel Capability\r\n" - " ExtendedVcCount %08x\r\n" - " PortCapability1 %08x\r\n" - " PortCapability2 %08x\r\n" - " ArbitrationTableOffset %08x\r\n" - " PortVcControl %04x\r\n" - " PortVcStatus %04x\r\n" -#string STR_PCI_EXT_CAP_VC_ITEM #language en-US " Virtual Channel Capability Extended Item[%x]\r\n" - " ResourceCapability %08x\r\n" - " ArbitrationTableOffset %08x\r\n" - " ResourceControl %08x\r\n" - " ResourceStatus %04x\r\n" -#string STR_PCI_EXT_CAP_MULTICAST #language en-US " MultiCast Capability\r\n" - " MultiCastCapability %04x\r\n" - " MulticastControl %04x\r\n" - " McBaseAddress %L16x\r\n" - " McReceiveAddress %L16x\r\n" - " McBlockAll %L16x\r\n" - " McBlockUntranslated %L16x\r\n" - " McOverlayBar %L16x\r\n" -#string STR_PCI_EXT_CAP_RESIZE_BAR #language en-US " Resizeable Bar Capability [%x]\r\n" - " ResizableBarCapability %08x\r\n" - " ResizableBarControl %04x\r\n" -#string STR_PCI_EXT_CAP_TPH #language en-US " TPH\r\n" - " TphRequesterCapability %08x\r\n" - " TphRequesterControl %04x\r\n" - " TphTable (optional):\r\n" -#string STR_PCI_EXT_CAP_SECONDARY #language en-US " Secondary PCI Express Extended Capability\r\n" - " LinkControl3 %08x\r\n" - " LaneErrorStatus %08x\r\n" - " EqualizationControl:\r\n" - -#string STR_DMPSTORE_SAVE #language en-US "Save variable to file: %H%s%N.\r\n" -#string STR_DMPSTORE_LOAD #language en-US "Load and set variables from file: %H%s%N.\r\n" -#string STR_DMPSTORE_LOAD_GEN_FAIL #language en-US "%H%s%N: Failed to set variable %H%s%N: %r.\r\n" -#string STR_DMPSTORE_LOAD_BAD_FILE #language en-US "%H%s%N: Incorrect file format.\r\n" -#string STR_DMPSTORE_HEADER_LINE #language en-US "Variable %H%s%N '%H%g%N:%H%s%N' DataSize = 0x%02x\r\n" -#string STR_DMPSTORE_HEADER_LINE2 #language en-US "Variable %H%s%N '%H%s%N:%H%s%N' DataSize = 0x%02x\r\n" -#string STR_DMPSTORE_DELETE_LINE #language en-US "Delete variable '%H%g%N:%H%s%N': %r\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND #language en-US "%H%s%N: No matching variables found.\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_SFO #language en-US "VariableInfo,\"\",\"\",\"\",\"\",\"\"\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_GN #language en-US "%H%s%N: No matching variables found. Guid %g, Name %s\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_NG_SFO #language en-US "VariableInfo,\"%s\",\"%g\",\"\",\"\",\"\"\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_N #language en-US "%H%s%N: No matching variables found. Name %s\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_N_SFO #language en-US #language en-US "VariableInfo,\"%s\",\"\",\"\",\"\",\"\"\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_G #language en-US "%H%s%N: No matching variables found. Guid %g\r\n" -#string STR_DMPSTORE_NO_VAR_FOUND_G_SFO #language en-US "VariableInfo,\"\",\"%g\",\"\",\"\",\"\"\r\n" -#string STR_DMPSTORE_VAR_SFO #language en-US "VariableInfo,\"%s\",\"%g\",\"0x%x\",\"0x%x\",\"%s\"\r\n" - -#string STR_GET_HELP_COMP #language en-US "" -".TH comp 0 "Compare 2 files"\r\n" -".SH NAME\r\n" -"Compares the contents of two files on a byte-for-byte basis.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"COMP [-b] file1 file2\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" file1 - Specifies a first file name (directory name or wildcards not permitted).\r\n" -" file2 - Specifies a second file name (directory name or wildcards not permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command compares the contents of two files in binary mode.\r\n" -" 2. It displays up to 10 differences between the two files. For each\r\n" -" difference, up to 32 bytes from the location where the difference starts\r\n" -" is dumped.\r\n" -" 3. It will exit immediately if the lengths of the compared files are\r\n" -" different.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To compare two files with the same length but different contents:\r\n" -" fs0:\> comp bios.inf bios2.inf\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The function operated as expected.\r\n" -" SHELL_NOT_EQUAL The files were not identical.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The requested file was not found.\r\n" - -#string STR_GET_HELP_SETSIZE #language en-US "" -".TH setsize 0 "Set file size"\r\n" -".SH NAME\r\n" -"Adjusts the size of a file.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SETSIZE size file [file...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" size - Specifies the size of the file after it is adjusted.\r\n" -" file - Specifies the file or files to be adjusted.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. Setting the size smaller than the actual data contained in this file will\r\n" -" truncate its data.\r\n" -" 2. This command adjusts the size of a particular target file.\r\n" -" 3. This command automatically truncates or extends the size of a file based on the passed-in\r\n" -" parameters. If the file does not exist, it is created.\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_VOLUME_FULL The media has insufficient space to complete the\r\n" -" request.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_MODE #language en-US "" -".TH mode 0 "Shows or changes ConOut mode."\r\n" -".SH NAME\r\n" -"Displays or changes the console output device mode.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MODE [col row]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" col - Specifies the number of columns.\r\n" -" row - Specifies the number of rows.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command changes the display mode for the console output\r\n" -" device.\r\n" -" 2. When this command is used without any parameters, it shows the list of\r\n" -" modes that the standard output device currently supports.\r\n" -" 3. When used with the row and col parameter, this command\r\n" -" changes the number of rows and columns on the standard output device.\r\n" -" 4. The current selected mode is indicated by a '*'. \r\n" -" 5. The display is cleared every time this command is used to change the\r\n" -" currently selected display mode.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all available modes on standard output:\r\n" -" Shell> mode\r\n" -" \r\n" -" * To change the current mode setting:\r\n" -" Shell> mode 80 50\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_MEMMAP #language en-US "" -".TH memmap 0 "Displays the memory map."\r\n" -".SH NAME\r\n" -"Displays the memory map maintained by the UEFI environment.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MEMMAP [-b] [-sfo]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time\r\n" -" -sfo - Displays information as described in Standard-Format Output.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The UEFI environment keeps track of all the physical memory in the system\r\n" -" and how it is currently being used.\r\n" -" 2. Total Memory is the physical memory size excluding Reserved, Unusable,\r\n" -" MemoryMappedIO, and MemoryMappedIOPortSpace memory types.\r\n" -" 3. Refer to the UEFI specification for memory type definitions.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the system memory map:\r\n" -" Shell> memmap\r\n" -" \r\n" - -#string STR_GET_HELP_EFICOMPRESS #language en-US "" -".TH eficompress 0 "compresses a file."\r\n" -".SH NAME\r\n" -"Compresses a file using UEFI Compression Algorithm.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"EFICOMPRESS infile outfile\r\n" -".SH OPTIONS\r\n" -" \r\n" -" infile - Specifies the file name of the uncompressed input file.\r\n" -" outfile - Specifies the file name of the compressed output file.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command compresses a file using UEFI Compression Algorithm\r\n" -" and writes the compressed form out to a new file.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To compress a file named 'uncompressed' to a file named 'compressed':\r\n" -" fs0:\> eficompress uncompressed compressed\r\n" - -#string STR_GET_HELP_EFIDCOMPRESS #language en-US "" -".TH efidecompress 0 "Decompresses a file."\r\n" -".SH NAME\r\n" -"Decompresses a file using UEFI Decompression Algorithm.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"EFIDECOMPRESS infile outfile\r\n" -".SH OPTIONS\r\n" -" \r\n" -" infile - Specifies the file name of the compressed input file.\r\n" -" outfile - Specifies the file name of the decompressed output file.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This decompresses a file using UEFI Decompression\r\n" -" Algorithm and writes the decompressed form out to a new file.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To decompress a file named 'compressed' to a file named 'uncompressed':\r\n" -" fs0:\> efidecompress compressed uncompressed\r\n" - -#string STR_GET_HELP_DMEM #language en-US "" -".TH dmem 0 "Displays memory."\r\n" -".SH NAME\r\n" -"Displays the contents of system or device memory.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DMEM [-b] [address] [size] [-MMIO]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" -MMIO - Forces address cycles to the PCI bus.\r\n" -" address - Specifies a starting address in hexadecimal format.\r\n" -" size - Specifies the number of bytes to display in hexadecimal format.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays the contents of system memory or device memory.\r\n" -" 2. Enter address and size in hexadecimal format.\r\n" -" 3. If address is not specified, the contents of the UEFI System Table\r\n" -" are displayed. Otherwise, memory starting at the specified address is displayed.\r\n" -" 4. Size specifies the number of bytes to display. If size is not specified,\r\n" -" 512 bytes are displayed.\r\n" -" 5. If MMIO is not specified, main system memory is displayed. Otherwise,\r\n" -" device memory is displayed through the use of the\r\n" -" EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the UEFI system table pointer entries:\r\n" -" fs0:\> dmem\r\n" -" \r\n" -" * To display memory contents from 1af3088 with size of 16 bytes:\r\n" -" Shell> dmem 1af3088 16\r\n" -" \r\n" -" * To display memory mapped IO contents from 1af3088 with a size of 16 bytes:\r\n" -" Shell> dmem 1af3088 16 -MMIO\r\n" - -#string STR_GET_HELP_MM #language en-US "" -".TH mm 0 "Displays or modifies address space memory."\r\n" -".SH NAME\r\n" -"Displays or modifies MEM/MMIO/IO/PCI/PCIE address space.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MM Address [Value] [-w 1|2|4|8] [-MEM | -MMIO | -IO | -PCI | -PCIE] [-n]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" Address - Starting address in hexadecimal format.\r\n" -" Value - The value to write in hexadecimal format.\r\n" -" -MEM - Memory Address type\r\n" -" -MMIO - Memory Mapped IO Address type\r\n" -" -IO - IO Address type\r\n" -" -PCI - PCI Configuration Space Address type:\r\n" -" Address format: ssssbbddffrr\r\n" -" ssss - Segment\r\n" -" bb - Bus\r\n" -" dd - Device\r\n" -" ff - Function\r\n" -" rr - Register\r\n" -" -PCIE - PCIE Configuration Space Address type:\r\n" -" Address format: ssssbbddffrrr\r\n" -" ssss - Segment\r\n" -" bb - Bus\r\n" -" dd - Device\r\n" -" ff - Function\r\n" -" rrr - Register\r\n" -" -w - Unit size accessed in bytes:\r\n" -" 1 - 1 byte\r\n" -" 2 - 2 bytes\r\n" -" 4 - 4 bytes\r\n" -" 8 - 8 bytes\r\n" -" -n - Non-interactive mode\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. If the address type parameter is not specified, address type defaults\r\n" -" to the 'MEM' type.\r\n" -" 2. If the 'Value' parameter is specified, the '-n' option is used and\r\n" -" the command writes the value to the\r\n" -" specified address in non-interactive mode. If the 'Value' parameter is\r\n" -" not specified, only the current contents in the address are displayed.\r\n" -" 3. If the '-w' option is not specified, unit size defaults to 1 byte.\r\n" -" 4. If the PCI address type is specified, the 'Address' parameter must\r\n" -" follow the PCI Configuration Space Address format above. The 'PCI'\r\n" -" command can be used to determine the address for a specified device.\r\n" -" It is listed in the PCI configuration space dump information in the\r\n" -" following format: "[EFI ssbbddffxx]".\r\n" -" 5. If the PCIE address type is specified, the 'Address' parameter must\r\n" -" follow the PCIE Configuration Space Address format above.\r\n" -" 6. In interactive mode, type a hex value to modify, 'q' or '.' to exit.\r\n" -" If the '-n' option is specified, it runs in non-interactive mode,\r\n" -" which supports batch file operation without user intervention.\r\n" -" 7. Not all PCI configuration register locations are writable.\r\n" -" 8. MM will only write the specified value. Read-modify-write operations\r\n" -" are not supported.\r\n" -" 9. The 'Address' parameter must be aligned on a boundary of the\r\n" -" specified width.\r\n" -" 10. Not all addresses are safe to access. Access to any improper address\r\n" -" can bring unexpected results.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display or modify memory:\r\n" -" Address 0x1b07288, default width=1 byte:\r\n" -" fs0:\> mm 1b07288\r\n" -" MEM 0x0000000001B07288 : 0x6D >\r\n" -" MEM 0x0000000001B07289 : 0x6D >\r\n" -" MEM 0x0000000001B0728A : 0x61 > 80\r\n" -" MEM 0x0000000001B0728B : 0x70 > q\r\n" -" fs0:\> mm 1b07288\r\n" -" MEM 0x0000000001B07288 : 0x6D >\r\n" -" MEM 0x0000000001B07289 : 0x6D >\r\n" -" MEM 0x0000000001B0728A : 0x80 > *Modified\r\n" -" MEM 0x0000000001B0728B : 0x70 > q\r\n" -" \r\n" -" * To modify memory: Address 0x1b07288, width = 2 bytes:\r\n" -" Shell> mm 1b07288 -w 2\r\n" -" MEM 0x0000000001B07288 : 0x6D6D >\r\n" -" MEM 0x0000000001B0728A : 0x7061 > 55aa\r\n" -" MEM 0x0000000001B0728C : 0x358C > q\r\n" -" Shell> mm 1b07288 -w 2\r\n" -" MEM 0x0000000001B07288 : 0x6D6D >\r\n" -" MEM 0x0000000001B0728A : 0x55AA > *Modified\r\n" -" MEM 0x0000000001B0728C : 0x358C > q\r\n" -" \r\n" -" * To display IO space: Address 80h, width = 4 bytes:\r\n" -" Shell> mm 80 -w 4 -IO\r\n" -" IO 0x0000000000000080 : 0x000000FE >\r\n" -" IO 0x0000000000000084 : 0x00FF5E6D > q\r\n" -" \r\n" -" * To modify IO space using non-interactive mode:\r\n" -" Shell> mm 80 52 -w 1 -IO\r\n" -" Shell> mm 80 -w 1 -IO\r\n" -" IO 0x0000000000000080 : 0x52 > FE *Modified\r\n" -" IO 0x0000000000000081 : 0xFF >\r\n" -" IO 0x0000000000000082 : 0x00 >\r\n" -" IO 0x0000000000000083 : 0x00 >\r\n" -" IO 0x0000000000000084 : 0x6D >\r\n" -" IO 0x0000000000000085 : 0x5E >\r\n" -" IO 0x0000000000000086 : 0xFF >\r\n" -" IO 0x0000000000000087 : 0x00 > q\r\n" -" \r\n" -" * To display PCI configuration space, ss=0000, bb=00, dd=00, ff=00, rr=00:\r\n" -" Shell> mm 000000000000 -PCI\r\n" -" PCI 0x0000000000000000 : 0x86 >\r\n" -" PCI 0x0000000000000001 : 0x80 >\r\n" -" PCI 0x0000000000000002 : 0x30 >\r\n" -" PCI 0x0000000000000003 : 0x11 >\r\n" -" PCI 0x0000000000000004 : 0x06 >\r\n" -" PCI 0x0000000000000005 : 0x00 > q\r\n" -" These contents can also be displayed by 'PCI 00 00 00'.\r\n" -" \r\n" -" * To display PCIE configuration space, ss=0000, bb=06, dd=00, ff=00, rrr=000:\r\n" -" Shell> mm 0000060000000 -PCIE\r\n" -" PCIE 0x0000000060000000 : 0xAB >\r\n" -" PCIE 0x0000000060000001 : 0x11 >\r\n" -" PCIE 0x0000000060000002 : 0x61 >\r\n" -" PCIE 0x0000000060000003 : 0x43 >\r\n" -" \r\n" - -#string STR_GET_HELP_LOAD_PCI_ROM #language en-US "" -".TH loadpcirom 0 "Loads a PCI option ROM file."\r\n" -".SH NAME\r\n" -"Loads a PCI Option ROM.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"LoadPciRom [-nc] romfile [romfile...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -nc - Loads the ROM image(s) but does not connect drivers.\r\n" -" romfile - Specifies the PCI option ROM image file (wildcards are permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command loads PCI option ROM images into memory for\r\n" -" execution.\r\n" -" 2. The file can contain legacy images and multiple PE32 images, in which case\r\n" -" all PE32 images are loaded.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To load a rom file 'rom.bin':\r\n" -" fs0:\> LoadPciRom rom.bin\r\n" -" \r\n" -" * To load '*.bin' files without connecting drivers:\r\n" -" fs0:\> LoadPciRom -nc *.bin\r\n" - -#string STR_GET_HELP_SETVAR #language en-US "" -".TH setvar 0 "Displays or modifies a UEFI variable."\r\n" -".SH NAME\r\n" -"Displays or modifies a UEFI variable.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SETVAR variable-name [-guid guid][-bs][-rt][-nv] [=data]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" variable-name - Specifies the name of the UEFI variable to modify or display.\r\n" -" -guid - Specifies the GUID of the UEFI variable to modify or display.\r\n" -" If not present, GUID EFI_GLOBAL_VARIABLE is assumed.\r\n" -" -bs - Indicates that the variable is a boot variable. Applies to a new variable;\r\n" -" otherwise, it is ignored. \r\n" -" -rt - Indicates that the variable is a runtime variable. Applies to a new variable;\r\n" -" otherwise, it is ignored. \r\n" -" -nv - Indicates that the variable is non-volatile. If not present,\r\n" -" then the variable is assumed to be volatile. Applies to a new variable;\r\n" -" otherwise, it is ignored. \r\n" -" =data - Specifies there is new data for the variable. If there is nothing after the '='\r\n" -" then the variable is deleted. If '=' is not present, then the\r\n" -" current value of the variable is dumped as hex bytes.\r\n" -" The data can consist of zero or more of the following:\r\n" -" xx[xx] - Hexadecimal bytes\r\n" -" ^"ascii-string^" - ASCII-string with no null-terminator\r\n" -" L^"UCS2-string^" - UCS-2 encoded string with no\r\n" -" null-terminator\r\n" -" --device - Device path text format\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command changes the UEFI variable specified by name and GUID.\r\n" -" 2. If = is specified, but data is not, the variable is deleted, if it exists.\r\n" -" 3. If = is not specified, then the current variable contents are displayed.\r\n" -" 4. If =data is specified, then the variable's value is changed to the value\r\n" -" specified by data.\r\n" -" 5. -bs, -rt and -nv are only useful if the variable does not exist.\r\n" -" 6. If the variable already exists, the attributes cannot be changed, and the" -" flags will be ignored.\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The shell has stored the variable and its data with\r\n" -" the defined attributes.\r\n" -" SHELL_INVALID_PARAMETER Incorrect attributes were used.\r\n" -" SHELL_OUT_OF_RESOURCES Insufficient resources were available for storing\r\n" -" the variable and its data.\r\n" -" SHELL_DEVICE_ERROR The Variable could not be saved due to a hardware\r\n" -" error.\r\n" -" SHELL_WRITE_PROTECTED The variable in question is read-only.\r\n" -" SHELL_WRITE_PROTECTED The variable in question cannot be deleted.\r\n" -" SHELL_NOT_FOUND The variable could not be found.\r\n" - -#string STR_GET_HELP_SERMODE #language en-US "" -".TH sermode 0 "configure serial port"\r\n" -".SH NAME\r\n" -"Sets serial port attributes.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SERMODE [handle [baudrate parity databits stopbits]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" handle - Specifies a device handle for a serial port in hexadecimal format.\r\n" -" baudrate - Specifies a baud rate for specified serial port.\r\n" -" parity - Sets parity bit settings for specified serial port. Valid values\r\n" -" are:\r\n" -" d - Default parity\r\n" -" n - No parity\r\n" -" e - Even parity\r\n" -" o - Odd parity\r\n" -" m - Mark parity\r\n" -" s - Space parity\r\n" -" databits - Sets the data bits for the specified serial port.\r\n" -" stopbits - Sets the stop bits for the specified serial port.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The 'handle' parameter is the device handle of the desired serial port.\r\n" -" The 'DH' command can be used to retrieve this information.\r\n" -" 2. The 'stopbits' parameter supports the following settings:\r\n" -" 0 (0 stop bits - default setting)\r\n" -" 1 (1 stop bit)\r\n" -" 2 (2 stop bits)\r\n" -" 15 (1.5 stop bits)\r\n" -" All other settings are invalid.\r\n" -" 3. The 'baudrate' parameter supports the following settings:\r\n" -" 50, 75, 110, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800,\r\n" -" 7200, 9600(default), 19200, 38400, 57600, 115200, 230400, 460800\r\n" -" All other values will be converted to the next highest setting.\r\n" -" 4. The 'databits' parameter supports the following settings:\r\n" -" 4\r\n" -" 7\r\n" -" 8 (default)\r\n" -" All other settings are invalid.\r\n" -" 5. Parity attributes are mutually exclusive.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the settings for all serial port devices:\r\n" -" Shell> sermode\r\n" -" \r\n" -" * To display the settings for the serial port device whose handle is 0x6B:\r\n" -" Shell> sermode 6B\r\n" -" \r\n" -" * To configure the serial port settings for handle 0x6B to 9600bps, even\r\n" -" parity, 8 data bits, and 1 stop bit:\r\n" -" Shell> sermode 6B 9600 e 8 1\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The new attributes were set on the serial device.\r\n" -" SHELL_INVALID_PARAMETER One or more of the attributes has an unsupported\r\n" -" value.\r\n" -" SHELL_DEVICE_ERROR The serial device is not functioning correctly.\r\n" - -#string STR_GET_HELP_PCI #language en-US "" -".TH pci 0 "Displays PCI device information."\r\n" -".SH NAME\r\n" -"Displays PCI device list or PCI function configuration space and PCIe extended\r\n" -"configuration space.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"PCI [Bus Dev [Func] [-s Seg] [-i [-ec ID]]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -s - Specifies optional segment number (hexadecimal number).\r\n" -" -i - Displays interpreted information.\r\n" -" -ec - Displays detailed interpretation of specified PCIe extended capability\r\n" -" ID (hexadecimal number).\r\n" -" Bus - Specifies a bus number (hexadecimal number).\r\n" -" Dev - Specifies a device number (hexadecimal number).\r\n" -" Func - Specifies a function number (hexadecimal number).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays a list of all the PCI devices found in the system. It\r\n" -" also displays the configuration space of a PCI device according to the\r\n" -" specified bus (Bus), device (Dev), and function (Func) addresses. If the\r\n" -" function address is not specified, it defaults to 0.\r\n" -" 2. The -i option displays verbose information for the specified PCI\r\n" -" device. The PCI configuration space for the device is displayed with\r\n" -" a detailed interpretation.\r\n" -" 3. If no parameters are specified, all PCI devices are listed.\r\n" -" 4. If the 'Bus' and 'Dev' parameters are specified but the 'Func' or\r\n" -" 'Seg' parameters are not, Function or Seg are set to the default value of 0.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all PCI devices in the system:\r\n" -" Shell> pci\r\n" -" \r\n" -" * To display the configuration space of Bus 0, Device 0, Function 0:\r\n" -" Shell> pci 00 00 00 -i\r\n" -" \r\n" -" * To display configuration space of Segment 0, Bus 0, Device 0, Function 0:\r\n" -" Shell> pci 00 00 00 -s 0\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS Data was displayed as requested.\r\n" -" SHELL_DEVICE_ERROR The specified device parameters did not match a physical\r\n" -" device in the system.\r\n" - -#string STR_GET_HELP_SMBIOSVIEW #language en-US "" -".TH smbiosview 0 "Displays SMBIOS information."\r\n" -".SH NAME\r\n" -"Displays SMBIOS information.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SMBIOSVIEW [-t SmbiosType]|[-h SmbiosHandle]|[-s]|[-a]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -t - Displays all structures of SmbiosType.\r\n" -" -h - Displays structure of SmbiosHandle.\r\n" -" -s - Displays a statistics table.\r\n" -" -a - Displays all information.\r\n" -" SmbiosType - Specifies a SMBIOS structure type.\r\n" -" SmbiosHandle - Specifies a SMBIOS structure unique 16-bit handle.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The SmbiosType parameter supports the following types:\n" -" 0 - BIOS Information\r\n" -" 1 - System Information\r\n" -" 2 - Baseboard Information\r\n" -" 3 - System Enclosure\r\n" -" 4 - Processor Information\r\n" -" 5 - Memory Controller Information\r\n" -" 6 - Memory Module Information\r\n" -" 7 - Cache Information\r\n" -" 8 - Port Connector Information\r\n" -" 9 - System Slots\r\n" -" 10 - On Board Devices Information\r\n" -" 11 - OEM Strings\r\n" -" 12 - System Configuration Options\r\n" -" 13 - BIOS Language Information\r\n" -" 14 - Group Associations\r\n" -" 15 - System Event Log\r\n" -" 16 - Physical Memory Array\r\n" -" 17 - Memory Device\r\n" -" 18 - 32-bit Memory Error Information\r\n" -" 19 - Memory Array Mapped Address\r\n" -" 20 - Memory Device Mapped Address\r\n" -" 21 - Built-in Pointing Device\r\n" -" 22 - Portable Battery\r\n" -" 23 - System Reset\r\n" -" 24 - Hardware Security\r\n" -" 25 - System Power Controls\r\n" -" 26 - Voltage Probe\r\n" -" 27 - Cooling Device\r\n" -" 28 - Temperature Probe\r\n" -" 29 - Electrical Current Probe\r\n" -" 30 - Out-Of-Band Remote Access\r\n" -" 31 - Boot Integrity Services (BIS) Entry Point\r\n" -" 32 - System Boot Information\r\n" -" 33 - 64-Bit Memory Error Information\r\n" -" 34 - Management Device\r\n" -" 35 - Management Device Component\r\n" -" 36 - Management Device Threshold Data\r\n" -" 37 - Memory Channel\r\n" -" 38 - IPMI Device Information\r\n" -" 39 - System Power Supply\r\n" -" 40 - Additional Information\r\n" -" 41 - Onboard Devices Extended Information\r\n" -" 42 - Management Controller Host Interface\r\n" -" 43 - TPM Device\r\n" -" 2. Enter the SmbiosHandle parameter in hexadecimal format.\r\n" -" Do not use the '0x' prefix format for hexadecimal values.\r\n" -" 3. Internal commands:\r\n" -" :q -------- quit smbiosview\r\n" -" :0 -------- Change smbiosview display NONE info\r\n" -" :1 -------- Change smbiosview display OUTLINE info\r\n" -" :2 -------- Change smbiosview display NORMAL info\r\n" -" :3 -------- Change smbiosview display DETAIL info\r\n" -" /? -------- Show help\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS Data was displayed as requested.\r\n" -" SHELL_DEVICE_ERROR The requested structure was not found.\r\n" - -#string STR_GET_HELP_DMPSTORE #language en-US "" -".TH dmpstore 0 "Manages all UEFI variables."\r\n" -".SH NAME\r\n" -"Manages all UEFI variables.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DMPSTORE [-b] [-d] [-all | ([variable] [-guid guid])] [-sfo]\r\n" -"DMPSTORE [-all | ([variable] [-guid guid])] [-s file]\r\n" -"DMPSTORE [-all | ([variable] [-guid guid])] [-l file]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" -guid - Specifies the GUID of the variables to be displayed in\r\n" -" standard text format. If not specified and -all is not\r\n" -" specified, the EFI_GLOBAL_VARIABLE GUID is assumed.\r\n" -" -sfo - Displays information as described in Standard-Format Output.\r\n" -" -all - Dumps all variables, including those\r\n" -" with a different GUID than EFI_GLOBAL_VARIABLE.\r\n" -" -d - Delete variables.\r\n" -" -s - Saves variables to a file.\r\n" -" -l - Loads and sets variables from a file.\r\n" -" variable - Specifies a variable name. This can be a literal name or\r\n" -" a pattern as specified in the MetaiMatch() function of the\r\n" -" EFI_UNICODE_COLLATION2_PROCOOL.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command manages the UEFI variables. The variables\r\n" -" displayed or deleted depend on the command line options, as specified in\r\n" -" the following table:\r\n" -" Variable GUID -all Description\r\n" -" --- --- --- All variables with the GUID EFI_GLOBAL_VARIABLE will\r\n" -" be operated on.\r\n" -" --- --- X All variables (regardless of GUID or name) will be\r\n" -" operated on.\r\n" -" --- X --- All variables with the specified GUID will be\r\n" -" operated on.\r\n" -" X --- --- The variable with the GUID EFI_GLOBAL_VARIABLE and\r\n" -" the name Variable will be operated on.\r\n" -" X X --- The variable with the specified GUID and name\r\n" -" Variable will be operated on.\r\n" -" 2. The variable value is printed as a hexadecimal dump.\r\n" -" 3. Option -d is used to delete variables. Option -s and -l are used to save\r\n" -" and load variables to and from a file. The variable name can be specified\r\n" -" when using these flags so that the operation only takes effect on\r\n" -" that variable.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To dump all variables with the GUID EFI_GLOBAL_VARIABLE:\r\n" -" Shell> dmpstore\r\n" -" \r\n" -" * To dump all variables (regardless of GUID or name):\r\n" -" Shell> dmpstore -all\r\n" -" \r\n" -" * To dump the 'path' variable with the GUID '158DEF5A-F656-419C-B027-\r\n" -" 7A3192C079D2':\r\n" -" Shell> dmpstore path -guid 158DEF5A-F656-419C-B027-7A3192C079D2\r\n" -" \r\n" -" * To save all variables (regardless of GUID or name) to a file 'VarDump.txt':\r\n" -" fs0:\> dmpstore -all -s VarDump.txt\r\n" -" \r\n" -" * To delete the 'BootOrder' variable with the GUID EFI_GLOBAL_VARIABLE:\r\n" -" Shell> dmpstore -d BootOrder\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_DBLK #language en-US "" -".TH dblk 0 "Displays one or more blocks from a block device."\r\n" -".SH NAME\r\n" -"Displays one or more blocks from a block device.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DBLK device [lba] [blocks] [-b]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" device - Blocks the device name.\r\n" -" lba - Specifies the index of the first block to be displayed (a hexadecimal number).\r\n" -" The default is 0.\r\n" -" blocks - Specifies the number of blocks to display (a hexadecimal number). The default\r\n" -" is 1. If larger than 0x10, then only 0x10 are displayed.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays the contents of one or more blocks from a block\r\n" -" device. Enter a hexidecimal value for the lba and blocks variables. If lba is not\r\n" -" specified, block #0 is assumed. If blocks is not specified, on1y one\r\n" -" block is displayed. The maximum number of blocks that can be\r\n" -" displayed at one time is 0x10.\r\n" -" 2. If an MBR is found on the block, the partition information is displayed\r\n" -" after all the block contents are displayed.\r\n" -" 3. If the block is a FAT partition, some FAT parameters are displayed\r\n" -" (label, systemid, oemid, sectorsize, clustersize, media, and so forth) after all the\r\n" -" blocks are displayed.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display one block of blk0, beginning from block 0:\r\n" -" Shell> dblk blk0\r\n" -" \r\n" -" * To display one block of fs0, beginning from block 0x2:\r\n" -" Shell> dblk fs0 2\r\n" -" \r\n" -" * To display 0x5 blocks of fs0, beginning from block 0x12:\r\n" -" Shell> dblk fs0 12 5\r\n" -" \r\n" -" * To display 0x10 blocks of fs0, beginning from block 0x12:\r\n" -" Shell> dblk fs0 12 10\r\n" -" \r\n" -" * To attempt to display more than 0x10 blocks, resulting in only 0x10\r\n" -" blocks being displayed:\r\n" -" Shell> dblk fs0 12 20\r\n" -" \r\n" -" * To display one block of blk2, beginning from the first block (blk0):\r\n" -" fs1:\tmps1> dblk blk2 0 1\r\n" -" \r\n" - -#string STR_GET_HELP_EDIT #language en-US "" -".TH edit 0 "Provides a full screen text editor for ASCII or UCS-2 files."\r\n" -".SH NAME\r\n" -"Provides a full screen text editor for ASCII or UCS-2 files.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"EDIT [file]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" file - Specifies the name of file to be edited. If none is specified, an empty file\r\n" -" is created with a default file name.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command enables full screen file editing.\r\n" -" 2. The editor supports both UCS-2 and ASCII file types.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To edit the 'shell.log' file:\r\n" -" fs0:\> edit shell.log\r\n" - -#string STR_GET_HELP_HEXEDIT #language en-US "" -".TH hexedit 0 "Provides a full screen hex editor for files, block devices, or memory."\r\n" -".SH NAME\r\n" -"Provides a full screen hex editor for files, block devices, or memory.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"HEXEDIT [[-f] filename| [-d diskname offset size] | [-m address size]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -f - Specifies the name of the file to edit.\r\n" -" -d - Specifies the disk block to edit:\r\n" -" DiskName - Name of the disk to edit (for example fs0)\r\n" -" Offset - Starting block number (beginning from 0)\r\n" -" Size - Number of blocks to edit\r\n" -" -m - Specifies the memory region to edit:\r\n" -" Address - Starting 32-bit memory address (beginning from 0)\r\n" -" Size - Size of memory region to edit in bytes\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command enables you to edit a file, block device, or memory region.\r\n" -" 2. The region being edited is displayed as hexadecimal bytes. The\r\n" -" contents can be modified and saved.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To edit a file in hex mode:\r\n" -" fs0:\> hexedit test.bin\r\n" -" \r\n" -" * To edit block device fs0 starting at block 0 with size of 2 blocks:\r\n" -" fs0:\> hexedit -d fs0 0 2\r\n" -" \r\n" -" * To edit memory region starting at address 0x00000000 with size of 2 bytes:\r\n" -" fs0:\> hexedit -m 0 2\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c deleted file mode 100644 index c6e4039..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c +++ /dev/null @@ -1,549 +0,0 @@ -/** @file - Main file for connect shell Driver1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -/** - Create all handles associate with every device path node. - - @param DevicePathToConnect The device path which will be connected. - - @retval EFI_SUCCESS All handles associate with every device path node - have been created. - @retval EFI_INVALID_PARAMETER DevicePathToConnect is NULL. - @retval EFI_NOT_FOUND Create the handle associate with one device path - node failed - -**/ -EFI_STATUS -ShellConnectDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect - ) -{ - EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath; - EFI_STATUS Status; - EFI_HANDLE Handle; - EFI_HANDLE PreviousHandle; - - if (DevicePathToConnect == NULL) { - return EFI_INVALID_PARAMETER; - } - - PreviousHandle = NULL; - do{ - RemainingDevicePath = DevicePathToConnect; - Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle); - - if (!EFI_ERROR (Status) && (Handle != NULL)) { - if (PreviousHandle == Handle) { - Status = EFI_NOT_FOUND; - } else { - PreviousHandle = Handle; - Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); - } - } - - } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath) ); - - return Status; - -} - -/** - Connect drivers for PCI root bridge. - - @retval EFI_SUCCESS Connect drivers successfully. - @retval EFI_NOT_FOUND Cannot find PCI root bridge device. - -**/ -EFI_STATUS -ShellConnectPciRootBridge ( - VOID - ) -{ - UINTN RootBridgeHandleCount; - EFI_HANDLE *RootBridgeHandleBuffer; - UINTN RootBridgeIndex; - EFI_STATUS Status; - - RootBridgeHandleCount = 0; - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciRootBridgeIoProtocolGuid, - NULL, - &RootBridgeHandleCount, - &RootBridgeHandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - for (RootBridgeIndex = 0; RootBridgeIndex < RootBridgeHandleCount; RootBridgeIndex++) { - gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE); - } - - FreePool (RootBridgeHandleBuffer); - - return EFI_SUCCESS; -} - - -/** - Connect controller(s) and driver(s). - - @param[in] ControllerHandle The handle to the controller. Should have driver binding on it. - @param[in] DriverHandle The handle to the driver. Should have driver binding. - @param[in] Recursive TRUE to connect recursively, FALSE otherwise. - @param[in] Output TRUE to have info on the screen, FALSE otherwise. - @param[in] AlwaysOutput Override Output for errors. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ConnectControllers ( - IN CONST EFI_HANDLE ControllerHandle OPTIONAL, - IN CONST EFI_HANDLE DriverHandle OPTIONAL, - IN CONST BOOLEAN Recursive, - IN CONST BOOLEAN Output, - IN CONST BOOLEAN AlwaysOutput - ) -{ - EFI_STATUS Status; - EFI_STATUS Status2; - EFI_HANDLE *ControllerHandleList; - EFI_HANDLE *DriverHandleList; - EFI_HANDLE *HandleWalker; - - ControllerHandleList = NULL; - Status = EFI_NOT_FOUND; - Status2 = EFI_NOT_FOUND; - - // - // If we have a single handle to connect make that a 'list' - // - if (DriverHandle == NULL) { - DriverHandleList = NULL; - } else { - DriverHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE)); - if (DriverHandleList == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - DriverHandleList[0] = DriverHandle; - DriverHandleList[1] = NULL; - } - - // - // do we connect all controllers (with a loop) or a single one... - // This is where we call the gBS->ConnectController function. - // - if (ControllerHandle == NULL) { - ControllerHandleList = GetHandleListByProtocol(&gEfiDevicePathProtocolGuid); - for (HandleWalker = ControllerHandleList - ; HandleWalker != NULL && *HandleWalker != NULL - ; HandleWalker++ - ){ - Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive); - if (!EFI_ERROR(Status)) { - Status2 = EFI_SUCCESS; - } - if ((Output && !EFI_ERROR(Status)) || AlwaysOutput) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex(*HandleWalker), Status); - } - } - } else { - Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive); - if (!EFI_ERROR(Status)) { - Status2 = EFI_SUCCESS; - } - if ((Output && !EFI_ERROR(Status)) || AlwaysOutput) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex(ControllerHandle), Status); - } - } - - // - // Free any memory we allocated. - // - if (ControllerHandleList != NULL) { - FreePool(ControllerHandleList); - } - if (DriverHandleList != NULL) { - FreePool(DriverHandleList); - } - return (Status2); -} - -/** - Do a connect from an EFI variable via it's key name. - - @param[in] Key The name of the EFI Variable. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ShellConnectFromDevPaths ( - IN CONST CHAR16 *Key - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *CopyOfDevPath; - EFI_DEVICE_PATH_PROTOCOL *Instance; - EFI_DEVICE_PATH_PROTOCOL *Next; - UINTN Length; - UINTN Index; - UINTN HandleArrayCount; - UINTN Size; - EFI_HANDLE *HandleArray; - EFI_STATUS Status; - BOOLEAN AtLeastOneConnected; - EFI_PCI_IO_PROTOCOL *PciIo; - UINT8 Class[3]; - - DevPath = NULL; - Length = 0; - AtLeastOneConnected = FALSE; - - // - // Get the DevicePath buffer from the variable... - // - Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath); - if (Status == EFI_BUFFER_TOO_SMALL) { - DevPath = AllocateZeroPool(Length); - if (DevPath == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath); - if (EFI_ERROR (Status)) { - if (DevPath != NULL) { - FreePool (DevPath); - } - return Status; - } - } else if (EFI_ERROR (Status)) { - return Status; - } - - Status = EFI_NOT_FOUND; - - CopyOfDevPath = DevPath; - // - // walk the list of devices and connect them - // - do { - // - // Check every instance of the console variable - // - Instance = GetNextDevicePathInstance (&CopyOfDevPath, &Size); - if (Instance == NULL) { - if (DevPath != NULL) { - FreePool (DevPath); - } - return EFI_UNSUPPORTED; - } - - Next = Instance; - while (!IsDevicePathEndType (Next)) { - Next = NextDevicePathNode (Next); - } - - SetDevicePathEndNode (Next); - // - // connect short form device path - // - if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) && - ((DevicePathSubType (Instance) == MSG_USB_CLASS_DP) - || (DevicePathSubType (Instance) == MSG_USB_WWID_DP) - )) { - - Status = ShellConnectPciRootBridge (); - if (EFI_ERROR(Status)) { - FreePool(Instance); - FreePool(DevPath); - return Status; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciIoProtocolGuid, - NULL, - &HandleArrayCount, - &HandleArray - ); - - if (!EFI_ERROR (Status)) { - for (Index = 0; Index < HandleArrayCount; Index++) { - Status = gBS->HandleProtocol ( - HandleArray[Index], - &gEfiPciIoProtocolGuid, - (VOID **)&PciIo - ); - - if (!EFI_ERROR (Status)) { - Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class); - if (!EFI_ERROR (Status)) { - if ((PCI_CLASS_SERIAL == Class[2]) && - (PCI_CLASS_SERIAL_USB == Class[1])) { - Status = gBS->ConnectController ( - HandleArray[Index], - NULL, - Instance, - FALSE - ); - if (!EFI_ERROR(Status)) { - AtLeastOneConnected = TRUE; - } - } - } - } - } - } - - if (HandleArray != NULL) { - FreePool (HandleArray); - } - } else { - // - // connect the entire device path - // - Status = ShellConnectDevicePath (Instance); - if (!EFI_ERROR (Status)) { - AtLeastOneConnected = TRUE; - } - } - FreePool (Instance); - - } while (CopyOfDevPath != NULL); - - if (DevPath != NULL) { - FreePool(DevPath); - } - - if (AtLeastOneConnected) { - return EFI_SUCCESS; - } else { - return EFI_NOT_FOUND; - } - -} - -/** - Convert the handle identifiers from strings and then connect them. - - One of them should have driver binding and either can be NULL. - - @param[in] Handle1 The first handle. - @param[in] Handle2 The second handle. - @param[in] Recursive TRUE to do connect recursively. FALSE otherwise. - @param[in] Output TRUE to have output to screen. FALSE otherwise. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ConvertAndConnectControllers ( - IN EFI_HANDLE *Handle1 OPTIONAL, - IN EFI_HANDLE *Handle2 OPTIONAL, - IN CONST BOOLEAN Recursive, - IN CONST BOOLEAN Output - ) -{ - // - // if only one is NULL verify it's the proper one... - // - if ( (Handle1 == NULL && Handle2 != NULL) - || (Handle1 != NULL && Handle2 == NULL) - ){ - // - // Figure out which one should be NULL and move the handle to the right place. - // If Handle1 is NULL then test Handle2 and vise versa. - // The one that DOES has driver binding must be Handle2 - // - if (Handle1 == NULL) { - if (EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - // swap - Handle1 = Handle2; - Handle2 = NULL; - } else { - // We're all good... - } - } else { - if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - // We're all good... - } else { - // swap - Handle2 = Handle1; - Handle1 = NULL; - } - } - } - - return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL))); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-c", TypeFlag}, - {L"-r", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'connect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunConnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Param1; - CONST CHAR16 *Param2; - UINTN Count; - EFI_HANDLE Handle1; - EFI_HANDLE Handle2; - UINT64 Intermediate; - - ShellStatus = SHELL_SUCCESS; - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"connect", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // if more than 2 'value' parameters (plus the name one) or either -r or -c with any value parameters we have too many parameters - // - Count = (gInReconnect?0x4:0x3); - if ((ShellCommandLineGetCount(Package) > Count) - ||(ShellCommandLineGetFlag(Package, L"-c") && ShellCommandLineGetCount(Package)>1) - ||(ShellCommandLineGetFlag(Package, L"-r") && ShellCommandLineGetCount(Package)>2) - ||(ShellCommandLineGetFlag(Package, L"-r") && ShellCommandLineGetFlag(Package, L"-c") ) - ){ - // - // error for too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"connect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-c")) { - // - // do the conin and conout from EFI variables - // if the first fails dont 'loose' the error - // - Status = ShellConnectFromDevPaths(L"ConInDev"); - if (EFI_ERROR(Status)) { - ShellConnectFromDevPaths(L"ConOutDev"); - } else { - Status = ShellConnectFromDevPaths(L"ConOutDev"); - } - if (EFI_ERROR(Status)) { - ShellConnectFromDevPaths(L"ErrOutDev"); - } else { - Status = ShellConnectFromDevPaths(L"ErrOutDev"); - } - if (EFI_ERROR(Status)) { - ShellConnectFromDevPaths(L"ErrOut"); - } else { - Status = ShellConnectFromDevPaths(L"ErrOut"); - } - if (EFI_ERROR(Status)) { - ShellConnectFromDevPaths(L"ConIn"); - } else { - Status = ShellConnectFromDevPaths(L"ConIn"); - } - if (EFI_ERROR(Status)) { - ShellConnectFromDevPaths(L"ConOut"); - } else { - Status = ShellConnectFromDevPaths(L"ConOut"); - } - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_DEVICE_ERROR; - } - } else { - // - // 0, 1, or 2 specific handles and possibly recursive - // - Param1 = ShellCommandLineGetRawValue(Package, 1); - Param2 = ShellCommandLineGetRawValue(Package, 2); - Count = ShellCommandLineGetCount(Package); - - if (Param1 != NULL) { - Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE); - Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - Handle1 = NULL; - } - - if (Param2 != NULL) { - Status = ShellConvertStringToUint64(Param2, &Intermediate, TRUE, FALSE); - Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - Handle2 = NULL; - } - - if (ShellStatus == SHELL_SUCCESS) { - if (Param1 != NULL && Handle1 == NULL){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Param2 != NULL && Handle2 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Handle2 != NULL && Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0)); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CONNECT_NONE), gShellDriver1HiiHandle); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - } - } - - ShellCommandLineFreeVarList (Package); - } - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c deleted file mode 100644 index f673b29..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - Main file for DevTree shell Driver1 function. - - (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-d", TypeFlag}, - {L"-l", TypeValue}, - {NULL, TypeMax} - }; - -/** - Display a tree starting from this handle. - - @param[in] TheHandle The handle to start with. - @param[in] Lang Optionally, a UEFI defined language code. - @param[in] UseDevPaths TRUE to display info from DevPath as identifiers. - FALSE will use component name protocol instead. - @param[in] IndentCharCount How many characters to indent (allows for recursion). - @param[in] HiiString The string from HII to use for output. - - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -DoDevTreeForHandle( - IN CONST EFI_HANDLE TheHandle, - IN CONST CHAR8 *Lang OPTIONAL, - IN CONST BOOLEAN UseDevPaths, - IN CONST UINTN IndentCharCount, - IN CONST CHAR16 *HiiString - ) -{ - SHELL_STATUS ShellStatus; - EFI_STATUS Status; - CHAR16 *FormatString; - CHAR16 *Name; - EFI_HANDLE *ChildHandleBuffer; - UINTN ChildCount; - UINTN LoopVar; - - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - Name = NULL; - ChildHandleBuffer = NULL; - ChildCount = 0; - - ASSERT (TheHandle != NULL); - ASSERT (HiiString != NULL); - - if (ShellGetExecutionBreakFlag()) { - ShellStatus = SHELL_ABORTED; - return ShellStatus; - } - - // - // We want controller handles. they will not have LoadedImage or DriverBinding (or others...) - // - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiDriverBindingProtocolGuid, - NULL, - NULL, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - return SHELL_SUCCESS; - } - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiLoadedImageProtocolGuid, - NULL, - NULL, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - return SHELL_SUCCESS; - } - - FormatString = AllocateZeroPool(StrSize(HiiString) + (10)*sizeof(FormatString[0])); - if (FormatString == NULL) { - return SHELL_OUT_OF_RESOURCES; - } - - // - // we generate the format string on the fly so that we can control the - // number of space characters that the first (empty) string has. this - // handles the indenting. - // - - UnicodeSPrint(FormatString, StrSize(HiiString) + (10)*sizeof(FormatString[0]), L"%%%ds %s", IndentCharCount, HiiString); - gEfiShellProtocol->GetDeviceName((EFI_HANDLE)TheHandle, !UseDevPaths?EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH:EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Lang, &Name); - // - // print out the information for ourselves - // - ShellPrintEx( - -1, - -1, - FormatString, - L"", - ConvertHandleToHandleIndex(TheHandle), - Name==NULL?L"Unknown":Name); - - FreePool(FormatString); - if (Name != NULL) { - FreePool(Name); - } - - // - // recurse on each child handle with IndentCharCount + 2 - // - ParseHandleDatabaseForChildControllers(TheHandle, &ChildCount, &ChildHandleBuffer); - for (LoopVar = 0 ; LoopVar < ChildCount && ShellStatus == SHELL_SUCCESS; LoopVar++){ - ShellStatus = DoDevTreeForHandle(ChildHandleBuffer[LoopVar], Lang, UseDevPaths, IndentCharCount+2, HiiString); - if (ShellStatus == SHELL_ABORTED) { - break; - } - } - - if (ChildHandleBuffer != NULL) { - FreePool(ChildHandleBuffer); - } - - return (ShellStatus); -} - -/** - Function for 'devtree' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDevTree ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR8 *Language; - CONST CHAR16 *Lang; - CHAR16 *HiiString; - UINTN LoopVar; - EFI_HANDLE TheHandle; - BOOLEAN FlagD; - UINT64 Intermediate; - UINTN ParentControllerHandleCount; - EFI_HANDLE *ParentControllerHandleBuffer; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Language = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devtree", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devtree"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } else if (!ShellCommandLineGetFlag(Package, L"-l")){ - ASSERT(Language == NULL); -// Language = AllocateZeroPool(10); -// AsciiSPrint(Language, 10, "en-us"); - } else { - ASSERT(Language == NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devtree", L"-l"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } - FlagD = ShellCommandLineGetFlag(Package, L"-d"); - - Lang = ShellCommandLineGetRawValue(Package, 1); - HiiString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN (STR_DEV_TREE_OUTPUT), Language); - - if (Lang == NULL) { - for (LoopVar = 1 ; ; LoopVar++){ - TheHandle = ConvertHandleIndexToHandle(LoopVar); - if (TheHandle == NULL){ - break; - } - - // - // Skip handles that do not have device path protocol - // - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiDevicePathProtocolGuid, - NULL, - NULL, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL - ); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Skip handles that do have parents - // - ParentControllerHandleBuffer = NULL; - Status = PARSE_HANDLE_DATABASE_PARENTS ( - TheHandle, - &ParentControllerHandleCount, - &ParentControllerHandleBuffer - ); - SHELL_FREE_NON_NULL (ParentControllerHandleBuffer); - if (ParentControllerHandleCount > 0) { - continue; - } - - // - // Start a devtree from TheHandle that has a device path and no parents - // - ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString); - } - } else { - Status = ShellConvertStringToUint64(Lang, &Intermediate, TRUE, FALSE); - if (EFI_ERROR(Status) || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"devtree", Lang); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellStatus = DoDevTreeForHandle(ConvertHandleIndexToHandle((UINTN)Intermediate), Language, FlagD, 0, HiiString); - } - } - - if (HiiString != NULL) { - FreePool(HiiString); - } - SHELL_FREE_NON_NULL(Language); - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c deleted file mode 100644 index 82f7d8c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c +++ /dev/null @@ -1,269 +0,0 @@ -/** @file - Main file for devices shell Driver1 function. - - (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -/** - Get lots of info about a device from its handle. - - @param[in] TheHandle The device handle to get info on. - @param[in, out] Type On successful return R, B, or D (root, bus, or - device) will be placed in this buffer. - @param[in, out] Cfg On successful return this buffer will be - TRUE if the handle has configuration, FALSE - otherwise. - @param[in, out] Diag On successful return this buffer will be - TRUE if the handle has disgnostics, FALSE - otherwise. - @param[in, out] Parents On successful return this buffer will be - contain the number of parent handles. - @param[in, out] Devices On successful return this buffer will be - contain the number of devices controlled. - @param[in, out] Children On successful return this buffer will be - contain the number of child handles. - @param[out] Name The pointer to a buffer that will be allocated - and contain the string name of the handle. - The caller must free this memory. - @param[in] Language The language code as defined by the UEFI spec. - - @retval EFI_SUCCESS The info is there. - @retval EFI_INVALID_PARAMETER A parameter was invalid. -**/ -EFI_STATUS -GetDeviceHandleInfo ( - IN EFI_HANDLE TheHandle, - IN OUT CHAR16 *Type, - IN OUT BOOLEAN *Cfg, - IN OUT BOOLEAN *Diag, - IN OUT UINTN *Parents, - IN OUT UINTN *Devices, - IN OUT UINTN *Children, - OUT CHAR16 **Name, - IN CONST CHAR8 *Language - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN Count; - - if (TheHandle == NULL - || Type == NULL - || Cfg == NULL - || Diag == NULL - || Parents == NULL - || Devices == NULL - || Children == NULL - || Name == NULL ) { - return (EFI_INVALID_PARAMETER); - } - - *Cfg = FALSE; - *Diag = FALSE; - *Children = 0; - *Parents = 0; - *Devices = 0; - *Type = L' '; - *Name = CHAR_NULL; - HandleBuffer = NULL; - Status = EFI_SUCCESS; - - gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name); - - Status = ParseHandleDatabaseForChildControllers(TheHandle, Children, NULL); -// if (!EFI_ERROR(Status)) { - Status = PARSE_HANDLE_DATABASE_PARENTS(TheHandle, Parents, NULL); - if (/*!EFI_ERROR(Status) && */Parents != NULL && Children != NULL) { - if (*Parents == 0) { - *Type = L'R'; - } else if (*Children > 0) { - *Type = L'B'; - } else { - *Type = L'D'; - } - } -// } - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS(TheHandle, Devices, &HandleBuffer); - if (!EFI_ERROR(Status) && Devices != NULL && HandleBuffer != NULL) { - for (Count = 0 ; Count < *Devices ; Count++) { - if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - *Cfg = TRUE; - } - if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - *Diag = TRUE; - } - if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - *Diag = TRUE; - } - } - SHELL_FREE_NON_NULL(HandleBuffer); - } - - return (Status); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-sfo", TypeFlag}, - {L"-l", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'devices' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDevices ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR8 *Language; - EFI_HANDLE *HandleList; - EFI_HANDLE *HandleListWalker; - CHAR16 Type; - BOOLEAN Cfg; - BOOLEAN Diag; - UINTN Parents; - UINTN Devices; - UINTN Children; - CHAR16 *Name; - CONST CHAR16 *Lang; - BOOLEAN SfoFlag; - - ShellStatus = SHELL_SUCCESS; - Language = NULL; - SfoFlag = FALSE; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devices", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // if more than 0 'value' parameters we have too many parameters - // - if (ShellCommandLineGetRawValue(Package, 1) != NULL){ - // - // error for too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devices"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // get the language if necessary - // - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } else if (!ShellCommandLineGetFlag(Package, L"-l")){ - ASSERT(Language == NULL); -// Language = AllocateZeroPool(10); -// AsciiSPrint(Language, 10, "en-us"); - } else { - ASSERT(Language == NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devices", L"-l"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } - - - // - // Print Header - - // - if (ShellCommandLineGetFlag (Package, L"-sfo")) { - ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDriver1HiiHandle, L"devices"); - SfoFlag = TRUE; - } else { - ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle); - } - - // - // loop through each handle - // - HandleList = GetHandleListByProtocol(NULL); - ASSERT(HandleList != NULL); - for (HandleListWalker = HandleList - ; HandleListWalker != NULL && *HandleListWalker != NULL /*&& !EFI_ERROR(Status)*/ - ; HandleListWalker++ - ){ - - // - // get all the info on each handle - // - Name = NULL; - Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language); - if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) { - ShellPrintHiiEx ( - -1, - -1, - Language, - SfoFlag?STRING_TOKEN (STR_DEVICES_ITEM_LINE_SFO):STRING_TOKEN (STR_DEVICES_ITEM_LINE), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (*HandleListWalker), - Type, - Cfg?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'), - Diag?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'), - Parents, - Devices, - Children, - Name!=NULL?Name:L""); - } - if (Name != NULL) { - FreePool(Name); - } - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - break; - } - - } - - if (HandleList != NULL) { - FreePool(HandleList); - } - - } - SHELL_FREE_NON_NULL(Language); - ShellCommandLineFreeVarList (Package); - } - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c deleted file mode 100644 index 79417b0..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c +++ /dev/null @@ -1,1197 +0,0 @@ -/** @file - Main file for Dh shell Driver1 function. - - (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2017 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-p", TypeValue}, - {L"-d", TypeFlag}, - {L"-v", TypeFlag}, - {L"-verbose", TypeFlag}, - {L"-sfo", TypeFlag}, - {L"-l", TypeValue}, - {NULL, TypeMax} - }; - -STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = { - &gEfiDriverBindingProtocolGuid, - &gEfiPlatformDriverOverrideProtocolGuid, - &gEfiBusSpecificDriverOverrideProtocolGuid, - &gEfiDriverDiagnosticsProtocolGuid, - &gEfiDriverDiagnostics2ProtocolGuid, - &gEfiComponentNameProtocolGuid, - &gEfiComponentName2ProtocolGuid, - &gEfiPlatformToDriverConfigurationProtocolGuid, - &gEfiDriverSupportedEfiVersionProtocolGuid, - &gEfiDriverFamilyOverrideProtocolGuid, - &gEfiDriverHealthProtocolGuid, - &gEfiLoadedImageProtocolGuid, - NULL -}; - -UINTN mGuidDataLen[] = {8, 4, 4, 4, 12}; -/** - Function to determine if the string can convert to a GUID. - The string must be restricted as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format. - - @param[in] String The string to test. - - @retval TRUE The string can convert to a GUID. - @retval FALSE The string can't convert to a GUID. -**/ -BOOLEAN -IsValidGuidString( - IN CONST CHAR16 *String - ) -{ - CONST CHAR16 *Walker; - CONST CHAR16 *PrevWalker; - UINTN Index; - - if (String == NULL) { - return FALSE; - } - - Walker = String; - PrevWalker = String; - Index = 0; - - while (Walker != NULL && *Walker != CHAR_NULL) { - if ( (*Walker >= '0' && *Walker <= '9') || - (*Walker >= 'a' && *Walker <= 'f') || - (*Walker >= 'A' && *Walker <= 'F') - ) { - Walker++; - } else { - if (*Walker == L'-' && (((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index]) { - Walker++; - PrevWalker = Walker; - Index++; - } else { - return FALSE; - } - } - } - - if ((((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index]) { - return TRUE; - } else { - return FALSE; - } -} - -/** - Convert a hex-character to decimal value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other - Unicode character, the value returned does not make sense. - - @param[in] Char The character to convert. - - @retval The numerical value converted. -**/ -UINTN -HexCharToDecimal( - IN CHAR16 Char - ) -{ - if (Char >= '0' && Char <= '9') { - return Char - L'0'; - } else if (Char >= 'a' && Char <= 'f') { - return Char - L'a' + 10; - } else { - return Char - L'A' + 10; - } -} - -/** - Function try to convert a string to GUID format. - - @param[in] String The string will be converted. - @param[out] Guid Save the result convert from string. - - @retval EFI_SUCCESS The string was successfully converted to a GUID. - @retval EFI_UNSUPPORTED The input string is not in registry format. -**/ -EFI_STATUS -ConvertStrToGuid( - IN CONST CHAR16 *String, - OUT GUID *Guid - ) -{ - CONST CHAR16 *Walker; - UINT8 TempValue; - UINTN Index; - - if (String == NULL || !IsValidGuidString (String)) { - return EFI_UNSUPPORTED; - } - - Index = 0; - - Walker = String; - Guid->Data1 = (UINT32)StrHexToUint64 (Walker); - - Walker += 9; - Guid->Data2 = (UINT16)StrHexToUint64 (Walker); - - Walker += 5; - Guid->Data3 = (UINT16)StrHexToUint64 (Walker); - - Walker += 5; - while (Walker != NULL && *Walker != CHAR_NULL) { - if (*Walker == L'-') { - Walker++; - } else { - TempValue = (UINT8)HexCharToDecimal (*Walker); - TempValue = (UINT8)LShiftU64 (TempValue, 4); - Walker++; - - TempValue += (UINT8)HexCharToDecimal (*Walker); - Walker++; - - Guid->Data4[Index] = TempValue; - Index++; - } - } - - return EFI_SUCCESS; -} - -/** - Get the name of a driver by it's handle. - - If a name is found the memory must be callee freed. - - @param[in] TheHandle The driver's handle. - @param[in] Language The language to use. - @param[in] NameFound Upon a successful return the name found. - - @retval EFI_SUCCESS The name was found. -**/ -EFI_STATUS -GetDriverName ( - IN EFI_HANDLE TheHandle, - IN CONST CHAR8 *Language, - IN CHAR16 **NameFound - ) -{ - CHAR8 *Lang; - EFI_STATUS Status; - EFI_COMPONENT_NAME2_PROTOCOL *CompName2; - CHAR16 *NameToReturn; - // - // Go through those handles until we get one that passes for GetComponentName - // - Status = gBS->OpenProtocol( - TheHandle, - &gEfiComponentName2ProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status)) { - Status = gBS->OpenProtocol( - TheHandle, - &gEfiComponentNameProtocolGuid, - (VOID**)&CompName2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - } - - if (EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE); - Status = CompName2->GetDriverName(CompName2, Lang, &NameToReturn); - FreePool(Lang); - - if (!EFI_ERROR(Status) && NameToReturn != NULL) { - *NameFound = NULL; - StrnCatGrow(NameFound, NULL, NameToReturn, 0); - } - return (Status); -} - -/** - Discover if a protocol guid is one of the UEFI Driver Model Protocols. - - @param[in] Guid The guid to test. - - @retval TRUE The guid does represent a driver model protocol. - @retval FALSE The guid does not represent a driver model protocol. -**/ -BOOLEAN -IsDriverProt ( - IN CONST EFI_GUID *Guid - ) -{ - CONST EFI_GUID **GuidWalker; - BOOLEAN GuidFound; - GuidFound = FALSE; - for (GuidWalker = UefiDriverModelProtocolsGuidArray - ; GuidWalker != NULL && *GuidWalker != NULL - ; GuidWalker++ - ){ - if (CompareGuid(*GuidWalker, Guid)) { - GuidFound = TRUE; - break; - } - } - return (GuidFound); -} - -/** - Get information for a handle. - - @param[in] TheHandle The handles to show info on. - @param[in] Language Language string per UEFI specification. - @param[in] Separator Separator string between information blocks. - @param[in] Verbose TRUE for extra info, FALSE otherwise. - @param[in] ExtraInfo TRUE for extra info, FALSE otherwise. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid. -**/ -CHAR16* -GetProtocolInfoString( - IN CONST EFI_HANDLE TheHandle, - IN CONST CHAR8 *Language, - IN CONST CHAR16 *Separator, - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN ExtraInfo - ) -{ - EFI_GUID **ProtocolGuidArray; - UINTN ArrayCount; - UINTN ProtocolIndex; - EFI_STATUS Status; - CHAR16 *RetVal; - UINTN Size; - CHAR16 *Temp; - CHAR16 GuidStr[40]; - VOID *Instance; - CHAR16 InstanceStr[17]; - - ProtocolGuidArray = NULL; - RetVal = NULL; - Size = 0; - - Status = gBS->ProtocolsPerHandle ( - TheHandle, - &ProtocolGuidArray, - &ArrayCount - ); - if (!EFI_ERROR (Status)) { - for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { - Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language); - ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL)); - if (Size != 0) { - StrnCatGrow(&RetVal, &Size, Separator, 0); - } - StrnCatGrow(&RetVal, &Size, L"%H", 0); - if (Temp == NULL) { - UnicodeSPrint (GuidStr, sizeof (GuidStr), L"%g", ProtocolGuidArray[ProtocolIndex]); - StrnCatGrow (&RetVal, &Size, GuidStr, 0); - } else { - StrnCatGrow(&RetVal, &Size, Temp, 0); - FreePool(Temp); - } - StrnCatGrow(&RetVal, &Size, L"%N", 0); - - if(Verbose) { - Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance); - if (!EFI_ERROR (Status)) { - StrnCatGrow (&RetVal, &Size, L"(%H", 0); - UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%x", Instance); - StrnCatGrow (&RetVal, &Size, InstanceStr, 0); - StrnCatGrow (&RetVal, &Size, L"%N)", 0); - } - } - - if (ExtraInfo) { - Temp = GetProtocolInformationDump(TheHandle, ProtocolGuidArray[ProtocolIndex], Verbose); - if (Temp != NULL) { - ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL)); - if (!Verbose) { - StrnCatGrow(&RetVal, &Size, L"(", 0); - StrnCatGrow(&RetVal, &Size, Temp, 0); - StrnCatGrow(&RetVal, &Size, L")", 0); - } else { - StrnCatGrow(&RetVal, &Size, Separator, 0); - StrnCatGrow(&RetVal, &Size, Temp, 0); - } - FreePool(Temp); - } - } - } - } - - SHELL_FREE_NON_NULL(ProtocolGuidArray); - - if (RetVal == NULL) { - return (NULL); - } - - ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL)); - StrnCatGrow(&RetVal, &Size, Separator, 0); - return (RetVal); -} - -/** - Gets the name of the loaded image. - - @param[in] TheHandle The handle of the driver to get info on. - @param[out] Name The pointer to the pointer. Valid upon a successful return. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -GetDriverImageName ( - IN EFI_HANDLE TheHandle, - OUT CHAR16 **Name - ) -{ - // get loaded image and devicepathtotext on image->Filepath - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - - if (TheHandle == NULL || Name == NULL) { - return (EFI_INVALID_PARAMETER); - } - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR(Status)) { - return (Status); - } - DevicePath = LoadedImage->FilePath; - *Name = ConvertDevicePathToText(DevicePath, TRUE, TRUE); - return (EFI_SUCCESS); -} - -/** - Display driver model information for a given handle. - - @param[in] Handle The handle to display info on. - @param[in] BestName Use the best name? - @param[in] Language The language to output in. -**/ -EFI_STATUS -DisplayDriverModelHandle ( - IN EFI_HANDLE Handle, - IN BOOLEAN BestName, - IN CONST CHAR8 *Language OPTIONAL - ) -{ - EFI_STATUS Status; - BOOLEAN ConfigurationStatus; - BOOLEAN DiagnosticsStatus; - UINTN DriverBindingHandleCount; - EFI_HANDLE *DriverBindingHandleBuffer; - UINTN ParentControllerHandleCount; - EFI_HANDLE *ParentControllerHandleBuffer; - UINTN ChildControllerHandleCount; - EFI_HANDLE *ChildControllerHandleBuffer; - CHAR16 *TempStringPointer; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - UINTN Index; - CHAR16 *DriverName; - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; - UINTN NumberOfChildren; - UINTN HandleIndex; - UINTN ControllerHandleCount; - EFI_HANDLE *ControllerHandleBuffer; - UINTN ChildIndex; - BOOLEAN Image; - - DriverName = NULL; - - // - // See if Handle is a device handle and display its details. - // - DriverBindingHandleBuffer = NULL; - Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS ( - Handle, - &DriverBindingHandleCount, - &DriverBindingHandleBuffer - ); - - ParentControllerHandleBuffer = NULL; - Status = PARSE_HANDLE_DATABASE_PARENTS ( - Handle, - &ParentControllerHandleCount, - &ParentControllerHandleBuffer - ); - - ChildControllerHandleBuffer = NULL; - Status = ParseHandleDatabaseForChildControllers ( - Handle, - &ChildControllerHandleCount, - &ChildControllerHandleBuffer - ); - - DiagnosticsStatus = FALSE; - ConfigurationStatus = FALSE; - - if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ConfigurationStatus = TRUE; - } - if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ConfigurationStatus = TRUE; - } - if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - DiagnosticsStatus = TRUE; - } - if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - DiagnosticsStatus = TRUE; - } - - Status = EFI_SUCCESS; - - if (DriverBindingHandleCount > 0 || ParentControllerHandleCount > 0 || ChildControllerHandleCount > 0) { - - - - DevicePath = NULL; - TempStringPointer = NULL; - Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevicePath); - - Status = gEfiShellProtocol->GetDeviceName(Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer!=NULL?TempStringPointer:L""); - SHELL_FREE_NON_NULL(TempStringPointer); - - TempStringPointer = ConvertDevicePathToText(DevicePath, TRUE, FALSE); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER2), - gShellDriver1HiiHandle, - TempStringPointer!=NULL?TempStringPointer:L"", - ParentControllerHandleCount == 0?L"ROOT":(ChildControllerHandleCount > 0)?L"BUS":L"DEVICE", - ConfigurationStatus?L"YES":L"NO", - DiagnosticsStatus?L"YES":L"NO" - ); - - SHELL_FREE_NON_NULL(TempStringPointer); - - if (DriverBindingHandleCount == 0) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER3), - gShellDriver1HiiHandle, - L"" - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER3), - gShellDriver1HiiHandle, - L"" - ); - for (Index = 0; Index < DriverBindingHandleCount; Index++) { - Image = FALSE; - Status = GetDriverName ( - DriverBindingHandleBuffer[Index], - Language, - &DriverName - ); - if (EFI_ERROR (Status)) { - Status = GetDriverImageName ( - DriverBindingHandleBuffer[Index], - &DriverName - ); - if (EFI_ERROR (Status)) { - DriverName = NULL; - } - } - - if (Image) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER4A), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]), - DriverName!=NULL?DriverName:L"" - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER4B), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]), - DriverName!=NULL?DriverName:L"" - ); - } - SHELL_FREE_NON_NULL(DriverName); - } - } - - if (ParentControllerHandleCount == 0) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER5), - gShellDriver1HiiHandle, - L"" - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER5), - gShellDriver1HiiHandle, - L"" - ); - for (Index = 0; Index < ParentControllerHandleCount; Index++) { - Status = gEfiShellProtocol->GetDeviceName(ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER5B), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (ParentControllerHandleBuffer[Index]), - TempStringPointer!=NULL?TempStringPointer:L"" - ); - SHELL_FREE_NON_NULL(TempStringPointer); - } - } - - if (ChildControllerHandleCount == 0) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER6), - gShellDriver1HiiHandle, - L"" - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER6), - gShellDriver1HiiHandle, - L"" - ); - for (Index = 0; Index < ChildControllerHandleCount; Index++) { - Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (ChildControllerHandleBuffer[Index]), - TempStringPointer!=NULL?TempStringPointer:L"" - ); - SHELL_FREE_NON_NULL(TempStringPointer); - } - } - } - - SHELL_FREE_NON_NULL(DriverBindingHandleBuffer); - - SHELL_FREE_NON_NULL(ParentControllerHandleBuffer); - - SHELL_FREE_NON_NULL(ChildControllerHandleBuffer); - - if (EFI_ERROR (Status)) { - return Status; - } - // - // See if Handle is a driver binding handle and display its details. - // - Status = gBS->OpenProtocol ( - Handle, - &gEfiDriverBindingProtocolGuid, - (VOID **) &DriverBinding, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return EFI_SUCCESS; - } - - NumberOfChildren = 0; - ControllerHandleBuffer = NULL; - Status = PARSE_HANDLE_DATABASE_DEVICES ( - Handle, - &ControllerHandleCount, - &ControllerHandleBuffer - ); - if (ControllerHandleCount > 0) { - for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) { - Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN ( - Handle, - ControllerHandleBuffer[HandleIndex], - &ChildControllerHandleCount, - NULL - ); - NumberOfChildren += ChildControllerHandleCount; - } - } - - Status = GetDriverName (Handle, Language, &DriverName); - if (EFI_ERROR (Status)) { - DriverName = NULL; - } - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER7), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(Handle), - DriverName!=NULL?DriverName:L"" - ); - SHELL_FREE_NON_NULL(DriverName); - Status = GetDriverImageName ( - Handle, - &DriverName - ); - if (EFI_ERROR (Status)) { - DriverName = NULL; - } - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER7B), - gShellDriver1HiiHandle, - DriverName!=NULL?DriverName:L"" - ); - SHELL_FREE_NON_NULL(DriverName); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER8), - gShellDriver1HiiHandle, - DriverBinding->Version, - NumberOfChildren > 0?L"Bus":ControllerHandleCount > 0?L"Device":L"", - ConfigurationStatus?L"YES":L"NO", - DiagnosticsStatus?L"YES":L"NO" - ); - - if (ControllerHandleCount == 0) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER9), - gShellDriver1HiiHandle, - L"None" - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER9), - gShellDriver1HiiHandle, - L"" - ); - for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) { - Status = gEfiShellProtocol->GetDeviceName(ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER9B), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(ControllerHandleBuffer[HandleIndex]), - TempStringPointer!=NULL?TempStringPointer:L"" - ); - SHELL_FREE_NON_NULL(TempStringPointer); - - Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN ( - Handle, - ControllerHandleBuffer[HandleIndex], - &ChildControllerHandleCount, - &ChildControllerHandleBuffer - ); - if (!EFI_ERROR (Status)) { - for (ChildIndex = 0; ChildIndex < ChildControllerHandleCount; ChildIndex++) { - Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_DRIVER6C), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(ChildControllerHandleBuffer[ChildIndex]), - TempStringPointer!=NULL?TempStringPointer:L"" - ); - SHELL_FREE_NON_NULL(TempStringPointer); - } - - SHELL_FREE_NON_NULL (ChildControllerHandleBuffer); - } - } - - SHELL_FREE_NON_NULL (ControllerHandleBuffer); - } - - return EFI_SUCCESS; -} - -/** - Display information for a handle. - - @param[in] TheHandle The handles to show info on. - @param[in] Verbose TRUE for extra info, FALSE otherwise. - @param[in] Sfo TRUE to output in standard format output (spec). - @param[in] Language Language string per UEFI specification. - @param[in] DriverInfo TRUE to show all info about the handle. - @param[in] Multiple TRUE indicates more than will be output, - FALSE for a single one. -**/ -VOID -DoDhByHandle( - IN CONST EFI_HANDLE TheHandle, - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Sfo, - IN CONST CHAR8 *Language, - IN CONST BOOLEAN DriverInfo, - IN CONST BOOLEAN Multiple - ) -{ - CHAR16 *ProtocolInfoString; - - ProtocolInfoString = NULL; - - if (!Sfo) { - if (Multiple) { - ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", Verbose, TRUE); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(TheHandle), - ProtocolInfoString==NULL?L"":ProtocolInfoString - ); - } else { - ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, Verbose ? L"\r\n" : L" ", Verbose, TRUE); - if (Verbose) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_SINGLE), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(TheHandle), - TheHandle, - ProtocolInfoString==NULL?L"":ProtocolInfoString - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_SINGLE_D), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(TheHandle), - ProtocolInfoString==NULL?L"":ProtocolInfoString - ); - } - } - - if (DriverInfo) { - DisplayDriverModelHandle ((EFI_HANDLE)TheHandle, TRUE, Language); - } - } else { - ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", FALSE, FALSE); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DH_OUTPUT_SFO), - gShellDriver1HiiHandle, - Multiple ?L"HandlesInfo":L"HandleInfo", - L"DriverName", - L"ControllerName", - ConvertHandleToHandleIndex(TheHandle), - L"DevPath", - ProtocolInfoString==NULL?L"":ProtocolInfoString - ); - } - - if (ProtocolInfoString != NULL) { - FreePool(ProtocolInfoString); - } -} - -/** - Display information for all handles on a list. - - @param[in] HandleList The NULL-terminated list of handles. - @param[in] Verbose TRUE for extra info, FALSE otherwise. - @param[in] Sfo TRUE to output in standard format output (spec). - @param[in] Language Language string per UEFI specification. - @param[in] DriverInfo TRUE to show all info about the handle. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_ABORTED The operation was aborted. -**/ -SHELL_STATUS -DoDhForHandleList( - IN CONST EFI_HANDLE *HandleList, - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Sfo, - IN CONST CHAR8 *Language, - IN CONST BOOLEAN DriverInfo - ) -{ - CONST EFI_HANDLE *HandleWalker; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - for (HandleWalker = HandleList; HandleWalker != NULL && *HandleWalker != NULL; HandleWalker++) { - DoDhByHandle (*HandleWalker, Verbose, Sfo, Language, DriverInfo, TRUE); - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - break; - } - } - return (ShellStatus); -} - -/** - Display information for a GUID of protocol. - - @param[in] Guid The pointer to the name of the protocol. - @param[in] Verbose TRUE for extra info, FALSE otherwise. - @param[in] Sfo TRUE to output in standard format output (spec). - @param[in] Language Language string per UEFI specification. - @param[in] DriverInfo TRUE to show all info about the handle. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_NOT_FOUND The GUID was not found. - @retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid. -**/ -SHELL_STATUS -DoDhByProtocolGuid( - IN CONST GUID *Guid, - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Sfo, - IN CONST CHAR8 *Language, - IN CONST BOOLEAN DriverInfo - ) -{ - CHAR16 *Name; - SHELL_STATUS ShellStatus; - EFI_HANDLE *HandleList; - - if (!Sfo) { - if (Guid == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_ALL_HEADER), gShellDriver1HiiHandle); - } else { - Name = GetStringNameFromGuid (Guid, NULL); - if (Name == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_GUID_HEADER), gShellDriver1HiiHandle, Guid); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_NAME_HEADER), gShellDriver1HiiHandle, Name); - } - } - } - HandleList = GetHandleListByProtocol(Guid); - ShellStatus = DoDhForHandleList(HandleList, Verbose, Sfo, Language, DriverInfo); - SHELL_FREE_NON_NULL(HandleList); - - return ShellStatus; -} - -/** - Function to determine use which method to print information. - If Protocol is NULL, The function will print all information. - - @param[in] Protocol The pointer to the name or GUID of protocol or NULL. - @param[in] Verbose TRUE for extra info, FALSE otherwise. - @param[in] Sfo TRUE to output in standard format output (spec). - @param[in] Language Language string per UEFI specification. - @param[in] DriverInfo TRUE to show all info about the handle. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_NOT_FOUND The protocol was not found. - @retval SHELL_INVALID_PARAMETER Protocol is invalid parameter. -**/ -SHELL_STATUS -DoDhByProtocol ( - IN CONST CHAR16 *Protocol, - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Sfo, - IN CONST CHAR8 *Language, - IN CONST BOOLEAN DriverInfo - ) -{ - EFI_GUID Guid; - EFI_GUID *GuidPtr; - EFI_STATUS Status; - - if (Protocol == NULL) { - return DoDhByProtocolGuid (NULL, Verbose, Sfo, Language, DriverInfo); - } else { - Status = ConvertStrToGuid (Protocol, &Guid); - if (!EFI_ERROR (Status)) { - GuidPtr = &Guid; - } else { - // - // Protocol is a Name, convert it to GUID - // - Status = GetGuidFromStringName (Protocol, Language, &GuidPtr); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_NAME_FOUND), gShellDriver1HiiHandle, Protocol); - return (SHELL_NOT_FOUND); - } - } - - return DoDhByProtocolGuid (GuidPtr, Verbose, Sfo, Language, DriverInfo); - } -} - -/** - Function to display decode information by Protocol. - The parameter Protocol is either a GUID or the name of protocol. - If the parameter Protocol is NULL, the function will print all - decode information. - - @param[in] Protocol The pointer to the name or GUID of protocol. - @param[in] Language Language string per UEFI specification. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_OUT_OT_RESOURCES A memory allocation failed. -**/ -SHELL_STATUS -DoDecodeByProtocol( - IN CONST CHAR16 *Protocol, - IN CONST CHAR8 *Language - ) -{ - EFI_STATUS Status; - EFI_GUID *Guids; - EFI_GUID Guid; - UINTN Counts; - UINTN Index; - CHAR16 *Name; - - if (Protocol == NULL) { - Counts = 0; - Status = GetAllMappingGuids (NULL, &Counts); - if (Status == EFI_BUFFER_TOO_SMALL) { - Guids = AllocatePool (Counts * sizeof(EFI_GUID)); - if (Guids == NULL) { - return SHELL_OUT_OF_RESOURCES; - } - - Status = GetAllMappingGuids (Guids, &Counts); - if (Status == EFI_SUCCESS) { - for (Index = 0; Index < Counts; Index++) { - Name = GetStringNameFromGuid (&Guids[Index], Language); - if (Name != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Name, &Guids[Index]); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guids[Index]); - } - SHELL_FREE_NON_NULL (Name); - } - } - FreePool (Guids); - } - } else { - if (ConvertStrToGuid (Protocol, &Guid) == EFI_SUCCESS) { - Name = GetStringNameFromGuid (&Guid, Language); - if (Name != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Name, &Guid); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guid); - } - SHELL_FREE_NON_NULL(Name); - } else { - Status = GetGuidFromStringName (Protocol, Language, &Guids); - if (Status == EFI_SUCCESS) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DECODE), gShellDriver1HiiHandle, Protocol, Guids); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_NAME_FOUND), gShellDriver1HiiHandle, Protocol); - } - } - } - - return SHELL_SUCCESS; -} - -/** - Function for 'dh' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDh ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR8 *Language; - CONST CHAR16 *Lang; - CONST CHAR16 *RawValue; - CONST CHAR16 *ProtocolVal; - BOOLEAN SfoFlag; - BOOLEAN DriverFlag; - BOOLEAN VerboseFlag; - UINT64 Intermediate; - EFI_HANDLE Handle; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Language = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"dh", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } - - if (ShellCommandLineGetFlag(Package, L"-l")) { - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } else { - ASSERT(Language == NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-l"); - ShellCommandLineFreeVarList(Package); - return (SHELL_INVALID_PARAMETER); - } - } else { - Language = AllocateZeroPool(10); - AsciiSPrint(Language, 10, "en-us"); - } - - SfoFlag = ShellCommandLineGetFlag (Package, L"-sfo"); - DriverFlag = ShellCommandLineGetFlag (Package, L"-d"); - VerboseFlag = (BOOLEAN)(ShellCommandLineGetFlag (Package, L"-v") || ShellCommandLineGetFlag (Package, L"-verbose")); - RawValue = ShellCommandLineGetRawValue (Package, 1); - ProtocolVal = ShellCommandLineGetValue (Package, L"-p"); - - if (RawValue == NULL) { - if (ShellCommandLineGetFlag (Package, L"-p") && (ProtocolVal == NULL)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-p"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Print information by protocol, The ProtocolVal maybe is name or GUID or NULL. - // - ShellStatus = DoDhByProtocol (ProtocolVal, VerboseFlag, SfoFlag, Language, DriverFlag); - } - } else if ((RawValue != NULL) && - (gUnicodeCollation->StriColl(gUnicodeCollation, L"decode", (CHAR16 *) RawValue) == 0)) { - if (ShellCommandLineGetFlag (Package, L"-p") && (ProtocolVal == NULL)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-p"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Print decode informatino by protocol. - // - ShellStatus = DoDecodeByProtocol (ProtocolVal, Language); - } - } else { - if (ShellCommandLineGetFlag (Package, L"-p")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64 (RawValue, &Intermediate, TRUE, FALSE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Handle = ConvertHandleIndexToHandle ((UINTN) Intermediate); - if (Handle == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Print information by handle. - // - DoDhByHandle (Handle, VerboseFlag, SfoFlag, Language, DriverFlag, FALSE); - } - } - } - } - - ShellCommandLineFreeVarList (Package); - SHELL_FREE_NON_NULL(Language); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c deleted file mode 100644 index 178ab49..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c +++ /dev/null @@ -1,204 +0,0 @@ -/** @file - Main file for Disconnect shell Driver1 function. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-r", TypeFlag}, - {L"-nc", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Disconnect everything. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -DisconnectAll( - VOID - ) -{ - // - // Stolen from UEFI 2.3 spec (May 2009 version) - // Pages 171/172 - // Removed gBS local definition - // - - // - // Disconnect All Handles Example - // The following example recusively disconnects all drivers from all - // controllers in a platform. - // - EFI_STATUS Status; -// EFI_BOOT_SERVICES *gBS; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN HandleIndex; - // - // Retrieve the list of all handles from the handle database - // - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - &HandleCount, - &HandleBuffer - ); - if (!EFI_ERROR (Status)) { - for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { - Status = gBS->DisconnectController ( - HandleBuffer[HandleIndex], - NULL, - NULL - ); - } - gBS->FreePool(HandleBuffer); - // - // end of stealing - // - } - return (EFI_SUCCESS); -} - -/** - Function for 'disconnect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDisconnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Param1; - CONST CHAR16 *Param2; - CONST CHAR16 *Param3; - EFI_HANDLE Handle1; - EFI_HANDLE Handle2; - EFI_HANDLE Handle3; - UINT64 Intermediate1; - UINT64 Intermediate2; - UINT64 Intermediate3; - - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"disconnect", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetFlag(Package, L"-r")){ - if (ShellCommandLineGetCount(Package) > 1){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = DisconnectAll (); - // - // Reconnect all consoles if -nc is not provided - // - if (!ShellCommandLineGetFlag (Package, L"-nc")){ - ShellConnectFromDevPaths (L"ConInDev"); - ShellConnectFromDevPaths (L"ConOutDev"); - ShellConnectFromDevPaths (L"ErrOutDev"); - ShellConnectFromDevPaths (L"ErrOut"); - ShellConnectFromDevPaths (L"ConIn"); - ShellConnectFromDevPaths (L"ConOut"); - } - } - } else if (ShellCommandLineGetFlag (Package, L"-nc")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetCount(Package) > 4){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // must have between 1 and 3 handles passed in ... - // - Param1 = ShellCommandLineGetRawValue(Package, 1); - Param2 = ShellCommandLineGetRawValue(Package, 2); - Param3 = ShellCommandLineGetRawValue(Package, 3); - ShellConvertStringToUint64(Param1, &Intermediate1, TRUE, FALSE); - Handle1 = Param1!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate1):NULL; - ShellConvertStringToUint64(Param2, &Intermediate2, TRUE, FALSE); - Handle2 = Param2!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate2):NULL; - ShellConvertStringToUint64(Param3, &Intermediate3, TRUE, FALSE); - Handle3 = Param3!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate3):NULL; - - if (Param1 != NULL && Handle1 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Param2 != NULL && Handle2 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param2); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Param3 != NULL && Handle3 == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param3); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ASSERT(Param2 != NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, L"disconnect", ShellStrToUintn(Param2), L"driver handle"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(Param1 != NULL); - Status = gBS->DisconnectController(Handle1, Handle2, Handle3); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_3P_RESULT), gShellDriver1HiiHandle, L"Disconnect", (UINTN)Intermediate1, (UINTN)Intermediate2, (UINTN)Intermediate3, Status); - } - } - } - } - if (ShellStatus == SHELL_SUCCESS) { - if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - } - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c deleted file mode 100644 index 91b19c4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ /dev/null @@ -1,429 +0,0 @@ -/** @file - Main file for Drivers shell Driver1 function. - - (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -#define MAX_LEN_DRIVER_NAME 35 - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-sfo", TypeFlag}, - {L"-l", TypeValue}, - {NULL, TypeMax} - }; - -/** - Get a device path (in text format) for a given handle. - - @param[in] TheHandle The handle to get the device path for. - - @retval NULL An error occured. - @return A pointer to the driver path as a string. The callee must - free this memory. -**/ -CHAR16* -GetDevicePathTextForHandle( - IN EFI_HANDLE TheHandle - ) -{ - EFI_STATUS Status; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; - EFI_DEVICE_PATH_PROTOCOL *FinalPath; - CHAR16 *RetVal; - - FinalPath = NULL; - - Status = gBS->OpenProtocol ( - TheHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&ImageDevicePath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - FinalPath = AppendDevicePath (ImageDevicePath, LoadedImage->FilePath); - gBS->CloseProtocol( - LoadedImage->DeviceHandle, - &gEfiDevicePathProtocolGuid, - gImageHandle, - NULL); - } - gBS->CloseProtocol( - TheHandle, - &gEfiLoadedImageProtocolGuid, - gImageHandle, - NULL); - } - - if (FinalPath == NULL) { - return (NULL); - } - RetVal = gEfiShellProtocol->GetFilePathFromDevicePath(FinalPath); - if (RetVal == NULL) { - RetVal = ConvertDevicePathToText(FinalPath, TRUE, TRUE); - } - FreePool(FinalPath); - return (RetVal); -} - -/** - Determine if the given handle has Driver Configuration protocol. - - @param[in] TheHandle The handle to the driver to test. - - @retval TRUE The driver does have Driver Configuration. - @retval FALSE The driver does not have Driver Configuration. -**/ -BOOLEAN -ReturnDriverConfig( - IN CONST EFI_HANDLE TheHandle - ) -{ - EFI_STATUS Status; - Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverConfigurationProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL); - if (EFI_ERROR(Status)) { - return (FALSE); - } - return (TRUE); -} - -/** - Determine if the given handle has DriverDiagnostics protocol. - - @param[in] TheHandle The handle to the driver to test. - - @retval TRUE The driver does have Driver Diasgnostics. - @retval FALSE The driver does not have Driver Diagnostics. -**/ -BOOLEAN -ReturnDriverDiag( - IN CONST EFI_HANDLE TheHandle - ) -{ - EFI_STATUS Status; - Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL); - if (EFI_ERROR(Status)) { - Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverDiagnosticsProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL); - if (EFI_ERROR(Status)) { - return (FALSE); - } - } - return (TRUE); -} - -/** - Finds and returns the version of the driver specified by TheHandle. - - @param[in] TheHandle The driver handle to get the version of. - - @return The version of the driver. - @retval 0xFFFFFFFF An error ocurred. -**/ -UINT32 -ReturnDriverVersion( - IN CONST EFI_HANDLE TheHandle - ) -{ - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; - EFI_STATUS Status; - UINT32 RetVal; - - RetVal = (UINT32)-1; - - Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverBindingProtocolGuid, (VOID**)&DriverBinding, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - RetVal = DriverBinding->Version; - gBS->CloseProtocol(TheHandle, &gEfiDriverBindingProtocolGuid, gImageHandle, NULL); - } - return (RetVal); -} - -/** - Get image name from Image Handle. - - @param[in] Handle Image Handle - - @return A pointer to the image name as a string. -**/ -CHAR16 * -GetImageNameFromHandle ( - IN CONST EFI_HANDLE Handle - ) -{ - EFI_STATUS Status; - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; - EFI_DEVICE_PATH_PROTOCOL *DevPathNode; - EFI_GUID *NameGuid; - CHAR16 *ImageName; - UINTN BufferSize; - UINT32 AuthenticationStatus; - EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2; - - LoadedImage = NULL; - DriverBinding = NULL; - ImageName = NULL; - - Status = gBS->OpenProtocol ( - Handle, - &gEfiDriverBindingProtocolGuid, - (VOID **) &DriverBinding, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return NULL; - } - Status = gBS->OpenProtocol ( - DriverBinding->ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID**)&LoadedImage, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR (Status)) { - DevPathNode = LoadedImage->FilePath; - if (DevPathNode == NULL) { - return NULL; - } - while (!IsDevicePathEnd (DevPathNode)) { - NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode); - if (NameGuid != NULL) { - Status = gBS->HandleProtocol ( - LoadedImage->DeviceHandle, - &gEfiFirmwareVolume2ProtocolGuid, - (VOID **)&Fv2 - ); - if (!EFI_ERROR (Status)) { - Status = Fv2->ReadSection ( - Fv2, - NameGuid, - EFI_SECTION_USER_INTERFACE, - 0, - (VOID **)&ImageName, - &BufferSize, - &AuthenticationStatus - ); - if (!EFI_ERROR (Status)) { - break; - } - ImageName = NULL; - } - } - // - // Next device path node - // - DevPathNode = NextDevicePathNode (DevPathNode); - } - if (ImageName == NULL) { - ImageName = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); - } - } - return ImageName; -} - -/** - Function for 'drivers' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrivers ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR8 *Language; - CONST CHAR16 *Lang; - EFI_HANDLE *HandleList; - EFI_HANDLE *HandleWalker; - UINTN ChildCount; - UINTN DeviceCount; - CHAR16 ChildCountStr[3]; - CHAR16 DeviceCountStr[3]; - CHAR16 *Temp2; - CONST CHAR16 *FullDriverName; - CHAR16 *TruncatedDriverName; - CHAR16 *ImageName; - CHAR16 *FormatString; - UINT32 DriverVersion; - BOOLEAN DriverConfig; - BOOLEAN DriverDiag; - BOOLEAN SfoFlag; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Language = NULL; - FormatString = NULL; - SfoFlag = FALSE; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drivers", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drivers"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetFlag(Package, L"-l")){ - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } else { - ASSERT(Language == NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drivers", L"-l"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } - } - - if (ShellCommandLineGetFlag (Package, L"-sfo")) { - SfoFlag = TRUE; - FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language); - // - // print the SFO header - // - ShellPrintHiiEx ( - -1, - -1, - Language, - STRING_TOKEN (STR_GEN_SFO_HEADER), - gShellDriver1HiiHandle, - L"drivers"); - } else { - FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language); - // - // print the header row - // - ShellPrintHiiEx( - -1, - -1, - Language, - STRING_TOKEN (STR_DRIVERS_HEADER_LINES), - gShellDriver1HiiHandle); - } - - HandleList = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid); - for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL ; HandleWalker++){ - ChildCount = 0; - DeviceCount = 0; - Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL); - Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL); - Temp2 = GetDevicePathTextForHandle(*HandleWalker); - DriverVersion = ReturnDriverVersion(*HandleWalker); - DriverConfig = ReturnDriverConfig(*HandleWalker); - DriverDiag = ReturnDriverDiag (*HandleWalker); - FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); - ImageName = GetImageNameFromHandle (*HandleWalker); - - UnicodeValueToStringS (ChildCountStr, sizeof (ChildCountStr), 0, ChildCount, 0); - UnicodeValueToStringS (DeviceCountStr, sizeof (DeviceCountStr), 0, DeviceCount, 0); - TruncatedDriverName = NULL; - if (!SfoFlag && (FullDriverName != NULL)) { - TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16)); - StrnCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName, MAX_LEN_DRIVER_NAME); - } - - if (!SfoFlag) { - ShellPrintEx ( - -1, - -1, - FormatString, - ConvertHandleToHandleIndex (*HandleWalker), - DriverVersion, - ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'), - DriverConfig ? L'X' : L'-', - DriverDiag ? L'X' : L'-', - DeviceCount > 0 ? DeviceCountStr : L"-", - ChildCount > 0 ? ChildCountStr : L"-", - TruncatedDriverName, - ImageName == NULL ? L"" : ImageName - ); - } else { - ShellPrintEx ( - -1, - -1, - FormatString, - ConvertHandleToHandleIndex (*HandleWalker), - DriverVersion, - ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'), - DriverConfig ? L'Y' : L'N', - DriverDiag ? L'Y' : L'N', - DeviceCount, - ChildCount, - FullDriverName, - Temp2 == NULL ? L"" : Temp2 - ); - } - if (TruncatedDriverName != NULL) { - FreePool (TruncatedDriverName); - } - if (Temp2 != NULL) { - FreePool(Temp2); - } - if (ImageName != NULL) { - FreePool (ImageName); - } - - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - break; - } - } - } - SHELL_FREE_NON_NULL(Language); - ShellCommandLineFreeVarList (Package); - SHELL_FREE_NON_NULL(FormatString); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c deleted file mode 100644 index bb07916..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c +++ /dev/null @@ -1,1412 +0,0 @@ -/** @file - Main file for DrvCfg shell Driver1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" -#include -#include - -STATIC CONST EFI_GUID *CfgGuidList[] = {&gEfiDriverConfigurationProtocolGuid, &gEfiDriverConfiguration2ProtocolGuid, NULL}; - -/** - Find the EFI_HII_HANDLE by device path. - - @param[in] DevPath1 The Device Path to match. - @param[out] HiiHandle The EFI_HII_HANDLE after the converstion. - @param[in] HiiDb The Hii database protocol - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND There was no EFI_HII_HANDLE found for that deviec path. -**/ -EFI_STATUS -FindHiiHandleViaDevPath( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath1, - OUT EFI_HII_HANDLE *HiiHandle, - IN EFI_HII_DATABASE_PROTOCOL *HiiDb - ) -{ - EFI_HII_HANDLE *HandleBuffer; - UINTN HandleBufferSize; - VOID *MainBuffer; - UINTN MainBufferSize; - EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader; - EFI_HII_PACKAGE_HEADER *PackageHeader; - UINTN LoopVariable; - EFI_DEVICE_PATH_PROTOCOL *DevPath2; - EFI_STATUS Status; - - ASSERT(DevPath1 != NULL); - ASSERT(HiiHandle != NULL); - ASSERT(*HiiHandle == NULL); - ASSERT(HiiDb != NULL); - - HandleBufferSize = 0; - HandleBuffer = NULL; - Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleBuffer = AllocateZeroPool(HandleBufferSize); - if (HandleBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = HiiDb->ListPackageLists (HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer); - } - } - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(HandleBuffer); - return (Status); - } - - if (HandleBuffer == NULL) { - return EFI_NOT_FOUND; - } - - for (LoopVariable = 0 ; LoopVariable < (HandleBufferSize/sizeof(HandleBuffer[0])) && *HiiHandle == NULL ; LoopVariable++) { - MainBufferSize = 0; - MainBuffer = NULL; - Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - MainBuffer = AllocateZeroPool(MainBufferSize); - if (MainBuffer != NULL) { - Status = HiiDb->ExportPackageLists (HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer); - } - } - if (EFI_ERROR (Status)) { - continue; - } - // - // Enumerate through the block of returned memory. - // This should actually be a small block, but we need to be sure. - // - for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer - ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && *HiiHandle == NULL - ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) { - for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER)) - ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END && *HiiHandle == NULL - ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) { - if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) { - DevPath2 = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)); - if (DevicePathCompare(&DevPath1, &DevPath2) == 0) { - *HiiHandle = HandleBuffer[LoopVariable]; - break; - } - } - } - } - SHELL_FREE_NON_NULL(MainBuffer); - } - SHELL_FREE_NON_NULL(HandleBuffer); - - if (*HiiHandle == NULL) { - return (EFI_NOT_FOUND); - } - return (EFI_SUCCESS); -} - -/** - Convert a EFI_HANDLE to a EFI_HII_HANDLE. - - @param[in] Handle The EFI_HANDLE to convert. - @param[out] HiiHandle The EFI_HII_HANDLE after the converstion. - @param[in] HiiDb The Hii database protocol - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ConvertHandleToHiiHandle( - IN CONST EFI_HANDLE Handle, - OUT EFI_HII_HANDLE *HiiHandle, - IN EFI_HII_DATABASE_PROTOCOL *HiiDb - ) -{ - EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *DevPath1; - - if (HiiHandle == NULL || HiiDb == NULL) { - return (EFI_INVALID_PARAMETER); - } - *HiiHandle = NULL; - - if (Handle == NULL) { - return (EFI_SUCCESS); - } - - DevPath1 = NULL; - Status = gBS->OpenProtocol(Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath1, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(Status) || DevPath1 == NULL) { - return (EFI_NOT_FOUND); - } - - return (FindHiiHandleViaDevPath(DevPath1, HiiHandle, HiiDb)); -} - -/** - Function to print out all HII configuration information to a file. - - @param[in] Handle The handle to get info on. NULL to do all handles. - @param[in] FileName The filename to rwite the info to. -**/ -SHELL_STATUS -ConfigToFile( - IN CONST EFI_HANDLE Handle, - IN CONST CHAR16 *FileName - ) -{ - EFI_HII_DATABASE_PROTOCOL *HiiDatabase; - EFI_STATUS Status; - VOID *MainBuffer; - UINTN MainBufferSize; - EFI_HII_HANDLE HiiHandle; - SHELL_FILE_HANDLE FileHandle; - - HiiDatabase = NULL; - MainBufferSize = 0; - MainBuffer = NULL; - FileHandle = NULL; - - Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_FILE_OPEN_FAIL), - gShellDriver1HiiHandle, - L"drvcfg", - FileName, - Status); - return (SHELL_DEVICE_ERROR); - } - - // - // Locate HII Database protocol - // - Status = gBS->LocateProtocol ( - &gEfiHiiDatabaseProtocolGuid, - NULL, - (VOID **) &HiiDatabase - ); - - if (EFI_ERROR(Status) || HiiDatabase == NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_PROTOCOL_NF), - gShellDriver1HiiHandle, - L"drvcfg", - L"EfiHiiDatabaseProtocol", - &gEfiHiiDatabaseProtocolGuid); - ShellCloseFile(&FileHandle); - return (SHELL_NOT_FOUND); - } - - HiiHandle = NULL; - Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_HANDLE_NOT), - gShellDriver1HiiHandle, - L"drvcfg", - ConvertHandleToHandleIndex(Handle), - L"Device"); - ShellCloseFile(&FileHandle); - return (SHELL_DEVICE_ERROR); - } - - Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - MainBuffer = AllocateZeroPool(MainBufferSize); - Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer); - } - - Status = ShellWriteFile(FileHandle, &MainBufferSize, MainBuffer); - - ShellCloseFile(&FileHandle); - SHELL_FREE_NON_NULL(MainBuffer); - - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_FILE_WRITE_FAIL), - gShellDriver1HiiHandle, - L"drvcfg", - FileName); - return (SHELL_DEVICE_ERROR); - } - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_DRVCFG_COMP), - gShellDriver1HiiHandle); - - return (SHELL_SUCCESS); -} - -/** - Function to read in HII configuration information from a file. - - @param[in] Handle The handle to get info for. - @param[in] FileName The filename to read the info from. -**/ -SHELL_STATUS -ConfigFromFile( - IN EFI_HANDLE Handle, - IN CONST CHAR16 *FileName - ) -{ - EFI_HII_DATABASE_PROTOCOL *HiiDatabase; - EFI_STATUS Status; - VOID *MainBuffer; - UINT64 Temp; - UINTN MainBufferSize; - EFI_HII_HANDLE HiiHandle; - SHELL_FILE_HANDLE FileHandle; - CHAR16 *TempDevPathString; - EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader; - EFI_HII_PACKAGE_HEADER *PackageHeader; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - UINTN HandleIndex; - - HiiDatabase = NULL; - MainBufferSize = 0; - MainBuffer = NULL; - FileHandle = NULL; - - Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_FILE_OPEN_FAIL), - gShellDriver1HiiHandle, - L"drvcfg", - FileName, - Status); - return (SHELL_DEVICE_ERROR); - } - - // - // Locate HII Database protocol - // - Status = gBS->LocateProtocol ( - &gEfiHiiDatabaseProtocolGuid, - NULL, - (VOID **) &HiiDatabase - ); - - if (EFI_ERROR(Status) || HiiDatabase == NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_PROTOCOL_NF), - gShellDriver1HiiHandle, - L"drvcfg", - L"EfiHiiDatabaseProtocol", - &gEfiHiiDatabaseProtocolGuid); - ShellCloseFile(&FileHandle); - return (SHELL_NOT_FOUND); - } - - Status = ShellGetFileSize(FileHandle, &Temp); - MainBufferSize = (UINTN)Temp; - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_FILE_READ_FAIL), - gShellDriver1HiiHandle, - L"drvcfg", - FileName); - - ShellCloseFile(&FileHandle); - return (SHELL_DEVICE_ERROR); - } - MainBuffer = AllocateZeroPool((UINTN)MainBufferSize); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_OUT_MEM), - gShellDriver1HiiHandle, L"drvcfg"); - ShellCloseFile(&FileHandle); - return (SHELL_DEVICE_ERROR); - } - Status = ShellReadFile(FileHandle, &MainBufferSize, MainBuffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_FILE_READ_FAIL), - gShellDriver1HiiHandle, - L"drvcfg", - FileName); - - ShellCloseFile(&FileHandle); - SHELL_FREE_NON_NULL(MainBuffer); - return (SHELL_DEVICE_ERROR); - } - - ShellCloseFile(&FileHandle); - - if (Handle != NULL) { - // - // User override in place. Just do it. - // - HiiHandle = NULL; - Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_HANDLE_NOT), - gShellDriver1HiiHandle, L"drvcfg", - ConvertHandleToHandleIndex(Handle), - L"Device"); - ShellCloseFile(&FileHandle); - return (SHELL_DEVICE_ERROR); - } - Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, MainBuffer); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN), - gShellDriver1HiiHandle, - L"drvcfg", - L"HiiDatabase->UpdatePackageList", - Status); - return (SHELL_DEVICE_ERROR); - } - } else { - // - // we need to parse the buffer and try to match the device paths for each item to try to find it's device path. - // - - for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer - ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) - ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) { - for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER)) - ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END - ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) { - if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) { - HiiHandle = NULL; - Status = FindHiiHandleViaDevPath((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), &HiiHandle, HiiDatabase); - if (EFI_ERROR(Status)) { - // - // print out an error. - // - TempDevPathString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_DRVCFG_IN_FILE_NF), - gShellDriver1HiiHandle, - TempDevPathString); - SHELL_FREE_NON_NULL(TempDevPathString); - } else { - Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, PackageListHeader); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN), - gShellDriver1HiiHandle, - L"drvcfg", - L"HiiDatabase->UpdatePackageList", - Status); - return (SHELL_DEVICE_ERROR); - } else { - DevPath = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)); - gBS->LocateDevicePath(&gEfiHiiConfigAccessProtocolGuid, &DevPath, &Handle); - HandleIndex = ConvertHandleToHandleIndex(Handle); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_DRVCFG_DONE_HII), - gShellDriver1HiiHandle, - HandleIndex); - } - } - } - } - } - } - - SHELL_FREE_NON_NULL(MainBuffer); - - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_DRVCFG_COMP), - gShellDriver1HiiHandle); - return (SHELL_SUCCESS); -} - -/** - Present a requested action to the user. - - @param[in] DriverImageHandle The handle for the driver to configure. - @param[in] ControllerHandle The handle of the device being managed by the Driver specified. - @param[in] ChildHandle The handle of a child device of the specified device. - @param[in] ActionRequired The required HII action. - - @retval SHELL_INVALID_PARAMETER A parameter has a invalid value. -**/ -EFI_STATUS -ShellCmdDriverConfigurationProcessActionRequired ( - EFI_HANDLE DriverImageHandle, - EFI_HANDLE ControllerHandle, - EFI_HANDLE ChildHandle, - EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED ActionRequired - ) -{ - EFI_HANDLE ConnectControllerContextOverride[2]; - - switch (ActionRequired) { - case EfiDriverConfigurationActionNone: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle); - break; - - case EfiDriverConfigurationActionStopController: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_STOP), gShellDriver1HiiHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"stop controller"); - ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL); - - gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"stopped"); - break; - - case EfiDriverConfigurationActionRestartController: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"controller"); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart controller"); - ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL); - - gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle); - ConnectControllerContextOverride[0] = DriverImageHandle; - ConnectControllerContextOverride[1] = NULL; - gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"restarted"); - break; - - case EfiDriverConfigurationActionRestartPlatform: - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"platform"); - ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart platform"); - ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL); - - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - break; - - default: - return (EFI_INVALID_PARAMETER); - } - - return EFI_SUCCESS; -} - -/** - Do the configuration in an environment without HII. - - @param[in] Language The language code. - @param[in] ForceDefaults TRUE to force defaults, FALSE otherwise. - @param[in] DefaultType If ForceDefaults is TRUE, specifies the default type. - @param[in] AllChildren TRUE to configure all children, FALSE otherwise. - @param[in] ValidateOptions TRUE to validate existing options, FALSE otherwise. - @param[in] SetOptions TRUE to set options, FALSE otherwise. - @param[in] DriverImageHandle The handle for the driver to configure. - @param[in] DeviceHandle The handle of the device being managed by the Driver specified. - @param[in] ChildHandle The handle of a child device of the specified device. - - @retval SHELL_NOT_FOUND A specified handle could not be found. - @retval SHELL_INVALID_PARAMETER A parameter has a invalid value. -**/ -SHELL_STATUS -PreHiiDrvCfg ( - IN CONST CHAR8 *Language, - IN BOOLEAN ForceDefaults, - IN UINT32 DefaultType, - IN BOOLEAN AllChildren, - IN BOOLEAN ValidateOptions, - IN BOOLEAN SetOptions, - IN EFI_HANDLE DriverImageHandle, - IN EFI_HANDLE DeviceHandle, - IN EFI_HANDLE ChildHandle - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - UINTN OuterLoopCounter; - CHAR8 *BestLanguage; - UINTN DriverImageHandleCount; - EFI_HANDLE *DriverImageHandleBuffer; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN *HandleType; - UINTN LoopCounter; - UINTN ChildIndex; - UINTN ChildHandleCount; - EFI_HANDLE *ChildHandleBuffer; - UINTN *ChildHandleType; - EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED ActionRequired; - EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration; - BOOLEAN Iso639Language; - UINTN HandleIndex1; - UINTN HandleIndex2; - UINTN HandleIndex3; - - ShellStatus = SHELL_SUCCESS; - - if (ChildHandle == NULL && AllChildren) { - SetOptions = FALSE; - } - - if (ForceDefaults) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_FORCE_D), - gShellDriver1HiiHandle, - DefaultType); - } else if (ValidateOptions) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_VALIDATE), - gShellDriver1HiiHandle); - } else if (SetOptions) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_SET), - gShellDriver1HiiHandle); - } - - if (DriverImageHandle == 0) { - DriverImageHandleBuffer = GetHandleListByProtocolList(CfgGuidList); - if (DriverImageHandleBuffer == NULL) { - ShellStatus = SHELL_NOT_FOUND; - goto Done; - } - for ( - HandleBuffer = DriverImageHandleBuffer, DriverImageHandleCount = 0 - ; HandleBuffer != NULL && *HandleBuffer != NULL - ; HandleBuffer++,DriverImageHandleCount++); - } else { - DriverImageHandleCount = 1; - // - // Allocate buffer to hold the image handle so as to - // keep consistent with the above clause - // - DriverImageHandleBuffer = AllocatePool (sizeof (EFI_HANDLE)); - ASSERT (DriverImageHandleBuffer); - DriverImageHandleBuffer[0] = DriverImageHandle; - } - - for (OuterLoopCounter = 0; OuterLoopCounter < DriverImageHandleCount; OuterLoopCounter++) { - Iso639Language = FALSE; - Status = gBS->OpenProtocol ( - DriverImageHandleBuffer[OuterLoopCounter], - &gEfiDriverConfiguration2ProtocolGuid, - (VOID **) &DriverConfiguration, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - Iso639Language = TRUE; - Status = gBS->OpenProtocol ( - DriverImageHandleBuffer[OuterLoopCounter], - &gEfiDriverConfigurationProtocolGuid, - (VOID **) &DriverConfiguration, - NULL, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - } - if (EFI_ERROR (Status)) { -// ShellPrintHiiEx( -// -1, -// -1, -// NULL, -// STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT), -// gShellDriver1HiiHandle, -// ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]) -// ); - ShellStatus = SHELL_UNSUPPORTED; - continue; - } - - BestLanguage = GetBestLanguage ( - DriverConfiguration->SupportedLanguages, - Iso639Language, - Language!=NULL?Language:"", - DriverConfiguration->SupportedLanguages, - NULL - ); - if (BestLanguage == NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellDriver1HiiHandle, - L"drvcfg", - L"-l" - ); - ShellStatus = SHELL_INVALID_PARAMETER; - continue; - } - - Status = ParseHandleDatabaseByRelationshipWithType ( - DriverImageHandleBuffer[OuterLoopCounter], - NULL, - &HandleCount, - &HandleBuffer, - &HandleType - ); - if (EFI_ERROR (Status)) { - continue; - } - - if (SetOptions && DeviceHandle == NULL) { - - gST->ConOut->ClearScreen (gST->ConOut); - Status = DriverConfiguration->SetOptions ( - DriverConfiguration, - NULL, - NULL, - BestLanguage, - &ActionRequired - ); - gST->ConOut->ClearScreen (gST->ConOut); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_ALL_LANG), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]), - DriverConfiguration->SupportedLanguages - ); - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_SET), - gShellDriver1HiiHandle); - for (LoopCounter = 0; LoopCounter < HandleCount; LoopCounter++) { - if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) == HR_CONTROLLER_HANDLE) { - ShellCmdDriverConfigurationProcessActionRequired ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - NULL, - ActionRequired - ); - } - } - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_NOT_SET), - gShellDriver1HiiHandle, - Status); - } - continue; - } - - for (LoopCounter = 0; LoopCounter < HandleCount; LoopCounter++) { - if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) != HR_CONTROLLER_HANDLE) { - continue; - } - if (DeviceHandle != NULL && DeviceHandle != HandleBuffer[LoopCounter]) { - continue; - } - if (ChildHandle == NULL) { - HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]); - HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_CTRL_LANG), - gShellDriver1HiiHandle, - HandleIndex1, - HandleIndex2, - DriverConfiguration->SupportedLanguages - ); - - if (ForceDefaults) { - Status = DriverConfiguration->ForceDefaults ( - DriverConfiguration, - HandleBuffer[LoopCounter], - NULL, - DefaultType, - &ActionRequired - ); - - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_DEF_FORCED), - gShellDriver1HiiHandle); - ShellCmdDriverConfigurationProcessActionRequired ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - NULL, - ActionRequired - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_FORCE_FAILED), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else if (ValidateOptions) { - Status = DriverConfiguration->OptionsValid ( - DriverConfiguration, - HandleBuffer[LoopCounter], - NULL - ); - - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID), - gShellDriver1HiiHandle); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_INV), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else if (SetOptions) { - gST->ConOut->ClearScreen (gST->ConOut); - Status = DriverConfiguration->SetOptions ( - DriverConfiguration, - HandleBuffer[LoopCounter], - NULL, - BestLanguage, - &ActionRequired - ); - gST->ConOut->ClearScreen (gST->ConOut); - HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]); - HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_CTRL_LANG), - gShellDriver1HiiHandle, - HandleIndex1, - HandleIndex2, - DriverConfiguration->SupportedLanguages - ); - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_SET), - gShellDriver1HiiHandle); - - ShellCmdDriverConfigurationProcessActionRequired ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - NULL, - ActionRequired - ); - - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_NOT_SET), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else { - Print (L"\n"); - } - } - - if (ChildHandle == NULL && !AllChildren) { - continue; - } - - Status = ParseHandleDatabaseByRelationshipWithType ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - &ChildHandleCount, - &ChildHandleBuffer, - &ChildHandleType - ); - if (EFI_ERROR (Status)) { - continue; - } - - for (ChildIndex = 0; ChildIndex < ChildHandleCount; ChildIndex++) { - - if ((ChildHandleType[ChildIndex] & HR_CHILD_HANDLE) != HR_CHILD_HANDLE) { - continue; - } - - if (ChildHandle != NULL && ChildHandle != ChildHandleBuffer[ChildIndex]) { - continue; - } - - HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]); - HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]); - HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_CHILD_LANG), - gShellDriver1HiiHandle, - HandleIndex1, - HandleIndex2, - HandleIndex3, - DriverConfiguration->SupportedLanguages); - - if (ForceDefaults) { - Status = DriverConfiguration->ForceDefaults ( - DriverConfiguration, - HandleBuffer[LoopCounter], - ChildHandleBuffer[ChildIndex], - DefaultType, - &ActionRequired - ); - - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_DEF_FORCED), - gShellDriver1HiiHandle); - - ShellCmdDriverConfigurationProcessActionRequired ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - ChildHandleBuffer[ChildIndex], - ActionRequired - ); - - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_FORCE_FAILED), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else if (ValidateOptions) { - Status = DriverConfiguration->OptionsValid ( - DriverConfiguration, - HandleBuffer[LoopCounter], - ChildHandleBuffer[ChildIndex] - ); - - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID), - gShellDriver1HiiHandle); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_INV), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else if (SetOptions) { - gST->ConOut->ClearScreen (gST->ConOut); - Status = DriverConfiguration->SetOptions ( - DriverConfiguration, - HandleBuffer[LoopCounter], - ChildHandleBuffer[ChildIndex], - BestLanguage, - &ActionRequired - ); - gST->ConOut->ClearScreen (gST->ConOut); - HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]); - HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]); - HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_CHILD_LANG), - gShellDriver1HiiHandle, - HandleIndex1, - HandleIndex2, - HandleIndex3, - DriverConfiguration->SupportedLanguages - ); - if (!EFI_ERROR (Status)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_OPTIONS_SET), - gShellDriver1HiiHandle); - - ShellCmdDriverConfigurationProcessActionRequired ( - DriverImageHandleBuffer[OuterLoopCounter], - HandleBuffer[LoopCounter], - ChildHandleBuffer[ChildIndex], - ActionRequired - ); - - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_NOT_SET), - gShellDriver1HiiHandle, - Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } else { - Print (L"\n"); - } - } - - FreePool (ChildHandleBuffer); - FreePool (ChildHandleType); - } - - FreePool (BestLanguage); - FreePool (HandleBuffer); - FreePool (HandleType); - } - - if (DriverImageHandle != NULL && DriverImageHandleCount != 0) { - FreePool (DriverImageHandleBuffer); - } - -Done: - return ShellStatus; -} - -/** - Function to print out configuration information on all configurable handles. - - @param[in] ChildrenToo TRUE to tewst for children. - @param[in] Language ASCII string for language code. - @param[in] UseHii TRUE to check for Hii and DPC, FALSE for DCP only. - - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -PrintConfigInfoOnAll( - IN CONST BOOLEAN ChildrenToo, - IN CONST CHAR8 *Language, - IN CONST BOOLEAN UseHii - ) -{ - EFI_HANDLE *HandleList; - EFI_HANDLE *CurrentHandle; - BOOLEAN Found; - UINTN Index2; - - - Found = FALSE; - HandleList = NULL; - CurrentHandle = NULL; - - if (UseHii) { - // - // HII method - // - HandleList = GetHandleListByProtocol(&gEfiHiiConfigAccessProtocolGuid); - for (CurrentHandle = HandleList ; CurrentHandle != NULL && *CurrentHandle != NULL; CurrentHandle++){ - Found = TRUE; - Index2 = *CurrentHandle == NULL ? 0 : ConvertHandleToHandleIndex(*CurrentHandle); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_LINE_HII), - gShellDriver1HiiHandle, - Index2 - ); - } - SHELL_FREE_NON_NULL(HandleList); - } - - if (PreHiiDrvCfg ( - Language, - FALSE, - 0, - ChildrenToo, - FALSE, - FALSE, - 0, - 0, - 0) == SHELL_SUCCESS) { - Found = TRUE; - } - - if (!Found) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE_FOUND), gShellDriver1HiiHandle); - return (SHELL_SUCCESS); - } - - return (SHELL_SUCCESS); -} - -STATIC CONST SHELL_PARAM_ITEM ParamListHii[] = { - {L"-s", TypeFlag}, - {L"-l", TypeValue}, - {L"-f", TypeValue}, - {L"-o", TypeValue}, - {L"-i", TypeValue}, - {NULL, TypeMax} - }; -STATIC CONST SHELL_PARAM_ITEM ParamListPreHii[] = { - {L"-c", TypeFlag}, - {L"-s", TypeFlag}, - {L"-v", TypeFlag}, - {L"-l", TypeValue}, - {L"-f", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'drvcfg' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrvCfg ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR8 *Language; - CONST CHAR16 *Lang; - CONST CHAR16 *HandleIndex1; - CONST CHAR16 *HandleIndex2; - CONST CHAR16 *HandleIndex3; - CONST CHAR16 *ForceTypeString; - BOOLEAN Force; - BOOLEAN Set; - BOOLEAN Validate; - BOOLEAN InFromFile; - BOOLEAN OutToFile; - BOOLEAN AllChildren; - BOOLEAN UseHii; - UINT32 ForceType; - UINT64 Intermediate; - EFI_HANDLE Handle1; - EFI_HANDLE Handle2; - EFI_HANDLE Handle3; - CONST CHAR16 *FileName; - - ShellStatus = SHELL_SUCCESS; - Status = EFI_SUCCESS; - Language = NULL; - UseHii = TRUE; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamListHii, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status) || ShellCommandLineGetCount(Package) > 2) { - UseHii = FALSE; - if (Package != NULL) { - ShellCommandLineFreeVarList (Package); - } - SHELL_FREE_NON_NULL(ProblemParam); - Status = ShellCommandLineParse (ParamListPreHii, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } else { - ASSERT(FALSE); - } - } - } - if (ShellStatus == SHELL_SUCCESS) { - if (ShellCommandLineGetCount(Package) > 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvcfg"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } else if (ShellCommandLineGetFlag(Package, L"-l")){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-l"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - Set = ShellCommandLineGetFlag (Package, L"-s"); - Validate = ShellCommandLineGetFlag (Package, L"-v"); - InFromFile = ShellCommandLineGetFlag (Package, L"-i"); - OutToFile = ShellCommandLineGetFlag (Package, L"-o"); - AllChildren = ShellCommandLineGetFlag (Package, L"-c"); - Force = ShellCommandLineGetFlag (Package, L"-f"); - ForceTypeString = ShellCommandLineGetValue(Package, L"-f"); - - if (OutToFile) { - FileName = ShellCommandLineGetValue(Package, L"-o"); - } else if (InFromFile) { - FileName = ShellCommandLineGetValue(Package, L"-i"); - } else { - FileName = NULL; - } - - if (InFromFile && EFI_ERROR(ShellFileExists(FileName))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellDriver1HiiHandle, L"drvcfg", FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (OutToFile && !EFI_ERROR(ShellFileExists(FileName))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_EXIST), gShellDriver1HiiHandle, L"drvcfg", FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (Force && ForceTypeString == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-f"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (Force) { - Status = ShellConvertStringToUint64(ForceTypeString, &Intermediate, FALSE, FALSE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDriver1HiiHandle, L"drvcfg", ForceTypeString, L"-f"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - ForceType = (UINT32)Intermediate; - } else { - ForceType = 0; - } - HandleIndex1 = ShellCommandLineGetRawValue(Package, 1); - Handle1 = NULL; - if (HandleIndex1 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex1, &Intermediate, TRUE, FALSE))) { - Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate); - if (Handle1 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex1); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - HandleIndex2 = ShellCommandLineGetRawValue(Package, 2); - Handle2 = NULL; - if (HandleIndex2 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex2, &Intermediate, TRUE, FALSE))) { - Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate); - if (Handle2 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex2); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - HandleIndex3 = ShellCommandLineGetRawValue(Package, 3); - Handle3 = NULL; - if (HandleIndex3 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex3, &Intermediate, TRUE, FALSE))) { - Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate); - if (Handle3 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex3); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - - if ((InFromFile || OutToFile) && (FileName == NULL)) { - if (FileName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", InFromFile?L"-i":L"-o"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_REQ), gShellDriver1HiiHandle, L"drvcfg"); - } - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (!UseHii && (InFromFile || OutToFile)) { - if (InFromFile) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-i"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (OutToFile) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-o"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - } - if (Validate && Force) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-f"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (Validate && Set) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (Set && Force) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-s", L"-f"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - if (OutToFile && InFromFile) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-i", L"-o"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto Done; - } - - // - // We do HII first. - // - if (UseHii) { - if (Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - // - // no HII on this handle. - // - ShellStatus = SHELL_UNSUPPORTED; - } else if (Validate) { - } else if (Force) { - } else if (Set) { - } else if (InFromFile) { - ShellStatus = ConfigFromFile(Handle1, FileName); - if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) { - goto Done; - } - } else if (OutToFile) { - ShellStatus = ConfigToFile(Handle1, FileName); - if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) { - goto Done; - } - } else if (HandleIndex1 == NULL) { - // - // display all that are configurable - // - ShellStatus = PrintConfigInfoOnAll(AllChildren, Language, UseHii); - goto Done; - } else { - if (!EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_LINE_HII), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(Handle1) - ); - goto Done; - } - } - } - - // - // We allways need to do this one since it does both by default. - // - if (!InFromFile && !OutToFile) { - ShellStatus = PreHiiDrvCfg ( - Language, - Force, - ForceType, - AllChildren, - Validate, - Set, - Handle1, - Handle2, - Handle3); - } - - if (ShellStatus == SHELL_UNSUPPORTED) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT), - gShellDriver1HiiHandle, - ConvertHandleToHandleIndex(Handle1) - ); - } - } - -Done: - ShellCommandLineFreeVarList (Package); - SHELL_FREE_NON_NULL(Language); - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c deleted file mode 100644 index f3d634f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c +++ /dev/null @@ -1,463 +0,0 @@ -/** @file - Main file for DrvDiag shell Driver1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST EFI_GUID *DiagGuidList[] = {&gEfiDriverDiagnosticsProtocolGuid, &gEfiDriverDiagnostics2ProtocolGuid, NULL}; -// -// We need 1 more item on the list... -// -typedef enum { - TestModeStandard = EfiDriverDiagnosticTypeStandard, - TestModeExtended = EfiDriverDiagnosticTypeExtended, - TestModeManufacturing = EfiDriverDiagnosticTypeManufacturing, - TestModeList, - TestModeMax -} DRV_DIAG_TEST_MODE; - -/** - Do the diagnostics call for some set of handles. - - @param[in] Mode The type of diagnostic test to run. - @param[in] Lang The language code to use. - @param[in] AllChilds Should the test be on all children. - @param[in] DriverHandle The driver handle to test with. - @param[in] ControllerHandle The specific controller handle to test. - @param[in] ChildHandle The specific child handle to test. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_INVALID_PARAMETER A parameter had an invalid value. - @retval EFI_NOT_FOUND No diagnostic handle could be found. -**/ -EFI_STATUS -DoDiagnostics ( - IN CONST DRV_DIAG_TEST_MODE Mode, - IN CONST CHAR8 *Lang, - IN CONST BOOLEAN AllChilds, - IN CONST EFI_HANDLE DriverHandle, - IN CONST EFI_HANDLE ControllerHandle, - IN CONST EFI_HANDLE ChildHandle - ) -{ - EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics; - EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2; - EFI_HANDLE *DriverHandleList; - EFI_HANDLE *ControllerHandleList; - EFI_HANDLE *ChildHandleList; - EFI_HANDLE *Walker; - UINTN DriverHandleListCount; - UINTN ControllerHandleListCount; - UINTN ChildHandleListCount; - UINTN DriverHandleListLoop; - UINTN ControllerHandleListLoop; - UINTN ChildHandleListLoop; - EFI_STATUS Status; - EFI_STATUS Status2; - EFI_GUID *ErrorType; - UINTN OutBufferSize; - CHAR16 *OutBuffer; - UINTN HandleIndex1; - UINTN HandleIndex2; - CHAR8 *Language; - BOOLEAN Found; - - if ((ChildHandle != NULL && AllChilds) || (Mode >= TestModeMax)){ - return (EFI_INVALID_PARAMETER); - } - - DriverDiagnostics = NULL; - DriverDiagnostics2 = NULL; - Status = EFI_SUCCESS; - Status2 = EFI_SUCCESS; - DriverHandleList = NULL; - ControllerHandleList = NULL; - ChildHandleList = NULL; - Language = NULL; - OutBuffer = NULL; - ErrorType = NULL; - DriverHandleListCount = 0; - ControllerHandleListCount = 0; - ChildHandleListCount = 0; - - if (DriverHandle != NULL) { - DriverHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE)); - if (DriverHandleList == NULL) { - return EFI_OUT_OF_RESOURCES; - } - DriverHandleList[0] = DriverHandle; - DriverHandleListCount = 1; - } else { - DriverHandleList = GetHandleListByProtocolList(DiagGuidList); - if (DriverHandleList == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid); - return (EFI_NOT_FOUND); - } - for (Walker = DriverHandleList ; Walker != NULL && *Walker != NULL ; DriverHandleListCount++, Walker++); - } - - if (ControllerHandle != NULL) { - ControllerHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE)); - if (ControllerHandleList == NULL) { - SHELL_FREE_NON_NULL (DriverHandleList); - return EFI_OUT_OF_RESOURCES; - } - ControllerHandleList[0] = ControllerHandle; - ControllerHandleListCount = 1; - } else { - ControllerHandleList = NULL; - } - - if (ChildHandle != NULL) { - ChildHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE)); - if (ChildHandleList == NULL) { - SHELL_FREE_NON_NULL (ControllerHandleList); - SHELL_FREE_NON_NULL (DriverHandleList); - return EFI_OUT_OF_RESOURCES; - } - ChildHandleList[0] = ChildHandle; - ChildHandleListCount = 1; - } else if (AllChilds) { - ChildHandleList = NULL; - // - // This gets handled in the loop below. - // - } else { - ChildHandleList = NULL; - } - - if (Mode == TestModeList) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_HEADER), gShellDriver1HiiHandle); - } - for (DriverHandleListLoop = 0 - ; DriverHandleListLoop < DriverHandleListCount - ; DriverHandleListLoop++ - ){ - if (Mode == TestModeList) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_HEADER), gShellDriver1HiiHandle, ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop])); - } - if (ControllerHandle == NULL) { - PARSE_HANDLE_DATABASE_DEVICES(DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList); - } - if (ControllerHandleListCount == 0) { - if (Mode == TestModeList) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_NO_HANDLES), gShellDriver1HiiHandle); - } - } else { - if (Mode == TestModeList) { - ShellPrintEx(-1, -1, L"\r\n"); - } - for (ControllerHandleListLoop = 0 - ; ControllerHandleListLoop < ControllerHandleListCount - ; ControllerHandleListLoop++ - ){ - if (AllChilds) { - ASSERT(ChildHandleList == NULL); - PARSE_HANDLE_DATABASE_MANAGED_CHILDREN( - DriverHandleList[DriverHandleListLoop], - ControllerHandleList[ControllerHandleListLoop], - &ChildHandleListCount, - &ChildHandleList); - } - for (ChildHandleListLoop = 0 - ; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList == NULL) - ; ChildHandleListLoop++ - ){ - Found = FALSE; - if (Mode != TestModeList) { - if (Lang == NULL || Lang[2] == '-') { - // - // Get the protocol pointer and call the function - // - Status = gBS->OpenProtocol( - DriverHandleList[DriverHandleListLoop], - &gEfiDriverDiagnostics2ProtocolGuid, - (VOID**)&DriverDiagnostics2, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status) && (DriverDiagnostics2 != NULL)) { - Language = GetBestLanguageForDriver(DriverDiagnostics2->SupportedLanguages, Lang, FALSE); - Found = TRUE; - Status = DriverDiagnostics2->RunDiagnostics( - DriverDiagnostics2, - ControllerHandleList[ControllerHandleListLoop], - ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop], - (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode, - Language, - &ErrorType, - &OutBufferSize, - &OutBuffer); - FreePool(Language); - } - } - if (!Found && (Lang == NULL||(Lang!=NULL&&(Lang[2]!='-')))){ - Status = gBS->OpenProtocol( - DriverHandleList[DriverHandleListLoop], - &gEfiDriverDiagnosticsProtocolGuid, - (VOID**)&DriverDiagnostics, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - Language = GetBestLanguageForDriver(DriverDiagnostics->SupportedLanguages, Lang, FALSE); - Status = DriverDiagnostics->RunDiagnostics( - DriverDiagnostics, - ControllerHandleList[ControllerHandleListLoop], - ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop], - (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode, - Language, - &ErrorType, - &OutBufferSize, - &OutBuffer); - FreePool(Language); - } - } - if (EFI_ERROR(Status)) { - Status2 = Status; - } - HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]); - HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_3P_RESULT), - gShellDriver1HiiHandle, - L"DrvDiag", - HandleIndex1, - HandleIndex2, - ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop]), - Status); - if (OutBuffer!=NULL) { - FreePool(OutBuffer); - OutBuffer = NULL; - } - if (ErrorType!=NULL) { - FreePool(ErrorType); - ErrorType = NULL; - } - } else { - HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]); - HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]); - // - // Print out the information that this set can be tested - // - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_DRV_DIAG_ITEM_LINE), - gShellDriver1HiiHandle, - HandleIndex1, - HandleIndex2, - ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop]) - ); - } - - // - // If we are doing a single pass with NULL child jump out after a single loop - // - if (ChildHandleList == NULL) { - break; - } - } - if (AllChilds) { - SHELL_FREE_NON_NULL(ChildHandleList); - ChildHandleList = NULL; - ChildHandleListCount = 0; - } - } - if (ControllerHandle == NULL) { - SHELL_FREE_NON_NULL(ControllerHandleList); - ControllerHandleList = NULL; - ControllerHandleListCount = 0; - } - } - } - - if (DriverHandleList != NULL) { - FreePool(DriverHandleList); - } - if (ControllerHandleList != NULL) { - FreePool(ControllerHandleList); - } - if (ChildHandleList != NULL) { - FreePool(ChildHandleList); - } - return (Status2); -} - - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-c", TypeFlag}, - {L"-s", TypeFlag}, - {L"-e", TypeFlag}, - {L"-m", TypeFlag}, - {L"-l", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'drvdiag' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrvDiag ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - DRV_DIAG_TEST_MODE Mode; - CHAR8 *Language; - CONST CHAR16 *DriverHandleStr; - CONST CHAR16 *ControllerHandleStr; - CONST CHAR16 *ChildHandleStr; - CONST CHAR16 *Lang; - EFI_HANDLE Handle1; - EFI_HANDLE Handle2; - EFI_HANDLE Handle3; - UINT64 Intermediate; - - ShellStatus = SHELL_SUCCESS; - Mode = TestModeMax; - Language = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvdiag", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // if more than 3 'value' parameters (plus the name one) or we have any 2 mode flags - // - if ((ShellCommandLineGetCount(Package) > 4) - ||(ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-e")) - ||(ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-m")) - ||(ShellCommandLineGetFlag(Package, L"-e") && ShellCommandLineGetFlag(Package, L"-m")) - ){ - // - // error for too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvdiag"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag(Package, L"-s")) - || (ShellCommandLineGetFlag(Package, L"-e")) - || (ShellCommandLineGetFlag(Package, L"-m")) - ){ - // - // Run the appropriate test - // - if (ShellCommandLineGetFlag(Package, L"-s")) { - Mode = TestModeStandard; - } else if (ShellCommandLineGetFlag(Package, L"-e")) { - Mode = TestModeExtended; - } else if (ShellCommandLineGetFlag(Package, L"-m")) { - Mode = TestModeManufacturing; - } else { - ASSERT(FALSE); - } - } else { - // - // Do a listing of what's available to test - // - Mode = TestModeList; - } - - Lang = ShellCommandLineGetValue(Package, L"-l"); - if (ShellCommandLineGetFlag(Package, L"-l") && Lang == NULL) { - ASSERT(Language == NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvdiag", L"-l"); - ShellCommandLineFreeVarList (Package); - return (SHELL_INVALID_PARAMETER); - } else if (Lang != NULL) { - Language = AllocateZeroPool(StrSize(Lang)); - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); - } - - DriverHandleStr = ShellCommandLineGetRawValue(Package, 1); - ControllerHandleStr = ShellCommandLineGetRawValue(Package, 2); - ChildHandleStr = ShellCommandLineGetRawValue(Package, 3); - - if (DriverHandleStr == NULL) { - Handle1 = NULL; - } else { - ShellConvertStringToUint64(DriverHandleStr, &Intermediate, TRUE, FALSE); - Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate); - } - if (ControllerHandleStr == NULL) { - Handle2 = NULL; - } else { - ShellConvertStringToUint64(ControllerHandleStr, &Intermediate, TRUE, FALSE); - Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate); - } - if (ChildHandleStr == NULL) { - Handle3 = NULL; - } else { - ShellConvertStringToUint64(ChildHandleStr, &Intermediate, TRUE, FALSE); - Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate); - } - - Status = DoDiagnostics ( - Mode, - Language, - ShellCommandLineGetFlag(Package, L"-c"), - Handle1, - Handle2, - Handle3 - ); - - SHELL_FREE_NON_NULL(Language); - ShellCommandLineFreeVarList (Package); - - } - if (ShellStatus == SHELL_SUCCESS) { - if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (Status == EFI_NOT_FOUND) { - ShellStatus = SHELL_NOT_FOUND; - } else if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c deleted file mode 100644 index ff7e4be..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c +++ /dev/null @@ -1,216 +0,0 @@ -/** @file - Main file for OpenInfo shell Driver1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST CHAR16 StringHandProt[] = L"HandProt "; -STATIC CONST CHAR16 StringGetProt[] = L"GetProt "; -STATIC CONST CHAR16 StringTestProt[] = L"TestProt "; -STATIC CONST CHAR16 StringChild[] = L"Child "; -STATIC CONST CHAR16 StringDriver[] = L"Driver "; -STATIC CONST CHAR16 StringExclusive[] = L"Exclusive"; -STATIC CONST CHAR16 StringDriverEx[] = L"DriverEx "; -STATIC CONST CHAR16 StringUnknown[] = L"Unknown "; - -/** - Open the database and print out all the info about TheHandle. - - @param[in] TheHandle The handle to print info on. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_INVALID_PARAMETER TheHandle was NULL. -**/ -EFI_STATUS -TraverseHandleDatabase ( - IN CONST EFI_HANDLE TheHandle - ) -{ - EFI_STATUS Status; - EFI_GUID **ProtocolGuidArray; - UINTN ArrayCount; - UINTN ProtocolIndex; - EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo; - UINTN OpenInfoCount; - UINTN OpenInfoIndex; - CONST CHAR16 *OpenTypeString; - CHAR16 *TempString; - UINTN HandleIndex; - CONST CHAR16 *Name; - UINTN ControllerIndex; - - if (TheHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Retrieve the list of all the protocols on the handle - // - Status = gBS->ProtocolsPerHandle ( - TheHandle, - &ProtocolGuidArray, - &ArrayCount - ); - ASSERT_EFI_ERROR(Status); - if (!EFI_ERROR (Status)) { - - for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { - // - // print out the human readable name for this one. - // - TempString = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], NULL); - if (TempString == NULL) { - continue; - } - ShellPrintEx(-1, -1, L"%H%s%N\r\n", TempString); - FreePool(TempString); - - // - // Retrieve the list of agents that have opened each protocol - // - Status = gBS->OpenProtocolInformation ( - TheHandle, - ProtocolGuidArray[ProtocolIndex], - &OpenInfo, - &OpenInfoCount - ); - ASSERT_EFI_ERROR(Status); - if (!EFI_ERROR (Status)) { - for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { - switch (OpenInfo[OpenInfoIndex].Attributes) { - case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: OpenTypeString = StringHandProt; break; - case EFI_OPEN_PROTOCOL_GET_PROTOCOL: OpenTypeString = StringGetProt; break; - case EFI_OPEN_PROTOCOL_TEST_PROTOCOL: OpenTypeString = StringTestProt; break; - case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER: OpenTypeString = StringChild; break; - case EFI_OPEN_PROTOCOL_BY_DRIVER: OpenTypeString = StringDriver; break; - case EFI_OPEN_PROTOCOL_EXCLUSIVE: OpenTypeString = StringExclusive; break; - case EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE: - OpenTypeString = StringDriverEx; break; - default: OpenTypeString = StringUnknown; break; - } - HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle); - Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, NULL); - ControllerIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle); - if (ControllerIndex != 0) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_OPENINFO_LINE), - gShellDriver1HiiHandle, - HandleIndex, - ControllerIndex, - OpenInfo[OpenInfoIndex].OpenCount, - OpenTypeString, - Name - ); - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN(STR_OPENINFO_MIN_LINE), - gShellDriver1HiiHandle, - HandleIndex, - OpenInfo[OpenInfoIndex].OpenCount, - OpenTypeString, - Name - ); - } - } - FreePool (OpenInfo); - } - } - FreePool (ProtocolGuidArray); - } - - return Status; -} - -/** - Function for 'openinfo' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunOpenInfo ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - EFI_HANDLE TheHandle; - CONST CHAR16 *Param1; - UINT64 Intermediate; - - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"openinfo", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2){ - // - // error for too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"openinfo"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"openinfo"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Param1 = ShellCommandLineGetRawValue(Package, 1); - Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE); - if (EFI_ERROR(Status) || Param1 == NULL || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TheHandle = ConvertHandleIndexToHandle((UINTN)Intermediate); - ASSERT(TheHandle != NULL); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, (UINTN)Intermediate, TheHandle); - - Status = TraverseHandleDatabase (TheHandle); - if (!EFI_ERROR(Status)) { - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1); - ShellStatus = SHELL_NOT_FOUND; - } - } - } - } - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c deleted file mode 100644 index 00dbcc1..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - Main file for Reconnect shell Driver1 function. - - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-r", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Connect all the possible console devices. - -**/ -VOID -ConnectAllConsoles ( - VOID - ) -{ - ShellConnectFromDevPaths(L"ConInDev"); - ShellConnectFromDevPaths(L"ConOutDev"); - ShellConnectFromDevPaths(L"ErrOutDev"); - - ShellConnectFromDevPaths(L"ErrOut"); - ShellConnectFromDevPaths(L"ConIn"); - ShellConnectFromDevPaths(L"ConOut"); -} - - -/** - Function for 'reconnect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunReconnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - SHELL_STATUS ShellStatus; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - EFI_STATUS Status; - - gInReconnect = TRUE; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"reconnect", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable); - if (ShellStatus == SHELL_SUCCESS) { - if (ShellCommandLineGetFlag(Package, L"-r")) { - ConnectAllConsoles(); - } - ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable); - } - } - - gInReconnect = FALSE; - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c deleted file mode 100644 index dc69d46..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c +++ /dev/null @@ -1,104 +0,0 @@ -/** @file - Main file for NULL named library for level 1 shell command functions. - - Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -STATIC CONST CHAR16 mFileName[] = L"Driver1Commands"; -EFI_HANDLE gShellDriver1HiiHandle = NULL; -BOOLEAN gInReconnect = FALSE; - -/** - Function to return the name of the file containing help if HII will not be used. - - @return The filename. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameDriver1 ( - VOID - ) -{ - return (mFileName); -} - -/** - Constructor for the Shell Driver1 Commands library. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -UefiShellDriver1CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // check our bit of the profiles mask - // - if ((PcdGet8(PcdShellProfileMask) & BIT0) == 0) { - return (EFI_SUCCESS); - } - - // - // install the HII stuff. - // - gShellDriver1HiiHandle = HiiAddPackages (&gShellDriver1HiiGuid, gImageHandle, UefiShellDriver1CommandsLibStrings, NULL); - if (gShellDriver1HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handlers that are always installed - // - ShellCommandRegisterCommandName(L"connect", ShellCommandRunConnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_CONNECT) ); - ShellCommandRegisterCommandName(L"devices", ShellCommandRunDevices , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVICES) ); - ShellCommandRegisterCommandName(L"openinfo", ShellCommandRunOpenInfo , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_OPENINFO) ); - ShellCommandRegisterCommandName(L"disconnect", ShellCommandRunDisconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DISCONNECT)); - ShellCommandRegisterCommandName(L"reconnect", ShellCommandRunReconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_RECONNECT) ); - ShellCommandRegisterCommandName(L"unload", ShellCommandRunUnload , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_UNLOAD) ); - ShellCommandRegisterCommandName(L"drvdiag", ShellCommandRunDrvDiag , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVDIAG) ); - ShellCommandRegisterCommandName(L"dh", ShellCommandRunDh , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DH) ); - ShellCommandRegisterCommandName(L"drivers", ShellCommandRunDrivers , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRIVERS) ); - ShellCommandRegisterCommandName(L"devtree", ShellCommandRunDevTree , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVTREE) ); - ShellCommandRegisterCommandName(L"drvcfg", ShellCommandRunDrvCfg , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVCFG) ); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -UefiShellDriver1CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellDriver1HiiHandle != NULL) { - HiiRemovePackages(gShellDriver1HiiHandle); - } - return (EFI_SUCCESS); -} - - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h deleted file mode 100644 index 952710f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h +++ /dev/null @@ -1,228 +0,0 @@ -/** @file - Main file for NULL named library for Profile1 shell command functions. - - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_ -#define _UEFI_SHELL_DRIVER1_COMMANDS_LIB_H_ - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -extern EFI_HANDLE gShellDriver1HiiHandle; -extern BOOLEAN gInReconnect; - -/** - Function for 'connect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunConnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'devices' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDevices ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'openinfo' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunOpenInfo ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'devtree' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDevTree ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'dh' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDh ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'disconnect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDisconnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'drivers' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrivers ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'drvcfg' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrvCfg ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'drvdiag' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDrvDiag ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'reconnect' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunReconnect ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'unload' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunUnload ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Do a connect from an EFI variable via it's key name. - - @param[in] Key The name of the EFI Variable. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ShellConnectFromDevPaths ( - IN CONST CHAR16 *Key - ); - - - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf deleted file mode 100644 index 6c9f760..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf +++ /dev/null @@ -1,73 +0,0 @@ -## @file -# Provides shell driver1 profile functions -# -# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellDriver1CommandsLib - FILE_GUID = 313D3674-3ED4-48fd-BF97-7DB35D4190D1 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = UefiShellDriver1CommandsLibConstructor - DESTRUCTOR = UefiShellDriver1CommandsLibDestructor - -[Sources] - Connect.c - Devices.c - OpenInfo.c - Disconnect.c - Reconnect.c - Unload.c - DrvDiag.c - Dh.c - Drivers.c - DevTree.c - DrvCfg.c - UefiShellDriver1CommandsLib.c - UefiShellDriver1CommandsLib.h - UefiShellDriver1CommandsLib.uni - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - SortLib - PrintLib - PeCoffGetEntryPointLib - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Protocols] - gEfiDriverHealthProtocolGuid ## UNDEFINED - gEfiDriverFamilyOverrideProtocolGuid ## UNDEFINED - gEfiHiiConfigAccessProtocolGuid ## SOMETIMES_CONSUMES - gEfiHiiDatabaseProtocolGuid ## CONSUMES - -[Guids] - gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## GUID - gEfiConsoleInDeviceGuid ## CONSUMES ## GUID - gEfiConsoleOutDeviceGuid ## CONSUMES ## GUID - gShellDriver1HiiGuid ## PRODUCES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni deleted file mode 100644 index 0df4eb3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ /dev/null @@ -1,759 +0,0 @@ -// /** -// -// (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
-// (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellDriver1CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 driver1 profile commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n" -#string STR_GEN_INV_HANDLE #language en-US "%H%s%N: Handle - '%H%s%N' not found\r\n" -#string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags conflict with - '%H%s%N' and '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_HANDLE_NOT #language en-US "%H%s%N: Handle [%H%02x%N] is not a valid %s\r\n" -#string STR_GEN_HANDLE_REQ #language en-US "%H%s%N: Handle required with the specified options\r\n" -#string STR_GEN_PROTOCOL_NF #language en-US "%H%s%N: The protocol '%H%s%N' is required and not found (%g)\r\n" -#string STR_GEN_FIND_FAIL #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_GEN_FILE_EXIST #language en-US "%H%s%N: File already exists - '%H%s%N'\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_FILE_WRITE_FAIL #language en-US "%H%s%N: Write file error - '%H%s%N'\r\n" -#string STR_FILE_READ_FAIL #language en-US "%H%s%N: Read file error - '%H%s%N'\r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful\r\n" -#string STR_GEN_UEFI_FUNC_ERROR #language en-US "%H%s%N: UEFI function '%H%s%N' returned an incorrect value for: %s (%x)\r\n" -#string STR_GEN_UEFI_FUNC_WARN #language en-US "%H%s%N: UEFI function '%H%s%N' returned: %r\r\n" -#string STR_GEN_SFO_HEADER #language en-US "ShellCommand,"%s"\r\n" - -#string STR_DRVDIAG_HEADER #language en-US "%EAvailable Diagnostics%N.\r\n" -#string STR_DRVDIAG_DRIVER_HEADER #language en-US "Driver [%H%02x%N]: " -#string STR_DRVDIAG_DRIVER_NO_HANDLES #language en-US "No controller handles found.\r\n" - -#string STR_HANDLE_RESULT #language en-US "%H%s%N - Handle [%H%02x%N] Result %r.\r\n" -#string STR_3P_RESULT #language en-US "%H%s%N - (%H%02x%N,%H%02x%N,%H%02x%N) Result %r.\r\n" -#string STR_CONNECT_NONE #language en-US "%HConnect%N No drivers could be connected.\r\n" - -#string STR_DRVCFG_NONE_FOUND #language en-US "%HDrvCfg%N No configurable devices were found.\r\n" -#string STR_DRVCFG_COMP #language en-US "%HDrvCfg%N - operation complete.\r\n" -#string STR_DRVCFG_DONE_HII #language en-US "Handle[%H%02x%N] successfully updated from file.\r\n" -#string STR_DRVCFG_LINE_HII #language en-US "Handle[%H%02x%N] HII Config Access\r\n" -#string STR_DRVCFG_ALL_LANG #language en-US "Driver[%H%02x%N] Ctrl[--] Lang[%H%a%N] Driver Configuration" -#string STR_DRVCFG_CTRL_LANG #language en-US "Driver[%H%02x%N] Ctrl[%H%02x%N] Lang[%H%a%N] Driver Configuration" -#string STR_DRVCFG_CHILD_LANG #language en-US "Driver[%H%02x%N] Ctrl[%H%02x%N] Child[%H%02x%N] Lang[%H%a%N] Driver Configuration" -#string STR_DRVCFG_RESTART_S #language en-US "Restart %s\r\n" -#string STR_DRVCFG_STOP #language en-US "Stop Controller\n" -#string STR_DRVCFG_ENTER_S #language en-US "\nPress [ENTER] to %s" -#string STR_DRVCFG_NONE #language en-US "None\n" -#string STR_DRVCFG_CTLR_S #language en-US "Controller %s\n" -#string STR_DRVCFG_FORCE_D #language en-US "Force Default Configuration to DefaultType %08x\n" -#string STR_DRVCFG_VALIDATE #language en-US "Validate Configuration Options\n" -#string STR_DRVCFG_SET #language en-US "Set Configuration Options\n" -#string STR_DRVCFG_NOT_SUPPORT #language en-US "Handle [%H%02x%N] does not support configuration.\n" -#string STR_DRVCFG_OPTIONS_SET #language en-US " - Options set. Action Required is " -#string STR_DRVCFG_NOT_SET #language en-US " - Options not set. Status = %r\n" -#string STR_DRVCFG_DEF_FORCED #language en-US " - Defaults forced. Action Required is " -#string STR_DRVCFG_FORCE_FAILED #language en-US " - Force of defaults failed. Status = %r\n" -#string STR_DRVCFG_OPTIONS_VALID #language en-US " - Options valid\n" -#string STR_DRVCFG_OPTIONS_INV #language en-US " - Options not valid. Status = %r\n" -#string STR_DRVCFG_IN_FILE_NF #language en-US "DevicePath '%B%s%N' from file not found in HII DB. Skipped.\r\n" - - -#string STR_DEVICES_HEADER_LINES #language en-US "%N" -" T D\r\n" -" Y C I\r\n" -" P F A\r\n" -"CTRL E G G #P #D #C Device Name\r\n" -"==== = = = == == === =========================================================\r\n" -#string STR_DEVICES_ITEM_LINE #language en-US "%H%4x%N %1c %1c %1c %2d %2d %3d %s\r\n" -#string STR_DEVICES_ITEM_LINE_SFO #language en-US "DevicesInfo,"%x","%c","%c","%c","%d","%d","%d","%s"\r\n" - -#string STR_DRIVERS_HEADER_LINES #language en-US "%N" -"%H T D%N\r\n" -"%HD Y C I%N\r\n" -"%HR P F A%N\r\n" -"%HV VERSION E G G #D #C DRIVER NAME IMAGE NAME%N\r\n" -"== ======== = = = == == =================================== ==========\r\n" -#string STR_DRIVERS_ITEM_LINE #language en-US "%H%2x%N %08x %1c %1c %1c %2s %2s %-35s %s\r\n" -#string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n" - -#string STR_DH_OUTPUT_DECODE #language en-US "%s: %g\r\n" -#string STR_DH_NO_NAME_FOUND #language en-US "Protocol Name '%s' could not be identified.\r\n" -#string STR_DH_NO_GUID_FOUND #language en-US "Protocol GUID '%g' could not be identified.\r\n" -#string STR_DH_SFO_OUTPUT #language en-US "%s, %s, %H%02x%N, %s, &s\r\n" -#string STR_DH_OUTPUT #language en-US "%H%02x%N: %s\r\n" -#string STR_DH_OUTPUT_ALL_HEADER #language en-US "Handle dump\r\n" -#string STR_DH_OUTPUT_GUID_HEADER #language en-US "Handle dump by protocol '%g'\r\n" -#string STR_DH_OUTPUT_NAME_HEADER #language en-US "Handle dump by protocol '%s'\r\n" -#string STR_DH_OUTPUT_SINGLE_D #language en-US "%H%02x%N: %s\r\n" -#string STR_DH_OUTPUT_SINGLE #language en-US "%H%02x%N: %x\r\n%s" -#string STR_DH_OUTPUT_SFO #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n" -#string STR_DH_OUTPUT_DRIVER1 #language en-US " Controller Name : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER2 #language en-US " Device Path : %H%s%N\r\n" - " Controller Type : %H%s%N\r\n" - " Configuration : %H%s%N\r\n" - " Diagnostics : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER3 #language en-US " Managed by : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER4A #language en-US " Drv[%H%02x%N] : Image(%H%s%N)r\n" -#string STR_DH_OUTPUT_DRIVER4B #language en-US " Drv[%H%02x%N] : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER5 #language en-US " Parent Controllers : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER5B #language en-US " Parent[%H%02x%N] : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER6 #language en-US " Child Controllers : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER6B #language en-US " Child[%H%02x%N] : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER6C #language en-US " Child[%H%02x%N] : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER7 #language en-US " Driver Name [%H%02x%N] : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER7B #language en-US " Driver Image Name : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER8 #language en-US " Driver Version : %H%08x%N\r\n" - " Driver Type : %H%s%N\r\n" - " Configuration : %H%s%N\r\n" - " Diagnostics : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER9 #language en-US " Managing : %H%s%N\r\n" -#string STR_DH_OUTPUT_DRIVER9B #language en-US " Ctrl[%H%02x%N] : %H%s%N\r\n" - -#string STR_DEV_TREE_OUTPUT #language en-US "Ctrl[%H%02x%N] %s\r\n" - -#string STR_UNLOAD_CONF #language en-US "%HUnload%N - Handle [%H%02x%N]. [y/n]?\r\n" -#string STR_UNLOAD_VERBOSE #language en-US "" -"Handle [%H%02x%N] (%08x)\r\n" -" Image (%08x)\r\n" -" ParentHandle..: %08x\r\n" -" SystemTable...: %08x\r\n" -" DeviceHandle..: %08x\r\n" -" FilePath......: %s\r\n" -" PDBFileName...: %a\r\n" -" ImageBase.....: %08x\r\n" -" ImageSize.....: %Ld\r\n" -" CodeType......: %s\r\n" -" DataType......: %s\r\n" - -#string STR_OPENINFO_HEADER_LINE #language en-US "Handle %H%02x%N (%H%0p%N)\r\n" -#string STR_OPENINFO_LINE #language en-US " Drv[%H%02x%N] Ctrl[%H%02x%N] Cnt(%H%02x%N) %H%s Image%N(%s)\r\n" -#string STR_OPENINFO_MIN_LINE #language en-US " Drv[%H%02x%N] Ctrl[ ] Cnt(%H%02x%N) %H%s Image%N(%s)\r\n" - -#string STR_DRV_DIAG_ITEM_LINE #language en-US " Drv[%H%02x%N] Ctrl[%H%02x%N] Child[%H%02x%N]\r\n" - -#string STR_GET_HELP_DRVCFG #language en-US "" -".TH drvcfg 0 "configure a UEFI driver."\r\n" -".SH NAME\r\n" -"Invokes the driver configuration.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DRVCFG [-l XXX] [-c] [-f |-v|-s] \r\n" -" [DriverHandle [DeviceHandle [ChildHandle]]] [-i filename] [-o filename]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -c - Configures all child devices.\r\n" -" -l - Configures using the ISO 3066 language specified by XXX.\r\n" -" -f - Forces defaults.\r\n" -" -v - Validates options.\r\n" -" -s - Sets options.\r\n" -" -i - Receives configuration updates from an input file.\r\n" -" -o - Exports the settings of the specified driver instance to a\r\n" -" file.\r\n" -" Type - Specifies the type of default configuration options to force on the\r\n" -" controller.\r\n" -" 0 - Standard Defaults.\r\n" -" 1 - Manufacturing Defaults.\r\n" -" 2 - Safe Defaults.\r\n" -" 4000-FFFF - Custom Defaults.\r\n" -" DriverHandle - Specifies the the handle of the driver to configure.\r\n" -" DeviceHandle - Specifies the handle of a device that the DriverHandle is managing.\r\n" -" ChildHandle - Specifies the handle of a device that is a child of the DeviceHandle. \r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. Default Type:\r\n" -" 0 - Safe Defaults. Places a controller in a safe configuration with\r\n" -" the greatest probability of functioning correctly in a platform.\r\n" -" 1 - Manufacturing Defaults. Optional type that places the controller in\r\n" -" a configuration suitable for a manufacturing and test environment.\r\n" -" 2 - Custom Defaults. Optional type that places the controller in a\r\n" -" custom configuration.\r\n" -" 3 - Performance Defaults. Optional type that places the controller in a\r\n" -" configuration that maximizes the controller's performance in a \r\n" -" platform. \r\n" -" Other Value - Depends on the driver's implementation.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the list of devices that are available for configuration:\r\n" -" Shell> drvcfg\r\n" -" \r\n" -" * To display the list of devices and child devices that are available for\r\n" -" configuration:\r\n" -" Shell> drvcfg -c\r\n" -" \r\n" -" * To force defaults on all devices:\r\n" -" Shell> drvcfg -f 0\r\n" -" \r\n" -" * To force defaults on all devices that are managed by driver 0x17:\r\n" -" Shell> drvcfg -f 0 17\r\n" -" \r\n" -" * To force defaults on device 0x28 that is managed by driver 0x17:\r\n" -" Shell> drvcfg -f 0 17 28\r\n" -" \r\n" -" * To force defaults on all child devices of device 0x28 that is managed by\r\n" -" driver 0x17:\r\n" -" Shell> drvcfg -f 0 17 28 -c\r\n" -" \r\n" -" * To force defaults on child device 0x30 of device 0x28 that is managed by\r\n" -" driver 0x17:\r\n" -" Shell> drvcfg -f 0 17 28 30\r\n" -" \r\n" -" * To validate options on all devices:\r\n" -" Shell> drvcfg -v\r\n" -" \r\n" -" * To validate options on all devices that are managed by driver 0x17:\r\n" -" Shell> drvcfg -v 17\r\n" -" \r\n" -" * To validate options on device 0x28 that is managed by driver 0x17:\r\n" -" Shell> drvcfg -v 17 28\r\n" -" \r\n" -" * To validate options on all child devices of device 0x28 that is managed by\r\n" -" driver 0x17:\r\n" -" Shell> drvcfg -v 17 28 -c\r\n" -" \r\n" -" * To validate options on child device 0x30 of device 0x28 that is managed by\r\n" -" driver 0x17:\r\n" -" Shell> drvcfg -v 17 28 30\r\n" -" \r\n" -" * To set options on device 0x28 that is managed by driver 0x17: \r\n" -" Shell> drvcfg -s 17 28\r\n" -" \r\n" -" * To set options on child device 0x30 of device 0x28 that is managed by\r\n" -" driver 0x17:\r\n" -" Shell> drvcfg -s 17 28 30\r\n" -" \r\n" -" * To set options on device 0x28 that is managed by driver 0x17 in English:\r\n" -" Shell> drvcfg -s 17 28 -l eng\r\n" -" \r\n" -" * To set options on device 0x28 that is managed by driver 0x17 in Spanish:\r\n" -" Shell> drvcfg -s 17 28 -l spa\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_UNSUPPORTED The action as requested was unsupported.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_DRIVERS #language en-US "" -".TH drivers 0 "display a list of drivers"\r\n" -".SH NAME\r\n" -"Displays the UEFI driver list.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DRIVERS [-l XXX] [-sfo] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -l - Displays drivers using the specified language (e.g. ISO 639-2) \r\n" -" -sfo - Displays information as described in Standard-Format Output.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays a list of information for drivers that follow the\r\n" -" UEFI Driver Model in the UEFI environment. The list includes:\r\n" -" DRV - The handle number of the UEFI driver.\r\n" -" VERSION - The version number of the UEFI driver.\r\n" -" TYPE - The driver type:\r\n" -" [B] - Bus Driver\r\n" -" [D] - Device Driver\r\n" -" CFG - Driver supports the Driver Configuration Protocol.\r\n" -" DIAG - Driver supports the Driver Diagnostics Protocol.\r\n" -" #D - The number of devices that this driver is managing.\r\n" -" #C - The number of child devices that this driver has produced.\r\n" -" DRIVER NAME - The name of the driver from the Component Name Protocol.\r\n" -" IMAGE PATH - The file path from which the driver was loaded.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the list:\r\n" -" Shell> drivers\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_DISCONNECT #language en-US "" -".TH disconnect 0 "disconnect a driver"\r\n" -".SH NAME\r\n" -"Disconnects one or more drivers from the specified devices. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DISCONNECT DeviceHandle [DriverHandle [ChildHandle]] \r\n" -"DISCONNECT -r [-nc] \r\n" -".SH OPTIONS\r\n" -" \r\n" -"NOTES:\r\n" -" -r - Disconnects all drivers from all devices, then reconnect\r\n" -" consoles.\r\n" -" -nc - Do not reconnect the console devices.\r\n" -" DeviceHandle - Specifies a device handle (a hexadecimal number). If not\r\n" -" specified, then disconnect DriverHandle.\r\n" -" DriverHandle - Specifies a driver handle (a hexadecimal number).\r\n" -" ChildHandle - Specifies a child handle of a device (a hexadecimal number).\r\n" -" If not specified, then all child handles of DeviceHandle are\r\n" -" disconnected.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. If the 'DriverHandle' parameter is not specified, the default is to\r\n" -" disconnect 'DeviceHandle'.\r\n" -" 2. If the 'ChildHandle' parameter is not specified, the default is to\r\n" -" disconnect all child handles of the 'DeviceHandle'.\r\n" -" 3. If the '-r' option is specified, all consoles and drivers will be\r\n" -" disconnected from all devices in the system, then consoles are\r\n" -" reconnected. If the '-nc' option is also spcified, then console devices\r\n" -" are not reconnected.\r\n" -" 4. This command does not support output redirection.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To disconnect all drivers from all devices, then reconnect console\r\n" -" devices:\r\n" -" Shell> disconnect -r\r\n" -" \r\n" -" * To disconnect all drivers from all devices, including console devices:\r\n" -" Shell> disconnect -r -nc\r\n" -" \r\n" -" * To disconnect all drivers from device 0x28:\r\n" -" fs0:\> disconnect 28\r\n" -" \r\n" -" * To disconnect driver 0x17 from device 0x28:\r\n" -" fs0:\> disconnect 28 17\r\n" -" \r\n" -" * To disconnect driver 0x17 from controlling the child 0x32 of device 0x28:\r\n" -" fs0:\> disconnect 28 17 32\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_DH #language en-US "" -".TH dh 0 "displays list of handles"\r\n" -".SH NAME\r\n" -"Displays the device handles in the UEFI environment. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DH [-l ] [handle | -p ] [-d] [-v] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -p - Dumps all handles of a protocol specified by the GUID.\r\n" -" -d - Dumps UEFI Driver Model-related information.\r\n" -" -l - Dumps information using the language codes (e.g. ISO 639-2).\r\n" -" -sfo - Displays information as described in Standard-Format Output.\r\n" -" -v - Dumps verbose information about a specific handle.\r\n" -" handle - Specifies a handle to dump information about (a hexadecimal number).\r\n" -" If not present, then all information will be dumped.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. When neither 'handle' nor 'prot_id' is specified, a list of all the\r\n" -" device handles in the UEFI environment is displayed. \r\n" -" 2. The '-d' option displays UEFI Driver Model related information including\r\n" -" parent handles, child handles, all drivers installed on the handle, etc.\r\n" -" 3. The '-v' option displays verbose information for the specified handle\r\n" -" including all the protocols on the handle and their details.\r\n" -" 4. If the '-p' option is specified, all handles containing the specified\r\n" -" protocol will be displayed. Otherwise, the 'handle' parameter has to be\r\n" -" specified for display. In this case, the '-d' option will be enabled\r\n" -" automatically if the '-v' option is not specified.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all handles and display one screen at a time:\r\n" -" Shell> dh -b\r\n" -" \r\n" -" * To display the detailed information on handle 0x30:\r\n" -" Shell> dh 30\r\n" -" \r\n" -" * To display all handles with 'diskio' protocol:\r\n" -" Shell> dh -p diskio\r\n" -" \r\n" -" * To display all handles with 'LoadedImage' protocol and break when the screen is\r\n" -" full:\r\n" -" Shell> dh -p LoadedImage -b\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_DEVTREE #language en-US "" -".TH devtree 0 "display device tree"\r\n" -".SH NAME\r\n" -"Displays the UEFI Driver Model compliant device tree.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DEVTREE [-b] [-d] [-l XXX] [DeviceHandle] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" -d - Displays the device tree using device paths.\r\n" -" -l - Displays the device tree using the specified language.\r\n" -" DeviceHandle - Displays the device tree below a certain handle.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command prints a tree of devices that are being managed by drivers\r\n" -" that follow the UEFI Driver Model. By default, the devices are printed in\r\n" -" device names that are retrieved from the Component Name Protocol.\r\n" -" 2. If the option -d is specified, the device paths will be printed instead.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the tree of all devices compliant with the UEFI Driver Model:\r\n" -" Shell> devtree\r\n" -" \r\n" -" * To display the tree of all devices below device 28 compliant with the UEFI\r\n" -" Driver Model:\r\n" -" Shell> devtree 28\r\n" -" \r\n" -" * To display the tree of all devices compliant with the UEFI Driver Model\r\n" -" one screen at a time:\r\n" -" Shell> devtree -b\r\n" -" \r\n" - -#string STR_GET_HELP_DEVICES #language en-US "" -".TH devices 0 "display a list of devices"\r\n" -".SH NAME\r\n" -"Displays the list of devices managed by UEFI drivers. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DEVICES [-b] [-l XXX] [-sfo] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Display one screen at a time\r\n" -" -l XXX - Display devices using the specified ISO 639-2 language\r\n" -" -sfo - Displays information as described in Standard-Format Output.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The command prints a list of devices that are being managed by drivers\r\n" -" that follow the UEFI Driver Model.\r\n" -" 2. Display Format:\r\n" -" CTRL - The handle number of the UEFI device\r\n" -" TYPE - The device type:\r\n" -" [R] - Root Controller\r\n" -" [B] - Bus Controller\r\n" -" [D] - Device Controller\r\n" -" CFG - A managing driver supports the Driver Configuration\r\n" -" Protocol. Yes if 'Y' or 'X'; No if 'N' or '-'.\r\n" -" DIAG - A managing driver supports the Driver Diagnostics\r\n" -" Protocol. Yes if 'Y' or 'X'; No if 'N' or '-'.\r\n" -" #P - The number of parent controllers for this device\r\n" -" #D - The number of drivers managing the device\r\n" -" #C - The number of child controllers produced by this device\r\n" -" DEVICE NAME - The name of the device from the Component Name Protocol\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all devices compliant with the UEFI Driver Model:\r\n" -" Shell> devices\r\n" -" \r\n" - -#string STR_GET_HELP_CONNECT #language en-US "" -".TH connect 0 "connect a driver"\r\n" -".SH NAME\r\n" -"Binds a driver to a specific device and starts the driver. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"CONNECT [[DeviceHandle] [DriverHandle] | [-c] | [-r]] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -c - Connects console devices\r\n" -" -r - Connects recursively\r\n" -" DeviceHandle - Specifies a device handle in hexadecimal format.\r\n" -" DriverHandle - Specifies a driver handle in hexadecimal format.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. If no 'DeviceHandle' parameter is specified, all device handles in the\r\n" -" current system will be the default.\r\n" -" 2. If no 'DriverHandle' parameter is specified, all matched drivers will be\r\n" -" bound to the specified device.\r\n" -" 3. If 'DriverHandle' parameter is provided, the specified driver will have\r\n" -" highest priority on connecting the device(s).\r\n" -" 4. If the '-c' option is specified, only console devices described in the\r\n" -" UEFI Shell environment variables and related devices will be connected.\r\n" -" 5. If the '-r' option is specified, the command will recursively scan all\r\n" -" handles and check to see if any loaded or embedded driver can match the\r\n" -" specified device. If so, the driver will be bound to the device.\r\n" -" Additionally, if more device handles are created during the binding, \r\n" -" these handles will also be checked to see if a matching driver can bind\r\n" -" to these devices as well. The process is repeated until no more drivers\r\n" -" are able to connect to any devices. However, without the option, the\r\n" -" newly created device handles will not be further bound to any\r\n" -" drivers.\r\n" -" 6. If only a single handle is specified and the handle has an\r\n" -" EFI_DRIVER_BINDING_PROTOCOL on it, then the handle is assumed to be a\r\n" -" driver handle. Otherwise, it is assumed to be a device handle.\r\n" -" 7. If no parameters are specified, then the command will attempt to bind\r\n" -" all proper drivers to all devices without recursion. Each connection\r\n" -" status will be displayed.\r\n" -" 8. Output redirection is not supported for 'connect -r' usage.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To connect all drivers to all devices recursively:\r\n" -" Shell> connect -r\r\n" -" \r\n" -" * To display all connections:\r\n" -" Shell> connect\r\n" -" \r\n" -" * To connect drivers with 0x17 as highest priority to all the devices they\r\n" -" can manage:\r\n" -" Shell> connect 17\r\n" -" \r\n" -" * To connect all possible drivers to device 0x19:\r\n" -" Shell> connect 19\r\n" -" \r\n" -" * To connect drivers with 0x17 as highest priority to device 0x19 they can\r\n" -" manage:\r\n" -" Shell> connect 19 17\r\n" -" \r\n" -" * To connect console devices described in the UEFI Shell environment\r\n" -" variables:\r\n" -" Shell> connect -c\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_OPENINFO #language en-US "" -".TH openinfo 0 "display info about a handle."\r\n" -".SH NAME\r\n" -"Displays the protocols and agents associated with a handle. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"OPENINFO Handle [-b] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -b - Displays one screen at a time.\r\n" -" Handle - Displays open protocol information for the specified handle.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command is used to display the open protocols on a given handle.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To show open protocols on handle 0x23:\r\n" -" Shell> openinfo 23\r\n" -" \r\n" - -#string STR_GET_HELP_DRVDIAG #language en-US "" -".TH drvdiag 0 "diagnose a driver"\r\n" -".SH NAME\r\n" -"Invokes the Driver Diagnostics Protocol. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DRVDIAG [-c] [-l XXX] [-s|-e|-m] [DriverHandle [DeviceHandle [ChildHandle]]] \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -c - Diagnoses all child devices.\r\n" -" -l - Diagnoses using the ISO 639-2 language specified by XXX.\r\n" -" -s - Runs diagnostics in standard mode.\r\n" -" -e - Runs diagnostics in extended mode.\r\n" -" -m - Runs diagnostics in manufacturing mode.\r\n" -" DriverHandle - Specifies the handle of the driver to diagnose.\r\n" -" DeviceHandle - Specifies the handle of a device that DriverHandle is managing.\r\n" -" ChildHandle - Specifies the handle of a device that is a child of DeviceHandle.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command invokes the Driver Diagnostics Protocol.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the list of devices that are available for diagnostics:\r\n" -" Shell> drvdiag\r\n" -" \r\n" -" * To display the list of devices and child devices that are available for\r\n" -" diagnostics:\r\n" -" Shell> drvdiag -c\r\n" -" \r\n" -" * To run diagnostics in standard mode on all devices:\r\n" -" Shell> drvdiag -s\r\n" -" \r\n" -" * To run diagnostics in standard mode on all devices in English:\r\n" -" Shell> drvdiag -s -l eng\r\n" -" \r\n" -" * To run diagnostics in standard mode on all devices in Spanish:\r\n" -" Shell> drvdiag -s -l spa\r\n" -" \r\n" -" * To run diagnostics in standard mode on all devices and child devices:\r\n" -" Shell> drvdiag -s -c\r\n" -" \r\n" -" * To run diagnostics in extended mode on all devices:\r\n" -" Shell> drvdiag -e\r\n" -" \r\n" -" * To run diagnostics in manufacturing mode on all devices:\r\n" -" Shell> drvdiag -m\r\n" -" \r\n" -" * To run diagnostics in standard mode on all devices managed by driver 0x17:\r\n" -" Shell> drvdiag -s 17\r\n" -" \r\n" -" * To run diagnostics in standard mode on device 0x28 managed by driver 0x17:\r\n" -" Shell> drvdiag -s 17 28\r\n" -" \r\n" -" * To run diagnostics in standard mode on all child devices of device 0x28\r\n" -" managed by driver 0x17:\r\n" -" Shell> drvdiag -s 17 28 -c\r\n" -" \r\n" -" * To run diagnostics in standard mode on child device 0x30 of device 0x28\r\n" -" managed by driver 0x17:\r\n" -" Shell> drvdiag -s 17 28 30\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_RECONNECT #language en-US "" -".TH reconnect 0 "reconnect drivers"\r\n" -".SH NAME\r\n" -"Reconnects drivers to the specific device. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"RECONNECT DeviceHandle [DriverHandle [ChildHandle]]\r\n" -"RECONNECT -r \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -r - Reconnects drivers to all devices.\r\n" -" DeviceHandle - Specifies a device handle (a hexadecimal number).\r\n" -" DriverHandle - Specifies a driver handle (a hexadecimal number). If not specified, all\r\n" -" drivers on the specified device will be reconnected. \r\n" -" ChildHandle - Specifies the child handle of device (a hexadecimal number). If not\r\n" -" specified, then all child handles of the specified device are\r\n" -" reconnected.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command reconnects drivers to the specific device. It will first\r\n" -" disconnect the specified driver from the specified device and then connect\r\n" -" the driver to the device recursively.\r\n" -" 2. If the -r option is used, then all drivers will be reconnected to all\r\n" -" devices. Any drivers that are bound to any devices will be disconnected\r\n" -" first and then connected recursively.\r\n" -" 3. See the connect and disconnect commands for more details. \r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To reconnect all drivers to all devices:\r\n" -" Shell> reconnect -r\r\n" -" \r\n" -" * To reconnect all drivers to device 0x28:\r\n" -" fs0:\> reconnect 28\r\n" -" \r\n" -" * To disconnect 0x17 from 0x28 then reconnect drivers with 0x17 as highest\r\n" -" priority to device 0x28:\r\n" -" fs0:\> reconnect 28 17\r\n" -" \r\n" -" * To disconnect 0x17 from 0x28 destroying child 0x32 then reconnect drivers\r\n" -" with 0x17 as highest priority to device 0x28\r\n" -" fs0:\> reconnect 28 17 32\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_UNLOAD #language en-US "" -".TH unload 0 "unload a driver"\r\n" -".SH NAME\r\n" -"Unloads a driver image that was already loaded. \r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"UNLOAD [-n] [-v|-verbose] Handle \r\n" -".SH OPTIONS\r\n" -" \r\n" -" -n - Skips all prompts during unloading, so that it can be used\r\n" -" in a script file.\r\n" -" -v, -verbose - Dumps verbose status information before the image is unloaded.\r\n" -" Handle - Specifies the handle of driver to unload, always taken as hexadecimal number.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The '-n' option can be used to skip all prompts during unloading.\r\n" -" 2. If the '-v' option is specified, verbose image information will be\r\n" -" displayed before the image is unloaded.\r\n" -" 3. Only drivers that support unloading can be successfully unloaded.\r\n" -" 4. Use the 'LOAD' command to load a driver.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To find the handle for the UEFI driver image to unload:\r\n" -" Shell> dh -b\r\n" -" \r\n" -" * To unload the UEFI driver image with handle 27:\r\n" -" Shell> unload 27\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - - - - - - - - - - - - - - - - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c deleted file mode 100644 index 15c2a0c..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c +++ /dev/null @@ -1,148 +0,0 @@ -/** @file - Main file for Unload shell Driver1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellDriver1CommandsLib.h" - -/** - Function to dump LoadedImage info from TheHandle. - - @param[in] TheHandle The handle to dump info from. - - @retval EFI_SUCCESS The info was dumped. - @retval EFI_INVALID_PARAMETER The handle did not have LoadedImage -**/ -EFI_STATUS -DumpLoadedImageProtocolInfo ( - IN EFI_HANDLE TheHandle - ) -{ - CHAR16 *TheString; - - TheString = GetProtocolInformationDump(TheHandle, &gEfiLoadedImageProtocolGuid, TRUE); - - ShellPrintEx(-1, -1, L"%s", TheString); - - SHELL_FREE_NON_NULL(TheString); - - return (EFI_SUCCESS); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-n", TypeFlag}, - {L"-v", TypeFlag}, - {L"-verbose", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'unload' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunUnload ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - EFI_HANDLE TheHandle; - CONST CHAR16 *Param1; - SHELL_PROMPT_RESPONSE *Resp; - UINT64 Value; - - ShellStatus = SHELL_SUCCESS; - Package = NULL; - Resp = NULL; - Value = 0; - TheHandle = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle,L"unload", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetCount(Package) > 2){ - // - // error for too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"unload"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetCount(Package) < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"unload"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Param1 = ShellCommandLineGetRawValue(Package, 1); - if (Param1 != NULL) { - Status = ShellConvertStringToUint64(Param1, &Value, TRUE, FALSE); - TheHandle = ConvertHandleIndexToHandle((UINTN)Value); - } - - if (EFI_ERROR(Status) || Param1 == NULL || TheHandle == NULL){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"unload", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(TheHandle != NULL); - if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) { - DumpLoadedImageProtocolInfo(TheHandle); - } - - if (!ShellCommandLineGetFlag(Package, L"-n")) { - Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, (UINTN)TheHandle); - Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp); - } - if (ShellCommandLineGetFlag(Package, L"-n") || (Resp != NULL && *Resp == ShellPromptResponseYes)) { - Status = gBS->UnloadImage(TheHandle); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", (UINTN)TheHandle, Status); - } - SHELL_FREE_NON_NULL(Resp); - } - } - } - if (ShellStatus == SHELL_SUCCESS) { - if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (EFI_ERROR(Status)) { - ShellStatus = SHELL_NOT_FOUND; - } - } - - if (Package != NULL) { - ShellCommandLineFreeVarList(Package); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c deleted file mode 100644 index 205ebd9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c +++ /dev/null @@ -1,59 +0,0 @@ -/** @file - Main file for NULL named library for install1 shell command functions. - - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include - -/** - Constructor for the Shell Level 1 Commands library. - - Install the handlers for level 1 UEFI Shell 2.0 commands. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellInstall1CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // check our bit of the profiles mask - // - if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) { - return (EFI_SUCCESS); - } - - return (BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Install1")); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -ShellInstall1CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return (BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable)); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf deleted file mode 100644 index c244d93..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf +++ /dev/null @@ -1,51 +0,0 @@ -## @file -# Provides shell install1 functions -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellInstall1CommandsLib - FILE_GUID = D250E364-51C6-49ed-AEBF-6D83F5130F74 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellInstall1CommandsLibConstructor - DESTRUCTOR = ShellInstall1CommandsLibDestructor - -[Sources.common] - UefiShellInstall1CommandsLib.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - SortLib - PrintLib - BcfgCommandLib - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Guids] - gShellInstall1HiiGuid ## UNDEFINED diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c deleted file mode 100644 index d8ca4a3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c +++ /dev/null @@ -1,97 +0,0 @@ -/** @file - Main file for exit shell level 1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"/b", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'exit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunExit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT64 RetVal; - CONST CHAR16 *Return; - - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"exit", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - - // - // return the specified error code - // - Return = ShellCommandLineGetRawValue(Package, 1); - if (Return != NULL) { - Status = ShellConvertStringToUint64(Return, &RetVal, FALSE, FALSE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"exit", Return); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // If we are in a batch file and /b then pass TRUE otherwise false... - // - ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")), RetVal); - - ShellStatus = SHELL_SUCCESS; - } - } else { - // If we are in a batch file and /b then pass TRUE otherwise false... - // - ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")), 0); - - ShellStatus = SHELL_SUCCESS; - } - - ShellCommandLineFreeVarList (Package); - } - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c deleted file mode 100644 index 30ad006..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ /dev/null @@ -1,751 +0,0 @@ -/** @file - Main file for endfor and for shell level 1 functions. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" -#include - -/** - Determine if a valid string is a valid number for the 'for' command. - - @param[in] Number The pointer to the string representation of the number to test. - - @retval TRUE The number is valid. - @retval FALSE The number is not valid. -**/ -BOOLEAN -ShellIsValidForNumber ( - IN CONST CHAR16 *Number - ) -{ - if (Number == NULL || *Number == CHAR_NULL) { - return (FALSE); - } - - if (*Number == L'-') { - Number++; - } - - if (StrLen(Number) == 0) { - return (FALSE); - } - - if (StrLen(Number) >= 7) { - if ((StrStr(Number, L" ") == NULL) || (((StrStr(Number, L" ") != NULL) && (StrStr(Number, L" ") - Number) >= 7))) { - return (FALSE); - } - } - - if (!ShellIsDecimalDigitCharacter(*Number)) { - return (FALSE); - } - - return (TRUE); -} - -/** - Function for 'endfor' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEndFor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - BOOLEAN Found; - SCRIPT_FILE *CurrentScriptFile; - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"endfor"); - return (SHELL_UNSUPPORTED); - } - - if (gEfiShellParametersProtocol->Argc > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"endfor"); - return (SHELL_INVALID_PARAMETER); - } - - Found = MoveToTag(GetPreviousNode, L"for", L"endfor", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE); - - if (!Found) { - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"For", - L"EndFor", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_NOT_FOUND); - } - return (SHELL_SUCCESS); -} - -typedef struct { - UINT32 Signature; - INTN Current; - INTN End; - INTN Step; - CHAR16 *ReplacementName; - CHAR16 *CurrentValue; - BOOLEAN RemoveSubstAlias; - CHAR16 Set[1]; - } SHELL_FOR_INFO; -#define SIZE_OF_SHELL_FOR_INFO OFFSET_OF (SHELL_FOR_INFO, Set) -#define SHELL_FOR_INFO_SIGNATURE SIGNATURE_32 ('S', 'F', 'I', 's') - -/** - Update the value of a given alias on the list. If the alias is not there then add it. - - @param[in] Alias The alias to test for. - @param[in] CommandString The updated command string. - @param[in, out] List The list to search. - - @retval EFI_SUCCESS The operation was completed successfully. - @retval EFI_OUT_OF_RESOURCES There was not enough free memory. -**/ -EFI_STATUS -InternalUpdateAliasOnList( - IN CONST CHAR16 *Alias, - IN CONST CHAR16 *CommandString, - IN OUT LIST_ENTRY *List - ) -{ - ALIAS_LIST *Node; - BOOLEAN Found; - - // - // assert for NULL parameter - // - ASSERT(Alias != NULL); - - // - // check for the Alias - // - for ( Node = (ALIAS_LIST *)GetFirstNode(List), Found = FALSE - ; !IsNull(List, &Node->Link) - ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - ASSERT(Node->Alias != NULL); - if (StrCmp(Node->Alias, Alias)==0) { - FreePool(Node->CommandString); - Node->CommandString = NULL; - Node->CommandString = StrnCatGrow(&Node->CommandString, NULL, CommandString, 0); - Found = TRUE; - break; - } - } - if (!Found) { - Node = AllocateZeroPool(sizeof(ALIAS_LIST)); - if (Node == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - ASSERT(Node->Alias == NULL); - Node->Alias = StrnCatGrow(&Node->Alias, NULL, Alias, 0); - ASSERT(Node->CommandString == NULL); - Node->CommandString = StrnCatGrow(&Node->CommandString, NULL, CommandString, 0); - InsertTailList(List, &Node->Link); - } - return (EFI_SUCCESS); -} - -/** - Find out if an alias is on the given list. - - @param[in] Alias The alias to test for. - @param[in] List The list to search. - - @retval TRUE The alias is on the list. - @retval FALSE The alias is not on the list. -**/ -BOOLEAN -InternalIsAliasOnList( - IN CONST CHAR16 *Alias, - IN CONST LIST_ENTRY *List - ) -{ - ALIAS_LIST *Node; - - // - // assert for NULL parameter - // - ASSERT(Alias != NULL); - - // - // check for the Alias - // - for ( Node = (ALIAS_LIST *)GetFirstNode(List) - ; !IsNull(List, &Node->Link) - ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - ASSERT(Node->Alias != NULL); - if (StrCmp(Node->Alias, Alias)==0) { - return (TRUE); - } - } - return (FALSE); -} - -/** - Remove an alias from the given list. - - @param[in] Alias The alias to remove. - @param[in, out] List The list to search. -**/ -BOOLEAN -InternalRemoveAliasFromList( - IN CONST CHAR16 *Alias, - IN OUT LIST_ENTRY *List - ) -{ - ALIAS_LIST *Node; - - // - // assert for NULL parameter - // - ASSERT(Alias != NULL); - - // - // check for the Alias - // - for ( Node = (ALIAS_LIST *)GetFirstNode(List) - ; !IsNull(List, &Node->Link) - ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link) - ){ - ASSERT(Node->CommandString != NULL); - ASSERT(Node->Alias != NULL); - if (StrCmp(Node->Alias, Alias)==0) { - RemoveEntryList(&Node->Link); - FreePool(Node->Alias); - FreePool(Node->CommandString); - FreePool(Node); - return (TRUE); - } - } - return (FALSE); -} - -/** - Function to determine whether a string is decimal or hex representation of a number - and return the number converted from the string. - - @param[in] String String representation of a number - - @return the number - @retval (UINTN)(-1) An error ocurred. -**/ -UINTN -ReturnUintn( - IN CONST CHAR16 *String - ) -{ - UINT64 RetVal; - - if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, FALSE, TRUE))) { - return ((UINTN)RetVal); - } - return ((UINTN)(-1)); -} - -/** - Function for 'for' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunFor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - SCRIPT_FILE *CurrentScriptFile; - CHAR16 *ArgSet; - CHAR16 *ArgSetWalker; - CHAR16 *Parameter; - UINTN ArgSize; - UINTN LoopVar; - SHELL_FOR_INFO *Info; - CHAR16 *TempString; - CHAR16 *TempSpot; - BOOLEAN FirstPass; - EFI_SHELL_FILE_INFO *Node; - EFI_SHELL_FILE_INFO *FileList; - UINTN NewSize; - - ArgSet = NULL; - ArgSize = 0; - ShellStatus = SHELL_SUCCESS; - ArgSetWalker = NULL; - TempString = NULL; - Parameter = NULL; - FirstPass = FALSE; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"for"); - return (SHELL_UNSUPPORTED); - } - - if (gEfiShellParametersProtocol->Argc < 4) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"for"); - return (SHELL_INVALID_PARAMETER); - } - - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - ASSERT(CurrentScriptFile != NULL); - - if ((CurrentScriptFile->CurrentCommand != NULL) && (CurrentScriptFile->CurrentCommand->Data == NULL)) { - FirstPass = TRUE; - - // - // Make sure that an End exists. - // - if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"EndFor", - L"For", - CurrentScriptFile->CurrentCommand->Line); - return (SHELL_DEVICE_ERROR); - } - - // - // Process the line. - // - if (gEfiShellParametersProtocol->Argv[1][0] != L'%' || gEfiShellParametersProtocol->Argv[1][2] != CHAR_NULL - ||!((gEfiShellParametersProtocol->Argv[1][1] >= L'a' && gEfiShellParametersProtocol->Argv[1][1] <= L'z') - ||(gEfiShellParametersProtocol->Argv[1][1] >= L'A' && gEfiShellParametersProtocol->Argv[1][1] <= L'Z')) - ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[1]); - return (SHELL_INVALID_PARAMETER); - } - - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - L"in", - gEfiShellParametersProtocol->Argv[2]) == 0) { - for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { - ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL)); - if (StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL - ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL - ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"[") != NULL - ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"]") != NULL) { - FileList = NULL; - Status = ShellOpenFileMetaArg ((CHAR16*)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList); - if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) { - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); - } else { - for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) - ){ - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Node->FullName, 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); - } - ShellCloseFileMetaArg(&FileList); - } - } else { - Parameter = gEfiShellParametersProtocol->Argv[LoopVar]; - if (Parameter[0] == L'\"' && Parameter[StrLen(Parameter)-1] == L'\"') { - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0); - } else { - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0); - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); - } - } - } - if (ArgSet == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - // - // set up for an 'in' for loop - // - NewSize = StrSize(ArgSet); - NewSize += sizeof(SHELL_FOR_INFO)+StrSize(gEfiShellParametersProtocol->Argv[1]); - Info = AllocateZeroPool(NewSize); - if (Info == NULL) { - FreePool (ArgSet); - return SHELL_OUT_OF_RESOURCES; - } - Info->Signature = SHELL_FOR_INFO_SIGNATURE; - CopyMem(Info->Set, ArgSet, StrSize(ArgSet)); - NewSize = StrSize(gEfiShellParametersProtocol->Argv[1]); - CopyMem(Info->Set+(StrSize(ArgSet)/sizeof(Info->Set[0])), gEfiShellParametersProtocol->Argv[1], NewSize); - Info->ReplacementName = Info->Set+StrSize(ArgSet)/sizeof(Info->Set[0]); - Info->CurrentValue = (CHAR16*)Info->Set; - Info->Step = 0; - Info->Current = 0; - Info->End = 0; - - if (InternalIsAliasOnList(Info->ReplacementName, &CurrentScriptFile->SubstList)) { - Info->RemoveSubstAlias = FALSE; - } else { - Info->RemoveSubstAlias = TRUE; - } - CurrentScriptFile->CurrentCommand->Data = Info; - } - } else if (gUnicodeCollation->StriColl( - gUnicodeCollation, - L"run", - gEfiShellParametersProtocol->Argv[2]) == 0) { - for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { - ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL)); - if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L")") != NULL && - (LoopVar + 1) < gEfiShellParametersProtocol->Argc - ) { - return (SHELL_INVALID_PARAMETER); - } - if (ArgSet == NULL) { -// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); - } else { - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0); - } - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0); -// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0); - } - if (ArgSet == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - // - // set up for a 'run' for loop - // - Info = AllocateZeroPool(sizeof(SHELL_FOR_INFO)+StrSize(gEfiShellParametersProtocol->Argv[1])); - if (Info == NULL) { - FreePool (ArgSet); - return SHELL_OUT_OF_RESOURCES; - } - Info->Signature = SHELL_FOR_INFO_SIGNATURE; - CopyMem(Info->Set, gEfiShellParametersProtocol->Argv[1], StrSize(gEfiShellParametersProtocol->Argv[1])); - Info->ReplacementName = Info->Set; - Info->CurrentValue = NULL; - ArgSetWalker = ArgSet; - if (ArgSetWalker[0] != L'(') { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempSpot = StrStr(ArgSetWalker, L")"); - if (TempSpot != NULL) { - TempString = TempSpot+1; - if (*(TempString) != CHAR_NULL) { - while(TempString != NULL && *TempString == L' ') { - TempString++; - } - if (StrLen(TempString) > 0) { - TempSpot = NULL; - } - } - } - if (TempSpot == NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - *TempSpot = CHAR_NULL; - ArgSetWalker++; - while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { - ArgSetWalker++; - } - if (!ShellIsValidForNumber(ArgSetWalker)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ArgSetWalker[0] == L'-') { - Info->Current = 0 - (INTN)ReturnUintn(ArgSetWalker+1); - } else { - Info->Current = (INTN)ReturnUintn(ArgSetWalker); - } - ArgSetWalker = StrStr(ArgSetWalker, L" "); - while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { - ArgSetWalker++; - } - if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){ - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ArgSetWalker[0] == L'-') { - Info->End = 0 - (INTN)ReturnUintn(ArgSetWalker+1); - } else { - Info->End = (INTN)ReturnUintn(ArgSetWalker); - } - if (Info->Current < Info->End) { - Info->Step = 1; - } else { - Info->Step = -1; - } - - ArgSetWalker = StrStr(ArgSetWalker, L" "); - while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { - ArgSetWalker++; - } - if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) { - if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){ - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (*ArgSetWalker == L')') { - ASSERT(Info->Step == 1 || Info->Step == -1); - } else { - if (ArgSetWalker[0] == L'-') { - Info->Step = 0 - (INTN)ReturnUintn(ArgSetWalker+1); - } else { - Info->Step = (INTN)ReturnUintn(ArgSetWalker); - } - - if (StrStr(ArgSetWalker, L" ") != NULL) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile->CurrentCommand->Line); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - - } - } - } - } - } - if (ShellStatus == SHELL_SUCCESS) { - if (InternalIsAliasOnList(Info->ReplacementName, &CurrentScriptFile->SubstList)) { - Info->RemoveSubstAlias = FALSE; - } else { - Info->RemoveSubstAlias = TRUE; - } - } - if (CurrentScriptFile->CurrentCommand != NULL) { - CurrentScriptFile->CurrentCommand->Data = Info; - } - } - } else { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), - gShellLevel1HiiHandle, - ArgSet, - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - // - // These need to be NULL since they are used to determine if this is the first pass later on... - // - ASSERT(ArgSetWalker == NULL); - ASSERT(ArgSet == NULL); - } - - if (CurrentScriptFile != NULL && CurrentScriptFile->CurrentCommand != NULL) { - Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data; - if (CurrentScriptFile->CurrentCommand->Reset) { - if (Info != NULL) { - Info->CurrentValue = (CHAR16*)Info->Set; - } - FirstPass = TRUE; - CurrentScriptFile->CurrentCommand->Reset = FALSE; - } - } else { - ShellStatus = SHELL_UNSUPPORTED; - Info = NULL; - } - if (ShellStatus == SHELL_SUCCESS) { - ASSERT(Info != NULL); - if (Info->Step != 0) { - // - // only advance if not the first pass - // - if (!FirstPass) { - // - // sequence version of for loop... - // - Info->Current += Info->Step; - } - - TempString = AllocateZeroPool(50*sizeof(CHAR16)); - UnicodeSPrint(TempString, 50*sizeof(CHAR16), L"%d", Info->Current); - InternalUpdateAliasOnList(Info->ReplacementName, TempString, &CurrentScriptFile->SubstList); - FreePool(TempString); - - if ((Info->Step > 0 && Info->Current > Info->End) || (Info->Step < 0 && Info->Current < Info->End)) { - CurrentScriptFile->CurrentCommand->Data = NULL; - // - // find the matching endfor (we're done with the loop) - // - if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"EndFor", - L"For", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - ShellStatus = SHELL_DEVICE_ERROR; - } - if (Info->RemoveSubstAlias) { - // - // remove item from list - // - InternalRemoveAliasFromList(Info->ReplacementName, &CurrentScriptFile->SubstList); - } - FreePool(Info); - } - } else { - // - // Must be in 'in' version of for loop... - // - ASSERT(Info->Set != NULL); - if (Info->CurrentValue != NULL && *Info->CurrentValue != CHAR_NULL) { - if (Info->CurrentValue[0] == L' ') { - Info->CurrentValue++; - } - if (Info->CurrentValue[0] == L'\"') { - Info->CurrentValue++; - } - // - // do the next one of the set - // - ASSERT(TempString == NULL); - TempString = StrnCatGrow(&TempString, NULL, Info->CurrentValue, 0); - if (TempString == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - TempSpot = StrStr(TempString, L"\" \""); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - while (TempString[StrLen(TempString)-1] == L'\"') { - TempString[StrLen(TempString)-1] = CHAR_NULL; - } - InternalUpdateAliasOnList(Info->ReplacementName, TempString, &CurrentScriptFile->SubstList); - Info->CurrentValue += StrLen(TempString); - - if (Info->CurrentValue[0] == L'\"') { - Info->CurrentValue++; - } - FreePool(TempString); - } - } else { - CurrentScriptFile->CurrentCommand->Data = NULL; - // - // find the matching endfor (we're done with the loop) - // - if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"EndFor", - L"For", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - ShellStatus = SHELL_DEVICE_ERROR; - } - if (Info->RemoveSubstAlias) { - // - // remove item from list - // - InternalRemoveAliasFromList(Info->ReplacementName, &CurrentScriptFile->SubstList); - } - FreePool(Info); - } - } - } - if (ArgSet != NULL) { - FreePool(ArgSet); - } - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c deleted file mode 100644 index 78f24c9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c +++ /dev/null @@ -1,105 +0,0 @@ -/** @file - Main file for goto shell level 1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" - -/** - Function for 'goto' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunGoto ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR16 *CompareString; - UINTN Size; - SCRIPT_FILE *CurrentScriptFile; - - ShellStatus = SHELL_SUCCESS; - CompareString = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Goto"); - return (SHELL_UNSUPPORTED); - } - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"goto", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"goto"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"goto"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Size = 0; - ASSERT((CompareString == NULL && Size == 0) || (CompareString != NULL)); - CompareString = StrnCatGrow(&CompareString, &Size, L":", 0); - CompareString = StrnCatGrow(&CompareString, &Size, ShellCommandLineGetRawValue(Package, 1), 0); - // - // Check forwards and then backwards for a label... - // - if (!MoveToTag(GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, TRUE)) { - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - CompareString, - L"Goto", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - ShellStatus = SHELL_NOT_FOUND; - } - FreePool(CompareString); - } - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c deleted file mode 100644 index 1fc1551..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c +++ /dev/null @@ -1,1111 +0,0 @@ -/** @file - Main file for If and else shell level 1 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" -#include - -typedef enum { - EndTagOr, - EndTagAnd, - EndTagThen, - EndTagMax -} END_TAG_TYPE; - -typedef enum { - OperatorGreaterThan, - OperatorLessThan, - OperatorEqual, - OperatorNotEqual, - OperatorGreatorOrEqual, - OperatorLessOrEqual, - OperatorUnisgnedGreaterThan, - OperatorUnsignedLessThan, - OperatorUnsignedGreaterOrEqual, - OperatorUnsignedLessOrEqual, - OperatorMax -} BIN_OPERATOR_TYPE; - -/** - Extract the next fragment, if there is one. - - @param[in, out] Statement The current remaining statement. - @param[in] Fragment The current fragment. - @param[out] Match TRUE when there is another Fragment in Statement, - FALSE otherwise. - - @retval EFI_SUCCESS The match operation is performed successfully. - @retval EFI_OUT_OF_RESOURCES Out of resources. -**/ -EFI_STATUS -IsNextFragment ( - IN OUT CONST CHAR16 **Statement, - IN CONST CHAR16 *Fragment, - OUT BOOLEAN *Match - ) -{ - CHAR16 *Tester; - - Tester = NULL; - - Tester = StrnCatGrow(&Tester, NULL, *Statement, StrLen(Fragment)); - if (Tester == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Tester[StrLen(Fragment)] = CHAR_NULL; - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Fragment, - Tester) == 0) { - // - // increment the string pointer to the end of what we found and then chop off spaces... - // - *Statement+=StrLen(Fragment); - while (*Statement[0] == L' ') { - (*Statement)++; - } - *Match = TRUE; - } else { - *Match = FALSE; - } - FreePool(Tester); - return EFI_SUCCESS; -} - -/** - Determine if String represents a valid profile. - - @param[in] String The pointer to the string to test. - - @retval TRUE String is a valid profile. - @retval FALSE String is not a valid profile. -**/ -BOOLEAN -IsValidProfile ( - IN CONST CHAR16 *String - ) -{ - CONST CHAR16 *ProfilesString; - CONST CHAR16 *TempLocation; - - ProfilesString = ShellGetEnvironmentVariable(L"profiles"); - ASSERT(ProfilesString != NULL); - TempLocation = StrStr(ProfilesString, String); - if ((TempLocation != NULL) && (*(TempLocation-1) == L';') && (*(TempLocation+StrLen(String)) == L';')) { - return (TRUE); - } - return (FALSE); -} - -/** - Do a comparison between 2 things. - - @param[in] Compare1 The first item to compare. - @param[in] Compare2 The second item to compare. - @param[in] BinOp The type of comparison to perform. - @param[in] CaseInsensitive TRUE to do non-case comparison, FALSE otherwise. - @param[in] ForceStringCompare TRUE to force string comparison, FALSE otherwise. - - @return The result of the comparison. -**/ -BOOLEAN -TestOperation ( - IN CONST CHAR16 *Compare1, - IN CONST CHAR16 *Compare2, - IN CONST BIN_OPERATOR_TYPE BinOp, - IN CONST BOOLEAN CaseInsensitive, - IN CONST BOOLEAN ForceStringCompare - ) -{ - INTN Cmp1; - INTN Cmp2; - - // - // "Compare1 BinOp Compare2" - // - switch (BinOp) { - case OperatorUnisgnedGreaterThan: - case OperatorGreaterThan: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (StringCompare(&Compare1, &Compare2) > 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (BinOp == OperatorGreaterThan) { - if (Cmp1 > Cmp2) { - return (TRUE); - } - } else { - if ((UINTN)Cmp1 > (UINTN)Cmp2) { - return (TRUE); - } - } - } - return (FALSE); - case OperatorUnsignedLessThan: - case OperatorLessThan: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (StringCompare(&Compare1, &Compare2) < 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (BinOp == OperatorLessThan) { - if (Cmp1 < Cmp2) { - return (TRUE); - } - } else { - if ((UINTN)Cmp1 < (UINTN)Cmp2) { - return (TRUE); - } - } - - } - return (FALSE); - case OperatorEqual: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (StringCompare(&Compare1, &Compare2) == 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (Cmp1 == Cmp2) { - return (TRUE); - } - } - return (FALSE); - case OperatorNotEqual: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (StringCompare(&Compare1, &Compare2) != 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (Cmp1 != Cmp2) { - return (TRUE); - } - } - return (FALSE); - case OperatorUnsignedGreaterOrEqual: - case OperatorGreatorOrEqual: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (StringCompare(&Compare1, &Compare2) >= 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (BinOp == OperatorGreatorOrEqual) { - if (Cmp1 >= Cmp2) { - return (TRUE); - } - } else { - if ((UINTN)Cmp1 >= (UINTN)Cmp2) { - return (TRUE); - } - } - } - return (FALSE); - case OperatorLessOrEqual: - case OperatorUnsignedLessOrEqual: - if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { - // - // string compare - // - if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (StringCompare(&Compare1, &Compare2) <= 0)) { - return (TRUE); - } - } else { - // - // numeric compare - // - if (Compare1[0] == L'-') { - Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1); - } else { - Cmp1 = (INTN)ShellStrToUintn(Compare1); - } - if (Compare2[0] == L'-') { - Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1); - } else { - Cmp2 = (INTN)ShellStrToUintn(Compare2); - } - if (BinOp == OperatorLessOrEqual) { - if (Cmp1 <= Cmp2) { - return (TRUE); - } - } else { - if ((UINTN)Cmp1 <= (UINTN)Cmp2) { - return (TRUE); - } - } - } - return (FALSE); - default: - ASSERT(FALSE); - return (FALSE); - } -} - -/** - Process an if statement and determine if its is valid or not. - - @param[in, out] PassingState Opon entry, the current state. Upon exit, - the new state. - @param[in] StartParameterNumber The number of the first parameter of - this statement. - @param[in] EndParameterNumber The number of the final parameter of - this statement. - @param[in] OperatorToUse The type of termination operator. - @param[in] CaseInsensitive TRUE for case insensitive, FALSE otherwise. - @param[in] ForceStringCompare TRUE for all string based, FALSE otherwise. - - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ProcessStatement ( - IN OUT BOOLEAN *PassingState, - IN UINTN StartParameterNumber, - IN UINTN EndParameterNumber, - IN CONST END_TAG_TYPE OperatorToUse, - IN CONST BOOLEAN CaseInsensitive, - IN CONST BOOLEAN ForceStringCompare - ) -{ - EFI_STATUS Status; - BOOLEAN OperationResult; - BOOLEAN NotPresent; - CHAR16 *StatementWalker; - BIN_OPERATOR_TYPE BinOp; - CHAR16 *Compare1; - CHAR16 *Compare2; - CHAR16 HexString[20]; - CHAR16 *TempSpot; - BOOLEAN Match; - - ASSERT((END_TAG_TYPE)OperatorToUse != EndTagThen); - - Status = EFI_SUCCESS; - BinOp = OperatorMax; - OperationResult = FALSE; - Match = FALSE; - StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber]; - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"not", &Match)) && Match) { - NotPresent = TRUE; - StatementWalker = gEfiShellParametersProtocol->Argv[++StartParameterNumber]; - } else { - NotPresent = FALSE; - } - - // - // now check for 'boolfunc' operators - // - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"isint", &Match)) && Match) { - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match - && StatementWalker[StrLen(StatementWalker)-1] == L')') { - StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL; - OperationResult = ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE); - } else { - Status = EFI_INVALID_PARAMETER; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"isint"); - } - } else if ((!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"exists", &Match)) && Match) || - (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"exist", &Match)) && Match)) { - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && - StatementWalker[StrLen(StatementWalker)-1] == L')') { - StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL; - // - // is what remains a file in CWD??? - // - OperationResult = (BOOLEAN)(ShellFileExists(StatementWalker)==EFI_SUCCESS); - } else if (StatementWalker[0] == CHAR_NULL && StartParameterNumber+1 == EndParameterNumber) { - OperationResult = (BOOLEAN)(ShellFileExists(gEfiShellParametersProtocol->Argv[++StartParameterNumber])==EFI_SUCCESS); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"exist(s)"); - Status = EFI_INVALID_PARAMETER; - } - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"available", &Match)) && Match) { - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && - StatementWalker[StrLen(StatementWalker)-1] == L')') { - StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL; - // - // is what remains a file in the CWD or path??? - // - OperationResult = (BOOLEAN)(ShellIsFileInPath(StatementWalker)==EFI_SUCCESS); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"available"); - Status = EFI_INVALID_PARAMETER; - } - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"profile", &Match)) && Match) { - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && - StatementWalker[StrLen(StatementWalker)-1] == L')') { - // - // Chop off that ')' - // - StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL; - OperationResult = IsValidProfile(StatementWalker); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"profile"); - Status = EFI_INVALID_PARAMETER; - } - } else if (StartParameterNumber+1 >= EndParameterNumber) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber]); - Status = EFI_INVALID_PARAMETER; - } else { - // - // must be 'item binop item' style - // - Compare1 = NULL; - Compare2 = NULL; - BinOp = OperatorMax; - - // - // get the first item - // - StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber]; - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"efierror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - *TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT); - ASSERT(Compare1 == NULL); - Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror"); - Status = EFI_INVALID_PARAMETER; - } - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"pierror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - *TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>2)); - ASSERT(Compare1 == NULL); - Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror"); - Status = EFI_INVALID_PARAMETER; - } - } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16**)(&StatementWalker), L"oemerror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>1)); - ASSERT(Compare1 == NULL); - Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ASSERT(Compare1 == NULL); - if (EndParameterNumber - StartParameterNumber > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber+2]); - Status = EFI_INVALID_PARAMETER; - } else { - // - // must be a raw string - // - Compare1 = StrnCatGrow(&Compare1, NULL, StatementWalker, 0); - } - } - - // - // get the operator - // - ASSERT(StartParameterNumber+1Argv[StartParameterNumber+1]; - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"gt", &Match)) && Match) { - BinOp = OperatorGreaterThan; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"lt", &Match)) && Match) { - BinOp = OperatorLessThan; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"eq", &Match)) && Match) { - BinOp = OperatorEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ne", &Match)) && Match) { - BinOp = OperatorNotEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ge", &Match)) && Match) { - BinOp = OperatorGreatorOrEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"le", &Match)) && Match) { - BinOp = OperatorLessOrEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"==", &Match)) && Match) { - BinOp = OperatorEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ugt", &Match)) && Match) { - BinOp = OperatorUnisgnedGreaterThan; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ult", &Match)) && Match) { - BinOp = OperatorUnsignedLessThan; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"uge", &Match)) && Match) { - BinOp = OperatorUnsignedGreaterOrEqual; - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ule", &Match)) && Match) { - BinOp = OperatorUnsignedLessOrEqual; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker); - Status = EFI_INVALID_PARAMETER; - } - - // - // get the second item - // - ASSERT(StartParameterNumber+2<=EndParameterNumber); - StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+2]; - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"efierror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT); - ASSERT(Compare2 == NULL); - Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror"); - Status = EFI_INVALID_PARAMETER; - } - // - // can this be collapsed into the above? - // - } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"pierror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>2)); - ASSERT(Compare2 == NULL); - Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror"); - Status = EFI_INVALID_PARAMETER; - } - } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16**)(&StatementWalker), L"oemerror", &Match)) && Match) { - TempSpot = StrStr(StatementWalker, L")"); - if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) { - TempSpot = CHAR_NULL; - if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) { - UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>1)); - ASSERT(Compare2 == NULL); - Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0); - StatementWalker += StrLen(StatementWalker) + 1; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror"); - Status = EFI_INVALID_PARAMETER; - } - } else { - // - // must be a raw string - // - ASSERT(Compare2 == NULL); - Compare2 = StrnCatGrow(&Compare2, NULL, StatementWalker, 0); - } - - if (Compare1 != NULL && Compare2 != NULL && BinOp != OperatorMax) { - OperationResult = TestOperation(Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare); - } - - SHELL_FREE_NON_NULL(Compare1); - SHELL_FREE_NON_NULL(Compare2); - } - - // - // done processing do result... - // - - if (!EFI_ERROR(Status)) { - if (NotPresent) { - OperationResult = (BOOLEAN)(!OperationResult); - } - switch(OperatorToUse) { - case EndTagOr: - *PassingState = (BOOLEAN)(*PassingState || OperationResult); - break; - case EndTagAnd: - *PassingState = (BOOLEAN)(*PassingState && OperationResult); - break; - case EndTagMax: - *PassingState = (BOOLEAN)(OperationResult); - break; - default: - ASSERT(FALSE); - } - } - return (Status); -} - -/** - Break up the next part of the if statement (until the next 'and', 'or', or 'then'). - - @param[in] ParameterNumber The current parameter number. - @param[out] EndParameter Upon successful return, will point to the - parameter to start the next iteration with. - @param[out] EndTag Upon successful return, will point to the - type that was found at the end of this statement. - - @retval TRUE A valid statement was found. - @retval FALSE A valid statement was not found. -**/ -BOOLEAN -BuildNextStatement ( - IN UINTN ParameterNumber, - OUT UINTN *EndParameter, - OUT END_TAG_TYPE *EndTag - ) -{ - *EndTag = EndTagMax; - - for( - ; ParameterNumber < gEfiShellParametersProtocol->Argc - ; ParameterNumber++ - ) { - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[ParameterNumber], - L"or") == 0) { - *EndParameter = ParameterNumber - 1; - *EndTag = EndTagOr; - break; - } else if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[ParameterNumber], - L"and") == 0) { - *EndParameter = ParameterNumber - 1; - *EndTag = EndTagAnd; - break; - } else if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[ParameterNumber], - L"then") == 0) { - *EndParameter = ParameterNumber - 1; - *EndTag = EndTagThen; - break; - } - } - if (*EndTag == EndTagMax) { - return (FALSE); - } - return (TRUE); -} - -/** - Move the script file pointer to a different place in the script file. - This one is special since it handles the if/else/endif syntax. - - @param[in] ScriptFile The script file from GetCurrnetScriptFile(). - - @retval TRUE The move target was found and the move was successful. - @retval FALSE Something went wrong. -**/ -BOOLEAN -MoveToTagSpecial ( - IN SCRIPT_FILE *ScriptFile - ) -{ - SCRIPT_COMMAND_LIST *CommandNode; - BOOLEAN Found; - UINTN TargetCount; - CHAR16 *CommandName; - CHAR16 *CommandWalker; - CHAR16 *TempLocation; - - TargetCount = 1; - Found = FALSE; - - if (ScriptFile == NULL) { - return FALSE; - } - - for (CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &ScriptFile->CurrentCommand->Link), Found = FALSE - ; !IsNull(&ScriptFile->CommandList, &CommandNode->Link) && !Found - ; CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &CommandNode->Link) - ){ - - // - // get just the first part of the command line... - // - CommandName = NULL; - CommandName = StrnCatGrow(&CommandName, NULL, CommandNode->Cl, 0); - if (CommandName == NULL) { - continue; - } - CommandWalker = CommandName; - - // - // Skip leading spaces and tabs. - // - while ((CommandWalker[0] == L' ') || (CommandWalker[0] == L'\t')) { - CommandWalker++; - } - TempLocation = StrStr(CommandWalker, L" "); - - if (TempLocation != NULL) { - *TempLocation = CHAR_NULL; - } - - // - // did we find a nested item ? - // - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandWalker, - L"If") == 0) { - TargetCount++; - } else if (TargetCount == 1 && gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandWalker, - (CHAR16*)L"else") == 0) { - // - // else can only decrement the last part... not an nested if - // hence the TargetCount compare added - // - TargetCount--; - } else if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandWalker, - (CHAR16*)L"endif") == 0) { - TargetCount--; - } - if (TargetCount == 0) { - ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &CommandNode->Link); - Found = TRUE; - } - - // - // Free the memory for this loop... - // - SHELL_FREE_NON_NULL(CommandName); - } - return (Found); -} - -/** - Deal with the result of the if operation. - - @param[in] Result The result of the if. - - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND The ending tag could not be found. -**/ -EFI_STATUS -PerformResultOperation ( - IN CONST BOOLEAN Result - ) -{ - if (Result || MoveToTagSpecial(ShellCommandGetCurrentScriptFile())) { - return (EFI_SUCCESS); - } - return (EFI_NOT_FOUND); -} - -/** - Function for 'if' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIf ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - BOOLEAN CaseInsensitive; - BOOLEAN ForceString; - UINTN CurrentParameter; - UINTN EndParameter; - BOOLEAN CurrentValue; - END_TAG_TYPE Ending; - END_TAG_TYPE PreviousEnding; - SCRIPT_FILE *CurrentScriptFile; - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"if"); - return (SHELL_UNSUPPORTED); - } - - if (gEfiShellParametersProtocol->Argc < 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"if"); - return (SHELL_INVALID_PARAMETER); - } - - // - // Make sure that an End exists. - // - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"EndIf", - L"If", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_DEVICE_ERROR); - } - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - CurrentParameter = 1; - EndParameter = 0; - - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[1], - L"/i") == 0 || - gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[2], - L"/i") == 0 || - (gEfiShellParametersProtocol->Argc > 3 && gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[3], - L"/i") == 0)) { - CaseInsensitive = TRUE; - CurrentParameter++; - } else { - CaseInsensitive = FALSE; - } - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[1], - L"/s") == 0 || - gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[2], - L"/s") == 0 || - (gEfiShellParametersProtocol->Argc > 3 && gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[3], - L"/s") == 0)) { - ForceString = TRUE; - CurrentParameter++; - } else { - ForceString = FALSE; - } - - for ( ShellStatus = SHELL_SUCCESS, CurrentValue = FALSE, Ending = EndTagMax - ; CurrentParameter < gEfiShellParametersProtocol->Argc && ShellStatus == SHELL_SUCCESS - ; CurrentParameter++) { - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - gEfiShellParametersProtocol->Argv[CurrentParameter], - L"then") == 0) { - // - // we are at the then - // - if (CurrentParameter+1 != gEfiShellParametersProtocol->Argc) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TEXT_AFTER_THEN), gShellLevel1HiiHandle, L"if"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = PerformResultOperation(CurrentValue); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } else { - PreviousEnding = Ending; - // - // build up the next statement for analysis - // - if (!BuildNextStatement(CurrentParameter, &EndParameter, &Ending)) { - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"Then", - L"If", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Analyze the statement - // - Status = ProcessStatement(&CurrentValue, CurrentParameter, EndParameter, PreviousEnding, CaseInsensitive, ForceString); - if (EFI_ERROR(Status)) { -// ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Optomize to get out of the loop early... - // - if ((Ending == EndTagOr && CurrentValue) || (Ending == EndTagAnd && !CurrentValue)) { - Status = PerformResultOperation(CurrentValue); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]); - ShellStatus = SHELL_INVALID_PARAMETER; - } - break; - } - } - } - if (ShellStatus == SHELL_SUCCESS){ - CurrentParameter = EndParameter; - // - // Skip over the or or and parameter. - // - if (Ending == EndTagOr || Ending == EndTagAnd) { - CurrentParameter++; - } - } - } - } - return (ShellStatus); -} - -/** - Function for 'else' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunElse ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SCRIPT_FILE *CurrentScriptFile; - - Status = CommandInit (); - ASSERT_EFI_ERROR (Status); - - if (gEfiShellParametersProtocol->Argc > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); - return (SHELL_INVALID_PARAMETER); - } - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Else"); - return (SHELL_UNSUPPORTED); - } - - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - - if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"If", - L"Else", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_DEVICE_ERROR); - } - if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"If", - L"Else", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_DEVICE_ERROR); - } - - if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"EndIf", - "Else", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_DEVICE_ERROR); - } - - return (SHELL_SUCCESS); -} - -/** - Function for 'endif' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEndIf ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SCRIPT_FILE *CurrentScriptFile; - - Status = CommandInit (); - ASSERT_EFI_ERROR (Status); - - if (gEfiShellParametersProtocol->Argc > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); - return (SHELL_INVALID_PARAMETER); - } - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Endif"); - return (SHELL_UNSUPPORTED); - } - - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_SYNTAX_NO_MATCHING), - gShellLevel1HiiHandle, - L"If", - L"EndIf", - CurrentScriptFile!=NULL - && CurrentScriptFile->CurrentCommand!=NULL - ? CurrentScriptFile->CurrentCommand->Line:0); - return (SHELL_DEVICE_ERROR); - } - - return (SHELL_SUCCESS); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c deleted file mode 100644 index 6ad079f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - Main file for Shift shell level 1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" - -/** - Function for 'shift' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunShift ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SCRIPT_FILE *CurrentScriptFile; - UINTN LoopVar; - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"shift"); - return (SHELL_UNSUPPORTED); - } - - CurrentScriptFile = ShellCommandGetCurrentScriptFile(); - ASSERT(CurrentScriptFile != NULL); - - if (CurrentScriptFile->Argc < 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"shift"); - return (SHELL_UNSUPPORTED); - } - - for (LoopVar = 0 ; LoopVar < CurrentScriptFile->Argc ; LoopVar++) { - if (LoopVar == 0) { - SHELL_FREE_NON_NULL(CurrentScriptFile->Argv[LoopVar]); - } - if (LoopVar < CurrentScriptFile->Argc -1) { - CurrentScriptFile->Argv[LoopVar] = CurrentScriptFile->Argv[LoopVar+1]; - } else { - CurrentScriptFile->Argv[LoopVar] = NULL; - } - } - CurrentScriptFile->Argc--; - return (SHELL_SUCCESS); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c deleted file mode 100644 index 8f12a2a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c +++ /dev/null @@ -1,84 +0,0 @@ -/** @file - Main file for stall shell level 1 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" - -/** - Function for 'stall' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunStall ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT64 Intermediate; - - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"stall", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"stall"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"stall"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellConvertStringToUint64(ShellCommandLineGetRawValue(Package, 1), &Intermediate, FALSE, FALSE); - if (EFI_ERROR(Status) || ((UINT64)(UINTN)(Intermediate)) != Intermediate) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"stall", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = gBS->Stall((UINTN)Intermediate); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_STALL_FAILED), gShellLevel1HiiHandle, L"stall"); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - } - ShellCommandLineFreeVarList (Package); - } - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c deleted file mode 100644 index a097802..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c +++ /dev/null @@ -1,308 +0,0 @@ -/** @file - Main file for NULL named library for level 1 shell command functions. - - (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel1CommandsLib.h" - -STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel1HiiHandle = NULL; - -/** - Return the help text filename. Only used if no HII information found. - - @retval the filename. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameLevel1 ( - VOID - ) -{ - return (mFileName); -} - -/** - Constructor for the Shell Level 1 Commands library. - - Install the handlers for level 1 UEFI Shell 2.0 commands. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellLevel1CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // if shell level is less than 2 do nothing - // - if (PcdGet8(PcdShellSupportLevel) < 1) { - return (EFI_SUCCESS); - } - - gShellLevel1HiiHandle = HiiAddPackages (&gShellLevel1HiiGuid, gImageHandle, UefiShellLevel1CommandsLibStrings, NULL); - if (gShellLevel1HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handlers that are always installed - // - ShellCommandRegisterCommandName(L"stall", ShellCommandRunStall , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_STALL) )); - ShellCommandRegisterCommandName(L"for", ShellCommandRunFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_FOR) )); - ShellCommandRegisterCommandName(L"goto", ShellCommandRunGoto , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_GOTO) )); - ShellCommandRegisterCommandName(L"if", ShellCommandRunIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_IF) )); - ShellCommandRegisterCommandName(L"shift", ShellCommandRunShift , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_SHIFT) )); - ShellCommandRegisterCommandName(L"exit", ShellCommandRunExit , ShellCommandGetManFileNameLevel1, 1, L"", TRUE , gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_EXIT) )); - ShellCommandRegisterCommandName(L"else", ShellCommandRunElse , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ELSE) )); - ShellCommandRegisterCommandName(L"endif", ShellCommandRunEndIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDIF) )); - ShellCommandRegisterCommandName(L"endfor", ShellCommandRunEndFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDFOR))); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -ShellLevel1CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellLevel1HiiHandle != NULL) { - HiiRemovePackages(gShellLevel1HiiHandle); - } - return (EFI_SUCCESS); -} - -/** - Test a node to see if meets the criterion. - - It functions so that count starts at 1 and it increases or decreases when it - hits the specified tags. when it hits zero the location has been found. - - DecrementerTag and IncrementerTag are used to get around for/endfor and - similar paired types where the entire middle should be ignored. - - If label is used it will be used instead of the count. - - @param[in] Function The function to use to enumerate through the - list. Normally GetNextNode or GetPreviousNode. - @param[in] DecrementerTag The tag to decrement the count at. - @param[in] IncrementerTag The tag to increment the count at. - @param[in] Label A label to look for. - @param[in, out] ScriptFile The pointer to the current script file structure. - @param[in] MovePast TRUE makes function return 1 past the found - location. - @param[in] FindOnly TRUE to not change the ScriptFile. - @param[in] CommandNode The pointer to the Node to test. - @param[in, out] TargetCount The pointer to the current count. -**/ -BOOLEAN -TestNodeForMove ( - IN CONST LIST_MANIP_FUNC Function, - IN CONST CHAR16 *DecrementerTag, - IN CONST CHAR16 *IncrementerTag, - IN CONST CHAR16 *Label OPTIONAL, - IN OUT SCRIPT_FILE *ScriptFile, - IN CONST BOOLEAN MovePast, - IN CONST BOOLEAN FindOnly, - IN CONST SCRIPT_COMMAND_LIST *CommandNode, - IN OUT UINTN *TargetCount - ) -{ - BOOLEAN Found; - CHAR16 *CommandName; - CHAR16 *CommandNameWalker; - CHAR16 *TempLocation; - - Found = FALSE; - - // - // get just the first part of the command line... - // - CommandName = NULL; - CommandName = StrnCatGrow(&CommandName, NULL, CommandNode->Cl, 0); - if (CommandName == NULL) { - return (FALSE); - } - - CommandNameWalker = CommandName; - - // - // Skip leading spaces and tabs. - // - while ((CommandNameWalker[0] == L' ') || (CommandNameWalker[0] == L'\t')) { - CommandNameWalker++; - } - TempLocation = StrStr(CommandNameWalker, L" "); - - if (TempLocation != NULL) { - *TempLocation = CHAR_NULL; - } - - // - // did we find a nested item ? - // - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandNameWalker, - (CHAR16*)IncrementerTag) == 0) { - (*TargetCount)++; - } else if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandNameWalker, - (CHAR16*)DecrementerTag) == 0) { - if (*TargetCount > 0) { - (*TargetCount)--; - } - } - - // - // did we find the matching one... - // - if (Label == NULL) { - if (*TargetCount == 0) { - Found = TRUE; - if (!FindOnly) { - if (MovePast) { - ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link); - } else { - ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)CommandNode; - } - } - } - } else { - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)CommandNameWalker, - (CHAR16*)Label) == 0 - && (*TargetCount) == 0) { - Found = TRUE; - if (!FindOnly) { - // - // we found the target label without loops - // - if (MovePast) { - ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link); - } else { - ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)CommandNode; - } - } - } - } - - // - // Free the memory for this loop... - // - FreePool(CommandName); - return (Found); -} - -/** - Move the script pointer from 1 tag (line) to another. - - It functions so that count starts at 1 and it increases or decreases when it - hits the specified tags. when it hits zero the location has been found. - - DecrementerTag and IncrementerTag are used to get around for/endfor and - similar paired types where the entire middle should be ignored. - - If label is used it will be used instead of the count. - - @param[in] Function The function to use to enumerate through the - list. Normally GetNextNode or GetPreviousNode. - @param[in] DecrementerTag The tag to decrement the count at. - @param[in] IncrementerTag The tag to increment the count at. - @param[in] Label A label to look for. - @param[in, out] ScriptFile The pointer to the current script file structure. - @param[in] MovePast TRUE makes function return 1 past the found - location. - @param[in] FindOnly TRUE to not change the ScriptFile. - @param[in] WrapAroundScript TRUE to wrap end-to-begining or vise versa in - searching. -**/ -BOOLEAN -MoveToTag ( - IN CONST LIST_MANIP_FUNC Function, - IN CONST CHAR16 *DecrementerTag, - IN CONST CHAR16 *IncrementerTag, - IN CONST CHAR16 *Label OPTIONAL, - IN OUT SCRIPT_FILE *ScriptFile, - IN CONST BOOLEAN MovePast, - IN CONST BOOLEAN FindOnly, - IN CONST BOOLEAN WrapAroundScript - ) -{ - SCRIPT_COMMAND_LIST *CommandNode; - BOOLEAN Found; - UINTN TargetCount; - - if (Label == NULL) { - TargetCount = 1; - } else { - TargetCount = 0; - } - - if (ScriptFile == NULL) { - return FALSE; - } - - for (CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &ScriptFile->CurrentCommand->Link), Found = FALSE - ; !IsNull(&ScriptFile->CommandList, &CommandNode->Link)&& !Found - ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link) - ){ - Found = TestNodeForMove( - Function, - DecrementerTag, - IncrementerTag, - Label, - ScriptFile, - MovePast, - FindOnly, - CommandNode, - &TargetCount); - } - - if (WrapAroundScript && !Found) { - for (CommandNode = (SCRIPT_COMMAND_LIST *)GetFirstNode(&ScriptFile->CommandList), Found = FALSE - ; CommandNode != ScriptFile->CurrentCommand && !Found - ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link) - ){ - Found = TestNodeForMove( - Function, - DecrementerTag, - IncrementerTag, - Label, - ScriptFile, - MovePast, - FindOnly, - CommandNode, - &TargetCount); - } - } - return (Found); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h deleted file mode 100644 index 4b9a77b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h +++ /dev/null @@ -1,209 +0,0 @@ -/** @file - Main file for NULL named library for level 1 shell command functions. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_ -#define _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_ - -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE gShellLevel1HiiHandle; - -/** - Function for 'stall' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunStall ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'exit' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunExit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'endif' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEndIf ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'for' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunFor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'endfor' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEndFor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'if' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIf ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'goto' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunGoto ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'shift' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunShift ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - - -/** - Function for 'else' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunElse ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/// -/// Function prototype for BOTH GetNextNode and GetPreviousNode... -/// This is used to control the MoveToTag function direction... -/// -typedef -LIST_ENTRY * -(EFIAPI *LIST_MANIP_FUNC)( - IN CONST LIST_ENTRY *List, - IN CONST LIST_ENTRY *Node - ); - -/** - Move the script pointer from 1 tag (line) to another. - - It functions so that count starts at 1 and it increases or decreases when it - hits the specified tags. when it hits zero the location has been found. - - DecrementerTag and IncrementerTag are used to get around for/endfor and - similar paired types where the entire middle should be ignored. - - If label is used it will be used instead of the count. - - @param[in] Function The function to use to enumerate through the - list. Normally GetNextNode or GetPreviousNode. - @param[in] DecrementerTag The tag to decrement the count at. - @param[in] IncrementerTag The tag to increment the count at. - @param[in] Label A label to look for. - @param[in, out] ScriptFile The pointer to the current script file structure. - @param[in] MovePast TRUE makes function return 1 past the found - location. - @param[in] FindOnly TRUE to not change the ScriptFile. - @param[in] WrapAroundScript TRUE to wrap end-to-begining or vise versa in - searching. -**/ -BOOLEAN -MoveToTag ( - IN CONST LIST_MANIP_FUNC Function, - IN CONST CHAR16 *DecrementerTag, - IN CONST CHAR16 *IncrementerTag, - IN CONST CHAR16 *Label OPTIONAL, - IN OUT SCRIPT_FILE *ScriptFile, - IN CONST BOOLEAN MovePast, - IN CONST BOOLEAN FindOnly, - IN CONST BOOLEAN WrapAroundScript - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf deleted file mode 100644 index 3aabf24..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf +++ /dev/null @@ -1,58 +0,0 @@ -## @file -# Provides shell level 1 functions -# -# Copyright (c) 2009-2015, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellLevel1CommandsLib - FILE_GUID = 50cb6037-1102-47af-b2dd-9944b6eb1abe - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellLevel1CommandsLibConstructor - DESTRUCTOR = ShellLevel1CommandsLibDestructor - -[Sources.common] - UefiShellLevel1CommandsLib.c - UefiShellLevel1CommandsLib.h - UefiShellLevel1CommandsLib.uni - Exit.c - Goto.c - If.c - For.c - Shift.c - Stall.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - SortLib - PrintLib - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES - -[Guids] - gShellLevel1HiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.uni deleted file mode 100644 index acc1cef..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.uni +++ /dev/null @@ -1,504 +0,0 @@ -// /** -// -// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellLevel2CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 level 1 commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_NO_SCRIPT #language en-US "The command '%H%s%N' is incorrect outside of a script\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_SCRIPT #language en-US "The argument '%B%s%N' is incorrect. Line: %d\r\n" -#string STR_GEN_INV_VAR #language en-US "The script's Indexvar '%B%s%N' is incorrect\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" - -#string STR_TEXT_AFTER_THEN #language en-US "%H%s%N: Then cannot be followed by anything\r\n" -#string STR_SYNTAX_AFTER_BAD #language en-US "%H%s%N: Syntax after '%H%s%N' is incorrect\r\n" -#string STR_SYNTAX_IN #language en-US "Syntax after analyzing %s\r\n" -#string STR_SYNTAX_NO_MATCHING #language en-US "No matching '%H%s%N' for '%H%s%N' statement found. Line: %d\r\n" -#string STR_INVALID_BINOP #language en-US "Binary operator not found first in '%H%s%N'\r\n" -#string STR_SYNTAX_STARTING #language en-US "Syntax after %s\r\n" - -#string STR_STALL_FAILED #language en-US "%H%s%N: BootService Stall() failed\r\n" - -#string STR_GET_HELP_EXIT #language en-US "" -".TH exit 0 "exits the script or shell"\r\n" -".SH NAME\r\n" -"Exits the UEFI Shell or the current script.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"EXIT [/b] [exit-code]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" /b - Indicates that only the current UEFI shell script should be\r\n" -" terminated. Ignored if not used within a script.\r\n" -" exit-code - If exiting a UEFI shell script, the value that will be placed\r\n" -" into the environment variable lasterror. If exiting an instance\r\n" -" of the UEFI shell, the value that will be returned to the\r\n" -" caller. If not specified, then 0 will be returned.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command exits the UEFI Shell or, if /b is specified, the current\r\n" -" script.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To exit shell successfully:\r\n" -" Shell> exit\r\n" -" \r\n" -" * To exit the current UEFI shell script:\r\n" -" Shell> exit /b \r\n" -" \r\n" -" * To exit a UEFI shell script with exit-code value returned to the caller:\r\n" -" Shell> exit 0\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" 0 Exited normally\r\n" -" exit-code The return value specified as an option.\r\n" - -#string STR_GET_HELP_FOR #language en-US "" -".TH for 0 "starts a for loop"\r\n" -".SH NAME\r\n" -"Starts a loop based on 'for' syntax.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"FOR %indexvar IN set\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -"ENDFOR\r\n" -" \r\n" -"FOR %indexvar RUN (start end [step])\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -"ENDFOR\r\n" -".SH OPTIONS\r\n" -" \r\n" -" %indexvar - Variable name used to index a set\r\n" -" set - Set to be searched\r\n" -" command [arguments] - Command to be executed with optional arguments\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The FOR command executes one or more commands for each item in a set of\r\n" -" items. The set may be text strings or filenames or a mixture of both,\r\n" -" separated by spaces (if not in a quotation).\r\n" -" 2. If the length of an element in the set is between 0 and 256, and if the\r\n" -" string contains wildcards, the string will be treated as a file name\r\n" -" containing wildcards, and be expanded before command is executed.\r\n" -" 3. If after expansion no such files are found, the literal string itself is\r\n" -" kept. %indexvar is any alphabet character from 'a' to 'z' or 'A' to 'Z',\r\n" -" and they are case sensitive. It should not be a digit (0-9) because\r\n" -" %digit will be interpreted as a positional argument on the command line\r\n" -" that launches the script. The namespace for index variables is separate\r\n" -" from that for environment variables, so if %indexvar has the same name as\r\n" -" an existing environment variable, the environment variable will remain\r\n" -" unchanged by the FOR loop.\r\n" -" 4. Each command is executed once for each item in the set, with any\r\n" -" occurrence of %indexvar in the command replacing with the current item.\r\n" -" In the second format of FOR ... ENDFOR statement, %indexvar will be\r\n" -" assigned a value from start to end with an interval of step. Start and\r\n" -" end can be any integer whose length is less than 7 digits excluding sign,\r\n" -" and it can also applied to step with one exception of zero. Step is\r\n" -" optional, if step is not specified it will be automatically determined by\r\n" -" following rule:\r\n" -" if start <= end then step = 1, otherwise step = -1.\r\n" -" start, end and step are divided by space.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * Sample FOR loop - listing all .txt files:\r\n" -" echo -off\r\n" -" for %a in *.txt\r\n" -" echo %a exists\r\n" -" endfor\r\n" -" \r\n" -" # \r\n" -" # If in current directory, there are 2 files named file1.txt and file2.txt\r\n" -" # then the output of the sample script will be as shown below.\r\n" -" # \r\n" -" Sample1> echo -off\r\n" -" file1.txt exists\r\n" -" file2.txt exists\r\n" -" \r\n" -" * Theoretically it is legal for 2 nested FOR commands to use the same\r\n" -" alphabet letter as their index variable, for instance, a: \r\n" -" #\r\n" -" # Sample FOR loop from 1 to 3 with step 1\r\n" -" #\r\n" -" echo -off\r\n" -" for %a run (1 3)\r\n" -" echo %a\r\n" -" endfor\r\n" -" \r\n" -" #\r\n" -" # Sample FOR loop from 3 down to 1 with step -1\r\n" -" #\r\n" -" echo -off\r\n" -" for %a run (3 1 -1)\r\n" -" echo %a\r\n" -" endfor\r\n" -" \r\n" -" #\r\n" -" # Sample FOR loop - 2 nested for using same index variable\r\n" -" #\r\n" -" echo -off\r\n" -" for %a in value1 value2\r\n" -" for %a in value3 value4\r\n" -" echo %a\r\n" -" endfor\r\n" -" endfor\r\n" -" \r\n" -" Note: When processing first FOR and before seeing the ENDFOR, the index\r\n" -" variable %a has the value "value1", so in second FOR, the %a has\r\n" -" been already defined and it will be replaced with the current value\r\n" -" of %a. The string after substitution becomes FOR value1 in value3\r\n" -" value4, which is not a legal FOR command. Thus only when the value\r\n" -" of %a is also a single alphabet letter, the script will be executed\r\n" -" without error. If 2 independent FOR commands use the same index\r\n" -" variable, when the second FOR is encountered, the first FOR has\r\n" -" already freed the variable so there will be no problem in this case.\r\n" - -#string STR_GET_HELP_ENDFOR #language en-US "" -".TH endfor 0 "ends a for loop"\r\n" -".SH NAME\r\n" -"Ends a 'for' loop.\r\n" -".SH SYNOPSIS\r\n" -"See 'for' for usage.\r\n" -".SH EXAMPLES\r\n" -"See 'for' for examples.\r\n" - -#string STR_GET_HELP_GOTO #language en-US "" -".TH goto 0 "moves to a label"\r\n" -".SH NAME\r\n" -"Moves around the point of execution in a script.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"GOTO label\r\n" -".SH OPTIONS\r\n" -" \r\n" -" label - Specifies a location in batch file\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The GOTO command directs script file execution to the line in the script\r\n" -" file after the given label. The command is not supported from the\r\n" -" interactive shell.\r\n" -" 2. A label is a line beginning with a colon (:). It can appear either after\r\n" -" the GOTO command, or before the GOTO command. The search for label is\r\n" -" done forward in the script file, from the current file position. If the\r\n" -" end of the file is reached, the search resumes at the top of the file and\r\n" -" continues until label is found or the starting point is reached. If label\r\n" -" is not found, the script process terminates and an error message is\r\n" -" displayed. If a label is encountered but there is no GOTO command\r\n" -" executed, the label lines are ignored.\r\n" -" 3. Using GOTO command to jump into another for loop is not allowed,\r\n" -" but jumping into an if statement is legal.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * This is a script:\r\n" -" goto Done\r\n" -" ...\r\n" -" :Done\r\n" -" cleanup.nsh\r\n" - -#string STR_GET_HELP_ENDIF #language en-US "" -".TH endif 0 "ends an if block"\r\n" -".SH NAME\r\n" -"Ends the block of a script controlled by an 'if' statement.\r\n" -".SH SYNOPSIS\r\n" -"See 'if' for usage.\r\n" -".SH EXAMPLES\r\n" -"See 'if' for examples.\r\n" - -#string STR_GET_HELP_IF #language en-US "" -".TH if 0 "controls the execution of a block of a script"\r\n" -".SH NAME\r\n" -"Executes commands in specified conditions.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"IF [NOT] EXIST filename THEN\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -"[ELSE\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -" ]\r\n" -"ENDIF\r\n" -" \r\n" -"IF [/i] [NOT] string1 == string2 THEN\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -"[ELSE\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -" ]\r\n" -"ENDIF\r\n" -"if [/i][/s] ConditionalExpression THEN\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -"[ELSE\r\n" -" command [arguments]\r\n" -" [command [arguments]]\r\n" -" ...\r\n" -" ]\r\n" -"ENDIF\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The IF command executes one or more commands before the ELSE or ENDIF\r\n" -" commands, if the specified condition is TRUE; otherwise commands between\r\n" -" ELSE (if present) and ENDIF are executed.\r\n" -" 2. In the first usage of IF, the EXIST condition is true when the file\r\n" -" specified by filename exists. The filename argument may include device\r\n" -" and path information. Also wildcard expansion is supported by this form.\r\n" -" If more than one file matches the wildcard pattern, the condition\r\n" -" evaluates to TRUE.\r\n" -" 3. In the second usage, the string1 == string2 condition is TRUE if the two\r\n" -" strings are identical. Here the comparison can be case sensitive or\r\n" -" insensitive, it depends on the optional switch /i. If /i is specified,\r\n" -" it will compare strings in the case insensitive manner; otherwise, it\r\n" -" compares strings in the case sensitive manner.\r\n" -" 4. In the third usage, general purpose comparison is supported using\r\n" -" expressions optionally separated by AND or OR. Since < and > are used for\r\n" -" redirection, the expressions use common two character (FORTRAN)\r\n" -" abbreviations for the operators (augmented with unsigned equivalents):\r\n" -" - Expressions : Conditional expressions are evaluated strictly from left\r\n" -" to right. Complex conditionals requiring precedence may\r\n" -" be implemented as nested IFs.\r\n" -" The expressions used in the third usage can have the\r\n" -" following syntax:\r\n" -" conditional-expression := expression |\r\n" -" expression and expression |\r\n" -" expression or expression\r\n" -" expression := expr | not expr\r\n" -" expr := item binop item | boolfunc(string)\r\n" -" item := mapfunc(string) | string\r\n" -" mapfunc := efierror | pierror | oemerror\r\n" -" boolfunc := isint | exists | available | profile\r\n" -" binop := gt | lt | eq | ne | ge | le | == | ugt | ult |\r\n" -" uge | ule\r\n" -" - Comparisons : By default, comparisons are done numerically if the\r\n" -" strings on both sides of the operator are numbers\r\n" -" (as defined below) and in case sensitive character sort\r\n" -" order otherwise. Spaces separate the operators from\r\n" -" operands.\r\n" -" 5. The /s option forces string comparisons and the /i option forces\r\n" -" case-insensitive string comparisons. If either of these is used, the\r\n" -" signed or unsigned versions of the operators have the same results.\r\n" -" The /s and /i apply to the entire line and must appear at the start of\r\n" -" the line (just after the if itself). The two may appear in either order.\r\n" -" 6. When performing comparisons, the Unicode Byte Ordering Character is\r\n" -" ignored at the beginning of any argument.\r\n" -" 7. Comparison Operator Definition:\r\n" -" gt : Greater than\r\n" -" ugt : Unsigned Greater than\r\n" -" lt : Less than\r\n" -" ult : Unsigned Less than\r\n" -" ge : Greater than or equal\r\n" -" uge : Unsigned greater than or equal\r\n" -" le : Less than or equal\r\n" -" ule : Unsigned less than or equal\r\n" -" ne : Not equal\r\n" -" eq : Equals (semantically equivalent to ==)\r\n" -" == : Equals (semantically equivalent to eq)\r\n" -" 8. Error Mapping Functions are used to convert integers into UEFI, PI or OEM\r\n" -" error codes.\r\n" -" Functions used to convert integers into UEFI, PI or OEM error codes:\r\n" -" UefiError : Sets top nibble of parameter to 1000 binary (0x8)\r\n" -" PiError : Sets top nibble of parameter to 1010 binary (0xA)\r\n" -" OemError : Sets top nibble of parameter to 1100 binary (0xC)\r\n" -" Each function maps the small positive parameter into its equivalent error\r\n" -" classification.\r\n" -" For example:\r\n" -" if %lasterror% == EfiError(8) then # Check for write protect.\r\n" -" ...\r\n" -" 9. Boolean Functions may only be used to modify operators in comparisons.\r\n" -" The following built-in Boolean functions are also available:\r\n" -" IsInt : Evaluates to true if the parameter string that follows\r\n" -" is a number (as defined below) and false otherwise.\r\n" -" Exists : Evaluates to true if the file specified by string exists\r\n" -" is in the current working directory or false if not.\r\n" -" Available : Evaluates to true if the file specified by string is in the\r\n" -" current working directory or current path.\r\n" -" Profile : Determines whether the parameter string matches one of the\r\n" -" profile names in the profiles environment variable.\r\n" -" 10. No spaces are allowed between function names and the open parenthesis,\r\n" -" between the open parenthesis and the string or between the string and\r\n" -" the closed parenthesis. Constant strings containing spaces must be\r\n" -" quoted.\r\n" -" 11. To avoid ambiguity and current or future incompatibility, users are\r\n" -" strongly encouraged to surround constant strings that contain\r\n" -" parenthesis with quotes in if statements.\r\n" -" 12. Allowable number formats are decimal numbers and C-style case\r\n" -" insensitive hexadecimal numbers. Numbers may be preceded by a\r\n" -" "-" indicating a negative number.\r\n" -" Examples:\r\n" -" 13\r\n" -" 46\r\n" -" -0x3FFF\r\n" -" 0x3fff\r\n" -" 0x1234\r\n" -" 13. Unsigned values must be less than 264. Signed integer values are bounded\r\n" -" by -/+263.\r\n" -" 14. Numbers are internally represented in two's compliment form. The\r\n" -" representation of the number in the string has no bearing on the way\r\n" -" that number is treated in an numeric expression - type is assigned by\r\n" -" the operator. So, for example, -1 lt 2 is true but -1 ult 2 is false.\r\n" -" 15. The IF command is only available in scripts.\r\n" -" 16. The ELSE command is optional in an IF/ELSE statement.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * Sample script for "if" command usages 1 and 2:\r\n" -" if exist fs0:\myscript.nsh then\r\n" -" myscript myarg1 myarg2\r\n" -" endif\r\n" -" if %myvar% == runboth then\r\n" -" myscript1\r\n" -" myscript2\r\n" -" else\r\n" -" echo ^%myvar^% != runboth\r\n" -" endif\r\n" -" Note: In this example, if the script file myscript.nsh exists in fs0:\,\r\n" -" this script will be launched with 2 arguments, myarg1 and myarg2.\r\n" -" After that, environment variable %myvar% is checked to see if its\r\n" -" value is runboth, if so, script myscript1 and myscript2 will be\r\n" -" executed one after the other, otherwise a message %myvar% != runboth\r\n" -" is printed.\r\n" -" \r\n" -" * Sample script for "if" command usage 3:\r\n" -" :Redo\r\n" -" echo Enter 0-6 or q to quit\r\n" -" # assumes "input y" stores a character of user input into variable y\r\n" -" InputCh MyVar\r\n" -" if x%MyVar% eq x then\r\n" -" echo Empty line. Try again\r\n" -" goto Redo\r\n" -" endif\r\n" -" if IsInt(%MyVar%) and %MyVar% le 6 then\r\n" -" myscript1 %MyVar%\r\n" -" goto Redo\r\n" -" endif\r\n" -" if /i %MyVar% ne q then\r\n" -" echo Invalid input\r\n" -" goto Redo\r\n" -" endif\r\n" -" Note: In this example, the script requests user input and uses the if\r\n" -" command for input validation. It checks for empty line first and\r\n" -" then range checks the input.\r\n" - -#string STR_GET_HELP_SHIFT #language en-US "" -".TH shift 0 "move parameters 1 down"\r\n" -".SH NAME\r\n" -"Shifts in-script parameter positions.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SHIFT\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The SHIFT command shifts the contents of a UEFI Shell script's positional\r\n" -" parameters so that %1 is discarded, %2 is copied to %1, %3 is copied to\r\n" -" %2, %4 is copied to %3 and so on. This allows UEFI Shell scripts to\r\n" -" process script parameters from left to right.\r\n" -" 2. This command does not change the UEFI shell environment variable\r\n" -" lasterror.\r\n" -" 3. The SHIFT command is available only in UEFI Shell scripts.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * Following script is a sample of 'shift' command:\r\n" -" fs0:\> type shift.nsh\r\n" -" #\r\n" -" # shift.nsh\r\n" -" # \r\n" -" echo %1 %2 %3\r\n" -" shift\r\n" -" echo %1 %2\r\n" -" \r\n" -" * To execute the script with echo on:\r\n" -" fs0:\> shift.nsh welcome UEFI world\r\n" -" shift.nsh> echo welcome UEFI world\r\n" -" welcome UEFI world\r\n" -" shift\r\n" -" echo UEFI world\r\n" -" UEFI world\r\n" -" \r\n" -" * To execute the script with echo off:\r\n" -" fs0:\> echo -off\r\n" -" fs0:\> shift.nsh welcome UEFI world\r\n" -" welcome UEFI world\r\n" -" UEFI world\r\n" - -#string STR_GET_HELP_ELSE #language en-US "" -".TH else 0 "part of an 'if' conditional statement"\r\n" -".SH NAME\r\n" -"Identifies the code executed when 'if' is FALSE.\r\n" -".SH SYNOPSIS\r\n" -"See 'else' for usage.\r\n" -".SH EXAMPLES\r\n" -"See 'if' for examples.\r\n" - -#string STR_GET_HELP_STALL #language en-US "" -".TH stall 0 "stall the operation"\r\n" -".SH NAME\r\n" -"Stalls the operation for a specified number of microseconds.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"STALL time\r\n" -".SH OPTIONS\r\n" -" \r\n" -" time - The number of microseconds for the processor to stall.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command would be used to establish a timed STALL of operations\r\n" -" during a script.\r\n" -" 2. Microseconds is in decimal units.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To stall the processor for 1000000 microseconds:\r\n" -" Shell> stall 1000000\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_NOT_FOUND The requested option was not found.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_DEVICE_ERROR There was a hardware error associated with this\r\n" -" request.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c deleted file mode 100644 index b0c3ddd..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -STATIC CONST CHAR16 AllFiles[] = L"*"; - -STATIC CONST SHELL_PARAM_ITEM AttribParamList[] = { - {L"-a", TypeFlag}, - {L"+a", TypeFlag}, - {L"-s", TypeFlag}, - {L"+s", TypeFlag}, - {L"-h", TypeFlag}, - {L"+h", TypeFlag}, - {L"-r", TypeFlag}, - {L"+r", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'attrib' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAttrib ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINT64 FileAttributesToAdd; - UINT64 FileAttributesToRemove; - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN ParamNumberCount; - CONST CHAR16 *FileName; - EFI_SHELL_FILE_INFO *ListOfFiles; - EFI_SHELL_FILE_INFO *FileNode; - EFI_FILE_INFO *FileInfo; - - ListOfFiles = NULL; - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (AttribParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else { - FileAttributesToAdd = 0; - FileAttributesToRemove = 0; - - // - // apply or remove each flag - // - if (ShellCommandLineGetFlag(Package, L"+a")) { - FileAttributesToAdd |= EFI_FILE_ARCHIVE; - } - if (ShellCommandLineGetFlag(Package, L"-a")) { - FileAttributesToRemove |= EFI_FILE_ARCHIVE; - } - if (ShellCommandLineGetFlag(Package, L"+s")) { - FileAttributesToAdd |= EFI_FILE_SYSTEM; - } - if (ShellCommandLineGetFlag(Package, L"-s")) { - FileAttributesToRemove |= EFI_FILE_SYSTEM; - } - if (ShellCommandLineGetFlag(Package, L"+h")) { - FileAttributesToAdd |= EFI_FILE_HIDDEN; - } - if (ShellCommandLineGetFlag(Package, L"-h")) { - FileAttributesToRemove |= EFI_FILE_HIDDEN; - } - if (ShellCommandLineGetFlag(Package, L"+r")) { - FileAttributesToAdd |= EFI_FILE_READ_ONLY; - } - if (ShellCommandLineGetFlag(Package, L"-r")) { - FileAttributesToRemove |= EFI_FILE_READ_ONLY; - } - - if (FileAttributesToRemove == 0 && FileAttributesToAdd == 0) { - // - // Do display as we have no attributes to change - // - for ( ParamNumberCount = 1 - ; - ; ParamNumberCount++ - ){ - FileName = ShellCommandLineGetRawValue(Package, ParamNumberCount); - // if we dont have anything left, move on... - if (FileName == NULL && ParamNumberCount == 1) { - FileName = (CHAR16*)AllFiles; - } else if (FileName == NULL) { - break; - } - ASSERT(ListOfFiles == NULL); - Status = ShellOpenFileMetaArg((CHAR16*)FileName, EFI_FILE_MODE_READ, &ListOfFiles); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_NOT_FOUND; - } else { - for (FileNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ListOfFiles->Link) - ; !IsNull(&ListOfFiles->Link, &FileNode->Link) - ; FileNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ListOfFiles->Link, &FileNode->Link) - ){ - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_ATTRIB_OUTPUT_LINE), - gShellLevel2HiiHandle, - FileNode->Info->Attribute&EFI_FILE_DIRECTORY? L'D':L' ', - FileNode->Info->Attribute&EFI_FILE_ARCHIVE? L'A':L' ', - FileNode->Info->Attribute&EFI_FILE_SYSTEM? L'S':L' ', - FileNode->Info->Attribute&EFI_FILE_HIDDEN? L'H':L' ', - FileNode->Info->Attribute&EFI_FILE_READ_ONLY? L'R':L' ', - FileNode->FileName - ); - - if (ShellGetExecutionBreakFlag()) { - ShellStatus = SHELL_ABORTED; - break; - } - } - Status = ShellCloseFileMetaArg(&ListOfFiles); - ListOfFiles = NULL; - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_NOT_FOUND; - } - } // for loop for handling wildcard filenames - } // for loop for printing out the info - } else if ((FileAttributesToRemove & FileAttributesToAdd) != 0) { - // - // fail as we have conflcting params. - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"attrib"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // enumerate through all the files/directories and apply the attributes - // - for ( ParamNumberCount = 1 - ; - ; ParamNumberCount++ - ){ - FileName = ShellCommandLineGetRawValue(Package, ParamNumberCount); - // if we dont have anything left, move on... - if (FileName == NULL) { - // - // make sure we are not failing on the first one we do... if yes that's an error... - // - if (ParamNumberCount == 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"attrib"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - break; - } - - // - // OpenFileByName / GetFileInfo / Change attributes / SetFileInfo / CloseFile / free memory - // for each file or directory on the line. - // - - // - // Open the file(s) - // - ASSERT(ListOfFiles == NULL); - Status = ShellOpenFileMetaArg((CHAR16*)FileName, EFI_FILE_MODE_READ, &ListOfFiles); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_NOT_FOUND; - } else { - for (FileNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ListOfFiles->Link) - ; !IsNull(&ListOfFiles->Link, &FileNode->Link) - ; FileNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ListOfFiles->Link, &FileNode->Link) - ){ - // - // skip the directory traversing stuff... - // - if (StrCmp(FileNode->FileName, L".") == 0 || StrCmp(FileNode->FileName, L"..") == 0) { - continue; - } - - FileInfo = gEfiShellProtocol->GetFileInfo(FileNode->Handle); - - // - // if we are removing Read-Only we need to do that alone - // - if ((FileAttributesToRemove & EFI_FILE_READ_ONLY) == EFI_FILE_READ_ONLY) { - FileInfo->Attribute &= ~EFI_FILE_READ_ONLY; - // - // SetFileInfo - // - Status = ShellSetFileInfo(FileNode->Handle, FileInfo); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_ACCESS_DENIED; - } - } - - // - // change the attribute - // - FileInfo->Attribute &= ~FileAttributesToRemove; - FileInfo->Attribute |= FileAttributesToAdd; - - // - // SetFileInfo - // - Status = ShellSetFileInfo(FileNode->Handle, FileInfo); - if (EFI_ERROR(Status)) {; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_ACCESS_DENIED; - } - - SHELL_FREE_NON_NULL(FileInfo); - } - Status = ShellCloseFileMetaArg(&ListOfFiles); - ListOfFiles = NULL; - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount)); - ShellStatus = SHELL_NOT_FOUND; - } - } // for loop for handling wildcard filenames - } - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c deleted file mode 100644 index c79fd59..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c +++ /dev/null @@ -1,351 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2018, Dell Technologies. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - Function will replace drive identifier with CWD. - - If FullPath begining with ':' is invalid path, then ASSERT. - If FullPath not include dirve identifier , then do nothing. - If FullPath likes "fs0:\xx" or "fs0:/xx" , then do nothing. - If FullPath likes "fs0:xxx" or "fs0:", the drive replaced by CWD. - - @param[in, out] FullPath The pointer to the string containing the path. - @param[in] Cwd Current directory. - - @retval EFI_SUCCESS Success. - @retval EFI_OUT_OF_SOURCES A memory allocation failed. -**/ -EFI_STATUS -ReplaceDriveWithCwd ( - IN OUT CHAR16 **FullPath, - IN CONST CHAR16 *Cwd - ) -{ - CHAR16 *Splitter; - CHAR16 *TempBuffer; - UINTN TotalSize; - - Splitter = NULL; - TempBuffer = NULL; - TotalSize = 0; - - if (FullPath == NULL || *FullPath == NULL) { - return EFI_SUCCESS; - } - - Splitter = StrStr (*FullPath, L":"); - ASSERT(Splitter != *FullPath); - - if (Splitter != NULL && *(Splitter + 1) != L'\\' && *(Splitter + 1) != L'/') { - TotalSize = StrSize (Cwd) + StrSize (Splitter + 1); - TempBuffer = AllocateZeroPool (TotalSize); - if (TempBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StrCpyS (TempBuffer, TotalSize / sizeof(CHAR16), Cwd); - StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), L"\\"); - StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), Splitter + 1); - - FreePool(*FullPath); - *FullPath = TempBuffer; - } - - return EFI_SUCCESS; -} - -/** - function to determine if FullPath is under current filesystem. - - @param[in] FullPath The target location to determine. - @param[in] Cwd Current directory. - - @retval TRUE The FullPath is in the current filesystem. - @retval FALSE The FullPaht isn't in the current filesystem. -**/ -BOOLEAN -IsCurrentFileSystem ( - IN CONST CHAR16 *FullPath, - IN CONST CHAR16 *Cwd - ) -{ - CHAR16 *Splitter1; - CHAR16 *Splitter2; - - Splitter1 = NULL; - Splitter2 = NULL; - - ASSERT(FullPath != NULL); - - Splitter1 = StrStr (FullPath, L":"); - if (Splitter1 == NULL) { - return TRUE; - } - - Splitter2 = StrStr (Cwd, L":"); - - if (((UINTN) Splitter1 - (UINTN) FullPath) != ((UINTN) Splitter2 - (UINTN) Cwd)) { - return FALSE; - } else { - if (StrniCmp (FullPath, Cwd, ((UINTN) Splitter1 - (UINTN) FullPath) / sizeof (CHAR16)) == 0) { - return TRUE; - } else { - return FALSE; - } - } -} - -/** - Extract drive string and path string from FullPath. - - The caller must be free Drive and Path. - - @param[in] FullPath A path to be extracted. - @param[out] Drive Buffer to save drive identifier. - @param[out] Path Buffer to save path. - - @retval EFI_SUCCESS Success. - @retval EFI_OUT_OF_RESOUCES A memory allocation failed. -**/ -EFI_STATUS -ExtractDriveAndPath ( - IN CONST CHAR16 *FullPath, - OUT CHAR16 **Drive, - OUT CHAR16 **Path - ) -{ - CHAR16 *Splitter; - - ASSERT (FullPath != NULL); - - Splitter = StrStr (FullPath, L":"); - - if (Splitter == NULL) { - *Drive = NULL; - *Path = AllocateCopyPool (StrSize (FullPath), FullPath); - if (*Path == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } else { - if (*(Splitter + 1) == CHAR_NULL) { - *Drive = AllocateCopyPool (StrSize (FullPath), FullPath); - *Path = NULL; - if (*Drive == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } else { - *Drive = AllocateCopyPool ((Splitter - FullPath + 2) * sizeof(CHAR16), FullPath); - if (*Drive == NULL) { - return EFI_OUT_OF_RESOURCES; - } - (*Drive)[Splitter - FullPath + 1] = CHAR_NULL; - - *Path = AllocateCopyPool (StrSize (Splitter + 1), Splitter + 1); - if (*Path == NULL) { - FreePool (*Drive); - return EFI_OUT_OF_RESOURCES; - } - } - } - - return EFI_SUCCESS; -} - -/** - Function for 'cd' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCd ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CONST CHAR16 *Cwd; - CHAR16 *Path; - CHAR16 *Drive; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Param1; - CHAR16 *Param1Copy; - CHAR16 *Walker; - CHAR16 *Splitter; - CHAR16 *TempBuffer; - UINTN TotalSize; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - Cwd = NULL; - Path = NULL; - Drive = NULL; - Splitter = NULL; - TempBuffer = NULL; - TotalSize = 0; - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cd", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } - - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"cd"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // remember that param 0 is the command name - // If there are 0 value parameters, then print the current directory - // else If there are 2 value parameters, then print the error message - // else If there is 1 value paramerer , then change the directory - // - Cwd = ShellGetCurrentDir (NULL); - if (Cwd == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cd"); - ShellStatus = SHELL_NOT_FOUND; - } else { - Param1 = ShellCommandLineGetRawValue (Package, 1); - if (Param1 == NULL) { - // - // display the current directory - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_CD_PRINT), gShellLevel2HiiHandle, Cwd); - } else { - Param1Copy = CatSPrint (NULL, L"%s", Param1, NULL); - for (Walker = Param1Copy; Walker != NULL && *Walker != CHAR_NULL; Walker++) { - if (*Walker == L'\"') { - CopyMem (Walker, Walker + 1, StrSize(Walker) - sizeof(Walker[0])); - } - } - - if (Param1Copy != NULL && IsCurrentFileSystem (Param1Copy, Cwd)) { - Status = ReplaceDriveWithCwd (&Param1Copy,Cwd); - } else { - // - // Can't use cd command to change filesystem. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle, L"cd"); - Status = EFI_NOT_FOUND; - } - - if (!EFI_ERROR(Status) && Param1Copy != NULL) { - Splitter = StrStr (Cwd, L":"); - if (Param1Copy[0] == L'\\') { - // - // Absolute Path on current drive letter. - // - TotalSize = ((Splitter - Cwd + 1) * sizeof(CHAR16)) + StrSize(Param1Copy); - TempBuffer = AllocateZeroPool (TotalSize); - if (TempBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - StrnCpyS (TempBuffer, TotalSize / sizeof(CHAR16), Cwd, (Splitter - Cwd + 1)); - StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), Param1Copy); - - FreePool (Param1Copy); - Param1Copy = TempBuffer; - TempBuffer = NULL; - } - } else { - if (StrStr (Param1Copy,L":") == NULL) { - TotalSize = StrSize (Cwd) + StrSize (Param1Copy); - TempBuffer = AllocateZeroPool (TotalSize); - if (TempBuffer == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - StrCpyS (TempBuffer, TotalSize / sizeof (CHAR16), Cwd); - StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), L"\\"); - StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), Param1Copy); - - FreePool (Param1Copy); - Param1Copy = TempBuffer; - TempBuffer = NULL; - } - } - } - } - - if (!EFI_ERROR(Status)) { - Param1Copy = PathCleanUpDirectories (Param1Copy); - Status = ExtractDriveAndPath (Param1Copy, &Drive, &Path); - } - - if (!EFI_ERROR (Status) && Drive != NULL && Path != NULL) { - if (EFI_ERROR(ShellIsDirectory (Param1Copy))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cd", Param1Copy); - ShellStatus = SHELL_NOT_FOUND; - } else { - Status = gEfiShellProtocol->SetCurDir (Drive, Path + 1); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cd", Param1Copy); - ShellStatus = SHELL_NOT_FOUND; - } - } - } - - if (Drive != NULL) { - FreePool (Drive); - } - - if (Path != NULL) { - FreePool (Path); - } - - FreePool (Param1Copy); - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c deleted file mode 100644 index 64d4d42..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c +++ /dev/null @@ -1,779 +0,0 @@ -/** @file - Main file for cp shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" -#include -#include - -/** - Function to take a list of files to copy and a destination location and do - the verification and copying of those files to that location. This function - will report any errors to the user and halt. - - @param[in] FileList A LIST_ENTRY* based list of files to move. - @param[in] DestDir The destination location. - @param[in] SilentMode TRUE to eliminate screen output. - @param[in] RecursiveMode TRUE to copy directories. - @param[in] Resp The response to the overwrite query (if always). - - @retval SHELL_SUCCESS the files were all moved. - @retval SHELL_INVALID_PARAMETER a parameter was invalid - @retval SHELL_SECURITY_VIOLATION a security violation ocurred - @retval SHELL_WRITE_PROTECTED the destination was write protected - @retval SHELL_OUT_OF_RESOURCES a memory allocation failed -**/ -SHELL_STATUS -ValidateAndCopyFiles( - IN CONST EFI_SHELL_FILE_INFO *FileList, - IN CONST CHAR16 *DestDir, - IN BOOLEAN SilentMode, - IN BOOLEAN RecursiveMode, - IN VOID **Resp - ); - -/** - Function to Copy one file to another location - - If the destination exists the user will be prompted and the result put into *resp - - @param[in] Source pointer to source file name - @param[in] Dest pointer to destination file name - @param[out] Resp pointer to response from question. Pass back on looped calling - @param[in] SilentMode whether to run in quiet mode or not - @param[in] CmdName Source command name requesting single file copy - - @retval SHELL_SUCCESS The source file was copied to the destination -**/ -SHELL_STATUS -CopySingleFile( - IN CONST CHAR16 *Source, - IN CONST CHAR16 *Dest, - OUT VOID **Resp, - IN BOOLEAN SilentMode, - IN CONST CHAR16 *CmdName - ) -{ - VOID *Response; - UINTN ReadSize; - SHELL_FILE_HANDLE SourceHandle; - SHELL_FILE_HANDLE DestHandle; - EFI_STATUS Status; - VOID *Buffer; - CHAR16 *TempName; - UINTN Size; - EFI_SHELL_FILE_INFO *List; - SHELL_STATUS ShellStatus; - UINT64 SourceFileSize; - UINT64 DestFileSize; - EFI_FILE_PROTOCOL *DestVolumeFP; - EFI_FILE_SYSTEM_INFO *DestVolumeInfo; - UINTN DestVolumeInfoSize; - - ASSERT(Resp != NULL); - - SourceHandle = NULL; - DestHandle = NULL; - Response = *Resp; - List = NULL; - DestVolumeInfo = NULL; - ShellStatus = SHELL_SUCCESS; - - ReadSize = PcdGet32(PcdShellFileOperationSize); - // Why bother copying a file to itself - if (StrCmp(Source, Dest) == 0) { - return (SHELL_SUCCESS); - } - - // - // if the destination file existed check response and possibly prompt user - // - if (ShellFileExists(Dest) == EFI_SUCCESS) { - if (Response == NULL && !SilentMode) { - Status = ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response); - } - // - // possibly return based on response - // - if (!SilentMode) { - switch (*(SHELL_PROMPT_RESPONSE*)Response) { - case ShellPromptResponseNo: - // - // return success here so we dont stop the process - // - return (SHELL_SUCCESS); - case ShellPromptResponseCancel: - *Resp = Response; - // - // indicate to stop everything - // - return (SHELL_ABORTED); - case ShellPromptResponseAll: - *Resp = Response; - case ShellPromptResponseYes: - break; - default: - return SHELL_ABORTED; - } - } - } - - if (ShellIsDirectory(Source) == EFI_SUCCESS) { - Status = ShellCreateDirectory(Dest, &DestHandle); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_DIR_FAIL), gShellLevel2HiiHandle, CmdName, Dest); - return (SHELL_ACCESS_DENIED); - } - - // - // Now copy all the files under the directory... - // - TempName = NULL; - Size = 0; - StrnCatGrow(&TempName, &Size, Source, 0); - StrnCatGrow(&TempName, &Size, L"\\*", 0); - if (TempName != NULL) { - ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List); - *TempName = CHAR_NULL; - StrnCatGrow(&TempName, &Size, Dest, 0); - StrnCatGrow(&TempName, &Size, L"\\", 0); - ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp); - ShellCloseFileMetaArg(&List); - SHELL_FREE_NON_NULL(TempName); - Size = 0; - } - } else { - Status = ShellDeleteFileByName(Dest); - - // - // open file with create enabled - // - Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_OPEN_FAIL), gShellLevel2HiiHandle, CmdName, Dest); - return (SHELL_ACCESS_DENIED); - } - - // - // open source file - // - Status = ShellOpenFileByName (Source, &SourceHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_SRC_OPEN_FAIL), gShellLevel2HiiHandle, CmdName, Source); - return (SHELL_ACCESS_DENIED); - } - - // - //get file size of source file and freespace available on destination volume - // - ShellGetFileSize(SourceHandle, &SourceFileSize); - ShellGetFileSize(DestHandle, &DestFileSize); - - // - //if the destination file already exists then it will be replaced, meaning the sourcefile effectively needs less storage space - // - if(DestFileSize < SourceFileSize){ - SourceFileSize -= DestFileSize; - } else { - SourceFileSize = 0; - } - - // - //get the system volume info to check the free space - // - DestVolumeFP = ConvertShellHandleToEfiFileProtocol(DestHandle); - DestVolumeInfo = NULL; - DestVolumeInfoSize = 0; - Status = DestVolumeFP->GetInfo( - DestVolumeFP, - &gEfiFileSystemInfoGuid, - &DestVolumeInfoSize, - DestVolumeInfo - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - DestVolumeInfo = AllocateZeroPool(DestVolumeInfoSize); - Status = DestVolumeFP->GetInfo( - DestVolumeFP, - &gEfiFileSystemInfoGuid, - &DestVolumeInfoSize, - DestVolumeInfo - ); - } - - // - //check if enough space available on destination drive to complete copy - // - if (DestVolumeInfo!= NULL && (DestVolumeInfo->FreeSpace < SourceFileSize)) { - // - //not enough space on destination directory to copy file - // - SHELL_FREE_NON_NULL(DestVolumeInfo); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle, CmdName); - return(SHELL_VOLUME_FULL); - } else { - // - // copy data between files - // - Buffer = AllocateZeroPool(ReadSize); - if (Buffer == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, CmdName); - return SHELL_OUT_OF_RESOURCES; - } - while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) { - Status = ShellReadFile(SourceHandle, &ReadSize, Buffer); - if (!EFI_ERROR(Status)) { - Status = ShellWriteFile(DestHandle, &ReadSize, Buffer); - if (EFI_ERROR(Status)) { - ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, CmdName, Dest); - break; - } - } else { - ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, CmdName, Source); - break; - } - } - } - SHELL_FREE_NON_NULL(DestVolumeInfo); - } - - // - // close files - // - if (DestHandle != NULL) { - ShellCloseFile(&DestHandle); - DestHandle = NULL; - } - if (SourceHandle != NULL) { - ShellCloseFile(&SourceHandle); - SourceHandle = NULL; - } - - // - // return - // - return ShellStatus; -} - -/** - function to take a list of files to copy and a destination location and do - the verification and copying of those files to that location. This function - will report any errors to the user and halt. - - The key is to have this function called ONLY once. this allows for the parameter - verification to happen correctly. - - @param[in] FileList A LIST_ENTRY* based list of files to move. - @param[in] DestDir The destination location. - @param[in] SilentMode TRUE to eliminate screen output. - @param[in] RecursiveMode TRUE to copy directories. - @param[in] Resp The response to the overwrite query (if always). - - @retval SHELL_SUCCESS the files were all moved. - @retval SHELL_INVALID_PARAMETER a parameter was invalid - @retval SHELL_SECURITY_VIOLATION a security violation ocurred - @retval SHELL_WRITE_PROTECTED the destination was write protected - @retval SHELL_OUT_OF_RESOURCES a memory allocation failed -**/ -SHELL_STATUS -ValidateAndCopyFiles( - IN CONST EFI_SHELL_FILE_INFO *FileList, - IN CONST CHAR16 *DestDir, - IN BOOLEAN SilentMode, - IN BOOLEAN RecursiveMode, - IN VOID **Resp - ) -{ - CHAR16 *HiiOutput; - CHAR16 *HiiResultOk; - CONST EFI_SHELL_FILE_INFO *Node; - SHELL_STATUS ShellStatus; - EFI_STATUS Status; - CHAR16 *DestPath; - VOID *Response; - UINTN PathSize; - CONST CHAR16 *Cwd; - UINTN NewSize; - CHAR16 *CleanFilePathStr; - - if (Resp == NULL) { - Response = NULL; - } else { - Response = *Resp; - } - - DestPath = NULL; - ShellStatus = SHELL_SUCCESS; - PathSize = 0; - Cwd = ShellGetCurrentDir(NULL); - CleanFilePathStr = NULL; - - ASSERT(FileList != NULL); - ASSERT(DestDir != NULL); - - - Status = ShellLevel2StripQuotes (DestDir, &CleanFilePathStr); - if (EFI_ERROR (Status)) { - if (Status == EFI_OUT_OF_RESOURCES) { - return SHELL_OUT_OF_RESOURCES; - } else { - return SHELL_INVALID_PARAMETER; - } - } - - ASSERT (CleanFilePathStr != NULL); - - // - // If we are trying to copy multiple files... make sure we got a directory for the target... - // - if (EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) && FileList->Link.ForwardLink != FileList->Link.BackLink) { - // - // Error for destination not a directory - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); - FreePool (CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) - ){ - // - // skip the directory traversing stuff... - // - if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) { - continue; - } - - NewSize = StrSize(CleanFilePathStr); - NewSize += StrSize(Node->FullName); - NewSize += (Cwd == NULL)? 0 : (StrSize(Cwd) + sizeof(CHAR16)); - if (NewSize > PathSize) { - PathSize = NewSize; - } - - // - // Make sure got -r if required - // - if (!RecursiveMode && !EFI_ERROR(ShellIsDirectory(Node->FullName))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_REQ), gShellLevel2HiiHandle, L"cp"); - FreePool (CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - - // - // make sure got dest as dir if needed - // - if (!EFI_ERROR(ShellIsDirectory(Node->FullName)) && EFI_ERROR(ShellIsDirectory(CleanFilePathStr))) { - // - // Error for destination not a directory - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); - FreePool (CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - } - - HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_CP_OUTPUT), NULL); - HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL); - DestPath = AllocateZeroPool(PathSize); - - if (DestPath == NULL || HiiOutput == NULL || HiiResultOk == NULL) { - SHELL_FREE_NON_NULL(DestPath); - SHELL_FREE_NON_NULL(HiiOutput); - SHELL_FREE_NON_NULL(HiiResultOk); - FreePool (CleanFilePathStr); - return (SHELL_OUT_OF_RESOURCES); - } - - // - // Go through the list of files to copy... - // - for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) - ){ - if (ShellGetExecutionBreakFlag()) { - break; - } - ASSERT(Node->FileName != NULL); - ASSERT(Node->FullName != NULL); - - // - // skip the directory traversing stuff... - // - if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) { - continue; - } - - if (FileList->Link.ForwardLink == FileList->Link.BackLink // 1 item - && EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) // not an existing directory - ) { - if (StrStr(CleanFilePathStr, L":") == NULL) { - // - // simple copy of a single file - // - if (Cwd != NULL) { - StrCpyS(DestPath, PathSize / sizeof(CHAR16), Cwd); - StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); - FreePool (CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') { - StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\"); - } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') { - ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; - } - StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr); - } else { - StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr); - } - } else { - // - // we have multiple files or a directory in the DestDir - // - - // - // Check for leading slash - // - if (CleanFilePathStr[0] == L'\\') { - // - // Copy to the root of CWD - // - if (Cwd != NULL) { - StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd); - StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); - FreePool(CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - while (PathRemoveLastItem(DestPath)); - StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr+1); - StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName); - } else if (StrStr(CleanFilePathStr, L":") == NULL) { - if (Cwd != NULL) { - StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd); - StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\"); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); - FreePool(CleanFilePathStr); - return (SHELL_INVALID_PARAMETER); - } - if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') { - StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\"); - } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') { - ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; - } - StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr); - if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') { - StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\"); - } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') { - ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; - } - StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName); - - } else { - StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr); - if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') { - StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\"); - } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') { - ((CHAR16*)CleanFilePathStr)[StrLen(CleanFilePathStr)-1] = CHAR_NULL; - } - StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName); - } - } - - // - // Make sure the path exists - // - if (EFI_ERROR(VerifyIntermediateDirectories(DestPath))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_WNF), gShellLevel2HiiHandle, L"cp", DestPath); - ShellStatus = SHELL_DEVICE_ERROR; - break; - } - - if ( !EFI_ERROR(ShellIsDirectory(Node->FullName)) - && !EFI_ERROR(ShellIsDirectory(DestPath)) - && StrniCmp(Node->FullName, DestPath, StrLen(DestPath)) == 0 - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } - if (StringNoCaseCompare(&Node->FullName, &DestPath) == 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } - - if ((StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName)) == 0) - && (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\') - ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } - - PathCleanUpDirectories(DestPath); - - if (!SilentMode) { - ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath); - } - - // - // copy single file... - // - ShellStatus = CopySingleFile(Node->FullName, DestPath, &Response, SilentMode, L"cp"); - if (ShellStatus != SHELL_SUCCESS) { - break; - } - } - if (ShellStatus == SHELL_SUCCESS && Resp == NULL) { - ShellPrintEx(-1, -1, L"%s", HiiResultOk); - } - - SHELL_FREE_NON_NULL(DestPath); - SHELL_FREE_NON_NULL(HiiOutput); - SHELL_FREE_NON_NULL(HiiResultOk); - SHELL_FREE_NON_NULL(CleanFilePathStr); - if (Resp == NULL) { - SHELL_FREE_NON_NULL(Response); - } - - return (ShellStatus); - -} - -/** - Validate and if successful copy all the files from the list into - destination directory. - - @param[in] FileList The list of files to copy. - @param[in] DestDir The directory to copy files to. - @param[in] SilentMode TRUE to eliminate screen output. - @param[in] RecursiveMode TRUE to copy directories. - - @retval SHELL_INVALID_PARAMETER A parameter was invalid. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -ProcessValidateAndCopyFiles( - IN EFI_SHELL_FILE_INFO *FileList, - IN CONST CHAR16 *DestDir, - IN BOOLEAN SilentMode, - IN BOOLEAN RecursiveMode - ) -{ - SHELL_STATUS ShellStatus; - EFI_SHELL_FILE_INFO *List; - EFI_FILE_INFO *FileInfo; - CHAR16 *FullName; - - List = NULL; - FullName = NULL; - FileInfo = NULL; - - ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List); - if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"cp", DestDir); - ShellStatus = SHELL_INVALID_PARAMETER; - ShellCloseFileMetaArg(&List); - } else if (List != NULL) { - ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL); - ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL); - FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle); - ASSERT(FileInfo != NULL); - StrnCatGrow(&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0); - ShellCloseFileMetaArg(&List); - if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) == 0) { - ShellStatus = ValidateAndCopyFiles(FileList, FullName, SilentMode, RecursiveMode, NULL); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_ACCESS_DENIED; - } - } else { - ShellCloseFileMetaArg(&List); - ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL); - } - - SHELL_FREE_NON_NULL(FileInfo); - SHELL_FREE_NON_NULL(FullName); - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-r", TypeFlag}, - {L"-q", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'cp' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - UINTN LoopCounter; - EFI_SHELL_FILE_INFO *FileList; - BOOLEAN SilentMode; - BOOLEAN RecursiveMode; - CONST CHAR16 *Cwd; - CHAR16 *FullCwd; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - ParamCount = 0; - FileList = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cp", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - - // - // Initialize SilentMode and RecursiveMode - // - if (gEfiShellProtocol->BatchIsActive()) { - SilentMode = TRUE; - } else { - SilentMode = ShellCommandLineGetFlag(Package, L"-q"); - } - RecursiveMode = ShellCommandLineGetFlag(Package, L"-r"); - - switch (ParamCount = ShellCommandLineGetCount(Package)) { - case 0: - case 1: - // - // we have insufficient parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - case 2: - // - // must have valid CWD for single parameter... - // - Cwd = ShellGetCurrentDir(NULL); - if (Cwd == NULL){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_NOT_FOUND; - } else { - FullCwd = AllocateZeroPool(StrSize(Cwd) + sizeof(CHAR16)); - if (FullCwd == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"cp"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - StrCpyS (FullCwd, StrSize (Cwd) / sizeof (CHAR16) + 1, Cwd); - ShellStatus = ProcessValidateAndCopyFiles (FileList, FullCwd, SilentMode, RecursiveMode); - FreePool (FullCwd); - } - } - } - - break; - default: - // - // Make a big list of all the files... - // - for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount && ShellStatus == SHELL_SUCCESS ; LoopCounter++) { - if (ShellGetExecutionBreakFlag()) { - break; - } - Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, LoopCounter)); - ShellStatus = SHELL_NOT_FOUND; - } - } - if (ShellStatus != SHELL_SUCCESS) { - Status = ShellCloseFileMetaArg(&FileList); - } else { - // - // now copy them all... - // - if (FileList != NULL && !IsListEmpty(&FileList->Link)) { - ShellStatus = ProcessValidateAndCopyFiles(FileList, PathCleanUpDirectories((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)), SilentMode, RecursiveMode); - Status = ShellCloseFileMetaArg(&FileList); - if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, ParamCount), ShellStatus|MAX_BIT); - ShellStatus = SHELL_ACCESS_DENIED; - } - } - } - break; - } // switch on parameter count - - if (FileList != NULL) { - ShellCloseFileMetaArg(&FileList); - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - if (ShellGetExecutionBreakFlag()) { - return (SHELL_ABORTED); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c deleted file mode 100644 index a3efb3b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c +++ /dev/null @@ -1,279 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -// This function was from from the BdsLib implementation in -// IntelFrameworkModulePkg\Library\GenericBdsLib\BdsConnect.c -// function name: BdsLibConnectAllEfi -/** - This function will connect all current system handles recursively. The - connection will finish until every handle's child handle created if it have. - - @retval EFI_SUCCESS All handles and it's child handle have been - connected - @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer(). - -**/ -EFI_STATUS -ConnectAllEfi ( - VOID - ) -{ - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN Index; - - Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return EFI_SUCCESS; -} - -/** - function to load a .EFI driver into memory and possible connect the driver. - - if FileName is NULL then ASSERT. - - @param[in] FileName FileName of the driver to load - @param[in] Connect Whether to connect or not - - @retval EFI_SUCCESS the driver was loaded and if Connect was - true then connect was attempted. Connection may - have failed. - @retval EFI_OUT_OF_RESOURCES there was insufficient memory -**/ -EFI_STATUS -LoadDriver( - IN CONST CHAR16 *FileName, - IN CONST BOOLEAN Connect - ) -{ - EFI_HANDLE LoadedDriverHandle; - EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *FilePath; - EFI_LOADED_IMAGE_PROTOCOL *LoadedDriverImage; - - LoadedDriverImage = NULL; - FilePath = NULL; - LoadedDriverHandle = NULL; - Status = EFI_SUCCESS; - - ASSERT (FileName != NULL); - - // - // Fix local copies of the protocol pointers - // - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // Convert to DEVICE_PATH - // - FilePath = gEfiShellProtocol->GetDevicePathFromFilePath(FileName); - - if (FilePath == NULL) { - ASSERT(FALSE); - return (EFI_INVALID_PARAMETER); - } - - // - // Use LoadImage to get it into memory - // - Status = gBS->LoadImage( - FALSE, - gImageHandle, - FilePath, - NULL, - 0, - &LoadedDriverHandle); - - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_IMAGE), gShellLevel2HiiHandle, FileName, Status); - } else { - // - // Make sure it is a driver image - // - Status = gBS->HandleProtocol (LoadedDriverHandle, &gEfiLoadedImageProtocolGuid, (VOID *) &LoadedDriverImage); - - ASSERT (LoadedDriverImage != NULL); - - if ( EFI_ERROR(Status) - || ( LoadedDriverImage->ImageCodeType != EfiBootServicesCode - && LoadedDriverImage->ImageCodeType != EfiRuntimeServicesCode) - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_DRIVER), gShellLevel2HiiHandle, FileName); - - // - // Exit and unload the non-driver image - // - gBS->Exit(LoadedDriverHandle, EFI_INVALID_PARAMETER, 0, NULL); - Status = EFI_INVALID_PARAMETER; - } - } - - if (!EFI_ERROR(Status)) { - // - // Start the image - // - Status = gBS->StartImage(LoadedDriverHandle, NULL, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_ERROR), gShellLevel2HiiHandle, FileName, Status); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_LOADED), gShellLevel2HiiHandle, FileName, LoadedDriverImage->ImageBase, Status); - } - } - - if (!EFI_ERROR(Status) && Connect) { - // - // Connect it... - // - Status = ConnectAllEfi(); - } - - // - // clean up memory... - // - if (FilePath != NULL) { - FreePool(FilePath); - } - - return (Status); -} - -STATIC CONST SHELL_PARAM_ITEM LoadParamList[] = { - {L"-nc", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'load' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLoad ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - EFI_SHELL_FILE_INFO *ListHead; - EFI_SHELL_FILE_INFO *Node; - - ListHead = NULL; - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (LoadParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"load", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // we didnt get a single file to load parameter - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"load"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - for ( ParamCount = 1 - ; ShellCommandLineGetRawValue(Package, ParamCount) != NULL - ; ParamCount++ - ){ - Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount), EFI_FILE_MODE_READ, &ListHead); - if (!EFI_ERROR(Status)) { - for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link) - ; !IsNull(&ListHead->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) - ){ - // - // once we have an error preserve that value, but finish the loop. - // - if (EFI_ERROR(Status)) { - LoadDriver(Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-nc")==FALSE)); - } else { - Status = LoadDriver(Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-nc")==FALSE)); - } - } // for loop for multi-open - if (EFI_ERROR(Status)) { - ShellCloseFileMetaArg(&ListHead); - } else { - Status = ShellCloseFileMetaArg(&ListHead);; - } - } else { - // - // no files found. - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"load", (CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)); - ShellStatus = SHELL_NOT_FOUND; - } - } // for loop for params - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) { - ShellStatus = SHELL_DEVICE_ERROR; - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c deleted file mode 100644 index f269db7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ /dev/null @@ -1,874 +0,0 @@ -/** @file - Main file for ls shell level 2 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" -#include - -UINTN mDayOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30}; - -/** - print out the standard format output volume entry. - - @param[in] TheList a list of files from the volume. -**/ -EFI_STATUS -PrintSfoVolumeInfoTableEntry( - IN CONST EFI_SHELL_FILE_INFO *TheList - ) -{ - EFI_STATUS Status; - EFI_SHELL_FILE_INFO *Node; - CHAR16 *DirectoryName; - EFI_FILE_SYSTEM_INFO *SysInfo; - UINTN SysInfoSize; - SHELL_FILE_HANDLE ShellFileHandle; - EFI_FILE_PROTOCOL *EfiFpHandle; - - // - // Get the first valid handle (directories) - // - for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link) - ; !IsNull(&TheList->Link, &Node->Link) && Node->Handle == NULL - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&TheList->Link, &Node->Link) - ); - - if (Node->Handle == NULL) { - DirectoryName = GetFullyQualifiedPath(((EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link))->FullName); - - // - // We need to open something up to get system information - // - Status = gEfiShellProtocol->OpenFileByName( - DirectoryName, - &ShellFileHandle, - EFI_FILE_MODE_READ - ); - - ASSERT_EFI_ERROR(Status); - FreePool(DirectoryName); - - // - // Get the Volume Info from ShellFileHandle - // - SysInfo = NULL; - SysInfoSize = 0; - EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - SysInfo = AllocateZeroPool(SysInfoSize); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo - ); - } - - ASSERT_EFI_ERROR(Status); - - gEfiShellProtocol->CloseFile(ShellFileHandle); - } else { - // - // Get the Volume Info from Node->Handle - // - SysInfo = NULL; - SysInfoSize = 0; - EfiFpHandle = ConvertShellHandleToEfiFileProtocol(Node->Handle); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo - ); - - if (Status == EFI_BUFFER_TOO_SMALL) { - SysInfo = AllocateZeroPool(SysInfoSize); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo - ); - } - - ASSERT_EFI_ERROR(Status); - } - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_SFO_HEADER), - gShellLevel2HiiHandle, - L"ls" - ); - // - // print VolumeInfo table - // - ASSERT(SysInfo != NULL); - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_LS_SFO_VOLINFO), - gShellLevel2HiiHandle, - SysInfo->VolumeLabel, - SysInfo->VolumeSize, - SysInfo->ReadOnly?L"TRUE":L"FALSE", - SysInfo->FreeSpace, - SysInfo->BlockSize - ); - - SHELL_FREE_NON_NULL(SysInfo); - - return (Status); -} - -/** - print out the info on a single file. - - @param[in] Sfo TRUE if in SFO, false otherwise. - @param[in] TheNode the EFI_SHELL_FILE_INFO node to print out information on. - @param[in] Files incremented if a file is printed. - @param[in] Size incremented by file size. - @param[in] Dirs incremented if a directory is printed. - -**/ -VOID -PrintFileInformation( - IN CONST BOOLEAN Sfo, - IN CONST EFI_SHELL_FILE_INFO *TheNode, - IN UINT64 *Files, - IN UINT64 *Size, - IN UINT64 *Dirs - ) -{ - ASSERT(Files != NULL); - ASSERT(Size != NULL); - ASSERT(Dirs != NULL); - ASSERT(TheNode != NULL); - - if (Sfo) { - // - // Print the FileInfo Table - // - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_LS_SFO_FILEINFO), - gShellLevel2HiiHandle, - TheNode->FullName, - TheNode->Info->FileSize, - TheNode->Info->PhysicalSize, - (TheNode->Info->Attribute & EFI_FILE_ARCHIVE) != 0?L"a":L"", - (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"d":L"", - (TheNode->Info->Attribute & EFI_FILE_HIDDEN) != 0?L"h":L"", - (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L"r":L"", - (TheNode->Info->Attribute & EFI_FILE_SYSTEM) != 0?L"s":L"", - TheNode->Info->CreateTime.Hour, - TheNode->Info->CreateTime.Minute, - TheNode->Info->CreateTime.Second, - TheNode->Info->CreateTime.Day, - TheNode->Info->CreateTime.Month, - TheNode->Info->CreateTime.Year, - TheNode->Info->LastAccessTime.Hour, - TheNode->Info->LastAccessTime.Minute, - TheNode->Info->LastAccessTime.Second, - TheNode->Info->LastAccessTime.Day, - TheNode->Info->LastAccessTime.Month, - TheNode->Info->LastAccessTime.Year, - TheNode->Info->ModificationTime.Hour, - TheNode->Info->ModificationTime.Minute, - TheNode->Info->ModificationTime.Second, - TheNode->Info->ModificationTime.Day, - TheNode->Info->ModificationTime.Month, - TheNode->Info->ModificationTime.Year - ); - } else { - // - // print this one out... - // first print the universal start, next print the type specific name format, last print the CRLF - // - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_LS_LINE_START_ALL), - gShellLevel2HiiHandle, - &TheNode->Info->ModificationTime, - (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"":L"", - (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L'r':L' ', - TheNode->Info->FileSize - ); - if (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) { - (*Dirs)++; - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_LS_LINE_END_DIR), - gShellLevel2HiiHandle, - TheNode->FileName - ); - } else { - (*Files)++; - (*Size) += TheNode->Info->FileSize; - if ( (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".nsh", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0) - || (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".efi", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0) - ){ - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_LS_LINE_END_EXE), - gShellLevel2HiiHandle, - TheNode->FileName - ); - } else { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_LS_LINE_END_FILE), - gShellLevel2HiiHandle, - TheNode->FileName - ); - } - } - } -} - -/** - print out the header when not using standard format output. - - @param[in] Path String with starting path. -**/ -VOID -PrintNonSfoHeader( - IN CONST CHAR16 *Path - ) -{ - CHAR16 *DirectoryName; - - // - // get directory name from path... - // - DirectoryName = GetFullyQualifiedPath(Path); - - if (DirectoryName != NULL) { - // - // print header - // - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_LS_HEADER_LINE1), - gShellLevel2HiiHandle, - DirectoryName - ); - - SHELL_FREE_NON_NULL(DirectoryName); - } -} - -/** - print out the footer when not using standard format output. - - @param[in] Files The number of files. - @param[in] Size The size of files in bytes. - @param[in] Dirs The number of directories. -**/ -VOID -PrintNonSfoFooter( - IN UINT64 Files, - IN UINT64 Size, - IN UINT64 Dirs - ) -{ - // - // print footer - // - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_LS_FOOTER_LINE), - gShellLevel2HiiHandle, - Files, - Size, - Dirs - ); -} - -/** - Change the file time to local time based on the timezone. - - @param[in] Time The file time. - @param[in] LocalTimeZone Local time zone. -**/ -VOID -FileTimeToLocalTime ( - IN EFI_TIME *Time, - IN INT16 LocalTimeZone - ) -{ - INTN MinuteDiff; - INTN TempMinute; - INTN HourNumberOfTempMinute; - INTN TempHour; - INTN DayNumberOfTempHour; - INTN TempDay; - INTN MonthNumberOfTempDay; - INTN TempMonth; - INTN YearNumberOfTempMonth; - INTN MonthRecord; - - ASSERT ((Time->TimeZone >= -1440) && (Time->TimeZone <=1440)); - ASSERT ((LocalTimeZone >= -1440) && (LocalTimeZone <=1440)); - ASSERT ((Time->Month >= 1) && (Time->Month <= 12)); - - if(Time->TimeZone == LocalTimeZone) { - // - //if the file timezone is equal to the local timezone, there is no need to adjust the file time. - // - return; - } - - if((Time->Year % 4 == 0 && Time->Year / 100 != 0)||(Time->Year % 400 == 0)) { - // - // Day in February of leap year is 29. - // - mDayOfMonth[1] = 29; - } - - MinuteDiff = Time->TimeZone - LocalTimeZone; - TempMinute = Time->Minute + MinuteDiff; - - // - // Calculate Time->Minute - // TempHour will be used to calculate Time->Hour - // - HourNumberOfTempMinute = TempMinute / 60; - if(TempMinute < 0) { - HourNumberOfTempMinute --; - } - TempHour = Time->Hour + HourNumberOfTempMinute; - Time->Minute = (UINT8)(TempMinute - 60 * HourNumberOfTempMinute); - - // - // Calculate Time->Hour - // TempDay will be used to calculate Time->Day - // - DayNumberOfTempHour = TempHour / 24 ; - if(TempHour < 0){ - DayNumberOfTempHour--; - } - TempDay = Time->Day + DayNumberOfTempHour; - Time->Hour = (UINT8)(TempHour - 24 * DayNumberOfTempHour); - - // - // Calculate Time->Day - // TempMonth will be used to calculate Time->Month - // - MonthNumberOfTempDay = (TempDay - 1) / (INTN)mDayOfMonth[Time->Month - 1]; - MonthRecord = (INTN)(Time->Month) ; - if(TempDay - 1 < 0){ - MonthNumberOfTempDay -- ; - MonthRecord -- ; - } - TempMonth = Time->Month + MonthNumberOfTempDay; - Time->Day = (UINT8)(TempDay - (INTN)mDayOfMonth[(MonthRecord - 1 + 12) % 12] * MonthNumberOfTempDay); - - // - // Calculate Time->Month, Time->Year - // - YearNumberOfTempMonth = (TempMonth - 1) / 12; - if(TempMonth - 1 < 0){ - YearNumberOfTempMonth --; - } - Time->Month = (UINT8)(TempMonth - 12 * (YearNumberOfTempMonth)); - Time->Year = (UINT16)(Time->Year + YearNumberOfTempMonth); -} - -/** - print out the list of files and directories from the LS command - - @param[in] Rec TRUE to automatically recurse into each found directory - FALSE to only list the specified directory. - @param[in] Attribs List of required Attribute for display. - If 0 then all non-system and non-hidden files will be printed. - @param[in] Sfo TRUE to use Standard Format Output, FALSE otherwise - @param[in] RootPath String with starting path to search in. - @param[in] SearchString String with search string. - @param[in] Found Set to TRUE, if anyone were found. - @param[in] Count The count of bits enabled in Attribs. - @param[in] TimeZone The current time zone offset. - - @retval SHELL_SUCCESS the printing was sucessful. -**/ -SHELL_STATUS -PrintLsOutput( - IN CONST BOOLEAN Rec, - IN CONST UINT64 Attribs, - IN CONST BOOLEAN Sfo, - IN CONST CHAR16 *RootPath, - IN CONST CHAR16 *SearchString, - IN BOOLEAN *Found, - IN CONST UINTN Count, - IN CONST INT16 TimeZone - ) -{ - EFI_STATUS Status; - EFI_SHELL_FILE_INFO *ListHead; - EFI_SHELL_FILE_INFO *Node; - SHELL_STATUS ShellStatus; - UINT64 FileCount; - UINT64 DirCount; - UINT64 FileSize; - UINTN LongestPath; - CHAR16 *CorrectedPath; - BOOLEAN FoundOne; - BOOLEAN HeaderPrinted; - EFI_TIME LocalTime; - - HeaderPrinted = FALSE; - FileCount = 0; - DirCount = 0; - FileSize = 0; - ListHead = NULL; - ShellStatus = SHELL_SUCCESS; - LongestPath = 0; - CorrectedPath = NULL; - - if (Found != NULL) { - FoundOne = *Found; - } else { - FoundOne = FALSE; - } - - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0); - if (CorrectedPath == NULL) { - return SHELL_OUT_OF_RESOURCES; - } - if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\' - &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') { - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0); - } - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, SearchString, 0); - if (CorrectedPath == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - - PathCleanUpDirectories(CorrectedPath); - - Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead); - if (!EFI_ERROR(Status)) { - if (ListHead == NULL || IsListEmpty(&ListHead->Link)) { - SHELL_FREE_NON_NULL(CorrectedPath); - return (SHELL_SUCCESS); - } - - if (Sfo && Found == NULL) { - PrintSfoVolumeInfoTableEntry(ListHead); - } - - for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link), LongestPath = 0 - ; !IsNull(&ListHead->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) - ){ - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - break; - } - ASSERT(Node != NULL); - - // - // Change the file time to local time. - // - Status = gRT->GetTime(&LocalTime, NULL); - if (!EFI_ERROR (Status)) { - if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) && - (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) { - // - // FileTimeToLocalTime () requires Month is in a valid range, other buffer out-of-band access happens. - // - FileTimeToLocalTime (&Node->Info->CreateTime, LocalTime.TimeZone); - } - if ((Node->Info->LastAccessTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) && - (Node->Info->LastAccessTime.Month >= 1 && Node->Info->LastAccessTime.Month <= 12)) { - FileTimeToLocalTime (&Node->Info->LastAccessTime, LocalTime.TimeZone); - } - if ((Node->Info->ModificationTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) && - (Node->Info->ModificationTime.Month >= 1 && Node->Info->ModificationTime.Month <= 12)) { - FileTimeToLocalTime (&Node->Info->ModificationTime, LocalTime.TimeZone); - } - } - - if (LongestPath < StrSize(Node->FullName)) { - LongestPath = StrSize(Node->FullName); - } - ASSERT(Node->Info != NULL); - ASSERT((Node->Info->Attribute & EFI_FILE_VALID_ATTR) == Node->Info->Attribute); - if (Attribs == 0) { - // - // NOT system & NOT hidden - // - if ( (Node->Info->Attribute & EFI_FILE_SYSTEM) - || (Node->Info->Attribute & EFI_FILE_HIDDEN) - ){ - continue; - } - } else if ((Attribs != EFI_FILE_VALID_ATTR) || - (Count == 5)) { - // - // Only matches the bits which "Attribs" contains, not - // all files/directories with any of the bits. - // Count == 5 is used to tell the difference between a user - // specifying all bits (EX: -arhsda) and just specifying - // -a (means display all files with any attribute). - // - if ( (Node->Info->Attribute & Attribs) != Attribs) { - continue; - } - } - - if (!Sfo && !HeaderPrinted) { - PathRemoveLastItem (CorrectedPath); - PrintNonSfoHeader(CorrectedPath); - } - PrintFileInformation(Sfo, Node, &FileCount, &FileSize, &DirCount); - FoundOne = TRUE; - HeaderPrinted = TRUE; - } - - if (!Sfo && ShellStatus != SHELL_ABORTED) { - PrintNonSfoFooter(FileCount, FileSize, DirCount); - } - } - - if (Rec && ShellStatus != SHELL_ABORTED) { - // - // Re-Open all the files under the starting path for directories that didnt necessarily match our file filter - // - ShellCloseFileMetaArg(&ListHead); - CorrectedPath[0] = CHAR_NULL; - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0); - if (CorrectedPath == NULL) { - return SHELL_OUT_OF_RESOURCES; - } - if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\' - &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') { - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0); - } - CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"*", 0); - Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead); - - if (!EFI_ERROR(Status)) { - for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link) - ; !IsNull(&ListHead->Link, &Node->Link) && ShellStatus == SHELL_SUCCESS - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) - ){ - if (ShellGetExecutionBreakFlag ()) { - ShellStatus = SHELL_ABORTED; - break; - } - - // - // recurse on any directory except the traversing ones... - // - if (((Node->Info->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) - && StrCmp(Node->FileName, L".") != 0 - && StrCmp(Node->FileName, L"..") != 0 - ){ - ShellStatus = PrintLsOutput( - Rec, - Attribs, - Sfo, - Node->FullName, - SearchString, - &FoundOne, - Count, - TimeZone); - - // - // Since it's running recursively, we have to break immediately when returned SHELL_ABORTED - // - if (ShellStatus == SHELL_ABORTED) { - break; - } - } - } - } - } - - SHELL_FREE_NON_NULL(CorrectedPath); - ShellCloseFileMetaArg(&ListHead); - - if (Found == NULL && !FoundOne) { - return (SHELL_NOT_FOUND); - } - - if (Found != NULL) { - *Found = FoundOne; - } - - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM LsParamList[] = { - {L"-r", TypeFlag}, - {L"-a", TypeStart}, - {L"-sfo", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'ls' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLs ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *Attribs; - SHELL_STATUS ShellStatus; - UINT64 RequiredAttributes; - CONST CHAR16 *PathName; - CONST CHAR16 *CurDir; - UINTN Count; - CHAR16 *FullPath; - UINTN Size; - EFI_TIME TheTime; - CHAR16 *SearchString; - - Size = 0; - FullPath = NULL; - ProblemParam = NULL; - Attribs = NULL; - ShellStatus = SHELL_SUCCESS; - RequiredAttributes = 0; - PathName = NULL; - SearchString = NULL; - CurDir = NULL; - Count = 0; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // Fix local copies of the protocol pointers - // - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (LsParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"ls"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // check for -a - // - if (ShellCommandLineGetFlag(Package, L"-a")) { - for ( Attribs = ShellCommandLineGetValue(Package, L"-a") - ; Attribs != NULL && *Attribs != CHAR_NULL && ShellStatus == SHELL_SUCCESS - ; Attribs++ - ){ - switch (*Attribs) { - case L'a': - case L'A': - RequiredAttributes |= EFI_FILE_ARCHIVE; - Count++; - continue; - case L's': - case L'S': - RequiredAttributes |= EFI_FILE_SYSTEM; - Count++; - continue; - case L'h': - case L'H': - RequiredAttributes |= EFI_FILE_HIDDEN; - Count++; - continue; - case L'r': - case L'R': - RequiredAttributes |= EFI_FILE_READ_ONLY; - Count++; - continue; - case L'd': - case L'D': - RequiredAttributes |= EFI_FILE_DIRECTORY; - Count++; - continue; - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ATTRIBUTE), gShellLevel2HiiHandle, L"ls", ShellCommandLineGetValue(Package, L"-a")); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } // switch - } // for loop - // - // if nothing is specified all are specified - // - if (RequiredAttributes == 0) { - RequiredAttributes = EFI_FILE_VALID_ATTR; - } - } // if -a present - if (ShellStatus == SHELL_SUCCESS) { - PathName = ShellCommandLineGetRawValue(Package, 1); - if (PathName == NULL) { - // - // Nothing specified... must start from current directory - // - CurDir = gEfiShellProtocol->GetCurDir(NULL); - if (CurDir == NULL) { - ShellStatus = SHELL_NOT_FOUND; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls"); - } - // - // Copy to the 2 strings for starting path and file search string - // - ASSERT(SearchString == NULL); - ASSERT(FullPath == NULL); - StrnCatGrow(&SearchString, NULL, L"*", 0); - StrnCatGrow(&FullPath, NULL, CurDir, 0); - Size = FullPath != NULL? StrSize(FullPath) : 0; - StrnCatGrow(&FullPath, &Size, L"\\", 0); - } else { - if (StrStr(PathName, L":") == NULL && gEfiShellProtocol->GetCurDir(NULL) == NULL) { - // - // If we got something and it doesnt have a fully qualified path, then we needed to have a CWD. - // - ShellStatus = SHELL_NOT_FOUND; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls"); - } else { - // - // We got a valid fully qualified path or we have a CWD - // - ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL)); - if (StrStr(PathName, L":") == NULL) { - StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0); - if (FullPath == NULL) { - ShellCommandLineFreeVarList (Package); - return SHELL_OUT_OF_RESOURCES; - } - Size = FullPath != NULL? StrSize(FullPath) : 0; - StrnCatGrow(&FullPath, &Size, L"\\", 0); - } - StrnCatGrow(&FullPath, &Size, PathName, 0); - if (FullPath == NULL) { - ShellCommandLineFreeVarList (Package); - return SHELL_OUT_OF_RESOURCES; - } - - if (ShellIsDirectory(PathName) == EFI_SUCCESS) { - // - // is listing ends with a directory, then we list all files in that directory - // - StrnCatGrow(&SearchString, NULL, L"*", 0); - } else { - // - // must split off the search part that applies to files from the end of the directory part - // - StrnCatGrow(&SearchString, NULL, FullPath, 0); - if (SearchString == NULL) { - FreePool (FullPath); - ShellCommandLineFreeVarList (Package); - return SHELL_OUT_OF_RESOURCES; - } - PathRemoveLastItem (FullPath); - CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath))); - } - } - } - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"ls", L"gRT->GetTime", Status); - TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; - } - - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = PrintLsOutput( - ShellCommandLineGetFlag(Package, L"-r"), - RequiredAttributes, - ShellCommandLineGetFlag(Package, L"-sfo"), - FullPath, - SearchString, - NULL, - Count, - TheTime.TimeZone - ); - if (ShellStatus == SHELL_NOT_FOUND) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle, L"ls", FullPath); - } else if (ShellStatus == SHELL_INVALID_PARAMETER) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath); - } else if (ShellStatus == SHELL_ABORTED) { - // - // Ignore aborting. - // - } else if (ShellStatus != SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath); - } - } - } - } - } - - // - // Free memory allocated - // - SHELL_FREE_NON_NULL(SearchString); - SHELL_FREE_NON_NULL(FullPath); - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c deleted file mode 100644 index e829154..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c +++ /dev/null @@ -1,1302 +0,0 @@ -/** @file - Main file for map shell level 2 command. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" -#include -#include -#include -#include -#include - -/** - Determine if a string has only numbers and letters. - - This is useful for such things as Map names which can only be letters and numbers. - - @param[in] String pointer to the string to analyze, - @param[in] Len Number of characters to analyze. - - @retval TRUE String has only numbers and letters - @retval FALSE String has at least one other character. -**/ -BOOLEAN -IsNumberLetterOnly( - IN CONST CHAR16 *String, - IN CONST UINTN Len - ) -{ - UINTN Count; - for (Count = 0 ; Count < Len && String != NULL && *String != CHAR_NULL ; String++,Count++) { - if (! ((*String >= L'a' && *String <= L'z') || - (*String >= L'A' && *String <= L'Z') || - (*String >= L'0' && *String <= L'9')) - ){ - return (FALSE); - } - } - return (TRUE); -} - -/** - Do a search in the Target delimited list. - - @param[in] List The list to seatch in. - @param[in] MetaTarget The item to search for. MetaMatching supported. - @param[out] FullName Optional pointer to an allocated buffer containing - the match. - @param[in] Meta TRUE to use MetaMatching. - @param[in] SkipTrailingNumbers TRUE to allow for numbers after the MetaTarget. - @param[in] Target The single character that delimits list - items (";" normally). -**/ -BOOLEAN -SearchList( - IN CONST CHAR16 *List, - IN CONST CHAR16 *MetaTarget, - OUT CHAR16 **FullName OPTIONAL, - IN CONST BOOLEAN Meta, - IN CONST BOOLEAN SkipTrailingNumbers, - IN CONST CHAR16 *Target - - ) -{ - CHAR16 *TempList; - CONST CHAR16 *ListWalker; - BOOLEAN Result; - CHAR16 *TempSpot; - - for (ListWalker = List , TempList = NULL - ; ListWalker != NULL && *ListWalker != CHAR_NULL - ; - ) { - TempList = StrnCatGrow(&TempList, NULL, ListWalker, 0); - ASSERT(TempList != NULL); - TempSpot = StrStr(TempList, Target); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - - while (SkipTrailingNumbers && (ShellIsDecimalDigitCharacter(TempList[StrLen(TempList)-1]) || TempList[StrLen(TempList)-1] == L':')) { - TempList[StrLen(TempList)-1] = CHAR_NULL; - } - - ListWalker = StrStr(ListWalker, Target); - while(ListWalker != NULL && *ListWalker == *Target) { - ListWalker++; - } - if (Meta) { - Result = gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)TempList, (CHAR16*)MetaTarget); - } else { - Result = (BOOLEAN)(StrCmp(TempList, MetaTarget)==0); - } - if (Result) { - if (FullName != NULL) { - *FullName = TempList; - } else { - FreePool(TempList); - } - return (TRUE); - } - FreePool(TempList); - TempList = NULL; - } - - return (FALSE); -} - -/** - Determine what type of device is represented and return it's string. The - string is in allocated memory and must be callee freed. The HII is is listed below. - The actual string cannot be determined. - - @param[in] DevicePath The device to analyze. - - @retval STR_MAP_MEDIA_UNKNOWN The media type is unknown. - @retval STR_MAP_MEDIA_HARDDISK The media is a hard drive. - @retval STR_MAP_MEDIA_CDROM The media is a CD ROM. - @retval STR_MAP_MEDIA_FLOPPY The media is a floppy drive. -**/ -CHAR16* -GetDeviceMediaType ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - ACPI_HID_DEVICE_PATH *Acpi; - - // - // Parse the device path: - // Devicepath sub type mediatype - // MEDIA_HANRDDRIVE_DP -> Hard Disk - // MEDIA_CDROM_DP -> CD Rom - // Acpi.HID = 0X0604 -> Floppy - // - if (NULL == DevicePath) { - return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_UNKNOWN), NULL); - } - - for (;!IsDevicePathEndType (DevicePath) ;DevicePath = NextDevicePathNode (DevicePath)) { - if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) { - switch (DevicePathSubType (DevicePath)) { - case MEDIA_HARDDRIVE_DP: - return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_HARDDISK), NULL); - case MEDIA_CDROM_DP: - return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_CDROM), NULL); - } - } else if (DevicePathType (DevicePath) == ACPI_DEVICE_PATH) { - Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath; - if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) { - return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_FLOPPY), NULL); - } - } - } - - return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_UNKNOWN), NULL); -} - -/** - Function to detemine if a handle has removable storage. - - @param[in] DevicePath DevicePath to test. - - @retval TRUE The handle has removable storage. - @retval FALSE The handle does not have removable storage. -**/ -BOOLEAN -IsRemoveableDevice ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - if (NULL == DevicePath) { - return FALSE; - } - - while (!IsDevicePathEndType (DevicePath)) { - if (DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) { - switch (DevicePathSubType (DevicePath)) { - case MSG_USB_DP: - case MSG_SCSI_DP: - return TRUE; - default: - return FALSE; - } - } - DevicePath = NextDevicePathNode (DevicePath); - } - return FALSE; -} - -/** - Function to detemine if a something on the map list matches. - - @param[in] MapList The pointer to the list to test. - @param[in] Specific The pointer to a specific name to test for. - @param[in] TypeString The pointer to the list of types. - @param[in] Normal Always show normal mappings. - @param[in] Consist Always show consistent mappings. - - @retval TRUE The map should be displayed. - @retval FALSE The map should not be displayed. -**/ -BOOLEAN -MappingListHasType( - IN CONST CHAR16 *MapList, - IN CONST CHAR16 *Specific, - IN CONST CHAR16 *TypeString, - IN CONST BOOLEAN Normal, - IN CONST BOOLEAN Consist - ) -{ - CHAR16 *NewSpecific; - RETURN_STATUS Status; - UINTN Length; - - // - // specific has priority - // - if (Specific != NULL) { - Length = StrLen (Specific); - // - // Allocate enough buffer for Specific and potential ":" - // - NewSpecific = AllocatePool ((Length + 2) * sizeof(CHAR16)); - if (NewSpecific == NULL){ - return FALSE; - } - StrCpyS (NewSpecific, Length + 2, Specific); - if (Specific[Length - 1] != L':') { - Status = StrnCatS(NewSpecific, Length + 2, L":", StrLen(L":")); - if (EFI_ERROR (Status)) { - FreePool(NewSpecific); - return FALSE; - } - } - - if (SearchList(MapList, NewSpecific, NULL, TRUE, FALSE, L";")) { - FreePool(NewSpecific); - return (TRUE); - } - FreePool(NewSpecific); - } - if ( Consist - && Specific == NULL - && (SearchList(MapList, L"HD*", NULL, TRUE, TRUE, L";") - ||SearchList(MapList, L"CD*", NULL, TRUE, TRUE, L";") - ||SearchList(MapList, L"F*", NULL, TRUE, TRUE, L";") - ||SearchList(MapList, L"FP*", NULL, TRUE, TRUE, L";"))){ - return (TRUE); - } - - if ( Normal - && Specific == NULL - && (SearchList(MapList, L"FS", NULL, FALSE, TRUE, L";") - ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){ - return (TRUE); - } - - if (TypeString != NULL && SearchList(MapList, TypeString, NULL, TRUE, TRUE, L";")) { - return (TRUE); - } - return (FALSE); -} - - -/** - Display a single map line for device Handle if conditions are met. - - @param[in] Verbose TRUE to display (extra) verbose information. - @param[in] Consist TRUE to display consistent mappings. - @param[in] Normal TRUE to display normal (not consist) mappings. - @param[in] TypeString pointer to string of filter types. - @param[in] SFO TRUE to display output in Standard Output Format. - @param[in] Specific pointer to string for specific map to display. - @param[in] Handle The handle to display from. - - @retval EFI_SUCCESS The mapping was displayed. -**/ -EFI_STATUS -PerformSingleMappingDisplay( - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Consist, - IN CONST BOOLEAN Normal, - IN CONST CHAR16 *TypeString, - IN CONST BOOLEAN SFO, - IN CONST CHAR16 *Specific OPTIONAL, - IN CONST EFI_HANDLE Handle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *DevPathCopy; - CONST CHAR16 *MapList; - CHAR16 *CurrentName; - CHAR16 *MediaType; - CHAR16 *DevPathString; - CHAR16 *TempSpot; - CHAR16 *Alias; - UINTN TempLen; - BOOLEAN Removable; - CONST CHAR16 *TempSpot2; - - Alias = NULL; - TempSpot2 = NULL; - CurrentName = NULL; - DevPath = DevicePathFromHandle(Handle); - DevPathCopy = DevPath; - MapList = gEfiShellProtocol->GetMapFromDevicePath(&DevPathCopy); - if (MapList == NULL) { - return EFI_NOT_FOUND; - } - - if (!MappingListHasType(MapList, Specific, TypeString, Normal, Consist)){ - return EFI_NOT_FOUND; - } - - if (Normal || !Consist) { - // - // need the Normal here since people can use both on command line. otherwise unused. - // - - // - // Allocate a name - // - CurrentName = NULL; - CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0); - if (CurrentName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - // - // Chop off the other names that become "Alias(s)" - // leaving just the normal name - // - TempSpot = StrStr(CurrentName, L";"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - } else { - CurrentName = NULL; - - // - // Skip the first name. This is the standard name. - // - TempSpot = StrStr(MapList, L";"); - if (TempSpot != NULL) { - TempSpot++; - } - SearchList(TempSpot, L"HD*", &CurrentName, TRUE, FALSE, L";"); - if (CurrentName == NULL) { - SearchList(TempSpot, L"CD*", &CurrentName, TRUE, FALSE, L";"); - } - if (CurrentName == NULL) { - SearchList(TempSpot, L"FP*", &CurrentName, TRUE, FALSE, L";"); - } - if (CurrentName == NULL) { - SearchList(TempSpot, L"F*", &CurrentName, TRUE, FALSE, L";"); - } - if (CurrentName == NULL) { - // - // We didnt find anything, so just the first one in the list... - // - CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0); - if (CurrentName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - TempSpot = StrStr(CurrentName, L";"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - } else { - Alias = StrnCatGrow(&Alias, 0, MapList, 0); - if (Alias == NULL) { - return EFI_OUT_OF_RESOURCES; - } - TempSpot = StrStr(Alias, CurrentName); - if (TempSpot != NULL) { - TempSpot2 = StrStr(TempSpot, L";"); - if (TempSpot2 != NULL) { - TempSpot2++; // Move past ";" from CurrentName - CopyMem(TempSpot, TempSpot2, StrSize(TempSpot2)); - } else { - *TempSpot = CHAR_NULL; - } - } - if (Alias[StrLen(Alias)-1] == L';') { - Alias[StrLen(Alias)-1] = CHAR_NULL; - } - } - } - DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE); - TempLen = StrLen(CurrentName); - if (!SFO) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_MAP_ENTRY), - gShellLevel2HiiHandle, - CurrentName, - Alias!=NULL?Alias:(TempLen < StrLen(MapList)?MapList + TempLen+1:L""), - DevPathString - ); - if (Verbose) { - // - // also print handle, media type, removable (y/n), and current directory - // - MediaType = GetDeviceMediaType(DevPath); - if ((TypeString != NULL &&MediaType != NULL && StrStr(TypeString, MediaType) != NULL) || TypeString == NULL) { - Removable = IsRemoveableDevice(DevPath); - TempSpot2 = ShellGetCurrentDir(CurrentName); - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_MAP_ENTRY_VERBOSE), - gShellLevel2HiiHandle, - ConvertHandleToHandleIndex(Handle), - MediaType, - Removable?L"Yes":L"No", - TempSpot2 - ); - } - SHELL_FREE_NON_NULL(MediaType); - } - } else { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_MAP_SFO_MAPPINGS), - gShellLevel2HiiHandle, - CurrentName, - DevPathString, - Consist?L"":(TempLen < StrLen(MapList)?MapList + TempLen+1:L"") - ); - } - SHELL_FREE_NON_NULL(DevPathString); - SHELL_FREE_NON_NULL(CurrentName); - SHELL_FREE_NON_NULL(Alias); - return EFI_SUCCESS; -} - -/** - Delete Specific from the list of maps for device Handle. - - @param[in] Specific The name to delete. - @param[in] Handle The device to look on. - - @retval EFI_SUCCESS The delete was successful. - @retval EFI_NOT_FOUND Name was not a map on Handle. -**/ -EFI_STATUS -PerformSingleMappingDelete( - IN CONST CHAR16 *Specific, - IN CONST EFI_HANDLE Handle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *DevPathCopy; - CONST CHAR16 *MapList; - CHAR16 *CurrentName; - - DevPath = DevicePathFromHandle(Handle); - DevPathCopy = DevPath; - MapList = gEfiShellProtocol->GetMapFromDevicePath(&DevPathCopy); - CurrentName = NULL; - - if (MapList == NULL) { - return (EFI_NOT_FOUND); - } - // - // if there is a specific and its not on the list... - // - if (!SearchList(MapList, Specific, &CurrentName, TRUE, FALSE, L";")) { - return (EFI_NOT_FOUND); - } - return (gEfiShellProtocol->SetMap(NULL, CurrentName)); -} - -CONST CHAR16 Cd[] = L"cd*"; -CONST CHAR16 Hd[] = L"hd*"; -CONST CHAR16 Fp[] = L"fp*"; -CONST CHAR16 AnyF[] = L"F*"; -/** - Function to display mapping information to the user. - - If Specific is specified then Consist and Normal will be ignored since information will - be printed for the specific item only. - - @param[in] Verbose TRUE to display (extra) verbose information. - @param[in] Consist TRUE to display consistent mappings. - @param[in] Normal TRUE to display normal (not consist) mappings. - @param[in] TypeString Pointer to string of filter types. - @param[in] SFO TRUE to display output in Standard Output Format. - @param[in] Specific Pointer to string for specific map to display. - @param[in] Header TRUE to print the header block. - - @retval SHELL_SUCCESS The display was printed. - @retval SHELL_INVALID_PARAMETER One of Consist or Normal must be TRUE if no Specific. - -**/ -SHELL_STATUS -PerformMappingDisplay( - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Consist, - IN CONST BOOLEAN Normal, - IN CONST CHAR16 *TypeString, - IN CONST BOOLEAN SFO, - IN CONST CHAR16 *Specific OPTIONAL, - IN CONST BOOLEAN Header - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN BufferSize; - UINTN LoopVar; - CHAR16 *Test; - BOOLEAN Found; - - if (!Consist && !Normal && Specific == NULL && TypeString == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map"); - return (SHELL_INVALID_PARAMETER); - } - - if (TypeString != NULL) { - Test = (CHAR16*)Cd; - if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) { - Test = (CHAR16*)Hd; - if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) { - Test = (CHAR16*)Fp; - if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", TypeString); - return (SHELL_INVALID_PARAMETER); - } - } else if (Test == NULL) { - Test = (CHAR16*)AnyF; - } - } - } else { - Test = NULL; - } - - if (Header) { - // - // Print the header - // - if (!SFO) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_HEADER), gShellLevel2HiiHandle); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"map"); - } - } - - BufferSize = 0; - HandleBuffer = NULL; - - // - // Look up all SimpleFileSystems in the platform - // - Status = gBS->LocateHandle( - ByProtocol, - &gEfiSimpleFileSystemProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleBuffer = AllocateZeroPool(BufferSize); - if (HandleBuffer == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle( - ByProtocol, - &gEfiSimpleFileSystemProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - } - - // - // Get the map name(s) for each one. - // - for ( LoopVar = 0, Found = FALSE - ; LoopVar < (BufferSize / sizeof(EFI_HANDLE)) && HandleBuffer != NULL - ; LoopVar ++ - ){ - Status = PerformSingleMappingDisplay( - Verbose, - Consist, - Normal, - Test, - SFO, - Specific, - HandleBuffer[LoopVar]); - if (!EFI_ERROR(Status)) { - Found = TRUE; - } - } - - // - // Look up all BlockIo in the platform - // - Status = gBS->LocateHandle( - ByProtocol, - &gEfiBlockIoProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - SHELL_FREE_NON_NULL(HandleBuffer); - HandleBuffer = AllocateZeroPool(BufferSize); - if (HandleBuffer == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle( - ByProtocol, - &gEfiBlockIoProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - } - if (!EFI_ERROR(Status) && HandleBuffer != NULL) { - // - // Get the map name(s) for each one. - // - for ( LoopVar = 0 - ; LoopVar < BufferSize / sizeof(EFI_HANDLE) - ; LoopVar ++ - ){ - // - // Skip any that were already done... - // - if (gBS->OpenProtocol( - HandleBuffer[LoopVar], - &gEfiSimpleFileSystemProtocolGuid, - NULL, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL) == EFI_SUCCESS) { - continue; - } - Status = PerformSingleMappingDisplay( - Verbose, - Consist, - Normal, - Test, - SFO, - Specific, - HandleBuffer[LoopVar]); - if (!EFI_ERROR(Status)) { - Found = TRUE; - } - } - FreePool(HandleBuffer); - } - if (!Found) { - if (Specific != NULL) { - ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", Specific); - } else { - ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle, L"map"); - } - } - return (SHELL_SUCCESS); -} - -/** - Perform a mapping display and parse for multiple types in the TypeString. - - @param[in] Verbose TRUE to use verbose output. - @param[in] Consist TRUE to display consistent names. - @param[in] Normal TRUE to display normal names. - @param[in] TypeString An optional comma-delimited list of types. - @param[in] SFO TRUE to display in SFO format. See Spec. - @param[in] Specific An optional specific map name to display alone. - - @retval SHELL_INVALID_PARAMETER A parameter was invalid. - @retval SHELL_SUCCESS The display was successful. - @sa PerformMappingDisplay -**/ -SHELL_STATUS -PerformMappingDisplay2( - IN CONST BOOLEAN Verbose, - IN CONST BOOLEAN Consist, - IN CONST BOOLEAN Normal, - IN CONST CHAR16 *TypeString, - IN CONST BOOLEAN SFO, - IN CONST CHAR16 *Specific OPTIONAL - ) -{ - CONST CHAR16 *TypeWalker; - SHELL_STATUS ShellStatus; - CHAR16 *Comma; - - - if (TypeString == NULL) { - return (PerformMappingDisplay(Verbose, Consist, Normal, NULL, SFO, Specific, TRUE)); - } - ShellStatus = SHELL_SUCCESS; - for (TypeWalker = TypeString ; TypeWalker != NULL && *TypeWalker != CHAR_NULL ;) { - Comma = StrStr(TypeWalker, L","); - if (Comma == NULL) { - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString)); - } else { - PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString)); - } - break; - } else { - *Comma = CHAR_NULL; - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString)); - } else { - PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString)); - } - *Comma = L','; - TypeWalker = Comma + 1; - } - } - - return (ShellStatus); -} - -/** - Delete a specific map. - - @param[in] Specific The pointer to the name of the map to delete. - - @retval EFI_INVALID_PARAMETER Specific was NULL. - @retval EFI_SUCCESS The operation was successful. - @retval EFI_NOT_FOUND Specific could not be found. -**/ -EFI_STATUS -PerformMappingDelete( - IN CONST CHAR16 *Specific - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN BufferSize; - UINTN LoopVar; - BOOLEAN Deleted; - - if (Specific == NULL) { - return (EFI_INVALID_PARAMETER); - } - - BufferSize = 0; - HandleBuffer = NULL; - Deleted = FALSE; - - // - // Look up all SimpleFileSystems in the platform - // - Status = gBS->LocateHandle( - ByProtocol, - &gEfiDevicePathProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleBuffer = AllocateZeroPool(BufferSize); - if (HandleBuffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle( - ByProtocol, - &gEfiDevicePathProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - } - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(HandleBuffer); - return (Status); - } - - if (HandleBuffer != NULL) { - // - // Get the map name(s) for each one. - // - for ( LoopVar = 0 - ; LoopVar < BufferSize / sizeof(EFI_HANDLE) - ; LoopVar ++ - ){ - if (PerformSingleMappingDelete(Specific,HandleBuffer[LoopVar]) == SHELL_SUCCESS) { - Deleted = TRUE; - } - } - } - // - // Look up all BlockIo in the platform - // - Status = gBS->LocateHandle( - ByProtocol, - &gEfiBlockIoProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - if (Status == EFI_BUFFER_TOO_SMALL) { - FreePool(HandleBuffer); - HandleBuffer = AllocateZeroPool(BufferSize); - if (HandleBuffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle( - ByProtocol, - &gEfiBlockIoProtocolGuid, - NULL, - &BufferSize, - HandleBuffer); - } - if (EFI_ERROR(Status)) { - SHELL_FREE_NON_NULL(HandleBuffer); - return (Status); - } - - if (HandleBuffer != NULL) { - // - // Get the map name(s) for each one. - // - for ( LoopVar = 0 - ; LoopVar < BufferSize / sizeof(EFI_HANDLE) - ; LoopVar ++ - ){ - // - // Skip any that were already done... - // - if (gBS->OpenProtocol( - HandleBuffer[LoopVar], - &gEfiDevicePathProtocolGuid, - NULL, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL) == EFI_SUCCESS) { - continue; - } - if (PerformSingleMappingDelete(Specific,HandleBuffer[LoopVar]) == SHELL_SUCCESS) { - Deleted = TRUE; - } - } - } - SHELL_FREE_NON_NULL(HandleBuffer); - if (!Deleted) { - return (EFI_NOT_FOUND); - } - return (EFI_SUCCESS); -} - -/** - function to add a mapping from mapping. - - This function will get the device path associated with the mapping and call SetMap. - - @param[in] Map The Map to add a mapping for - @param[in] SName The name of the new mapping - - @retval SHELL_SUCCESS the mapping was added - @retval SHELL_INVALID_PARAMETER the device path for Map could not be retrieved. - @return Shell version of a return value from EfiShellProtocol->SetMap - -**/ -SHELL_STATUS -AddMappingFromMapping( - IN CONST CHAR16 *Map, - IN CONST CHAR16 *SName - ) -{ - CONST EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_STATUS Status; - CHAR16 *NewSName; - RETURN_STATUS StrRetStatus; - - NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName); - if (NewSName == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - if (NewSName[StrLen(NewSName)-1] != L':') { - StrRetStatus = StrnCatS(NewSName, (StrSize(SName) + sizeof(CHAR16))/sizeof(CHAR16), L":", StrLen(L":")); - if (EFI_ERROR(StrRetStatus)) { - FreePool(NewSName); - return ((SHELL_STATUS) (StrRetStatus & (~MAX_BIT))); - } - } - - if (!IsNumberLetterOnly(NewSName, StrLen(NewSName)-1)) { - FreePool(NewSName); - return (SHELL_INVALID_PARAMETER); - } - - DevPath = gEfiShellProtocol->GetDevicePathFromMap(Map); - if (DevPath == NULL) { - FreePool(NewSName); - return (SHELL_INVALID_PARAMETER); - } - - Status = gEfiShellProtocol->SetMap(DevPath, NewSName); - FreePool(NewSName); - if (EFI_ERROR(Status)) { - return (SHELL_DEVICE_ERROR); - } - return (SHELL_SUCCESS); -} - -/** - function to add a mapping from an EFI_HANDLE. - - This function will get the device path associated with the Handle and call SetMap. - - @param[in] Handle The handle to add a mapping for - @param[in] SName The name of the new mapping - - @retval SHELL_SUCCESS the mapping was added - @retval SHELL_INVALID_PARAMETER SName was not valid for a map name. - @return Shell version of a return value from either - gBS->OpenProtocol or EfiShellProtocol->SetMap - -**/ -SHELL_STATUS -AddMappingFromHandle( - IN CONST EFI_HANDLE Handle, - IN CONST CHAR16 *SName - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_STATUS Status; - CHAR16 *NewSName; - RETURN_STATUS StrRetStatus; - - NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName); - if (NewSName == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - if (NewSName[StrLen(NewSName)-1] != L':') { - StrRetStatus = StrnCatS(NewSName, (StrSize(SName) + sizeof(CHAR16))/sizeof(CHAR16), L":", StrLen(L":")); - if (EFI_ERROR(StrRetStatus)) { - FreePool(NewSName); - return ((SHELL_STATUS) (StrRetStatus & (~MAX_BIT))); - } - } - - if (!IsNumberLetterOnly(NewSName, StrLen(NewSName)-1)) { - FreePool(NewSName); - return (SHELL_INVALID_PARAMETER); - } - - Status = gBS->OpenProtocol( - Handle, - &gEfiDevicePathProtocolGuid, - (VOID**)&DevPath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR(Status)) { - FreePool(NewSName); - return (SHELL_DEVICE_ERROR); - } - Status = gEfiShellProtocol->SetMap(DevPath, NewSName); - FreePool(NewSName); - if (EFI_ERROR(Status)) { - return (SHELL_DEVICE_ERROR); - } - return (SHELL_SUCCESS); -} - -STATIC CONST SHELL_PARAM_ITEM MapParamList[] = { - {L"-d", TypeValue}, - {L"-r", TypeFlag}, - {L"-v", TypeFlag}, - {L"-c", TypeFlag}, - {L"-f", TypeFlag}, - {L"-u", TypeFlag}, - {L"-t", TypeValue}, - {L"-sfo", TypeValue}, - {NULL, TypeMax} - }; - -/** - The routine issues dummy read for every physical block device to cause - the BlockIo re-installed if media change happened. -**/ -VOID -ProbeForMediaChange ( - VOID - ) -{ - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *Handles; - EFI_BLOCK_IO_PROTOCOL *BlockIo; - UINTN Index; - - gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiBlockIoProtocolGuid, - NULL, - &HandleCount, - &Handles - ); - // - // Probe for media change for every physical block io - // - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->HandleProtocol ( - Handles[Index], - &gEfiBlockIoProtocolGuid, - (VOID **) &BlockIo - ); - if (!EFI_ERROR (Status)) { - if (!BlockIo->Media->LogicalPartition) { - // - // Per spec: - // The function (ReadBlocks) must return EFI_NO_MEDIA or - // EFI_MEDIA_CHANGED even if LBA, BufferSize, or Buffer are invalid so the caller can probe - // for changes in media state. - // - BlockIo->ReadBlocks ( - BlockIo, - BlockIo->Media->MediaId, - 0, - 0, - NULL - ); - } - } - } -} - -/** - Function for 'map' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMap ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *SName; - CONST CHAR16 *Mapping; - EFI_HANDLE MapAsHandle; - SHELL_STATUS ShellStatus; - BOOLEAN SfoMode; - BOOLEAN ConstMode; - BOOLEAN NormlMode; - CONST CHAR16 *Param1; - CONST CHAR16 *TypeString; - UINTN TempStringLength; - - ProblemParam = NULL; - Mapping = NULL; - SName = NULL; - ShellStatus = SHELL_SUCCESS; - MapAsHandle = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (MapParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"map", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - SfoMode = ShellCommandLineGetFlag(Package, L"-sfo"); - ConstMode = ShellCommandLineGetFlag(Package, L"-c"); - NormlMode = ShellCommandLineGetFlag(Package, L"-f"); - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 3) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"map"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Deleting a map name... - // - if (ShellCommandLineGetFlag(Package, L"-d")) { - if ( ShellCommandLineGetFlag(Package, L"-r") - || ShellCommandLineGetFlag(Package, L"-v") - || ConstMode - || NormlMode - || ShellCommandLineGetFlag(Package, L"-u") - || ShellCommandLineGetFlag(Package, L"-t") - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"map"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - SName = ShellCommandLineGetValue(Package, L"-d"); - if (SName != NULL) { - Status = PerformMappingDelete(SName); - if (EFI_ERROR(Status)) { - if (Status == EFI_ACCESS_DENIED) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map"); - ShellStatus = SHELL_ACCESS_DENIED; - } else if (Status == EFI_NOT_FOUND) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", SName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status); - ShellStatus = SHELL_UNSUPPORTED; - } - } - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } else if ( ShellCommandLineGetFlag(Package, L"-r") -// || ShellCommandLineGetFlag(Package, L"-v") - || ConstMode - || NormlMode - || ShellCommandLineGetFlag(Package, L"-u") - || ShellCommandLineGetFlag(Package, L"-t") - ){ - ProbeForMediaChange (); - if ( ShellCommandLineGetFlag(Package, L"-r")) { - // - // Do the reset - // - Status = ShellCommandCreateInitialMappingsAndPaths(); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status); - ShellStatus = SHELL_UNSUPPORTED; - } - } - if ( ShellStatus == SHELL_SUCCESS && ShellCommandLineGetFlag(Package, L"-u")) { - // - // Do the Update - // - Status = ShellCommandUpdateMapping (); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status); - ShellStatus = SHELL_UNSUPPORTED; - } - } - if (ShellStatus == SHELL_SUCCESS) { - Param1 = ShellCommandLineGetRawValue(Package, 1); - TypeString = ShellCommandLineGetValue(Package, L"-t"); - if (!ConstMode - &&!NormlMode - &&TypeString == NULL - ) { - // - // now do the display... - // - ShellStatus = PerformMappingDisplay( - ShellCommandLineGetFlag(Package, L"-v"), - TRUE, - TRUE, - NULL, - SfoMode, - Param1, - TRUE - ); - } else { - // - // now do the display... - // - ShellStatus = PerformMappingDisplay2( - ShellCommandLineGetFlag(Package, L"-v"), - ConstMode, - NormlMode, - TypeString, - SfoMode, - Param1 - ); - } - } - } else { - // - // adding or displaying (there were no flags) - // - SName = ShellCommandLineGetRawValue(Package, 1); - Mapping = ShellCommandLineGetRawValue(Package, 2); - if ( SName == NULL - && Mapping == NULL - ){ - // - // display only since no flags - // - ShellStatus = PerformMappingDisplay( - ShellCommandLineGetFlag(Package, L"-v"), - TRUE, - TRUE, - NULL, - SfoMode, - NULL, - TRUE - ); - } else if ( SName == NULL - || Mapping == NULL - ){ - // - // Display only the one specified - // - ShellStatus = PerformMappingDisplay( - FALSE, - FALSE, - FALSE, - NULL, - SfoMode, - SName, // note the variable here... - TRUE - ); - } else { - if (ShellIsHexOrDecimalNumber(Mapping, TRUE, FALSE)) { - MapAsHandle = ConvertHandleIndexToHandle(ShellStrToUintn(Mapping)); - } else { - MapAsHandle = NULL; - } - if (MapAsHandle == NULL && Mapping[StrLen(Mapping)-1] != L':') { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempStringLength = StrLen(SName); - if (!IsNumberLetterOnly(SName, TempStringLength-(SName[TempStringLength-1]==L':'?1:0))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", SName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - - if (ShellStatus == SHELL_SUCCESS) { - if (MapAsHandle != NULL) { - ShellStatus = AddMappingFromHandle(MapAsHandle, SName); - } else { - ShellStatus = AddMappingFromMapping(Mapping, SName); - } - - if (ShellStatus != SHELL_SUCCESS) { - switch (ShellStatus) { - case SHELL_ACCESS_DENIED: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map"); - break; - case SHELL_INVALID_PARAMETER: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping); - break; - case SHELL_DEVICE_ERROR: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NOF), gShellLevel2HiiHandle, L"map", Mapping); - break; - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", ShellStatus|MAX_BIT); - } - } else { - // - // now do the display... - // - ShellStatus = PerformMappingDisplay( - FALSE, - FALSE, - FALSE, - NULL, - SfoMode, - SName, - TRUE - ); - } // we were sucessful so do an output - } - } // got a valid map target - } // got 2 variables - } // we are adding a mapping - } // got valid parameters - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c deleted file mode 100644 index 77ebfb6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c +++ /dev/null @@ -1,167 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - Function for 'mkdir' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMkDir ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - CONST CHAR16 *NewDirName; - CHAR16 *NewDirNameCopy; - CHAR16 *SplitName; - CHAR16 SaveSplitChar; - UINTN DirCreateCount; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_FILE_HANDLE FileHandle; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - NewDirNameCopy = NULL; - SplitName = NULL; - SaveSplitChar = CHAR_NULL; - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mkdir", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - - // - // create a set of directories - // - if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // we didnt get a single parameter - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mkdir"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - for ( DirCreateCount = 1 - ; - ; DirCreateCount++ - ){ - // - // loop through each directory specified - // - - NewDirName = ShellCommandLineGetRawValue(Package, DirCreateCount); - if (NewDirName == NULL) { - break; - } - // - // check if that already exists... if yes fail - // - FileHandle = NULL; - Status = ShellOpenFileByName(NewDirName, - &FileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, - EFI_FILE_DIRECTORY - ); - if (!EFI_ERROR(Status)) { - ShellCloseFile(&FileHandle); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MKDIR_ALREADY), gShellLevel2HiiHandle, NewDirName); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FileHandle == NULL); - // - // create the nested directory from parent to child. - // if NewDirName = test1\test2\test3, first create "test1\" directory, then "test1\test2\", finally "test1\test2\test3". - // - NewDirNameCopy = AllocateCopyPool (StrSize(NewDirName), NewDirName); - NewDirNameCopy = PathCleanUpDirectories (NewDirNameCopy); - if(NewDirNameCopy == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - break; - } - SplitName = NewDirNameCopy; - while (SplitName != NULL) { - SplitName = StrStr (SplitName + 1, L"\\"); - if (SplitName != NULL) { - SaveSplitChar = *(SplitName + 1); - *(SplitName + 1) = '\0'; - } - // - // check if current nested directory already exists... continue to create the child directory. - // - Status = ShellOpenFileByName (NewDirNameCopy, - &FileHandle, - EFI_FILE_MODE_READ, - EFI_FILE_DIRECTORY - ); - if (!EFI_ERROR(Status)) { - ShellCloseFile (&FileHandle); - } else { - Status = ShellCreateDirectory (NewDirNameCopy, &FileHandle); - if (EFI_ERROR(Status)) { - break; - } - if (FileHandle != NULL) { - gEfiShellProtocol->CloseFile (FileHandle); - } - } - if (SplitName != NULL) { - *(SplitName + 1) = SaveSplitChar; - } - } - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MKDIR_CREATEFAIL), gShellLevel2HiiHandle, NewDirName); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - SHELL_FREE_NON_NULL (NewDirNameCopy); - } - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c deleted file mode 100644 index 392c2a9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c +++ /dev/null @@ -1,863 +0,0 @@ -/** @file - Main file for mv shell level 2 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - function to determine if a move is between file systems. - - @param FullName [in] The name of the file to move. - @param Cwd [in] The current working directory - @param DestPath [in] The target location to move to - - @retval TRUE The move is across file system. - @retval FALSE The move is within a file system. -**/ -BOOLEAN -IsBetweenFileSystem( - IN CONST CHAR16 *FullName, - IN CONST CHAR16 *Cwd, - IN CONST CHAR16 *DestPath - ) -{ - CHAR16 *Test; - CHAR16 *Test1; - UINTN Result; - - Test = StrStr(FullName, L":"); - if (Test == NULL && Cwd != NULL) { - Test = StrStr(Cwd, L":"); - } - Test1 = StrStr(DestPath, L":"); - if (Test1 == NULL && Cwd != NULL) { - Test1 = StrStr(Cwd, L":"); - } - if (Test1 != NULL && Test != NULL) { - *Test = CHAR_NULL; - *Test1 = CHAR_NULL; - Result = StringNoCaseCompare(&FullName, &DestPath); - *Test = L':'; - *Test1 = L':'; - if (Result != 0) { - return (TRUE); - } - } - return (FALSE); -} - -/** - function to determine if SrcPath is valid to mv. - - if SrcPath equal CWD then it's invalid. - if SrcPath is the parent path of CWD then it's invalid. - is SrcPath is NULL return FALSE. - - if CwdPath is NULL then ASSERT() - - @param SrcPath [in] The source path. - @param CwdPath [in] The current working directory. - - @retval TRUE The source path is valid. - @retval FALSE The source path is invalid. -**/ -BOOLEAN -IsSoucePathValid( - IN CONST CHAR16* SrcPath, - IN CONST CHAR16* CwdPath - ) -{ - CHAR16* SrcPathBuffer; - CHAR16* CwdPathBuffer; - BOOLEAN Ret; - - ASSERT (CwdPath != NULL); - if (SrcPath == NULL) { - return FALSE; - } - - Ret = TRUE; - - SrcPathBuffer = AllocateCopyPool (StrSize (SrcPath), SrcPath); - if (SrcPathBuffer == NULL) { - return FALSE; - } - - CwdPathBuffer = AllocateCopyPool (StrSize (CwdPath), CwdPath); - if (CwdPathBuffer == NULL) { - FreePool(SrcPathBuffer); - return FALSE; - } - - gUnicodeCollation->StrUpr (gUnicodeCollation, SrcPathBuffer); - gUnicodeCollation->StrUpr (gUnicodeCollation, CwdPathBuffer); - - if (SrcPathBuffer[StrLen (SrcPathBuffer) -1 ] == L'\\') { - SrcPathBuffer[StrLen (SrcPathBuffer) - 1] = CHAR_NULL; - } - - if (CwdPathBuffer[StrLen (CwdPathBuffer) - 1] == L'\\') { - CwdPathBuffer[StrLen (CwdPathBuffer) - 1] = CHAR_NULL; - } - - if (StrCmp (CwdPathBuffer, SrcPathBuffer) == 0 || - ((StrStr (CwdPathBuffer, SrcPathBuffer) == CwdPathBuffer) && - (CwdPathBuffer[StrLen (SrcPathBuffer)] == L'\\')) - ) { - Ret = FALSE; - } - - FreePool (SrcPathBuffer); - FreePool (CwdPathBuffer); - - return Ret; -} - -/** - Function to validate that moving a specific file (FileName) to a specific - location (DestPath) is valid. - - This function will verify that the destination is not a subdirectory of - FullName, that the Current working Directory is not being moved, and that - the directory is not read only. - - if the move is invalid this function will report the error to StdOut. - - @param SourcePath [in] The name of the file to move. - @param Cwd [in] The current working directory - @param DestPath [in] The target location to move to - @param Attribute [in] The Attribute of the file - @param DestAttr [in] The Attribute of the destination - @param FileStatus [in] The Status of the file when opened - - @retval TRUE The move is valid - @retval FALSE The move is not -**/ -BOOLEAN -IsValidMove( - IN CONST CHAR16 *SourcePath, - IN CONST CHAR16 *Cwd, - IN CONST CHAR16 *DestPath, - IN CONST UINT64 Attribute, - IN CONST UINT64 DestAttr, - IN CONST EFI_STATUS FileStatus - ) -{ - CHAR16 *DestPathCopy; - CHAR16 *DestPathWalker; - - if ((Cwd != NULL) && ((Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY)) { - if (!IsSoucePathValid (SourcePath, Cwd)) { - // - // Invalid move - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_MV_INV_CWD), gShellLevel2HiiHandle); - return FALSE; - } - } - - // - // invalid to move read only or move to a read only destination - // - if (((Attribute & EFI_FILE_READ_ONLY) != 0) - || (FileStatus == EFI_WRITE_PROTECTED) - || ((DestAttr & EFI_FILE_READ_ONLY) != 0) - ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_RO), gShellLevel2HiiHandle, SourcePath); - return (FALSE); - } - - DestPathCopy = AllocateCopyPool(StrSize(DestPath), DestPath); - if (DestPathCopy == NULL) { - return (FALSE); - } - - for (DestPathWalker = DestPathCopy; *DestPathWalker == L'\\'; DestPathWalker++) ; - - while(DestPathWalker != NULL && DestPathWalker[StrLen(DestPathWalker)-1] == L'\\') { - DestPathWalker[StrLen(DestPathWalker)-1] = CHAR_NULL; - } - - ASSERT(DestPathWalker != NULL); - ASSERT(SourcePath != NULL); - - // - // If they're the same, or if source is "above" dest on file path tree - // - if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0 || - ((StrStr(DestPathWalker, SourcePath) == DestPathWalker) && - (DestPathWalker[StrLen(SourcePath)] == '\\') - ) - ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle); - FreePool(DestPathCopy); - return (FALSE); - } - FreePool(DestPathCopy); - - return (TRUE); -} - -/** - Function to take a destination path that might contain wildcards and verify - that there is only a single possible target (IE we cant have wildcards that - have 2 possible destination). - - if the result is sucessful the caller must free *DestPathPointer. - - @param[in] DestParameter The original path to the destination. - @param[in, out] DestPathPointer A pointer to the callee allocated final path. - @param[in] Cwd A pointer to the current working directory. - @param[in] SingleSource TRUE to have only one source file. - @param[in, out] DestAttr A pointer to the destination information attribute. - - @retval SHELL_INVALID_PARAMETER The DestParameter could not be resolved to a location. - @retval SHELL_INVALID_PARAMETER The DestParameter could be resolved to more than 1 location. - @retval SHELL_INVALID_PARAMETER Cwd is required and is NULL. - @retval SHELL_SUCCESS The operation was sucessful. -**/ -SHELL_STATUS -GetDestinationLocation( - IN CONST CHAR16 *DestParameter, - IN OUT CHAR16 **DestPathPointer, - IN CONST CHAR16 *Cwd, - IN CONST BOOLEAN SingleSource, - IN OUT UINT64 *DestAttr - ) -{ - EFI_SHELL_FILE_INFO *DestList; - EFI_SHELL_FILE_INFO *Node; - CHAR16 *DestPath; - UINTN NewSize; - UINTN CurrentSize; - - DestList = NULL; - DestPath = NULL; - - ASSERT(DestAttr != NULL); - - if (StrStr(DestParameter, L"\\") == DestParameter) { - if (Cwd == NULL) { - return SHELL_INVALID_PARAMETER; - } - DestPath = AllocateZeroPool(StrSize(Cwd)); - if (DestPath == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - StrCpyS(DestPath, StrSize(Cwd) / sizeof(CHAR16), Cwd); - while (PathRemoveLastItem(DestPath)) ; - - // - // Append DestParameter beyond '\' which may be present - // - CurrentSize = StrSize(DestPath); - StrnCatGrow(&DestPath, &CurrentSize, &DestParameter[1], 0); - - *DestPathPointer = DestPath; - return (SHELL_SUCCESS); - } - // - // get the destination path - // - ShellOpenFileMetaArg((CHAR16*)DestParameter, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList); - if (DestList == NULL || IsListEmpty(&DestList->Link)) { - // - // Not existing... must be renaming - // - if (StrStr(DestParameter, L":") == NULL) { - if (Cwd == NULL) { - ShellCloseFileMetaArg(&DestList); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle); - return (SHELL_INVALID_PARAMETER); - } - NewSize = StrSize(Cwd); - NewSize += StrSize(DestParameter); - DestPath = AllocateZeroPool(NewSize); - if (DestPath == NULL) { - ShellCloseFileMetaArg(&DestList); - return (SHELL_OUT_OF_RESOURCES); - } - StrCpyS(DestPath, NewSize / sizeof(CHAR16), Cwd); - if (DestPath[StrLen(DestPath)-1] != L'\\' && DestParameter[0] != L'\\') { - StrCatS(DestPath, NewSize / sizeof(CHAR16), L"\\"); - } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestParameter[0] == L'\\') { - ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; - } - StrCatS(DestPath, NewSize / sizeof(CHAR16), DestParameter); - } else { - ASSERT(DestPath == NULL); - DestPath = StrnCatGrow(&DestPath, NULL, DestParameter, 0); - if (DestPath == NULL) { - ShellCloseFileMetaArg(&DestList); - return (SHELL_OUT_OF_RESOURCES); - } - } - } else { - Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&DestList->Link); - *DestAttr = Node->Info->Attribute; - // - // Make sure there is only 1 node in the list. - // - if (!IsNodeAtEnd(&DestList->Link, &Node->Link)) { - ShellCloseFileMetaArg(&DestList); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter); - return (SHELL_INVALID_PARAMETER); - } - - // - // If we are a directory or a single file, then one node is fine. - // - if (ShellIsDirectory(Node->FullName)==EFI_SUCCESS || SingleSource) { - DestPath = AllocateZeroPool(StrSize(Node->FullName)+sizeof(CHAR16)); - if (DestPath == NULL) { - ShellCloseFileMetaArg(&DestList); - return (SHELL_OUT_OF_RESOURCES); - } - StrCpyS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), Node->FullName); - StrCatS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), L"\\"); - } else { - // - // cant move multiple files onto a single file. - // - ShellCloseFileMetaArg(&DestList); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter); - return (SHELL_INVALID_PARAMETER); - } - } - - *DestPathPointer = DestPath; - ShellCloseFileMetaArg(&DestList); - - return (SHELL_SUCCESS); -} - -/** - Function to do a move across file systems. - - @param[in] Node A pointer to the file to be removed. - @param[in] DestPath A pointer to the destination file path. - @param[out] Resp A pointer to response from question. Pass back on looped calling - - @retval SHELL_SUCCESS The source file was moved to the destination. -**/ -EFI_STATUS -MoveBetweenFileSystems( - IN EFI_SHELL_FILE_INFO *Node, - IN CONST CHAR16 *DestPath, - OUT VOID **Resp - ) -{ - SHELL_STATUS ShellStatus; - - // - // First we copy the file - // - ShellStatus = CopySingleFile (Node->FullName, DestPath, Resp, TRUE, L"mv"); - - // - // Check our result - // - if (ShellStatus == SHELL_SUCCESS) { - // - // The copy was successful. delete the source file. - // - CascadeDelete(Node, TRUE); - Node->Handle = NULL; - } else if (ShellStatus == SHELL_ABORTED) { - return EFI_ABORTED; - } else if (ShellStatus == SHELL_ACCESS_DENIED) { - return EFI_ACCESS_DENIED; - } else if (ShellStatus == SHELL_VOLUME_FULL) { - return EFI_VOLUME_FULL; - } else { - return EFI_UNSUPPORTED; - } - - return (EFI_SUCCESS); -} - -/** - Function to take the destination path and target file name to generate the full destination path. - - @param[in] DestPath A pointer to the destination file path string. - @param[out] FullDestPath A pointer to the full destination path string. - @param[in] FileName Name string of the targe file. - - @retval SHELL_SUCCESS the files were all moved. - @retval SHELL_INVALID_PARAMETER a parameter was invalid - @retval SHELL_OUT_OF_RESOURCES a memory allocation failed -**/ -EFI_STATUS -CreateFullDestPath( - IN CONST CHAR16 **DestPath, - OUT CHAR16 **FullDestPath, - IN CONST CHAR16 *FileName - ) -{ - UINTN Size; - if (FullDestPath == NULL || FileName == NULL || DestPath == NULL || *DestPath == NULL){ - return (EFI_INVALID_PARAMETER); - } - - Size = StrSize(*DestPath) + StrSize(FileName); - - *FullDestPath = AllocateZeroPool(Size); - if (*FullDestPath == NULL){ - return (EFI_OUT_OF_RESOURCES); - } - - StrCpyS(*FullDestPath, Size / sizeof(CHAR16), *DestPath); - if ((*FullDestPath)[StrLen(*FullDestPath)-1] != L'\\' && FileName[0] != L'\\') { - StrCatS(*FullDestPath, Size / sizeof(CHAR16), L"\\"); - } - StrCatS(*FullDestPath, Size / sizeof(CHAR16), FileName); - - return (EFI_SUCCESS); -} - -/** - Function to do a move within a file system. - - @param[in] Node A pointer to the file to be removed. - @param[in] DestPath A pointer to the destination file path. - @param[out] Resp A pointer to response from question. Pass back on looped calling. - - @retval SHELL_SUCCESS The source file was moved to the destination. - @retval SHELL_OUT_OF_RESOURCES A memory allocation failed. -**/ -EFI_STATUS -MoveWithinFileSystems( - IN EFI_SHELL_FILE_INFO *Node, - IN CHAR16 *DestPath, - OUT VOID **Resp - ) -{ - EFI_FILE_INFO *NewFileInfo; - CHAR16 *TempLocation; - UINTN NewSize; - UINTN Length; - EFI_STATUS Status; - - // - // Chop off map info from DestPath - // - if ((TempLocation = StrStr(DestPath, L":")) != NULL) { - CopyMem(DestPath, TempLocation+1, StrSize(TempLocation+1)); - } - - // - // construct the new file info block - // - NewSize = StrSize(DestPath); - NewSize += StrSize(Node->FileName) + SIZE_OF_EFI_FILE_INFO + sizeof(CHAR16); - NewFileInfo = AllocateZeroPool(NewSize); - if (NewFileInfo == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle); - Status = EFI_OUT_OF_RESOURCES; - } else { - CopyMem(NewFileInfo, Node->Info, SIZE_OF_EFI_FILE_INFO); - if (DestPath[0] != L'\\') { - StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), L"\\"); - StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath); - } else { - StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath); - } - Length = StrLen(NewFileInfo->FileName); - if (Length > 0) { - Length--; - } - if (NewFileInfo->FileName[Length] == L'\\') { - if (Node->FileName[0] == L'\\') { - // - // Don't allow for double slashes. Eliminate one of them. - // - NewFileInfo->FileName[Length] = CHAR_NULL; - } - StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), Node->FileName); - } - NewFileInfo->Size = SIZE_OF_EFI_FILE_INFO + StrSize(NewFileInfo->FileName); - - // - // Perform the move operation - // - Status = ShellSetFileInfo(Node->Handle, NewFileInfo); - - // - // Free the info object we used... - // - FreePool(NewFileInfo); - } - - return (Status); -} -/** - function to take a list of files to move and a destination location and do - the verification and moving of those files to that location. This function - will report any errors to the user and continue to move the rest of the files. - - @param[in] FileList A LIST_ENTRY* based list of files to move - @param[out] Resp pointer to response from question. Pass back on looped calling - @param[in] DestParameter the originally specified destination location - - @retval SHELL_SUCCESS the files were all moved. - @retval SHELL_INVALID_PARAMETER a parameter was invalid - @retval SHELL_SECURITY_VIOLATION a security violation ocurred - @retval SHELL_WRITE_PROTECTED the destination was write protected - @retval SHELL_OUT_OF_RESOURCES a memory allocation failed -**/ -SHELL_STATUS -ValidateAndMoveFiles( - IN EFI_SHELL_FILE_INFO *FileList, - OUT VOID **Resp, - IN CONST CHAR16 *DestParameter - ) -{ - EFI_STATUS Status; - CHAR16 *HiiOutput; - CHAR16 *HiiResultOk; - CHAR16 *DestPath; - CHAR16 *FullDestPath; - CONST CHAR16 *Cwd; - CHAR16 *FullCwd; - SHELL_STATUS ShellStatus; - EFI_SHELL_FILE_INFO *Node; - VOID *Response; - UINT64 Attr; - CHAR16 *CleanFilePathStr; - - ASSERT(FileList != NULL); - ASSERT(DestParameter != NULL); - - DestPath = NULL; - FullDestPath = NULL; - Cwd = ShellGetCurrentDir(NULL); - Response = *Resp; - Attr = 0; - CleanFilePathStr = NULL; - FullCwd = NULL; - - if (Cwd != NULL) { - FullCwd = AllocateZeroPool(StrSize(Cwd) + sizeof(CHAR16)); - if (FullCwd == NULL) { - return SHELL_OUT_OF_RESOURCES; - } else { - StrCpyS(FullCwd, StrSize(Cwd)/sizeof(CHAR16)+1, Cwd); - StrCatS(FullCwd, StrSize(Cwd)/sizeof(CHAR16)+1, L"\\"); - } - } - - Status = ShellLevel2StripQuotes (DestParameter, &CleanFilePathStr); - if (EFI_ERROR (Status)) { - SHELL_FREE_NON_NULL(FullCwd); - if (Status == EFI_OUT_OF_RESOURCES) { - return SHELL_OUT_OF_RESOURCES; - } else { - return SHELL_INVALID_PARAMETER; - } - } - - ASSERT (CleanFilePathStr != NULL); - - // - // Get and validate the destination location - // - ShellStatus = GetDestinationLocation(CleanFilePathStr, &DestPath, FullCwd, (BOOLEAN)(FileList->Link.ForwardLink == FileList->Link.BackLink), &Attr); - FreePool (CleanFilePathStr); - - if (ShellStatus != SHELL_SUCCESS) { - SHELL_FREE_NON_NULL (FullCwd); - return (ShellStatus); - } - DestPath = PathCleanUpDirectories(DestPath); - if (DestPath == NULL) { - FreePool (FullCwd); - return (SHELL_OUT_OF_RESOURCES); - } - - HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MV_OUTPUT), NULL); - HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL); - if (HiiOutput == NULL || HiiResultOk == NULL) { - SHELL_FREE_NON_NULL(DestPath); - SHELL_FREE_NON_NULL(HiiOutput); - SHELL_FREE_NON_NULL(HiiResultOk); - SHELL_FREE_NON_NULL(FullCwd); - return (SHELL_OUT_OF_RESOURCES); - } - - // - // Go through the list of files and directories to move... - // - for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) - ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) - ){ - if (ShellGetExecutionBreakFlag()) { - break; - } - - // - // These should never be NULL - // - ASSERT(Node->FileName != NULL); - ASSERT(Node->FullName != NULL); - ASSERT(Node->Info != NULL); - - // - // skip the directory traversing stuff... - // - if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) { - continue; - } - - SHELL_FREE_NON_NULL(FullDestPath); - FullDestPath = NULL; - if (ShellIsDirectory(DestPath)==EFI_SUCCESS) { - CreateFullDestPath((CONST CHAR16 **)&DestPath, &FullDestPath, Node->FileName); - } - - // - // Validate that the move is valid - // - if (!IsValidMove(Node->FullName, FullCwd, FullDestPath!=NULL? FullDestPath:DestPath, Node->Info->Attribute, Attr, Node->Status)) { - ShellStatus = SHELL_INVALID_PARAMETER; - continue; - } - - ShellPrintEx(-1, -1, HiiOutput, Node->FullName, FullDestPath!=NULL? FullDestPath:DestPath); - - // - // See if destination exists - // - if (!EFI_ERROR(ShellFileExists(FullDestPath!=NULL? FullDestPath:DestPath))) { - if (Response == NULL) { - ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response); - } - switch (*(SHELL_PROMPT_RESPONSE*)Response) { - case ShellPromptResponseNo: - FreePool(Response); - Response = NULL; - continue; - case ShellPromptResponseCancel: - *Resp = Response; - // - // indicate to stop everything - // - SHELL_FREE_NON_NULL(FullCwd); - return (SHELL_ABORTED); - case ShellPromptResponseAll: - *Resp = Response; - break; - case ShellPromptResponseYes: - FreePool(Response); - Response = NULL; - break; - default: - FreePool(Response); - SHELL_FREE_NON_NULL(FullCwd); - return SHELL_ABORTED; - } - Status = ShellDeleteFileByName(FullDestPath!=NULL? FullDestPath:DestPath); - } - - if (IsBetweenFileSystem(Node->FullName, FullCwd, DestPath)) { - while (FullDestPath == NULL && DestPath != NULL && DestPath[0] != CHAR_NULL && DestPath[StrLen(DestPath) - 1] == L'\\') { - DestPath[StrLen(DestPath) - 1] = CHAR_NULL; - } - Status = MoveBetweenFileSystems(Node, FullDestPath!=NULL? FullDestPath:DestPath, &Response); - } else { - Status = MoveWithinFileSystems(Node, DestPath, &Response); - // - // Display error status - // - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"mv", Status); - } - } - - // - // Check our result - // - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_INVALID_PARAMETER; - if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (Status == EFI_WRITE_PROTECTED) { - ShellStatus = SHELL_WRITE_PROTECTED; - } else if (Status == EFI_OUT_OF_RESOURCES) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else if (Status == EFI_DEVICE_ERROR) { - ShellStatus = SHELL_DEVICE_ERROR; - } else if (Status == EFI_ACCESS_DENIED) { - ShellStatus = SHELL_ACCESS_DENIED; - } - } else { - ShellPrintEx(-1, -1, L"%s", HiiResultOk); - } - - } // main for loop - - SHELL_FREE_NON_NULL(FullDestPath); - SHELL_FREE_NON_NULL(DestPath); - SHELL_FREE_NON_NULL(HiiOutput); - SHELL_FREE_NON_NULL(HiiResultOk); - SHELL_FREE_NON_NULL(FullCwd); - return (ShellStatus); -} - -/** - Function for 'mv' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMv ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CHAR16 *Cwd; - UINTN CwdSize; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - UINTN LoopCounter; - EFI_SHELL_FILE_INFO *FileList; - VOID *Response; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - ParamCount = 0; - FileList = NULL; - Response = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mv", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - - switch (ParamCount = ShellCommandLineGetCount(Package)) { - case 0: - case 1: - // - // we have insufficient parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mv"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - case 2: - // - // must have valid CWD for single parameter... - // - if (ShellGetCurrentDir(NULL) == NULL){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"mv"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_NOT_FOUND; - } else { - // - // ValidateAndMoveFiles will report errors to the screen itself - // - CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16); - Cwd = AllocateZeroPool(CwdSize); - if (Cwd == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"mv"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - StrCpyS (Cwd, CwdSize / sizeof (CHAR16), ShellGetCurrentDir (NULL)); - StrCatS (Cwd, CwdSize / sizeof (CHAR16), L"\\"); - ShellStatus = ValidateAndMoveFiles (FileList, &Response, Cwd); - FreePool (Cwd); - } - } - } - - break; - default: - ///@todo make sure this works with error half way through and continues... - for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount ; LoopCounter++) { - if (ShellGetExecutionBreakFlag()) { - break; - } - Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, LoopCounter)); - ShellStatus = SHELL_NOT_FOUND; - } else { - // - // ValidateAndMoveFiles will report errors to the screen itself - // Only change ShellStatus if it's sucessful - // - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = ValidateAndMoveFiles(FileList, &Response, ShellCommandLineGetRawValue(Package, ParamCount)); - } else { - ValidateAndMoveFiles(FileList, &Response, ShellCommandLineGetRawValue(Package, ParamCount)); - } - } - if (FileList != NULL && !IsListEmpty(&FileList->Link)) { - Status = ShellCloseFileMetaArg(&FileList); - if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) { - ShellStatus = SHELL_ACCESS_DENIED; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, 1), ShellStatus|MAX_BIT); - } - } - } - break; - } // switch on parameter count - - if (FileList != NULL) { - ShellCloseFileMetaArg(&FileList); - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - SHELL_FREE_NON_NULL(Response); - - if (ShellGetExecutionBreakFlag()) { - return (SHELL_ABORTED); - } - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c deleted file mode 100644 index b0614bb..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c +++ /dev/null @@ -1,317 +0,0 @@ -/** @file - Main file for Parse shell level 2 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - Check if data is coming from StdIn output. - - @param[in] None - - @retval TRUE StdIn stream data available to parse - @retval FALSE StdIn stream data is not available to parse. -**/ -BOOLEAN -IsStdInDataAvailable ( - VOID - ) -{ - SHELL_FILE_HANDLE FileHandle; - EFI_STATUS Status; - CHAR16 CharBuffer; - UINTN CharSize; - UINT64 OriginalFilePosition; - - Status = EFI_SUCCESS; - FileHandle = NULL; - OriginalFilePosition = 0; - - if (ShellOpenFileByName (L">i", &FileHandle, EFI_FILE_MODE_READ, 0) == EFI_SUCCESS) { - CharSize = sizeof(CHAR16); - gEfiShellProtocol->GetFilePosition (FileHandle, &OriginalFilePosition); - Status = gEfiShellProtocol->ReadFile (FileHandle, &CharSize, &CharBuffer); - if (EFI_ERROR (Status) || (CharSize != sizeof(CHAR16))) { - return FALSE; - } - gEfiShellProtocol->SetFilePosition(FileHandle, OriginalFilePosition); - } - - if (FileHandle == NULL) { - return FALSE; - } else { - return TRUE; - } -} - -/** - Handle stings for SFO Output with escape character ^ in a string - 1. Quotation marks in the string must be escaped by using a ^ character (i.e. ^"). - 2. The ^ character may be inserted using ^^. - - @param[in] String The Unicode NULL-terminated string. - - @retval NewString The new string handled for SFO. -**/ -EFI_STRING -HandleStringWithEscapeCharForParse ( - IN CHAR16 *String - ) -{ - EFI_STRING NewStr; - EFI_STRING StrWalker; - EFI_STRING ReturnStr; - - if (String == NULL) { - return NULL; - } - - // - // start to parse the input string. - // - NewStr = AllocateZeroPool (StrSize (String)); - if (NewStr == NULL) { - return NULL; - } - ReturnStr = NewStr; - StrWalker = String; - while (*StrWalker != CHAR_NULL) { - if (*StrWalker == L'^' && (*(StrWalker + 1) == L'^' || *(StrWalker + 1) == L'"')) { - *NewStr = *(StrWalker + 1); - StrWalker++; - } else { - *NewStr = *StrWalker; - } - StrWalker++; - NewStr++; - } - - return ReturnStr; -} - - -/** - Do the actual parsing of the file. the file should be SFO output from a - shell command or a similar format. - - @param[in] FileName The filename to open. - @param[in] TableName The name of the table to find. - @param[in] ColumnIndex The column number to get. - @param[in] TableNameInstance Which instance of the table to get (row). - @param[in] ShellCommandInstance Which instance of the command to get. - @param[in] StreamingUnicode Indicates Input file is StdIn Unicode streaming data or not - - @retval SHELL_NOT_FOUND The requested instance was not found. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -PerformParsing( - IN CONST CHAR16 *FileName, - IN CONST CHAR16 *TableName, - IN CONST UINTN ColumnIndex, - IN CONST UINTN TableNameInstance, - IN CONST UINTN ShellCommandInstance, - IN BOOLEAN StreamingUnicode - ) -{ - SHELL_FILE_HANDLE FileHandle; - EFI_STATUS Status; - BOOLEAN Ascii; - UINTN LoopVariable; - UINTN ColumnLoop; - CHAR16 *TempLine; - CHAR16 *ColumnPointer; - SHELL_STATUS ShellStatus; - CHAR16 *TempSpot; - CHAR16 *SfoString; - - ASSERT(FileName != NULL); - ASSERT(TableName != NULL); - - ShellStatus = SHELL_SUCCESS; - - Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"parse", FileName); - ShellStatus = SHELL_NOT_FOUND; - } else if (!EFI_ERROR (FileHandleIsDirectory (FileHandle))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_FILE), gShellLevel2HiiHandle, L"parse", FileName); - ShellStatus = SHELL_NOT_FOUND; - } else { - for (LoopVariable = 0 ; LoopVariable < ShellCommandInstance && !ShellFileHandleEof(FileHandle);) { - TempLine = ShellFileHandleReturnLine (FileHandle, &Ascii); - - if ((TempLine == NULL) || (*TempLine == CHAR_NULL && StreamingUnicode)) { - break; - } - - // - // Search for "ShellCommand," in the file to start the SFO table - // for a given ShellCommand. The UEFI Shell spec does not specify - // a space after the comma. - // - if (StrStr (TempLine, L"ShellCommand,") == TempLine) { - LoopVariable++; - } - SHELL_FREE_NON_NULL(TempLine); - } - if (LoopVariable == ShellCommandInstance) { - LoopVariable = 0; - while(1) { - TempLine = ShellFileHandleReturnLine (FileHandle, &Ascii); - if (TempLine == NULL - || *TempLine == CHAR_NULL - || StrStr (TempLine, L"ShellCommand,") == TempLine) { - SHELL_FREE_NON_NULL(TempLine); - break; - } - if (StrStr (TempLine, TableName) == TempLine) { - LoopVariable++; - if (LoopVariable == TableNameInstance - || (TableNameInstance == (UINTN)-1)) { - for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) { - ColumnPointer = StrStr (ColumnPointer, L",\""); - if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){ - ColumnPointer++; - } - } - if (ColumnLoop == ColumnIndex) { - if (ColumnPointer == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"parse", L"Column Index"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - TempSpot = StrStr (ColumnPointer, L",\""); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){ - ColumnPointer++; - } - if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){ - ColumnPointer++; - } - if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen (ColumnPointer) - 1] == L'\"'){ - ColumnPointer[StrLen (ColumnPointer) - 1] = CHAR_NULL; - } - SfoString = HandleStringWithEscapeCharForParse (ColumnPointer); - if (SfoString != NULL) { - ShellPrintEx (-1, -1, L"%s\r\n", SfoString); - SHELL_FREE_NON_NULL (SfoString); - } - } - } - } - } - SHELL_FREE_NON_NULL(TempLine); - } - } - } - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-i", TypeValue}, - {L"-s", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'parse' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunParse ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *FileName; - CONST CHAR16 *TableName; - CONST CHAR16 *ColumnString; - SHELL_STATUS ShellStatus; - UINTN ShellCommandInstance; - UINTN TableNameInstance; - BOOLEAN StreamingUnicode; - - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - StreamingUnicode = FALSE; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, FALSE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"parse", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - StreamingUnicode = IsStdInDataAvailable (); - if ((!StreamingUnicode && (ShellCommandLineGetCount(Package) < 4)) || - (ShellCommandLineGetCount(Package) < 3)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"parse"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if ((StreamingUnicode && (ShellCommandLineGetCount(Package) > 3)) || - (ShellCommandLineGetCount(Package) > 4)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"parse"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (StreamingUnicode) { - FileName = L">i"; - TableName = ShellCommandLineGetRawValue(Package, 1); - ColumnString = ShellCommandLineGetRawValue(Package, 2); - } else { - FileName = ShellCommandLineGetRawValue(Package, 1); - TableName = ShellCommandLineGetRawValue(Package, 2); - ColumnString = ShellCommandLineGetRawValue(Package, 3); - } - if (ShellCommandLineGetValue(Package, L"-i") == NULL) { - TableNameInstance = (UINTN)-1; - } else { - TableNameInstance = ShellStrToUintn(ShellCommandLineGetValue(Package, L"-i")); - } - if (ShellCommandLineGetValue(Package, L"-s") == NULL) { - ShellCommandInstance = 1; - } else { - ShellCommandInstance = ShellStrToUintn(ShellCommandLineGetValue(Package, L"-s")); - } - - ShellStatus = PerformParsing(FileName, TableName, ShellStrToUintn(ColumnString), TableNameInstance, ShellCommandInstance, StreamingUnicode); - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c deleted file mode 100644 index 753e422..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c +++ /dev/null @@ -1,170 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ResetParamList[] = { - {L"-w", TypeValue}, - {L"-s", TypeValue}, - {L"-c", TypeValue}, - {L"-fwui", TypeFlag }, - {NULL, TypeMax } - }; - -/** - Function for 'reset' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunReset ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CONST CHAR16 *String; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT64 OsIndications; - UINT32 Attr; - UINTN DataSize; - - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ResetParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam); - FreePool(ProblemParam); - return (SHELL_INVALID_PARAMETER); - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - - if (ShellCommandLineGetFlag (Package, L"-fwui")) { - - DataSize = sizeof (OsIndications); - Status = gRT->GetVariable ( - EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, &gEfiGlobalVariableGuid, - &Attr, &DataSize, &OsIndications - ); - if (!EFI_ERROR (Status)) { - if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) { - DataSize = sizeof (OsIndications); - Status = gRT->GetVariable ( - EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid, - &Attr, &DataSize, &OsIndications - ); - if (!EFI_ERROR (Status)) { - OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI; - } else { - OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI; - } - Status = gRT->SetVariable ( - EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof (OsIndications), &OsIndications - ); - } - } - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_UNSUPPORTED; - goto Error; - } - } - - // - // check for warm reset flag, then shutdown reset flag, then cold (default) reset flag - // - if (ShellCommandLineGetFlag(Package, L"-w")) { - if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-c")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - String = ShellCommandLineGetValue(Package, L"-w"); - if (String != NULL) { - gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, StrSize(String), (VOID*)String); - } else { - gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); - } - } - } else if (ShellCommandLineGetFlag(Package, L"-s")) { - if (ShellCommandLineGetFlag(Package, L"-c")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - String = ShellCommandLineGetValue(Package, L"-s"); - DEBUG_CODE(ShellPrintEx(-1,-1,L"Reset with %s (%d bytes)", String, String!=NULL?StrSize(String):0);); - if (String != NULL) { - gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, StrSize(String), (VOID*)String); - } else { - gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); - } - } - } else { - // - // this is default so dont worry about flag... - // - String = ShellCommandLineGetValue(Package, L"-c"); - if (String != NULL) { - gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, StrSize(String), (VOID*)String); - } else { - gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); - } - } - } - } - - // - // we should never get here... so the free and return are for formality more than use - // as the ResetSystem function should not return... - // - -Error: - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c deleted file mode 100644 index f79b5b6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c +++ /dev/null @@ -1,380 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-q", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Determine if a directory has no files in it. - - @param[in] FileHandle The EFI_HANDLE to the directory. - - @retval TRUE The directory has no files (or directories). - @retval FALSE The directory has at least 1 file or directory in it. -**/ -BOOLEAN -IsDirectoryEmpty ( - IN EFI_HANDLE FileHandle - ) -{ - EFI_STATUS Status; - EFI_FILE_INFO *FileInfo; - BOOLEAN NoFile; - BOOLEAN RetVal; - - RetVal = TRUE; - NoFile = FALSE; - FileInfo = NULL; - - for (Status = FileHandleFindFirstFile(FileHandle, &FileInfo) - ; !NoFile && !EFI_ERROR (Status) - ; FileHandleFindNextFile(FileHandle, FileInfo, &NoFile) - ){ - if (StrStr(FileInfo->FileName, L".") != FileInfo->FileName - &&StrStr(FileInfo->FileName, L"..") != FileInfo->FileName) { - RetVal = FALSE; - } - } - return (RetVal); -} - -/** - Delete a node and all nodes under it (including sub directories). - - @param[in] Node The node to start deleting with. - @param[in] Quiet TRUE to print no messages. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_ACCESS_DENIED A file was read only. - @retval SHELL_ABORTED The abort message was received. - @retval SHELL_DEVICE_ERROR A device error occured reading this Node. -**/ -SHELL_STATUS -CascadeDelete( - IN EFI_SHELL_FILE_INFO *Node, - IN CONST BOOLEAN Quiet - ) -{ - SHELL_STATUS ShellStatus; - EFI_SHELL_FILE_INFO *List; - EFI_SHELL_FILE_INFO *Node2; - EFI_STATUS Status; - SHELL_PROMPT_RESPONSE *Resp; - CHAR16 *TempName; - UINTN NewSize; - - Resp = NULL; - ShellStatus = SHELL_SUCCESS; - List = NULL; - Status = EFI_SUCCESS; - - if ((Node->Info->Attribute & EFI_FILE_READ_ONLY) == EFI_FILE_READ_ONLY) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DETELE_RO), gShellLevel2HiiHandle, L"rm", Node->FullName); - return (SHELL_ACCESS_DENIED); - } - - if ((Node->Info->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { - if (!IsDirectoryEmpty(Node->Handle)) { - if (!Quiet) { - Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_RM_LOG_DELETE_CONF), gShellLevel2HiiHandle, Node->FullName); - Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp); - ASSERT(Resp != NULL); - if (EFI_ERROR(Status) || *Resp != ShellPromptResponseYes) { - SHELL_FREE_NON_NULL(Resp); - return (SHELL_ABORTED); - } - SHELL_FREE_NON_NULL(Resp); - } - // - // empty out the directory - // - Status = gEfiShellProtocol->FindFilesInDir(Node->Handle, &List); - if (EFI_ERROR(Status)) { - if (List!=NULL) { - gEfiShellProtocol->FreeFileList(&List); - } - return (SHELL_DEVICE_ERROR); - } - for (Node2 = (EFI_SHELL_FILE_INFO *)GetFirstNode(&List->Link) - ; !IsNull(&List->Link, &Node2->Link) - ; Node2 = (EFI_SHELL_FILE_INFO *)GetNextNode(&List->Link, &Node2->Link) - ){ - // - // skip the directory traversing stuff... - // - if (StrCmp(Node2->FileName, L".") == 0 || StrCmp(Node2->FileName, L"..") == 0) { - continue; - } - Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE); - if (EFI_ERROR(Node2->Status) && StrStr(Node2->FileName, L":") == NULL) { - // - // Update the node filename to have full path with file system identifier - // - NewSize = StrSize(Node->FullName) + StrSize(Node2->FullName); - TempName = AllocateZeroPool(NewSize); - if (TempName == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - } else { - StrCpyS(TempName, NewSize/sizeof(CHAR16), Node->FullName); - TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL; - StrCatS(TempName, NewSize/sizeof(CHAR16), Node2->FullName); - FreePool((VOID*)Node2->FullName); - Node2->FullName = TempName; - - // - // Now try again to open the file - // - Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE); - } - } - if (!EFI_ERROR(Node2->Status)) { - ShellStatus = CascadeDelete(Node2, Quiet); - } else if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = (SHELL_STATUS)(Node2->Status&(~0x80000000)); - } - if (ShellStatus != SHELL_SUCCESS) { - if (List!=NULL) { - gEfiShellProtocol->FreeFileList(&List); - } - return (ShellStatus); - } - } - if (List!=NULL) { - gEfiShellProtocol->FreeFileList(&List); - } - } - } - - if (!(StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0)) { - // - // now delete the current node... - // - if (!Quiet) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE), gShellLevel2HiiHandle, Node->FullName); - } - Status = gEfiShellProtocol->DeleteFile(Node->Handle); - Node->Handle = NULL; - } - - // - // We cant allow for the warning here! (Dont use EFI_ERROR Macro). - // - if (Status != EFI_SUCCESS){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR), gShellLevel2HiiHandle, Status); - return (SHELL_ACCESS_DENIED); - } else { - if (!Quiet) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_COMP), gShellLevel2HiiHandle); - } - return (SHELL_SUCCESS); - } -} - -/** - Determines if a Node is a valid delete target. Will prevent deleting the root directory. - - @param[in] List RESERVED. Not used. - @param[in] Node The node to analyze. - @param[in] Package RESERVED. Not used. -**/ -BOOLEAN -IsValidDeleteTarget( - IN CONST EFI_SHELL_FILE_INFO *List, - IN CONST EFI_SHELL_FILE_INFO *Node, - IN CONST LIST_ENTRY *Package - ) -{ - CONST CHAR16 *TempLocation; - BOOLEAN RetVal; - CHAR16 *SearchString; - CHAR16 *Pattern; - UINTN Size; - - if (Node == NULL || Node->FullName == NULL) { - return (FALSE); - } - - TempLocation = StrStr(Node->FullName, L":"); - if (StrLen(TempLocation) <= 2) { - // - // Deleting the root directory is invalid. - // - return (FALSE); - } - - TempLocation = ShellGetCurrentDir(NULL); - if (TempLocation == NULL) { - // - // No working directory is specified so whatever is left is ok. - // - return (TRUE); - } - - Pattern = NULL; - SearchString = NULL; - Size = 0; - Pattern = StrnCatGrow(&Pattern, &Size, TempLocation , 0); - Pattern = StrnCatGrow(&Pattern, &Size, L"\\" , 0); - Size = 0; - SearchString = StrnCatGrow(&SearchString, &Size, Node->FullName, 0); - if (!EFI_ERROR(ShellIsDirectory(SearchString))) { - SearchString = StrnCatGrow(&SearchString, &Size, L"\\", 0); - SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0); - } - - if (Pattern == NULL || SearchString == NULL) { - RetVal = FALSE; - } else { - RetVal = TRUE; - if (gUnicodeCollation->MetaiMatch(gUnicodeCollation, Pattern, SearchString)) { - RetVal = FALSE; - } - } - - SHELL_FREE_NON_NULL(Pattern ); - SHELL_FREE_NON_NULL(SearchString); - - return (RetVal); -} - -/** - Function for 'rm' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunRm ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *Param; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *Node; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - ParamCount = 0; - FileList = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"rm", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // we insufficient parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"rm"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // get a list with each file specified by parameters - // if parameter is a directory then add all the files below it to the list - // - for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ; Param != NULL - ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ){ - Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList); - if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"rm", (CHAR16*)Param); - ShellStatus = SHELL_NOT_FOUND; - break; - } - } - - if (ShellStatus == SHELL_SUCCESS){ - // - // loop through the list and make sure we are not aborting... - // - for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag() - ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link) - ){ - // - // skip the directory traversing stuff... - // - if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) { - continue; - } - - // - // do the deleting of nodes - // - if (EFI_ERROR(Node->Status)){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR2), gShellLevel2HiiHandle, Node->Status); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - if (!IsValidDeleteTarget(FileList, Node, Package)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR3), gShellLevel2HiiHandle, Node->FullName); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - } - - ShellStatus = CascadeDelete(Node, ShellCommandLineGetFlag(Package, L"-q")); - } - } - // - // Free the fileList - // - if (FileList != NULL) { - Status = ShellCloseFileMetaArg(&FileList); - } - FileList = NULL; - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c deleted file mode 100644 index d299ff3..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c +++ /dev/null @@ -1,174 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - Print out each environment variable registered with the Shell 2.0 GUID. - - If you spawn a pre 2.0 shell from the Shell 2.0 the environment variable may not carry through. - - @retval STATUS_SUCCESS the printout was sucessful - @return any return code from GetNextVariableName except EFI_NOT_FOUND -**/ -SHELL_STATUS -PrintAllShellEnvVars( - VOID - ) -{ - CONST CHAR16 *Value; - CONST CHAR16 *ConstEnvNameList; - - ConstEnvNameList = gEfiShellProtocol->GetEnv(NULL); - if (ConstEnvNameList == NULL) { - return (SHELL_SUCCESS); - } - while (*ConstEnvNameList != CHAR_NULL){ - Value = gEfiShellProtocol->GetEnv(ConstEnvNameList); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, ConstEnvNameList, Value); - ConstEnvNameList += StrLen(ConstEnvNameList)+1; - } - - return (SHELL_SUCCESS); -} - -STATIC CONST SHELL_PARAM_ITEM SetParamList[] = { - {L"-d", TypeValue}, - {L"-v", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'set' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSet ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CONST CHAR16 *KeyName; - CONST CHAR16 *Value; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // Make sure globals are good... - // - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (SetParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam); - FreePool(ProblemParam); - return (SHELL_INVALID_PARAMETER); - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 3) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 1) != NULL && ShellCommandLineGetFlag(Package, L"-d")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-d")) { - // - // delete a environment variable - // - KeyName = ShellCommandLineGetValue(Package, L"-d"); - if (KeyName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"set", L"-d"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Status = ShellSetEnvironmentVariable(KeyName, L"", ShellCommandLineGetFlag(Package, L"-v")); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ND), gShellLevel2HiiHandle, L"set", KeyName); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // print out all current environment variables - // - return(PrintAllShellEnvVars()); - } else { - // - // we are either printing one or assigning one - // - KeyName = ShellCommandLineGetRawValue(Package, 1); - Value = ShellCommandLineGetRawValue(Package, 2); - if (KeyName != NULL && Value != NULL) { - // - // assigning one - // - Status = ShellSetEnvironmentVariable(KeyName, Value, ShellCommandLineGetFlag(Package, L"-v")); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName); - ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); - } - - } else { - if (KeyName != NULL) { - // - // print out value for this one only. - // - Value = ShellGetEnvironmentVariable(KeyName); - if (Value == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_NF), gShellLevel2HiiHandle, L"set", KeyName); - ShellStatus = SHELL_SUCCESS; - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, KeyName, Value); - ShellStatus = SHELL_SUCCESS; - } - } else { - ASSERT(FALSE); - } - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c deleted file mode 100644 index ea51620..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c +++ /dev/null @@ -1,972 +0,0 @@ -/** @file - Main file for time, timezone, and date shell level 2 and shell level 3 functions. - - (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" - -/** - Determine if String is a valid representation for a time or date. - - @param[in] String The pointer to the string to test. - @param[in] Char The delimeter character. - @param[in] Min The minimum value allowed. - @param[in] Max The maximum value allowed. - @param[in] MinusOk Whether negative numbers are permitted. - - @retval TRUE String is a valid representation. - @retval FALSE String is invalid. -**/ -BOOLEAN -InternalIsTimeLikeString ( - IN CONST CHAR16 *String, - IN CONST CHAR16 Char, - IN CONST UINTN Min, - IN CONST UINTN Max, - IN CONST BOOLEAN MinusOk - ) -{ - UINTN Count; - Count = 0; - - if (MinusOk) { - // - // A single minus is ok. - // - if (*String == L'-') { - String++; - } - } - - // - // the first char must be numeric. - // - if (!ShellIsDecimalDigitCharacter(*String)) { - return (FALSE); - } - // - // loop through the characters and use the lib function - // - for ( ; String != NULL && *String != CHAR_NULL ; String++){ - if (*String == Char) { - Count++; - if (Count > Max) { - return (FALSE); - } - continue; - } - if (!ShellIsDecimalDigitCharacter(*String)) { - return (FALSE); - } - } - if (Count < Min) { - return (FALSE); - } - return (TRUE); -} - -/** - Verify that the DateString is valid and if so set that as the current - date. - - @param[in] DateString The pointer to a string representation of the date. - - @retval SHELL_INVALID_PARAMETER DateString was NULL. - @retval SHELL_INVALID_PARAMETER DateString was mis-formatted. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -CheckAndSetDate ( - IN CONST CHAR16 *DateString - ) -{ - EFI_TIME TheTime; - EFI_STATUS Status; - CHAR16 *DateStringCopy; - CHAR16 *Walker; - CHAR16 *Walker1; - - if (!InternalIsTimeLikeString(DateString, L'/', 2, 2, FALSE)) { - return (SHELL_INVALID_PARAMETER); - } - - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - DateStringCopy = NULL; - DateStringCopy = StrnCatGrow(&DateStringCopy, NULL, DateString, 0); - if (DateStringCopy == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - Walker = DateStringCopy; - - TheTime.Month = 0xFF; - TheTime.Day = 0xFF; - TheTime.Year = 0xFFFF; - - Walker1 = StrStr(Walker, L"/"); - if (Walker1 != NULL && *Walker1 == L'/') { - *Walker1 = CHAR_NULL; - } - - TheTime.Month = (UINT8)ShellStrToUintn (Walker); - if (Walker1 != NULL) { - Walker = Walker1 + 1; - } - Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL; - if (Walker1 != NULL && *Walker1 == L'/') { - *Walker1 = CHAR_NULL; - } - if (Walker != NULL && Walker[0] != CHAR_NULL) { - TheTime.Day = (UINT8)ShellStrToUintn (Walker); - if (Walker1 != NULL) { - Walker = Walker1 + 1; - } - Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL; - if (Walker1 != NULL && *Walker1 == L'/') { - *Walker1 = CHAR_NULL; - } - if (Walker != NULL && Walker[0] != CHAR_NULL) { - TheTime.Year = (UINT16)ShellStrToUintn (Walker); - } - } - - if (TheTime.Year < 100) { - if (TheTime.Year >= 98) { - TheTime.Year = (UINT16)(1900 + TheTime.Year); - } else { - TheTime.Year = (UINT16)(2000 + TheTime.Year); - } - } - - Status = gRT->SetTime(&TheTime); - - if (!EFI_ERROR(Status)){ - return (SHELL_SUCCESS); - } - return (SHELL_INVALID_PARAMETER); -} - -/** - Function for 'date' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDate ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - EFI_TIME TheTime; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Param1; - - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"date", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // If there are 0 value parameters, then print the current date - // else If there are any value paramerers, then print error - // - if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // get the current date - // - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - // - // ShellPrintEx the date in SFO or regular format - // - if (ShellCommandLineGetFlag(Package, L"-sfo")) { - // - // Match UEFI Shell spec: - // ShellCommand,"date" - // Date,"DD","MM","YYYY" - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"date"); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DATE_SFO_FORMAT), gShellLevel2HiiHandle, TheTime.Day, TheTime.Month, TheTime.Year); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DATE_FORMAT), gShellLevel2HiiHandle, TheTime.Month, TheTime.Day, TheTime.Year); - } - } else { - if (PcdGet8(PcdShellSupportLevel) == 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // perform level 3 operation here. - // - Param1 = ShellCommandLineGetRawValue(Package, 1); - if (Param1 == NULL) { - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellStatus = CheckAndSetDate(Param1); - } - if (ShellStatus != SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"date", Param1); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } - } - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} - -// -// Note "-tz" is invalid for this (non-interactive) version of 'time'. -// -STATIC CONST SHELL_PARAM_ITEM TimeParamList2[] = { - {L"-d", TypeValue}, - {NULL, TypeMax} - }; - -STATIC CONST SHELL_PARAM_ITEM TimeParamList3[] = { - {L"-d", TypeValue}, - {L"-tz", TypeValue}, - {NULL, TypeMax} - }; - -/** - Verify that the TimeString is valid and if so set that as the current - time. - - @param[in] TimeString The pointer to a string representation of the time. - @param[in] Tz The value to set for TimeZone. - @param[in] Daylight The value to set for Daylight. - - @retval SHELL_INVALID_PARAMETER TimeString was NULL. - @retval SHELL_INVALID_PARAMETER TimeString was mis-formatted. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -CheckAndSetTime ( - IN CONST CHAR16 *TimeString, - IN CONST INT16 Tz, - IN CONST UINT8 Daylight - ) -{ - EFI_TIME TheTime; - EFI_STATUS Status; - CHAR16 *TimeStringCopy; - CHAR16 *Walker1; - CHAR16 *Walker2; - - if (TimeString != NULL && !InternalIsTimeLikeString(TimeString, L':', 1, 2, FALSE)) { - return (SHELL_INVALID_PARAMETER); - } - if (Daylight != 0xFF &&((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) { - return (SHELL_INVALID_PARAMETER); - } - - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - if (TimeString != NULL) { - TimeStringCopy = NULL; - TimeStringCopy = StrnCatGrow(&TimeStringCopy, NULL, TimeString, 0); - Walker1 = TimeStringCopy; - TheTime.Hour = 0xFF; - TheTime.Minute = 0xFF; - - Walker2 = Walker1!=NULL?StrStr(Walker1, L":"):NULL; - if (Walker2 != NULL && *Walker2 == L':') { - *Walker2 = CHAR_NULL; - } - TheTime.Hour = (UINT8)ShellStrToUintn (Walker1); - if (Walker2 != NULL) { - Walker1 = Walker2 + 1; - } - Walker2 = Walker1!=NULL?StrStr(Walker1, L":"):NULL; - if (Walker2 != NULL && *Walker2 == L':') { - *Walker2 = CHAR_NULL; - TheTime.Second = (UINT8)0; - } - else if (Walker2 == NULL) { - TheTime.Second = (UINT8)0; - } - if (Walker1 != NULL && Walker1[0] != CHAR_NULL) { - TheTime.Minute = (UINT8)ShellStrToUintn (Walker1); - if (Walker2 != NULL) { - Walker1 = Walker2 + 1; - if (Walker1 != NULL && Walker1[0] != CHAR_NULL) { - TheTime.Second = (UINT8)ShellStrToUintn (Walker1); - } - } - } - SHELL_FREE_NON_NULL(TimeStringCopy); - } - - - if (Tz >= -1440 && Tz <= 1440) { - // - // EFI_TIME TimeZone is stored to meet the following calculation (see UEFI Spec): - // Localtime = UTC - TimeZone - // This means the sign must be changed for the user provided Tz. - // EX: User wants to set TimeZone to Pacific Standard Time, so runs - // time -tz -480 # set to UTC-08:00 - // To meet the calculation, the sign must be changed. - // - TheTime.TimeZone = -Tz; - } else if (Tz == EFI_UNSPECIFIED_TIMEZONE) { - TheTime.TimeZone = Tz; - } - - if (Daylight != 0xFF) { - TheTime.Daylight = Daylight; - } - - Status = gRT->SetTime(&TheTime); - - if (!EFI_ERROR(Status)){ - return (SHELL_SUCCESS); - } - - return (SHELL_INVALID_PARAMETER); -} - -/** - Function for 'time' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTime ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - EFI_TIME TheTime; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - INT16 Tz; - UINT8 Daylight; - CONST CHAR16 *TempLocation; - UINTN TzMinutes; - - // - // Initialize variables - // - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - if (PcdGet8(PcdShellSupportLevel) == 2) { - Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE); - } else { - ASSERT(PcdGet8(PcdShellSupportLevel) == 3); - Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE); - } - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // If there are no parameters, then print the current time - // - if (ShellCommandLineGetRawValue(Package, 1) == NULL - && !ShellCommandLineGetFlag(Package, L"-d") - && !ShellCommandLineGetFlag(Package, L"-tz")) { - // - // ShellPrintEx the current time - // - if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { - TzMinutes = 0; - } else { - TzMinutes = (ABS(TheTime.TimeZone)) % 60; - } - - if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_TIME_FORMAT), - gShellLevel2HiiHandle, - TheTime.Hour, - TheTime.Minute, - TheTime.Second, - (TheTime.TimeZone > 0?L"-":L"+"), - ((ABS(TheTime.TimeZone)) / 60), - TzMinutes - ); - } else { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_TIME_FORMAT_LOCAL), - gShellLevel2HiiHandle, - TheTime.Hour, - TheTime.Minute, - TheTime.Second - ); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); - } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) { - if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_TIME_FORMAT_LOCAL), - gShellLevel2HiiHandle, - TheTime.Hour, - TheTime.Minute, - TheTime.Second - ); - } else { - TzMinutes = (ABS(TheTime.TimeZone)) % 60; - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_TIME_FORMAT), - gShellLevel2HiiHandle, - TheTime.Hour, - TheTime.Minute, - TheTime.Second, - (TheTime.TimeZone > 0?L"-":L"+"), - ((ABS(TheTime.TimeZone)) / 60), - TzMinutes - ); - } - switch (TheTime.Daylight) { - case 0: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST0), gShellLevel2HiiHandle); - break; - case EFI_TIME_ADJUST_DAYLIGHT: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST1), gShellLevel2HiiHandle); - break; - case EFI_TIME_IN_DAYLIGHT: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST2), gShellLevel2HiiHandle); - break; - case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST3), gShellLevel2HiiHandle); - break; - default: - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", L"TheTime.Daylight", TheTime.Daylight); - } - } else { - if (PcdGet8(PcdShellSupportLevel) == 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // perform level 3 operation here. - // - if ((TempLocation = ShellCommandLineGetValue(Package, L"-tz")) != NULL) { - if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16 *)TempLocation, L"_local") == 0) { - Tz = EFI_UNSPECIFIED_TIMEZONE; - } else if (TempLocation[0] == L'-') { - - Tz = (INT16) ShellStrToUintn (++TempLocation); - // - // When the argument of "time [-tz tz]" is not numeric, ShellStrToUintn() returns "-1". - // Here we can detect the argument error by checking the return of ShellStrToUintn(). - // - if (Tz == -1) { - Tz = 1441; //make it to be out of bounds value - } else { - Tz *= (-1); //sign convert - } - } else { - if (TempLocation[0] == L'+') { - Tz = (INT16)ShellStrToUintn (++TempLocation); - } else { - Tz = (INT16)ShellStrToUintn (TempLocation); - } - // - // Detect the return of ShellStrToUintn() to make sure the argument is valid. - // - if (Tz == -1) { - Tz = 1441; //make it to be out of bounds value - } - } - if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-tz"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - // - // intentionally out of bounds value will prevent changing it... - // - Tz = 1441; - } - TempLocation = ShellCommandLineGetValue(Package, L"-d"); - if (TempLocation != NULL) { - Daylight = (UINT8)ShellStrToUintn(TempLocation); - // - // The argument of "time [-d dl]" is unsigned, if the first character is '-', - // the argument is incorrect. That's because ShellStrToUintn() will skip past - // any '-' sign and convert what's next, forgetting the sign is here. - // - if (TempLocation[0] == '-') { - Daylight = 0xff; //make it invalid = will not use - } - if (Daylight != 0 && Daylight != 1 && Daylight != 3) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-d"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else { - // - // invalid = will not use - // - Daylight = 0xFF; - } - if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = CheckAndSetTime(ShellCommandLineGetRawValue(Package, 1), Tz, Daylight); - if (ShellStatus != SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"time", ShellCommandLineGetRawValue(Package, 1)); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} - -typedef struct { - INT16 TimeZone; - EFI_STRING_ID StringId; -} TIME_ZONE_ITEM; - -STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList2[] = { - {L"-l", TypeFlag}, - {L"-f", TypeFlag}, - {NULL, TypeMax} - }; -STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList3[] = { - {L"-l", TypeFlag}, - {L"-f", TypeFlag}, - {L"-s", TypeTimeValue}, - {NULL, TypeMax} - }; - - STATIC CONST TIME_ZONE_ITEM TimeZoneList[] = { - {720, STRING_TOKEN (STR_TIMEZONE_M12)}, - {660, STRING_TOKEN (STR_TIMEZONE_M11)}, - {600, STRING_TOKEN (STR_TIMEZONE_M10)}, - {540, STRING_TOKEN (STR_TIMEZONE_M9)}, - {480, STRING_TOKEN (STR_TIMEZONE_M8)}, - {420, STRING_TOKEN (STR_TIMEZONE_M7)}, - {360, STRING_TOKEN (STR_TIMEZONE_M6)}, - {300, STRING_TOKEN (STR_TIMEZONE_M5)}, - {270, STRING_TOKEN (STR_TIMEZONE_M430)}, - {240, STRING_TOKEN (STR_TIMEZONE_M4)}, - {210, STRING_TOKEN (STR_TIMEZONE_M330)}, - {180, STRING_TOKEN (STR_TIMEZONE_M3)}, - {120, STRING_TOKEN (STR_TIMEZONE_M2)}, - {60 , STRING_TOKEN (STR_TIMEZONE_M1)}, - {0 , STRING_TOKEN (STR_TIMEZONE_0)}, - {-60 , STRING_TOKEN (STR_TIMEZONE_P1)}, - {-120 , STRING_TOKEN (STR_TIMEZONE_P2)}, - {-180 , STRING_TOKEN (STR_TIMEZONE_P3)}, - {-210 , STRING_TOKEN (STR_TIMEZONE_P330)}, - {-240 , STRING_TOKEN (STR_TIMEZONE_P4)}, - {-270 , STRING_TOKEN (STR_TIMEZONE_P430)}, - {-300 , STRING_TOKEN (STR_TIMEZONE_P5)}, - {-330 , STRING_TOKEN (STR_TIMEZONE_P530)}, - {-345 , STRING_TOKEN (STR_TIMEZONE_P545)}, - {-360 , STRING_TOKEN (STR_TIMEZONE_P6)}, - {-390 , STRING_TOKEN (STR_TIMEZONE_P630)}, - {-420 , STRING_TOKEN (STR_TIMEZONE_P7)}, - {-480 , STRING_TOKEN (STR_TIMEZONE_P8)}, - {-540 , STRING_TOKEN (STR_TIMEZONE_P9)}, - {-570 , STRING_TOKEN (STR_TIMEZONE_P930)}, - {-600 , STRING_TOKEN (STR_TIMEZONE_P10)}, - {-660 , STRING_TOKEN (STR_TIMEZONE_P11)}, - {-720 , STRING_TOKEN (STR_TIMEZONE_P12)}, - {-780 , STRING_TOKEN (STR_TIMEZONE_P13)}, - {-840 , STRING_TOKEN (STR_TIMEZONE_P14)}, - {EFI_UNSPECIFIED_TIMEZONE, STRING_TOKEN (STR_TIMEZONE_LOCAL)} -}; - -/** - Verify that the TimeZoneString is valid and if so set that as the current - timezone. - - @param[in] TimeZoneString The pointer to a string representation of the timezone. - - @retval SHELL_INVALID_PARAMETER TimeZoneString was NULL. - @retval SHELL_INVALID_PARAMETER TimeZoneString was mis-formatted. - @retval SHELL_SUCCESS The operation was successful. -**/ -SHELL_STATUS -CheckAndSetTimeZone ( - IN CONST CHAR16 *TimeZoneString - ) -{ - EFI_TIME TheTime; - EFI_STATUS Status; - CHAR16 *TimeZoneCopy; - CHAR16 *Walker; - CHAR16 *Walker2; - UINTN LoopVar; - - if (TimeZoneString == NULL) { - return (SHELL_INVALID_PARAMETER); - } - - if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16 *)TimeZoneString, L"_local") == 0) { - Status = gRT->GetTime (&TheTime, NULL); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; - Status = gRT->SetTime (&TheTime); - if (!EFI_ERROR(Status)){ - return (SHELL_SUCCESS); - } - return (SHELL_INVALID_PARAMETER); - } - if (TimeZoneString != NULL && !InternalIsTimeLikeString(TimeZoneString, L':', 1, 1, TRUE)) { - return (SHELL_INVALID_PARAMETER); - } - - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - TimeZoneCopy = NULL; - TimeZoneCopy = StrnCatGrow(&TimeZoneCopy, NULL, TimeZoneString, 0); - if (TimeZoneCopy == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - Walker = TimeZoneCopy; - Walker2 = StrStr(Walker, L":"); - if (Walker2 != NULL && *Walker2 == L':') { - *Walker2 = CHAR_NULL; - } - if (*Walker == L'-') { - TheTime.TimeZone = (INT16)((ShellStrToUintn (++Walker)) * 60); - } else { - TheTime.TimeZone = (INT16)((INT16)(ShellStrToUintn (Walker)) * -60); - } - if (Walker2 != NULL) { - Walker = Walker2 + 1; - } - if (Walker != NULL && Walker[0] != CHAR_NULL) { - if (TheTime.TimeZone < 0) { - TheTime.TimeZone = (INT16)(TheTime.TimeZone - (UINT8)ShellStrToUintn (Walker)); - } else { - TheTime.TimeZone = (INT16)(TheTime.TimeZone + (UINT8)ShellStrToUintn (Walker)); - } - } - - Status = EFI_INVALID_PARAMETER; - - for ( LoopVar = 0 - ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) - ; LoopVar++ - ){ - if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) { - Status = gRT->SetTime(&TheTime); - break; - } - } - - FreePool(TimeZoneCopy); - - if (!EFI_ERROR(Status)){ - return (SHELL_SUCCESS); - } - return (SHELL_INVALID_PARAMETER); -} - - -/** - Function for 'timezone' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTimeZone ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // non interactive - // - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT8 LoopVar; - EFI_TIME TheTime; - BOOLEAN Found; - UINTN TzMinutes; - - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - if (PcdGet8(PcdShellSupportLevel) == 2) { - Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE); - } else { - ASSERT(PcdGet8(PcdShellSupportLevel) == 3); - Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE); - } - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"timezone", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetCount(Package) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"timezone"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetFlag(Package, L"-s")) { - if ((ShellCommandLineGetFlag(Package, L"-l")) || (ShellCommandLineGetFlag(Package, L"-f"))) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", L"-l or -f"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(PcdGet8(PcdShellSupportLevel) == 3); - if (ShellCommandLineGetValue(Package, L"-s") == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"timezone", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Set the time zone - // - ShellStatus = CheckAndSetTimeZone(ShellCommandLineGetValue(Package, L"-s")); - if (ShellStatus != SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", ShellCommandLineGetValue(Package, L"-s")); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - } - } else if (ShellCommandLineGetFlag(Package, L"-l")) { - // - // Print a list of all time zones - // - for ( LoopVar = 0 - ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) - ; LoopVar++ - ){ - ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); - } - } else { - // - // Get Current Time Zone Info - // - Status = gRT->GetTime(&TheTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { - Found = FALSE; - for ( LoopVar = 0 - ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) - ; LoopVar++ - ){ - if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) { - if (ShellCommandLineGetFlag(Package, L"-f")) { - // - // Print all info about current time zone - // - ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); - } else { - // - // Print basic info only - // - TzMinutes = (ABS(TheTime.TimeZone)) % 60; - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN(STR_TIMEZONE_SIMPLE), - gShellLevel2HiiHandle, - (TheTime.TimeZone > 0?L"-":L"+"), - (ABS(TheTime.TimeZone)) / 60, - TzMinutes); - } - Found = TRUE; - break; - } - } - if (!Found) { - // - // Print basic info only - // - TzMinutes = (ABS(TheTime.TimeZone)) % 60; - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN(STR_TIMEZONE_SIMPLE), - gShellLevel2HiiHandle, - (TheTime.TimeZone > 0?L"-":L"+"), - (ABS(TheTime.TimeZone)) / 60, - TzMinutes); - - if (ShellCommandLineGetFlag(Package, L"-f")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle); - } - } - } else { - // - // TimeZone was EFI_UNSPECIFIED_TIMEZONE (local) from GetTime() - // - if (ShellCommandLineGetFlag (Package, L"-f")) { - for ( LoopVar = 0 - ; LoopVar < ARRAY_SIZE (TimeZoneList) - ; LoopVar++ - ){ - if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) { - // - // Print all info about current time zone - // - ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); - break; - } - } - } else { - // - // Print basic info only - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIMEZONE_SIMPLE_LOCAL), gShellLevel2HiiHandle); - } - } - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c deleted file mode 100644 index adecb5f..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c +++ /dev/null @@ -1,350 +0,0 @@ -/** @file - Main file for NULL named library for level 2 shell command functions. - - these functions are: - attrib, - cd, - cp, - date*, - time*, - load, - ls, - map, - mkdir, - mv, - parse, - rm, - reset, - set, - timezone*, - vol - - * functions are non-interactive only - - Copyright (c) 2014 Hewlett-Packard Development Company, L.P. - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "UefiShellLevel2CommandsLib.h" - -CONST CHAR16 mFileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel2HiiHandle = NULL; - -/** - Get the filename to get help text from if not using HII. - - @retval The filename. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameLevel2 ( - VOID - ) -{ - return (mFileName); -} - -/** - Constructor for the Shell Level 2 Commands library. - - Install the handlers for level 2 UEFI Shell 2.0 commands. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellLevel2CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - // - // if shell level is less than 2 do nothing - // - if (PcdGet8(PcdShellSupportLevel) < 2) { - return (EFI_SUCCESS); - } - - gShellLevel2HiiHandle = HiiAddPackages (&gShellLevel2HiiGuid, gImageHandle, UefiShellLevel2CommandsLibStrings, NULL); - if (gShellLevel2HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handlers that are always installed - // - ShellCommandRegisterCommandName(L"attrib", ShellCommandRunAttrib , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_ATTRIB) ); - ShellCommandRegisterCommandName(L"cd", ShellCommandRunCd , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_CD) ); - ShellCommandRegisterCommandName(L"cp", ShellCommandRunCp , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_CP) ); - ShellCommandRegisterCommandName(L"load", ShellCommandRunLoad , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD) ); - ShellCommandRegisterCommandName(L"map", ShellCommandRunMap , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MAP) ); - ShellCommandRegisterCommandName(L"mkdir", ShellCommandRunMkDir , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MKDIR) ); - ShellCommandRegisterCommandName(L"mv", ShellCommandRunMv , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MV) ); - ShellCommandRegisterCommandName(L"parse", ShellCommandRunParse , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_PARSE) ); - ShellCommandRegisterCommandName(L"reset", ShellCommandRunReset , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RESET) ); - ShellCommandRegisterCommandName(L"set", ShellCommandRunSet , ShellCommandGetManFileNameLevel2, 2, L"",FALSE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET) ); - ShellCommandRegisterCommandName(L"ls", ShellCommandRunLs , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LS) ); - ShellCommandRegisterCommandName(L"rm", ShellCommandRunRm , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RM) ); - ShellCommandRegisterCommandName(L"vol", ShellCommandRunVol , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_VOL) ); - - // - // support for permanent (built in) aliases - // - ShellCommandRegisterAlias(L"rm", L"del"); - ShellCommandRegisterAlias(L"ls", L"dir"); - ShellCommandRegisterAlias(L"cp", L"copy"); - ShellCommandRegisterAlias(L"mkdir", L"md"); - ShellCommandRegisterAlias(L"cd ..", L"cd.."); - ShellCommandRegisterAlias(L"cd \\", L"cd\\"); - ShellCommandRegisterAlias(L"mv", L"ren"); - ShellCommandRegisterAlias(L"mv", L"move"); - ShellCommandRegisterAlias(L"map", L"mount"); - // - // These are installed in level 2 or 3... - // - if (PcdGet8(PcdShellSupportLevel) == 2 || PcdGet8(PcdShellSupportLevel) == 3) { - ShellCommandRegisterCommandName(L"date", ShellCommandRunDate , ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_DATE) ); - ShellCommandRegisterCommandName(L"time", ShellCommandRunTime , ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIME) ); - ShellCommandRegisterCommandName(L"timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIMEZONE)); - } else { - DEBUG_CODE_BEGIN(); - // - // we want to be able to test these so install them under a different name in debug mode... - // - ShellCommandRegisterCommandName(L"l2date", ShellCommandRunDate , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_DATE) ); - ShellCommandRegisterCommandName(L"l2time", ShellCommandRunTime , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIME) ); - ShellCommandRegisterCommandName(L"l2timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIMEZONE)); - DEBUG_CODE_END(); - } - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS Always returned. -**/ -EFI_STATUS -EFIAPI -ShellLevel2CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellLevel2HiiHandle != NULL) { - HiiRemovePackages(gShellLevel2HiiHandle); - } - return (EFI_SUCCESS); -} - -/** - returns a fully qualified directory (contains a map drive at the begining) - path from a unknown directory path. - - If Path is already fully qualified this will return a duplicat otherwise this - will use get the current directory and use that to build the fully qualified - version. - - if the return value is not NULL it must be caller freed. - - @param[in] Path The unknown Path Value - - @retval NULL A memory allocation failed - @retval NULL A fully qualified path could not be discovered. - @retval other An allocated pointer to a fuly qualified path. -**/ -CHAR16* -GetFullyQualifiedPath( - IN CONST CHAR16* Path - ) -{ - CHAR16 *PathToReturn; - UINTN Size; - CONST CHAR16 *CurDir; - - PathToReturn = NULL; - Size = 0; - - ASSERT((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL)); - // - // convert a local path to an absolute path - // - if (StrStr(Path, L":") == NULL) { - CurDir = gEfiShellProtocol->GetCurDir(NULL); - StrnCatGrow(&PathToReturn, &Size, CurDir, 0); - StrnCatGrow(&PathToReturn, &Size, L"\\", 0); - if (*Path == L'\\') { - Path++; - } - } - StrnCatGrow(&PathToReturn, &Size, Path, 0); - - PathCleanUpDirectories(PathToReturn); - - if (PathToReturn == NULL) { - return NULL; - } - - while (PathToReturn[StrLen(PathToReturn)-1] == L'*') { - PathToReturn[StrLen(PathToReturn)-1] = CHAR_NULL; - } - - return (PathToReturn); -} - -/** - Function to verify all intermediate directories in the path. - - @param[in] Path The pointer to the path to fix. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -VerifyIntermediateDirectories ( - IN CONST CHAR16 *Path - ) -{ - EFI_STATUS Status; - CHAR16 *PathCopy; - CHAR16 *TempSpot; - SHELL_FILE_HANDLE FileHandle; - - ASSERT(Path != NULL); - - Status = EFI_SUCCESS; - PathCopy = NULL; - PathCopy = StrnCatGrow(&PathCopy, NULL, Path, 0); - FileHandle = NULL; - - if (PathCopy == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - for (TempSpot = &PathCopy[StrLen(PathCopy)-1] ; *TempSpot != CHAR_NULL && *TempSpot != L'\\' ; TempSpot = &PathCopy[StrLen(PathCopy)-1]){ - *TempSpot = CHAR_NULL; - } - if (*TempSpot == L'\\') { - *TempSpot = CHAR_NULL; - } - - if (PathCopy != NULL && *PathCopy != CHAR_NULL) { - Status = VerifyIntermediateDirectories(PathCopy); - - if (PathCopy[StrLen(PathCopy)-1] != L':') { - if (!EFI_ERROR(Status)) { - Status = ShellOpenFileByName(PathCopy, &FileHandle, EFI_FILE_MODE_READ, 0); - if (FileHandle != NULL) { - ShellCloseFile(&FileHandle); - } - } - } - } - - SHELL_FREE_NON_NULL(PathCopy); - - return (Status); -} - -/** - String comparison without regard to case for a limited number of characters. - - @param[in] Source The first item to compare. - @param[in] Target The second item to compare. - @param[in] Count How many characters to compare. - - @retval 0 Source and Target are identical strings without regard to case. - @retval !=0 Source is not identical to Target. - -**/ -INTN -StrniCmp( - IN CONST CHAR16 *Source, - IN CONST CHAR16 *Target, - IN CONST UINTN Count - ) -{ - CHAR16 *SourceCopy; - CHAR16 *TargetCopy; - UINTN SourceLength; - UINTN TargetLength; - INTN Result; - - if (Count == 0) { - return 0; - } - - SourceLength = StrLen (Source); - TargetLength = StrLen (Target); - SourceLength = MIN (SourceLength, Count); - TargetLength = MIN (TargetLength, Count); - SourceCopy = AllocateCopyPool ((SourceLength + 1) * sizeof (CHAR16), Source); - if (SourceCopy == NULL) { - return -1; - } - TargetCopy = AllocateCopyPool ((TargetLength + 1) * sizeof (CHAR16), Target); - if (TargetCopy == NULL) { - FreePool (SourceCopy); - return -1; - } - - SourceCopy[SourceLength] = L'\0'; - TargetCopy[TargetLength] = L'\0'; - Result = gUnicodeCollation->StriColl (gUnicodeCollation, SourceCopy, TargetCopy); - FreePool (SourceCopy); - FreePool (TargetCopy); - return Result; -} - - -/** - Cleans off all the quotes in the string. - - @param[in] OriginalString pointer to the string to be cleaned. - @param[out] CleanString The new string with all quotes removed. - Memory allocated in the function and free - by caller. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ShellLevel2StripQuotes ( - IN CONST CHAR16 *OriginalString, - OUT CHAR16 **CleanString - ) -{ - CHAR16 *Walker; - - if (OriginalString == NULL || CleanString == NULL) { - return EFI_INVALID_PARAMETER; - } - - *CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString); - if (*CleanString == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { - if (*Walker == L'\"') { - CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); - } - } - - return EFI_SUCCESS; -} - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h deleted file mode 100644 index f1e5b99..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h +++ /dev/null @@ -1,369 +0,0 @@ -/** @file - Main file for NULL named library for level 2 shell command functions. - - these functions are: - attrib, cd, cp, date*, time*, rm, reset, - load, ls, map, mkdir, mv, parse, set, timezone* - - - * functions are non-interactive only - - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_ -#define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern CONST CHAR16 mFileName[]; -extern EFI_HANDLE gShellLevel2HiiHandle; - -/** - Function for 'attrib' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAttrib ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'date' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunDate ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'time' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTime ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'load' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLoad ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'ls' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunLs ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'map' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMap ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'reset' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunReset ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'timezone' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTimeZone ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'set' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunSet ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'mkdir' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMkDir ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'cd' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCd ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'cp' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'parse' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunParse ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'rm' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunRm ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'mv' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunMv ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - returns a fully qualified directory (contains a map drive at the begining) - path from a unknown directory path. - - If Path is already fully qualified this will return a duplicat otherwise this - will use get the current directory and use that to build the fully qualified - version. - - if the return value is not NULL it must be caller freed. - - @param[in] Path The unknown Path Value - - @retval NULL A memory allocation failed - @retval NULL a fully qualified path could not be discovered. - @retval other pointer to a fuly qualified path. -**/ -CHAR16* -GetFullyQualifiedPath( - IN CONST CHAR16* Path - ); - -/** - Function to verify all intermediate directories in the path. - - @param[in] Path The pointer to the path to fix. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -VerifyIntermediateDirectories ( - IN CONST CHAR16 *Path - ); - -/** - String comparison without regard to case for a limited number of characters. - - @param[in] Source The first item to compare. - @param[in] Target The second item to compare. - @param[in] Count How many characters to compare. - - @retval 0 Source and Target are identical strings without regard to case. - @retval !=0 Source is not identical to Target. - -**/ -INTN -StrniCmp( - IN CONST CHAR16 *Source, - IN CONST CHAR16 *Target, - IN CONST UINTN Count - ); - -/** - Cleans off all the quotes in the string. - - @param[in] OriginalString pointer to the string to be cleaned. - @param[out] CleanString The new string with all quotes removed. - Memory allocated in the function and free - by caller. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -ShellLevel2StripQuotes ( - IN CONST CHAR16 *OriginalString, - OUT CHAR16 **CleanString - ); - -/** - Function for 'Vol' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunVol ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function to Copy one file to another location - - If the destination exists the user will be prompted and the result put into *resp - - @param[in] Source pointer to source file name - @param[in] Dest pointer to destination file name - @param[out] Resp pointer to response from question. Pass back on looped calling - @param[in] SilentMode whether to run in quiet mode or not - @param[in] CmdName Source command name requesting single file copy - - @retval SHELL_SUCCESS The source file was copied to the destination -**/ -SHELL_STATUS -CopySingleFile( - IN CONST CHAR16 *Source, - IN CONST CHAR16 *Dest, - OUT VOID **Resp, - IN BOOLEAN SilentMode, - IN CONST CHAR16 *CmdName - ); - -/** - Delete a node and all nodes under it (including sub directories). - - @param[in] Node The node to start deleting with. - @param[in] Quiet TRUE to print no messages. - - @retval SHELL_SUCCESS The operation was successful. - @retval SHELL_ACCESS_DENIED A file was read only. - @retval SHELL_ABORTED The abort message was received. - @retval SHELL_DEVICE_ERROR A device error occured reading this Node. -**/ -SHELL_STATUS -CascadeDelete( - IN EFI_SHELL_FILE_INFO *Node, - IN CONST BOOLEAN Quiet - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf deleted file mode 100644 index 8391601..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf +++ /dev/null @@ -1,84 +0,0 @@ -## @file -# Provides shell level 2 functions -# -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellLevel2CommandsLib - FILE_GUID = CBF3931C-A2DF-40e5-B77E-CCA9555E9755 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellLevel2CommandsLibConstructor - DESTRUCTOR = ShellLevel2CommandsLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiShellLevel2CommandsLib.c - UefiShellLevel2CommandsLib.h - UefiShellLevel2CommandsLib.uni - TimeDate.c - Load.c - Ls.c - Map.c - Reset.c - Set.c - MkDir.c - Cd.c - Cp.c - Parse.c - Rm.c - Mv.c - Attrib.c - Vol.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - HandleParsingLib - DevicePathLib - -[Protocols] - gEfiUnicodeCollation2ProtocolGuid ## CONSUMES - gEfiShellProtocolGuid ## CONSUMES - gEfiShellParametersProtocolGuid ## CONSUMES - gEfiDevicePathProtocolGuid ## CONSUMES - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## CONSUMES - -[Guids] - gEfiFileSystemInfoGuid ## SOMETIMES_CONSUMES ## GUID - gEfiFileInfoGuid ## UNDEFINED - gShellLevel2HiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni deleted file mode 100644 index 65e1d38..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni +++ /dev/null @@ -1,1085 +0,0 @@ -// /** -// -// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellLevel2CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 level 2 commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_NO_MEM #language en-US "%H%s%N: Memory is not available.\r\n" -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments.\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments.\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n" -#string STR_GEN_ATTRIBUTE #language en-US "%H%s%N: Invalid argument - '%H-a%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_ERR_AD #language en-US "%H%s%N: Access denied.\r\n" -#string STR_GEN_ERR_FILE #language en-US "%H%s%N: File '%H%s%N' error - %r\r\n" -#string STR_GEN_ERR_UK #language en-US "%H%s%N: Status: %r\r\n" -#string STR_GEN_PARAM_CON #language en-US "%H%s%N: Parameters conflict.\r\n" -#string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags conflict with - '%H%s%N' and '%H%s%N'\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_FILE_CLOSE_FAIL #language en-US "%H%s%N: Cannot close file - '%H%s%N'\r\n" -#string STR_GEN_FILE_AD #language en-US "%H%s%N: File access error - '%H%s%N'\r\n" -#string STR_GEN_FILE_NF #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_GEN_CRLF #language en-US "\r\n" -#string STR_GEN_NO_CWD #language en-US "%H%s%N: Current directory not specified.\r\n" -#string STR_GEN_NO_FILES #language en-US "%H%s%N: No matching files were found.\r\n" -#string STR_GEN_DIR_NF #language en-US "%H%s%N: Directory not found - '%H%s%N'\r\n" -#string STR_GEN_RES_OK #language en-US "- [ok]\r\n" -#string STR_GEN_NOT_DIR #language en-US "%H%s%N: '%H%s%N' is not a directory.\r\n" -#string STR_GEN_NOT_FILE #language en-US "%H%s%N: '%H%s%N' is not a file.\r\n" -#string STR_GEN_SFO_HEADER #language en-US "ShellCommand,"%s"\r\n" -#string STR_GEN_MARG_ERROR #language en-US "%H%s%N: The destination '%H%s%N' is ambiguous.\r\n" -#string STR_GEN_FILE_ERROR #language en-US "%H%s%N: The destination is an existing file '%H%s%N'.\r\n" -#string STR_GEN_UEFI_FUNC_ERROR #language en-US "%H%s%N: UEFI function '%H%s%N' returned an incorrect value for: %s (%x).\r\n" -#string STR_GEN_UEFI_FUNC_WARN #language en-US "%H%s%N: UEFI function '%H%s%N' returned: %r\r\n" -#string STR_GEN_DEST_EXIST_OVR #language en-US "Destination file already exists. Overwrite? %BY%Nes, %BN%No, %BA%Nll, %BC%Nancel " -#string STR_GEN_CPY_FAIL #language en-US "%H%s%N: Copy failure: insufficient capacity on destination media.\r\n" -#string STR_GEN_CPY_READ_ERROR #language en-US "%H%s%N: reading '%B%s%N': IO Error \r\n" -#string STR_GEN_CPY_WRITE_ERROR #language en-US "%H%s%N: writing '%B%s%N': IO Error \r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful.\r\n" - -#string STR_SET_DISP #language en-US "%V%8s %N= %H%s%N\r\n" -#string STR_SET_NF #language en-US "%H%s%N: Environment Variable '%H%s%N' not defined.\r\n" -#string STR_SET_ND #language en-US "%H%s%N: Environment Variable '%H%s%N' could not be deleted.\r\n" -#string STR_SET_ERROR_SET #language en-US "%H%s%N: Unable to set %H%s%N\r\n" - -#string STR_CD_PRINT #language en-US "%s\r\n" -#string STR_CD_NF #language en-US "%H%s%N: No mapping found.\r\n" - -#string STR_MAP_NF #language en-US "%H%s%N: Cannot find mapped device - '%H%s%N'\r\n" -#string STR_MAP_NOF #language en-US "%H%s%N: No mappable target found - '%H%s%N'\r\n" -#string STR_MAP_SFO_MAPPINGS #language en-US "Mappings,"%s","%s","%s"\r\n" -#string STR_MAP_HEADER #language en-US "%EMapping table%N\r\n" -#string STR_MAP_ENTRY #language en-US "%E%10s%N %HAlias(s):%N%s\r\n %s\r\n" -#string STR_MAP_ENTRY_VERBOSE #language en-US " Handle: [%H%02x%N]\r\n" - " Media Type: %s\r\n" - " Removable: %s\r\n" - " Current Dir: %s\r\n" - -#string STR_ATTRIB_OUTPUT_LINE #language en-US "Attrib: %1c%1c%1c%1c%1c %s\r\n" - -#string STR_MAP_MEDIA_FLOPPY #language en-US "Floppy" -#string STR_MAP_MEDIA_UNKNOWN #language en-US "Unknown" -#string STR_MAP_MEDIA_HARDDISK #language en-US "HardDisk" -#string STR_MAP_MEDIA_CDROM #language en-US "CD-Rom" - -#string STR_MKDIR_ALREADY #language en-US "Directory '%B%s%N' already exists.\r\n" -#string STR_MKDIR_CREATEFAIL #language en-US "Directory '%B%s%N' unable to create.\r\n" - -#string STR_DATE_FORMAT #language en-US "%02d/%02d/%04d\r\n" -#string STR_DATE_SFO_FORMAT #language en-US "Date,"%02d","%02d","%04d"\r\n" - -#string STR_TIME_FORMAT #language en-US "%02d:%02d:%02d (UTC%1s%02d:%02d)" -#string STR_TIME_FORMAT_LOCAL #language en-US "%02d:%02d:%02d (LOCAL)" -#string STR_TIME_DST0 #language en-US " DST: Not Affected\r\n" -#string STR_TIME_DST1 #language en-US " DST: Affected\r\n" -#string STR_TIME_DST2 #language en-US " DST: Adjusted\r\n" -#string STR_TIME_DST3 #language en-US " DST: Affected and Adjusted\r\n" - -#string STR_TIMEZONE_M12 #language en-US "UTC-12:00, International Date Line West\r\n" -#string STR_TIMEZONE_M11 #language en-US "UTC-11:00, Midway Island, Samoa\r\n" -#string STR_TIMEZONE_M10 #language en-US "UTC-10:00, Hawaii\r\n" -#string STR_TIMEZONE_M9 #language en-US "UTC-09:00, Alaska\r\n" -#string STR_TIMEZONE_M8 #language en-US "UTC-08:00, Pacific Time(US & Canada), Tijuana, Portland\r\n" -#string STR_TIMEZONE_M7 #language en-US "UTC-07:00, Arizona, Chihuahua, La Paz, Mazatlan, Mountain Time (US & Canada)\r\n" -#string STR_TIMEZONE_M6 #language en-US "UTC-06:00, Central America, Central Time(US & Canada)\r\n" -#string STR_TIMEZONE_M5 #language en-US "UTC-05:00, Bogota, Lima, Quito, Eastern Time(US & Canada)\r\n" -#string STR_TIMEZONE_M430 #language en-US "UTC-04:30, Caracas\r\n" -#string STR_TIMEZONE_M4 #language en-US "UTC-04:00, Atlantic Time(Canada), Caracas, Santiago\r\n" -#string STR_TIMEZONE_M330 #language en-US "UTC-03:30, Newfoundland\r\n" -#string STR_TIMEZONE_M3 #language en-US "UTC-03:00, Brasilia, Buenos Aires, Georgetown, Greenland\r\n" -#string STR_TIMEZONE_M2 #language en-US "UTC-02:00, Mid-Atlantic\r\n" -#string STR_TIMEZONE_M1 #language en-US "UTC-01:00, Azores, Cape Verde Is.\r\n" -#string STR_TIMEZONE_0 #language en-US "UTC , Greenwich Mean Time, Casablanca, Monrovia, Dublin, London\r\n" -#string STR_TIMEZONE_P1 #language en-US "UTC+01:00, Amsterdam, Berlin, Bern, Rome, Paris, West Central Africa\r\n" -#string STR_TIMEZONE_P2 #language en-US "UTC+02:00, Athens, Istanbul, Bucharest, Cairo, Jerusalem\r\n" -#string STR_TIMEZONE_P3 #language en-US "UTC+03:00, Baghdad, Kuwait, Riyadh, Moscow, Nairobi\r\n" -#string STR_TIMEZONE_P330 #language en-US "UTC+03:30, Tehran\r\n" -#string STR_TIMEZONE_P4 #language en-US "UTC+04:00, Abu Dhabi, Muscat, Baku, Tbilisi, Yerevan\r\n" -#string STR_TIMEZONE_P430 #language en-US "UTC+04:30, Kabul\r\n" -#string STR_TIMEZONE_P5 #language en-US "UTC+05:00, Ekaterinburg, Islamabad, Karachi, Tashkent\r\n" -#string STR_TIMEZONE_P530 #language en-US "UTC+05:30, Chennai, Kolkata, Mumbai, New Delhi\r\n" -#string STR_TIMEZONE_P545 #language en-US "UTC+05:45, Kathmandu\r\n" -#string STR_TIMEZONE_P6 #language en-US "UTC+06:00, Almaty, Novosibirsk, Astana, Dhaka, Sri Jayawardenepura\r\n" -#string STR_TIMEZONE_P630 #language en-US "UTC+06:30, Rangoon\r\n" -#string STR_TIMEZONE_P7 #language en-US "UTC+07:00, Bangkok, Hanio, Jakarta, Krasnoyarsk\r\n" -#string STR_TIMEZONE_P8 #language en-US "UTC+08:00, Beijing, Chongqing, Hong Kong, Urumqi, Taipei, Perth\r\n" -#string STR_TIMEZONE_P9 #language en-US "UTC+09:00, Osaka, Sapporo, Tokyo, Seoul, Yakutsk\r\n" -#string STR_TIMEZONE_P930 #language en-US "UTC+09:30, Adelaide, Darwin\r\n" -#string STR_TIMEZONE_P10 #language en-US "UTC+10:00, Canberra, Melbourne, Sydney, Guam, Hobart, Vladivostok\r\n" -#string STR_TIMEZONE_P11 #language en-US "UTC+11:00, Magadan, Solomon Is., New Caledonia\r\n" -#string STR_TIMEZONE_P12 #language en-US "UTC+12:00, Auckland, Wellington, Fiji, Kamchatka, Marshall Is.\r\n" -#string STR_TIMEZONE_P13 #language en-US "UTC+13:00, Nuku'alofa\r\n" -#string STR_TIMEZONE_P14 #language en-US "UTC+14:00, Line Islands\r\n" -#string STR_TIMEZONE_LOCAL #language en-US "LOCAL , Local Time\r\n" -#string STR_TIMEZONE_SIMPLE #language en-US "UTC%1s%02d:%02d\r\n" -#string STR_TIMEZONE_SIMPLE_LOCAL #language en-US "LOCAL\r\n" -#string STR_TIMEZONE_NI #language en-US "No additional information known." - -#string STR_LOAD_NOT_IMAGE #language en-US "Image '%s' is not an image.\r\n" -#string STR_LOAD_NOT_DRIVER #language en-US "Image '%s' is not a driver.\r\n" -#string STR_LOAD_LOADED #language en-US "Image '%s' loaded at %x - %r\r\n" -#string STR_LOAD_ERROR #language en-US "Image '%s' error in StartImage: %r\r\n" - -#string STR_LS_LINE_START_ALL #language en-US "%t %5s %1c % ,L11d " -#string STR_LS_LINE_END_FILE #language en-US "%s\r\n" -#string STR_LS_LINE_END_EXE #language en-US "%V%s%N\r\n" -#string STR_LS_LINE_END_DIR #language en-US "%B%s%N\r\n" -#string STR_LS_FOOTER_LINE #language en-US "% ,L11d File(s) % ,L11d bytes\r\n% ,L11d Dir(s)\r\n" -#string STR_LS_HEADER_LINE1 #language en-US "Directory of: %H%s%N\r\n" -#string STR_LS_FILE_NOT_FOUND #language en-US "%H%s%N: File Not Found - '%H%s%N'\r\n" -#string STR_LS_SFO_VOLINFO #language en-US "VolumeInfo,"%s","%Ld","%5s","%Ld","%Ld"\r\n" -#string STR_LS_SFO_FILEINFO #language en-US "FileInfo,"%s","%Ld","%Ld","%s%s%s%s%s","%02d:%02d:%02d","%02d.%02d.%04d","%02d:%02d:%02d","%02d.%02d.%04d","%02d:%02d:%02d","%02d.%02d.%04d"\r\n" - -#string STR_VOL_VOLINFO #language en-US "Volume %s (%s)\r\n" - "%Ld bytes total disk space\r\n" - "%Ld bytes available on disk\r\n" - "%d bytes in each allocation unit\r\n" - -#string STR_RM_LOG_DELETE_CONF #language en-US "Remove Subtree '%B%s%N' [y/n]?" -#string STR_RM_LOG_DELETE #language en-US "Deleting '%B%s%N'\r\n" -#string STR_RM_LOG_DELETE_ERR #language en-US "Delete error: %r\r\n" -#string STR_RM_LOG_DELETE_ERR2 #language en-US "Delete error. Couldn't open file: %r\r\n" -#string STR_RM_LOG_DELETE_ERR3 #language en-US "Delete error. Invalid target '%B%s%N'\r\n" -#string STR_RM_LOG_DELETE_COMP #language en-US "Delete successful.\r\n" -#string STR_RM_LOG_DETELE_RO #language en-US "%H%s%N: '%H%s%N' is read-only\r\n" - -#string STR_MV_OUTPUT #language en-US "Moving %s -> %s\r\n" -#string STR_MV_INV_SUB #language en-US "Cannot move a directory into itself or its subdirectory.\r\n" -#string STR_MV_INV_RO #language en-US "Cannot move to or from a read-only file or directory '%B%s%N'\r\n" -#string STR_MV_INV_CWD #language en-US "Cannot move current working directory or its subdirectory.\r\n" - -#string STR_CP_OUTPUT #language en-US "Copying %s -> %s\r\n" -#string STR_CP_ERROR #language en-US "%H%s%N: Could not copy - '%H%s%N'\r\n" -#string STR_CP_DIR_REQ #language en-US "%H%s%N: Copying a directory requires -r.\r\n" -#string STR_CP_DIR_WNF #language en-US "%H%s%N: The specified path does not exist - '%H%s%N'\r\n" -#string STR_CP_SD_SAME #language en-US "%H%s%N: The source and destination are the same.\r\n" -#string STR_CP_SD_PARENT #language en-US "%H%s%N: The destination is a parent of the source.\r\n" -#string STR_CP_DEST_ERROR #language en-US "%H%s%N: The destination is read-only.\r\n" -#string STR_CP_DEST_OPEN_FAIL #language en-US "%H%s%N: The destination file '%B%s%N' failed to open with create.\r\n" -#string STR_CP_DEST_DIR_FAIL #language en-US "%H%s%N: The destination directory '%B%s%N' could not be created.\r\n" -#string STR_CP_SRC_OPEN_FAIL #language en-US "%H%s%N: The source file '%B%s%N' failed to open with read.\r\n" - -#string STR_GET_HELP_ATTRIB #language en-US "" -".TH attrib 0 "Displays or modifies the attributes of files or directories."\r\n" -".SH NAME\r\n" -"Displays or modifies the attributes of files or directories.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"ATTRIB [+a|-a] [+s|-s] [+h|-h] [+r|-r] [file...] [directory...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" +a|-a - Sets or clears the 'archive' attribute.\r\n" -" +s|-s - Sets or clears the 'system' attribute.\r\n" -" +h|-h - Sets or clears the 'hidden' attribute.\r\n" -" +r|-r - Sets or clears the 'read-only' attribute.\r\n" -" file - Specifies the file name (wild cards are permitted).\r\n" -" directory - Specifies the directory name (wildcards are permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. Four attribute types are supported in the UEFI file system:\r\n" -" - Archive [A]\r\n" -" - System [S]\r\n" -" - Hidden [H]\r\n" -" - Read only [R]\r\n" -" 2. If a file (in general meaning) is a directory, then it is also shown\r\n" -" to have the attribute [D].\r\n" -" 3. If any file in the file list that is specified \r\n" -" does not exist, attrib will continue processing the remaining files\r\n" -" while reporting the error.\r\n" -" 4. If no attributes parameters are specified, the current attributes of\r\n" -" the specified files or directories are displayed.\r\n" -" 5. If no files or directories are specified, the command applies to\r\n" -" all files and sub-directories within the current directory.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the attributes of a directory:\r\n" -" fs0:\> attrib fs0:\ \r\n" -" \r\n" -" * To display the attributes of all files and sub-directories in the current\r\n" -" directory:\r\n" -" fs0:\> attrib *\r\n" -" \r\n" -" * To add the system attribute to all files with extension '.efi':\r\n" -" fs0:\> attrib +s *.efi\r\n" -" \r\n" -" * To remove the read-only attribute from all files with extension '.inf':\r\n" -" fs0:\> attrib -r *.inf\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_NOT_FOUND The requested file was not found.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_WRITE_PROTECTED The media that the action was to take place on is\r\n" -" write-protected.\r\n" - -#string STR_GET_HELP_CD #language en-US "" -".TH cd 0 "Displays or changes the current directory."\r\n" -".SH NAME\r\n" -"Displays or changes the current directory.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"CD [path]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" path - Specifies the relative or absolute directory path.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command changes the current working directory that is used by the\r\n" -" UEFI Shell environment. If a file system mapping is specified, then the\r\n" -" current working directory is changed for that device. Otherwise, the\r\n" -" current working directory is changed for the current device.\r\n" -" 2. If path is not present, then the current working directory (including\r\n" -" file system mapping) is displayed to standard out.\r\n" -" 3. The table below describes the conventions that are used to refer to the\r\n" -" directory, its parent, and the root directory in the UEFI Shell\r\n" -" environment.\r\n" -" Convention Description\r\n" -" '.' Refers to the current directory.\r\n" -" '..' Refers to the directory's parent.\r\n" -" '\\\' Refers to the root of the current file system.\r\n" -" 4. The current working directory is maintained in the environment\r\n" -" variable %cwd%.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To change the current file system to the mapped fs0 file system:\r\n" -" Shell> fs0:\r\n" -" \r\n" -" * To change the current directory to subdirectory 'efi':\r\n" -" fs0:\> cd efi\r\n" -" \r\n" -" * To change the current directory to the parent directory (fs0:\):\r\n" -" fs0:\efi\> cd ..\r\n" -" \r\n" -" * To change the current directory to 'fs0:\efi\Tools':\r\n" -" fs0:\> cd efi\Tools\r\n" -" \r\n" -" * To change the current directory to the root of the current fs (fs0):\r\n" -" fs0:\efi\Tools\> cd \ \r\n" -" \r\n" -" * To move between volumes and maintain the current path, and then copy\r\n" -" all of files in fs0:\efi\Tools into the fs1:\Tmp directory:\r\n" -" fs0:\> cd \efi\Tools\r\n" -" fs0:\efi\Tools\> fs1:\r\n" -" fs1:\> cd Tmp\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_CP #language en-US "" -".TH cp 0 "Copies files or directories."\r\n" -".SH NAME\r\n" -"Copies one or more files or directories to another location.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"CP [-r] [-q] src [src...] [dst]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -r - Makes a recursive copy.\r\n" -" -q - Makes a quiet copy (without a prompt).\r\n" -" src - Specifies a source file/directory name (wildcards are permitted).\r\n" -" dst - Specifies a destination file/directory name (wildcards are not permitted). \r\n" -" If more than one directory is specified, the last directory is\r\n" -" assumed to be the destination.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. '-r' must be specified if src is a directory. If '-r' is specified,\r\n" -" the source directory is recursively copied to the destination.\r\n" -" 'src' itself is copied.\r\n" -" 2. If a destination is not specified, the current working directory is\r\n" -" assumed to be the destination.\r\n" -" 3. 'CP -r src1 src2 dst' copies all files and subdirectories in 'src1' and\r\n" -" 'src2' to the destination 'dst'. 'src1' and 'src2' themselves are also\r\n" -" copied. The 'dst' parameter is interpreted as a directory.\r\n" -" 4. Copying a directory or file to itself is not allowed.\r\n" -" 5. If an error occurs, this command exits immediately and the remaining files or\r\n" -" directories are not copied.\r\n" -" 6. When 'cp' is executed with a script file, it always performs quiet\r\n" -" copying, regardless of whether the '-q' option is specified.\r\n" -" 7. If you are copying multiple files, the destination must be an existing\r\n" -" directory.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the contents of the current directory:\r\n" -" fs0:\> ls\r\n" -" \r\n" -" * To copy a file in the same directory and change the file name:\r\n" -" fs0:\> cp temp.txt readme.txt\r\n" -" \r\n" -" * To copy multiple files to another directory:\r\n" -" fs0:\> cp temp.txt isaBus.efi \Test\r\n" -" \r\n" -" * To copy multiple directories recursively to another directory:\r\n" -" fs0:\> cp -r test1 test2 boot \Test\r\n" -" \r\n" -" * To see the results of the above operations:\r\n" -" fs0:\> ls \Test\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly \r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_OUT_OF_RESOURCES There was insufficient space to save the \r\n" -" requested file at the destination.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security \r\n" -" violation.\r\n" -" SHELL_WRITE_PROTECTED An attempt was made to create a file on media that\r\n" -" was write-protected.\r\n" - -#string STR_GET_HELP_MAP #language en-US "" -".TH map 0 "Displays or defines file system mappings"\r\n" -".SH NAME\r\n" -"Displays or defines file system mappings.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MAP [-d ]\r\n" -"MAP [[-r][-v][-c][-f][-u][-t ][sname]]\r\n" -"MAP [sname handle | mapping]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -d - Deletes a file system mapping.\r\n" -" -r - Resets file system mappings to default values.\r\n" -" -u - Adds file system mappings for newly-installed devices and\r\n" -" removes mappings for uninstalled devices. This does not change\r\n" -" the mappings of existing devices and preserves user-defined mappings.\r\n" -" -v - Displays verbose information about all file system mappings.\r\n" -" -c - Displays the consistent mappings.\r\n" -" -f - Displays the normal mappings (not the consistent mappings).\r\n" -" -t - Displays the device mappings, filtered according to the device type.\r\n" -" Supported types are:\r\n" -" fp - Floppy\r\n" -" hd - Hard Disk\r\n" -" cd - CD-ROM\r\n" -" Types can be combined by putting a comma between two types. Spaces\r\n" -" are not allowed between types.\r\n" -" -sfo - Displays information in Standard-Format Output.\r\n" -" sname - Specifies a mapping name.\r\n" -" handle - Specifies the number of a handle. Use the same value that is\r\n" -" displayed by the 'dh' command.\r\n" -" mapping - Specifies a new mapping name to assign to a device.\r\n" -" This value must end with a ':'.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command creates a mapping between a user-defined name and a device.\r\n" -" The most common use of this command is to create a mapped name for\r\n" -" devices that support a file system protocol. After these mappings are\r\n" -" created, the names can be used with all the file manipulation commands.\r\n" -" 2. The UEFI Shell environment creates default mappings for all of the\r\n" -" devices that support a recognized file system.\r\n" -" 3. This command can be used to create additional mappings, or \r\n" -" when used with the -d option, to delete an existing mapping. If it is\r\n" -" used without any parameters, all of the current mappings are listed.\r\n" -" If the -v option is used, the mappings are shown with additional\r\n" -" information about each device.\r\n" -" 4. The -r option is used to reset all the default mappings in a system,\r\n" -" which is useful if the system configuration has changed since the\r\n" -" last boot.\r\n" -" 5. The -u option adds mappings for newly-installed devices and removes\r\n" -" mappings for uninstalled devices without changing the mappings of\r\n" -" existing devices. User-defined mappings are also preserved. A mapping\r\n" -" history is saved, which preserves the original mapping name for\r\n" -" a device with a specific device path. The current directory is also\r\n" -" preserved if the current device is not changed.\r\n" -" 6. Each device in the system has a consistent mapping. If the hardware\r\n" -" configuration has not changed, the device's consistent mappings do not\r\n" -" change. If two or more machines have the same hardware configurations,\r\n" -" the device's consistent mapping remains the same. Use the -c option to\r\n" -" list all the consistent mappings in the system.\r\n" -" 7. The mapping value must consist of digits and characters. Other\r\n" -" characters are illegal.\r\n" -" 8. This command support wildcards. You can use the wildcards to delete\r\n" -" or show the mapping. However, when you assign the mapping, wildcards\r\n" -" are forbidden.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display verbose mapping table information:\r\n" -" Shell> map -v\r\n" -" \r\n" -" * To assign a different name to fs0:\r\n" -" Shell> map floppy fs0:\r\n" -" \r\n" -" * To operate with the mapped name:\r\n" -" Shell> floppy:\r\n" -" \r\n" -" * To delete a mapped name:\r\n" -" Shell> map -d floppy:\r\n" -" \r\n" -" * To display all the mapped names starting with 'f': \r\n" -" Shell> map f* \r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_MKDIR #language en-US "" -".TH mkdir 0 "Creates directories."\r\n" -".SH NAME\r\n" -"Creates one or more new directories.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MKDIR dir [dir...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" dir - Specifies the name of a directory or directories to create.\r\n" -" (Wildcards are not allowed)\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. Mkdir can create one or more new directories.\r\n" -" 2. If dir includes nested directories, then parent directories will be\r\n" -" created before child directories.\r\n" -" 3. If the directory already exists, mkdir will exit with an error.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To create a new directory:\r\n" -" fs0:\> mkdir rafter\r\n" -" \r\n" -" * To create multiple directories:\r\n" -" fs0:\> mkdir temp1 temp2\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly \r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_OUT_OF_RESOURCES There was insufficient space on the destination \r\n" -" to create the requested directory.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security \r\n" -" violation.\r\n" -" SHELL_WRITE_PROTECTED An attempt was made to create a directory when the\r\n" -" target media was write-protected.\r\n" - -#string STR_GET_HELP_MV #language en-US "" -".TH mv 0 "Moves files."\r\n" -".SH NAME\r\n" -"Moves one or more files to a destination within or between file systems.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"MV src [src...] [dst]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" src - Specifies a source file/directory name (wildcards are permitted).\r\n" -" dst - Specifies a destination file/directory name (wildcards are permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command moves one or more files to a destination within or between\r\n" -" file systems.\r\n" -" 2. If the destination is an existing directory, the sources are moved\r\n" -" into that directory. You cannot move the sources to a non-existing\r\n" -" directory.\r\n" -" 3. If a destination is not specified, the current directory is assumed to be\r\n" -" the destination. If there is more than one argument on the command line,\r\n" -" the last one is assumed to be the destination.\r\n" -" 4. Attempting to move a read-only file/directory results in an error.\r\n" -" Moving a directory that contains read-only files is allowed.\r\n" -" 5. You cannot move a directory into itself or its subdirectories.\r\n" -" 6. You cannot move a directory if the current working directory is itself or\r\n" -" its subdirectories.\r\n" -" 7. If an error occurs, the remaining files or directories are still be\r\n" -" moved.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To rename a file:\r\n" -" fs0:\> mv IsaBus.efi Bus.efi\r\n" -" \r\n" -" * To move a directory to the current directory:\r\n" -" fs0:\> mkdir Test1\Temp\r\n" -" fs0:\> mv Test1\Temp\r\n" -" \r\n" -" * To rename a directory:\r\n" -" fs0:\> mv efi efi1.1\r\n" -" \r\n" -" * To move multiple directories at a time:\r\n" -" fs0:\> mv Test1 Test2 Test\r\n" -" \r\n" -" * To attempt moving a read-only directory, which results in a failure:\r\n" -" fs0:\Test> attrib +r Temp1\r\n" -" DA R fs0:\Test\Temp1\r\n" -" fs0:\Test> mv Temp1 Temp2\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_NOT_FOUND The source file was not able to be found.\r\n" -" SHELL_OUT_OF_RESOURCES There was insufficient free space to move the\r\n" -" requested file to its destination.\r\n" -" SHELL_WRITE_PROTECTED An attempt was made to create a file on media that\r\n" -" was write-protected.\r\n" - -#string STR_GET_HELP_PARSE #language en-US "" -".TH parse 0 "Parses standard format output files."\r\n" -".SH NAME\r\n" -"Retrieves a value from a standard format output file.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"PARSE filename tablename column [-i ] [-s ]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" filename - Specifies a source file name.\r\n" -" tablename - Specifies the name of the table to be parsed.\r\n" -" column - Specifies the one-based column index to use to determine which value\r\n" -" from a particular record to parse.\r\n" -" -i - Specifies an instance number to use to start parsing the ShellCommand table,\r\n" -" and then the specified tablename. If not specified, all instances are returned.\r\n" -" -s - Specifies an instance number to use to start parsing the ShellCommand\r\n" -" table. If not present, then 1 is assumed.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command enables you to parse data from a file that has been output\r\n" -" using the -sfo parameter.\r\n" -" 2. Since the standard formatted output has a well known means of parsing,\r\n" -" this command is intended to provide an easy way of enabling\r\n" -" scripts to consume retrieved data from such constructed output files, and\r\n" -" use it in the logic of scripts written for the UEFI shell.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * The following data is contained in a temporary file (temp.txt):\r\n" -" ShellCommand,"ls"\r\n" -" VolumeInfo,"MikesVolume","400000000","FALSE","32000000","16000000"\r\n" -" FileInfo,"FS0:\efi\\boot\winloader.efi","45670","45900","arsh","08:30:12","01.08.2013","00:00:00","01.08.2013","08:30:12","01.08.2013"\r\n" -" FileInfo,"FS0:\efi\\boot\mikesfile.txt","1250","1280","a","08:30:12","01.08.2013","00:00:00","01.08.2013","08:30:12","01.08.2013"\r\n" -" FileInfo,"FS0:\efi\\boot\\readme.txt","795","900","a","08:30:12","01.08.2013","00:00:00","01.08.2013","08:30:12","01.08.2013"\r\n" -" \r\n" -" * To display VolumeInfo column 2 in temp.txt:\r\n" -" fs0:\> parse temp.txt VolumeInfo 2\r\n" -" MikesVolume\r\n" -" \r\n" -" * To display FileInfo column 3 in temp.txt, starting with instance 3:\r\n" -" fs0:\> parse temp.txt FileInfo 3 -i 3\r\n" -" 795\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_NOT_FOUND The source file was not able to be found.\r\n" - -#string STR_GET_HELP_RESET #language en-US "" -".TH reset 0 "Reset the system."\r\n" -".SH NAME\r\n" -"Resets the system.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"RESET [-w [string]]\r\n" -"RESET [-s [string]]\r\n" -"RESET [-c [string]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -s - Performs a shutdown.\r\n" -" -w - Performs a warm boot.\r\n" -" -c - Performs a cold boot.\r\n" -" string - Describes a reason for the reset.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command resets the system.\r\n" -" 2. The default is to perform a cold reset unless the -w parameter is\r\n" -" specified.\r\n" -" 3. If a reset string is specified, it is passed into the Reset() \r\n" -" function, and the system records the reason for the system reset.\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly \r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_RM #language en-US "" -".TH rm 0 "Deletes one or more files or directories."\r\n" -".SH NAME\r\n" -"Deletes one or more files or directories.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"RM [-q] file/directory [file/directory ...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -q - Specifies quiet mode. Does not prompt for a confirmation.\r\n" -" file - Specifies a file name (wildcards are permitted).\r\n" -" directory - Specifies a directory name (wildcards are permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command deletes one or more files or directories.\r\n" -" 2. If the target is a directory, it deletes the directory, including all\r\n" -" its subdirectories.\r\n" -" 3. Redirecting a file whose parent directory (or the file\r\n" -" itself) is being deleted is not allowed.\r\n" -" 4. Removing a read-only file/directory results in a failure.\r\n" -" 5. Removing a directory containing read-only file(s) results in\r\n" -" a failure. If an error occurs, the command exits immediately and stops\r\n" -" removing files/directories.\r\n" -" 6. You cannot remove a directory when the current directory is itself or its\r\n" -" subdirectory. If a file contains wildcards, you are not prompted for\r\n" -" confirmation.\r\n" -" 7. The root directory cannot be removed.\r\n" -" 8. The current directory or its ancestor directories cannot be removed.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To remove multiple directories at a time:\r\n" -" fs0:\> rm Test\Temp1 Temp2\r\n" -" \r\n" -" * To remove multiple directories with wildcards:\r\n" -" fs0:\> rm Test\Temp*\r\n" -" \r\n" -" * To attempt removing a directory that contains a read-only file,\r\n" -" which results in a failure:\r\n" -" fs0:\> attrib +r Test\Temp1\readme.txt\r\n" -" A R fs0:\Test\Temp1\readme.txt\r\n" -" fs0:\> rm Test\Temp1\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The source file was not able to be found.\r\n" -" SHELL_WRITE_PROTECTED The target was write protected.\r\n" - -#string STR_GET_HELP_SET #language en-US "" -".TH set 0 "Displays or modifies UEFI Shell environment variables."\r\n" -".SH NAME\r\n" -"Displays or modifies UEFI Shell environment variables.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"SET [-v] [sname [value]]\r\n" -"SET [-d ]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -d - Deletes the environment variable.\r\n" -" -v - Displays or modifies a volatile variable.\r\n" -" sname - Specifies an environment variable name.\r\n" -" value - Specifies an environment variable value.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command is used to maintain the UEFI Shell environment variables.\r\n" -" This command can do the following:\r\n" -" - Display environment variables.\r\n" -" - Create new environment variables.\r\n" -" - Change the value of existing environment variables.\r\n" -" - Delete environment variables.\r\n" -" 2. This command sets an environment variable to a specified \r\n" -" value. You can use it to create a new environment\r\n" -" variable or to modify an existing environment variable.\r\n" -" 3. If used without any parameters, all the environment variables\r\n" -" are displayed.\r\n" -" 4. If used with the -d option, the environment variable that\r\n" -" is specified by sname is deleted.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To add an environment variable:\r\n" -" Shell> set DiagnosticPath fs0:\efi\diag;fs1:\efi\diag\r\n" -" \r\n" -" * To display environment variables:\r\n" -" Shell> set\r\n" -" \r\n" -" * To delete an environment variable:\r\n" -" Shell> set -d diagnosticpath\r\n" -" \r\n" -" * To change an environment variable:\r\n" -" fs0:\> set src efi\r\n" -" fs0:\> set src efi1.1\r\n" -" \r\n" -" * To append an environment variable:\r\n" -" Shell> set path %path%;fs0:\efi\Tools;fs0:\efi\boot;fs0:\\r\n" -" \r\n" -" * To set a volatile variable that will disappear at the next boot:\r\n" -" Shell> set -v EFI_SOURCE c:\project\EFI1.1\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_OUT_OF_RESOURCES A request to set a variable in a non-volatile \r\n" -" fashion could not be completed. The resulting \r\n" -" non-volatile request has been converted into a \r\n" -" volatile request.\r\n" - -#string STR_GET_HELP_DATE #language en-US "" -".TH date 0 "Displays and sets the current date for the system."\r\n" -".SH NAME\r\n" -"Displays and sets the current date for the system.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"DATE [mm/dd/[yy]yy][-sfo]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -sfo - Displays information in Standard-Format Output.\r\n" -" mm - Specifies the month of the date to be set. (1-12)\r\n" -" dd - Specifies the day of the date to be set (1-31)\r\n" -" yy/yyyy - Specifies the year of the date to be set. If only two digits,\r\n" -" then enter 9x = 199x. Otherwise enter 20xx.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays and/or sets the current date for the system.\r\n" -" If no parameters are used, it shows the current date. If a valid month,\r\n" -" day, and year are specified, the system's date is updated.\r\n" -" The following rules apply:\r\n" -" - Except for numeric characters and /, all other characters in the\r\n" -" argument are invalid.\r\n" -" - The Shell reports an error if the number is in the wrong\r\n" -" month/date/year range.\r\n" -" - A space before or after the numeric character is not allowed. Inserting\r\n" -" a space into the number is invalid.\r\n" -" - Repeated zeros are allowed before the number. For example:\r\n" -" Shell > date 0000008/000004/000097\r\n" -" Shell > date\r\n" -" 08/04/2097\r\n" -" Shell >\r\n" -" - The year range must be greater than or equal to 1998.\r\n" -" - Two numeric characters indicate the year. Numbers below 98 are\r\n" -" regarded as 20xx, and numbers equal to or above 98 are regarded as\r\n" -" 19xx. 00 means 2000. For example:\r\n" -" Shell > date 8/4/97\r\n" -" Shell > date\r\n" -" 08/04/2097\r\n" -" Shell >\r\n" -" Shell > date 8/4/98\r\n" -" Shell > date\r\n" -" 08/04/1998\r\n" -" Shell >\r\n" -" 2. The range of valid years is from 1998-2099.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the current date in the system:\r\n" -" fs0:\> date\r\n" -" \r\n" -" * To set the date with long year format:\r\n" -" fs0:\> date 01/01/2050\r\n" -" \r\n" -" * To set the date with short year format:\r\n" -" fs0:\> date 06/18/01\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_DEVICE_ERROR There was a hardware error preventing the\r\n" -" completion of this command.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_TIME #language en-US "" -".TH time 0 "Displays or sets the time for the system."\r\n" -".SH NAME\r\n" -"Displays or sets the current time for the system.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"TIME [hh:mm[:ss]] [-tz tz] [-d dl]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -d - Sets or displays a daylight savings time value.\r\n" -" -tz - Specifies a time zone adjustment, measured in minutes offset from UTC. Valid values\r\n" -" are between -1440 and 1440 or 2047. If not present or set to 2047,\r\n" -" time is interpreted as local time.\r\n" -" hh - Specifies a new hour (0-23) (required).\r\n" -" mm - Specifies a new minute (0-59) (required).\r\n" -" ss - Specifies a new second (0-59). If not specified, zero is used.\r\n" -" dl - Specifies a daylight saving time value to set.\r\n" -" 0 : Time is not affected.\r\n" -" 1 : Time is affected, and has not been adjusted for daylight\r\n" -" savings.\r\n" -" 3 : Time is affected, and has been adjusted for daylight savings.\r\n" -" All other values are invalid. If no value follows -d, the\r\n" -" current daylight savings time is displayed.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays or sets the current time for the system.\r\n" -" If no parameters are used, it shows the current time. If valid hours, \r\n" -" minutes, and seconds are provided, the system time is\r\n" -" updated. Note the following rules:\r\n" -" - Except for numeric characters and the : character, all other\r\n" -" characters in the argument are invalid.\r\n" -" - The Shell reports an error if the number is in the wrong \r\n" -" hour/minute/second range.\r\n" -" - Spaces before or after the numeric character and spaces inserted into\r\n" -" the number are not allowed.\r\n" -" - Repeated zeros are allowed before the number. For example:\r\n" -" Shell> time 00000017:000004:0000\r\n" -" Shell> time\r\n" -" 17:04:00 (UTC+08:00)\r\n" -" 2. The seconds parameter is optional. If none is specified, it is\r\n" -" set to zero.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display current system time:\r\n" -" fs0:\> time\r\n" -" \r\n" -" * To set the system time:\r\n" -" fs0:\> time 9:51:30\r\n" -" \r\n" -" * To display the system time, including daylight savings time:\r\n" -" fs0:\> time -d\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_DEVICE_ERROR There was a hardware error preventing the\r\n" -" completion of this command\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_TIMEZONE #language en-US "" -".TH timezone 0 "Displays or sets time zone information."\r\n" -".SH NAME\r\n" -"Displays or sets time zone information.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"TIMEZONE [-s hh:mm | -l] [-b] [-f]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -s - Sets the time zone associated with hh:mm offset from UTC.\r\n" -" -l - Displays a list of all time zones.\r\n" -" -b - Displays one screen at a time.\r\n" -" -f - Displays full information for the specified time zone.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays and sets the current time zone for the system.\r\n" -" 2. If no parameters are used, it shows the current time zone.\r\n" -" 3. If a valid hh:mm parameter is provided, the time zone\r\n" -" information is updated.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all available time zones:\r\n" -" Shell> timezone -l\r\n" -" \r\n" -" * To set the time zone:\r\n" -" Shell> timezone -s -7:00\r\n" -" \r\n" -" * To display detailed information for the current time zone:\r\n" -" Shell> timezone -f\r\n" - -#string STR_GET_HELP_LS #language en-US "" -".TH ls 0 "Lists the contents of a directory or file information."\r\n" -".SH NAME\r\n" -"Lists the contents of a directory or file information.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"LS [-r] [-a[attrib]][-sfo][file]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -r - Displays recursively (including subdirectories).\r\n" -" -a - Displays files with a specified attribute. If \r\n" -" attribute is not specified, all files are listed. If -a is not\r\n" -" specified, all non-system and non-hidden files are listed.\r\n" -" -sfo - Displays information in Standard-Format Output.\r\n" -" attrib - Specifies a file attribute list value:\r\n" -" a - Archive\r\n" -" s - System\r\n" -" h - Hidden\r\n" -" r - Read-only\r\n" -" d - Directory\r\n" -" file - Specifies a name of a file or directory (wildcards are permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command lists directory contents or file information. If no file\r\n" -" name or directory name is specified, the current working directory\r\n" -" is assumed.\r\n" -" 2. The contents of a directory are listed if all of the following are true:\r\n" -" - If option -r is not specified.\r\n" -" - If no wildcard characters are specified in the file parameter.\r\n" -" - If the file specified represents an existing directory.\r\n" -" 3. In all other cases, the command functions as follows:\r\n" -" - All files/directories that match the specified name are displayed.\r\n" -" - The -r flag determines whether a recursive search is performed.\r\n" -" - The option flag -a[attrib] only displays those\r\n" -" files with the attributes that are specified.\r\n" -" - If more than one attribute is specified, only the files that have all\r\n" -" those attributes are listed.\r\n" -" - If -a is followed by nothing, then all files/directories are\r\n" -" displayed, regardless of their attributes.\r\n" -" - If -a itself is not specified, then all files except system and\r\n" -" hidden files are displayed.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To hide files by adding the hidden or system attribute to them:\r\n" -" fs0:\> attrib +s +h *.efi\r\n" -" \r\n" -" * To display all, except the files/directories with 'h' or 's' attribute:\r\n" -" fs0:\> ls\r\n" -" \r\n" -" * To display files with all attributes in the current directory:\r\n" -" fs0:\> ls -a\r\n" -" \r\n" -" * To display files with read-only attributes in the current directory:\r\n" -" fs0:\> ls -ar\r\n" -" \r\n" -" * To display the files with attribute of 's':\r\n" -" fs0:\> ls -as isabus.efi\r\n" -" \r\n" -" * To display all in fs0:\efi directory recursively:\r\n" -" fs0:\> ls -r -a efi\r\n" -" \r\n" -" * To display files with a specified type in the current directory: \r\n" -" recursively:\r\n" -" fs0:\> ls -r -a *.efi -b\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The requested file or directory was not found.\r\n" - -#string STR_GET_HELP_LOAD #language en-US "" -".TH load 0 "Loads a UEFI driver into memory."\r\n" -".SH NAME\r\n" -"Loads a UEFI driver into memory.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"LOAD [-nc] file [file...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -nc - Loads the driver, but does not connect the driver.\r\n" -" File - Specifies a file that contains the image of the UEFI driver (wildcards are\r\n" -" permitted).\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command loads a driver into memory. It can load multiple files at\r\n" -" one time. The file name supports wildcards.\r\n" -" 2. If the -nc flag is not specified, this command attempts to connect the\r\n" -" driver to a proper device. It might also cause previously loaded drivers\r\n" -" to be connected to their corresponding devices.\r\n" -" 3. Use the 'UNLOAD' command to unload a driver.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To load a driver:\r\n" -" fs0:\> load Isabus.efi\r\n" -" \r\n" -" * To load multiple drivers:\r\n" -" fs0:\> load Isabus.efi IsaSerial.efi\r\n" -" \r\n" -" * To load multiple drivers using file name wildcards:\r\n" -" fs0:\> load Isa*.efi\r\n" -" \r\n" -" * To load a driver without connecting it to a device:\r\n" -" fs0:\> load -nc IsaBus.efi\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The requested file was not found.\r\n" - -#string STR_GET_HELP_VOL #language en-US "" -".TH vol 0 "Displays or modifies information about a disk volume."\r\n" -".SH NAME\r\n" -"Displays or modifies information about a disk volume.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"VOL [fs] [-n ]\r\n" -"VOL [fs] [-d]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -n - Displays or modifies a new volume label.\r\n" -" -d - Displays or modifies an empty volume label.\r\n" -" fs - Specifies the name of the file system.\r\n" -" VolumeLabel - Specifies a volume label.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The following characters cannot be used in a volume label:\r\n" -" % ^ * + = [ ] | : ; \" < > ? / . \r\n" -" 2. No spaces are allowed in a volume label.\r\n" -" 3. This command displays the volume information for the specified file\r\n" -" system. If fs is not specified, the current file system is used.\r\n" -" 4. If -n is specified, the volume label for fs is set to\r\n" -" VolumeLabel.\r\n" -" 5. The maximum length for volume label is 11 characters.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the volume of the current file system:\r\n" -" fs0:\> vol\r\n" -" \r\n" -" * To change the label of fs0:\r\n" -" Shell> vol fs0 -n help_test\r\n" -" \r\n" -" * To delete the volume label of fs0:\r\n" -" fs0:\> vol fs0 -d\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The target file-system was not found.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c deleted file mode 100644 index 76a0b1b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c +++ /dev/null @@ -1,313 +0,0 @@ -/** @file - Main file for vol shell level 2 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel2CommandsLib.h" -#include -#include - -/** - Print the info or change the volume info. - - @param[in] Path String with starting path. - @param[in] Delete TRUE to delete the volume label. FALSE otherwise. - @param[in] Name New name to set to the volume label. - - @retval SHELL_SUCCESS The operation was sucessful. -**/ -SHELL_STATUS -HandleVol( - IN CONST CHAR16 *Path, - IN CONST BOOLEAN Delete, - IN CONST CHAR16 *Name OPTIONAL - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - EFI_FILE_SYSTEM_INFO *SysInfo; - UINTN SysInfoSize; - SHELL_FILE_HANDLE ShellFileHandle; - EFI_FILE_PROTOCOL *EfiFpHandle; - UINTN Size1; - UINTN Size2; - - ShellStatus = SHELL_SUCCESS; - - if ( - Name != NULL && ( - StrStr(Name, L"%") != NULL || - StrStr(Name, L"^") != NULL || - StrStr(Name, L"*") != NULL || - StrStr(Name, L"+") != NULL || - StrStr(Name, L"=") != NULL || - StrStr(Name, L"[") != NULL || - StrStr(Name, L"]") != NULL || - StrStr(Name, L"|") != NULL || - StrStr(Name, L":") != NULL || - StrStr(Name, L";") != NULL || - StrStr(Name, L"\"") != NULL || - StrStr(Name, L"<") != NULL || - StrStr(Name, L">") != NULL || - StrStr(Name, L"?") != NULL || - StrStr(Name, L"/") != NULL || - StrStr(Name, L" ") != NULL ) - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"vol", Name); - return (SHELL_INVALID_PARAMETER); - } - - Status = gEfiShellProtocol->OpenFileByName( - Path, - &ShellFileHandle, - Name != NULL?EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE:EFI_FILE_MODE_READ); - - if (EFI_ERROR(Status) || ShellFileHandle == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"vol", Path); - return (SHELL_ACCESS_DENIED); - } - - // - // Get the Volume Info from ShellFileHandle - // - SysInfo = NULL; - SysInfoSize = 0; - EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo); - - if (Status == EFI_BUFFER_TOO_SMALL) { - SysInfo = AllocateZeroPool(SysInfoSize); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo); - } - - ASSERT(SysInfo != NULL); - - if (Delete) { - *((CHAR16 *) SysInfo->VolumeLabel) = CHAR_NULL; - SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize(SysInfo->VolumeLabel); - Status = EfiFpHandle->SetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - (UINTN)SysInfo->Size, - SysInfo); - } else if (Name != NULL) { - Size1 = StrSize(Name); - Size2 = StrSize(SysInfo->VolumeLabel); - if (Size1 > Size2) { - SysInfo = ReallocatePool((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo); - if (SysInfo == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"vol"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - } - } - if (SysInfo != NULL) { - StrCpyS ( (CHAR16 *) SysInfo->VolumeLabel, - (Size1>Size2? Size1/sizeof(CHAR16) : Size2/sizeof(CHAR16)), - Name - ); - SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1; - Status = EfiFpHandle->SetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - (UINTN)SysInfo->Size, - SysInfo); - } - } - - FreePool(SysInfo); - - if (Delete || Name != NULL) { - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"vol", Path); - ShellStatus = SHELL_ACCESS_DENIED; - } - } - - SysInfoSize = 0; - SysInfo = NULL; - - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo); - - if (Status == EFI_BUFFER_TOO_SMALL) { - SysInfo = AllocateZeroPool(SysInfoSize); - Status = EfiFpHandle->GetInfo( - EfiFpHandle, - &gEfiFileSystemInfoGuid, - &SysInfoSize, - SysInfo); - } - - gEfiShellProtocol->CloseFile(ShellFileHandle); - - ASSERT(SysInfo != NULL); - - if (SysInfo != NULL) { - // - // print VolumeInfo table - // - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_VOL_VOLINFO), - gShellLevel2HiiHandle, - SysInfo->VolumeLabel, - SysInfo->ReadOnly?L"r":L"rw", - SysInfo->VolumeSize, - SysInfo->FreeSpace, - SysInfo->BlockSize - ); - SHELL_FREE_NON_NULL(SysInfo); - } - - return (ShellStatus); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-d", TypeFlag}, - {L"-n", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'Vol' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunVol ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *PathName; - CONST CHAR16 *CurDir; - BOOLEAN DeleteMode; - CHAR16 *FullPath; - CHAR16 *TempSpot; - UINTN Length; - CONST CHAR16 *NewName; - - Length = 0; - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - PathName = NULL; - CurDir = NULL; - FullPath = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // Fix local copies of the protocol pointers - // - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"vol", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - - if (ShellCommandLineGetCount(Package) > 2) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"vol"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - PathName = ShellCommandLineGetRawValue(Package, 1); - if (PathName == NULL) { - CurDir = gEfiShellProtocol->GetCurDir(NULL); - if (CurDir == NULL) { - ShellStatus = SHELL_NOT_FOUND; - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"vol"); - } else { - PathName = CurDir; - } - } - if (PathName != NULL) { - TempSpot = StrStr(PathName, L":"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - TempSpot = StrStr(PathName, L"\\"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - StrnCatGrow(&FullPath, &Length, PathName, 0); - StrnCatGrow(&FullPath, &Length, L":\\", 0); - DeleteMode = ShellCommandLineGetFlag(Package, L"-d"); - NewName = ShellCommandLineGetValue(Package, L"-n"); - if (DeleteMode && ShellCommandLineGetFlag(Package, L"-n")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel2HiiHandle, L"vol", L"-d", L"-n"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-n") && NewName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"vol", L"-n"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (NewName != NULL && StrLen(NewName) > 11) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"vol", NewName, L"-n"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellStatus == SHELL_SUCCESS) { - ShellStatus = HandleVol( - FullPath, - DeleteMode, - NewName - ); - } - } - } - } - - SHELL_FREE_NON_NULL(FullPath); - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c deleted file mode 100644 index 36aa7ed..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c +++ /dev/null @@ -1,286 +0,0 @@ -/** @file - Main file for Alias shell level 3 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -/** - Print out single alias registered with the Shell. - - @param[in] Alias Points to the NULL-terminated shell alias. - If this parameter is NULL, then all - aliases will be returned in ReturnedData. - @retval SHELL_SUCCESS the printout was sucessful -**/ -SHELL_STATUS -PrintSingleShellAlias( - IN CONST CHAR16 *Alias - ) -{ - CONST CHAR16 *ConstAliasVal; - SHELL_STATUS ShellStatus; - BOOLEAN Volatile; - - ShellStatus = SHELL_SUCCESS; - ConstAliasVal = gEfiShellProtocol->GetAlias (Alias, &Volatile); - if (ConstAliasVal == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"alias", Alias); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandIsOnAliasList (Alias)) { - Volatile = FALSE; - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_ALIAS_OUTPUT), gShellLevel3HiiHandle, !Volatile ? L' ' : L'*', Alias, ConstAliasVal); - } - return ShellStatus; -} - -/** - Print out each alias registered with the Shell. - - @retval STATUS_SUCCESS the printout was sucessful - @return any return code from GetNextVariableName except EFI_NOT_FOUND -**/ -SHELL_STATUS -PrintAllShellAlias( - VOID - ) -{ - CONST CHAR16 *ConstAllAliasList; - CHAR16 *Alias; - CHAR16 *Walker; - - ConstAllAliasList = gEfiShellProtocol->GetAlias(NULL, NULL); - if (ConstAllAliasList == NULL) { - return (SHELL_SUCCESS); - } - Alias = AllocateZeroPool(StrSize(ConstAllAliasList)); - if (Alias == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - Walker = (CHAR16*)ConstAllAliasList; - - do { - CopyMem(Alias, Walker, StrSize(Walker)); - Walker = StrStr(Alias, L";"); - if (Walker != NULL) { - Walker[0] = CHAR_NULL; - Walker = Walker + 1; - } - PrintSingleShellAlias(Alias); - } while (Walker != NULL && Walker[0] != CHAR_NULL); - - FreePool(Alias); - - return (SHELL_SUCCESS); -} - -/** - Changes a shell command alias. - - This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. - - - @param[in] Command Points to the NULL-terminated shell command or existing alias. - @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and - Command refers to an alias, that alias will be deleted. - @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If - FALSE and the alias already exists, then the existing alias is unchanged and - EFI_ACCESS_DENIED is returned. - @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the - Alias being set will be stored in a non-volatile fashion. - - @retval SHELL_SUCCESS Alias created or deleted successfully. - @retval SHELL_NOT_FOUND the Alias intended to be deleted was not found - @retval SHELL_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to - FALSE. - @retval SHELL_DEVICE_ERROR Command is null or the empty string. -**/ -SHELL_STATUS -ShellLevel3CommandsLibSetAlias( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias, - IN BOOLEAN Replace, - IN BOOLEAN Volatile - ) -{ - SHELL_STATUS ShellStatus; - EFI_STATUS Status; - - ShellStatus = SHELL_SUCCESS; - Status = gEfiShellProtocol->SetAlias (Command, Alias, Replace, Volatile); - if (EFI_ERROR(Status)) { - if (Status == EFI_ACCESS_DENIED) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_ACCESS_DENIED; - } else if (Status == EFI_NOT_FOUND) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_NOT_FOUND), gShellLevel3HiiHandle, L"alias", Command); - ShellStatus = SHELL_NOT_FOUND; - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel3HiiHandle, L"alias", Status); - ShellStatus = SHELL_DEVICE_ERROR; - } - } - return ShellStatus; -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-v", TypeFlag}, - {L"-d", TypeValue}, - {NULL, TypeMax} - }; - -/** - Function for 'alias' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAlias ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *Param1; - CONST CHAR16 *Param2; - CONST CHAR16 *ParamStrD; - CHAR16 *CleanParam2; - BOOLEAN DeleteFlag; - BOOLEAN VolatileFlag; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - CleanParam2 = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"alias", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - Param1 = ShellCommandLineGetRawValue(Package, 1); - Param2 = ShellCommandLineGetRawValue(Package, 2); - - DeleteFlag = ShellCommandLineGetFlag (Package, L"-d"); - VolatileFlag = ShellCommandLineGetFlag (Package, L"-v"); - - if (Param2 != NULL) { - CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2); - if (CleanParam2 == NULL) { - ShellCommandLineFreeVarList (Package); - return SHELL_OUT_OF_RESOURCES; - } - - if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') { - CleanParam2[StrLen(CleanParam2)-1] = L'\0'; - CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0])); - } - } - - if (!DeleteFlag && !VolatileFlag) { - switch (ShellCommandLineGetCount (Package)) { - case 1: - // - // "alias" - // - ShellStatus = PrintAllShellAlias (); - break; - case 2: - // - // "alias Param1" - // - ShellStatus = PrintSingleShellAlias (Param1); - break; - case 3: - // - // "alias Param1 CleanParam2" - // - ShellStatus = ShellLevel3CommandsLibSetAlias (CleanParam2, Param1, FALSE, VolatileFlag); - break; - default: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } else if (DeleteFlag) { - if (VolatileFlag || ShellCommandLineGetCount (Package) > 1) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ParamStrD = ShellCommandLineGetValue (Package, L"-d"); - if (ParamStrD == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Delete an alias: "alias -d ParamStrD" - // - ShellStatus = ShellLevel3CommandsLibSetAlias (ParamStrD, NULL, TRUE, FALSE); - } - } - } else { - // - // Set volatile alias. - // - ASSERT (VolatileFlag); - ASSERT (!DeleteFlag); - switch (ShellCommandLineGetCount (Package)) { - case 1: - case 2: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_INVALID_PARAMETER; - break; - case 3: - // - // "alias -v Param1 CleanParam2" - // - ShellStatus = ShellLevel3CommandsLibSetAlias (CleanParam2, Param1, FALSE, VolatileFlag); - break; - default: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias"); - ShellStatus = SHELL_INVALID_PARAMETER; - } - } - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - SHELL_FREE_NON_NULL (CleanParam2); - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c deleted file mode 100644 index b3fbde6..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c +++ /dev/null @@ -1,230 +0,0 @@ -/** @file - Main file for attrib shell level 2 function. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-sfo", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'cls' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCls ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - UINTN Background; - UINTN Foreground; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CONST CHAR16 *BackColorStr; - CONST CHAR16 *ForeColorStr; - - // - // Initialize variables - // - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - Background = 0; - Foreground = 0; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"cls", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetFlag (Package, L"-sfo")) { - if (ShellCommandLineGetCount (Package) > 1) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"cls"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - Background = (gST->ConOut->Mode->Attribute >> 4) & 0x7; - Foreground = gST->ConOut->Mode->Attribute & 0x0F; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel3HiiHandle, L"cls"); - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_CLS_OUTPUT_SFO), - gShellLevel3HiiHandle, - gST->ConOut->Mode->Attribute, - Foreground, - Background - ); - } - } else { - // - // If there are 0 value parameters, clear sceen - // - BackColorStr = ShellCommandLineGetRawValue (Package, 1); - ForeColorStr = ShellCommandLineGetRawValue (Package, 2); - - if (BackColorStr == NULL && ForeColorStr == NULL) { - // - // clear screen - // - gST->ConOut->ClearScreen (gST->ConOut); - } else if (ShellCommandLineGetCount (Package) > 3) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"cls"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (BackColorStr != NULL) { - if ((ShellStrToUintn (BackColorStr) > 7) || (StrLen (BackColorStr) > 1) || (!ShellIsDecimalDigitCharacter (*BackColorStr))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"cls", BackColorStr); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - switch (ShellStrToUintn (BackColorStr)) { - case 0: - Background = EFI_BACKGROUND_BLACK; - break; - case 1: - Background = EFI_BACKGROUND_BLUE; - break; - case 2: - Background = EFI_BACKGROUND_GREEN; - break; - case 3: - Background = EFI_BACKGROUND_CYAN; - break; - case 4: - Background = EFI_BACKGROUND_RED; - break; - case 5: - Background = EFI_BACKGROUND_MAGENTA; - break; - case 6: - Background = EFI_BACKGROUND_BROWN; - break; - case 7: - Background = EFI_BACKGROUND_LIGHTGRAY; - break; - } - - if (ForeColorStr != NULL) { - if ((ShellStrToUintn (ForeColorStr) > 15) || (StrLen (ForeColorStr) > 2) || (!ShellIsDecimalDigitCharacter (*ForeColorStr))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"cls", ForeColorStr); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - switch (ShellStrToUintn (ForeColorStr)) { - case 0: - Foreground = EFI_BLACK; - break; - case 1: - Foreground = EFI_BLUE; - break; - case 2: - Foreground = EFI_GREEN; - break; - case 3: - Foreground = EFI_CYAN; - break; - case 4: - Foreground = EFI_RED; - break; - case 5: - Foreground = EFI_MAGENTA; - break; - case 6: - Foreground = EFI_BROWN; - break; - case 7: - Foreground = EFI_LIGHTGRAY; - break; - case 8: - Foreground = EFI_DARKGRAY; - break; - case 9: - Foreground = EFI_LIGHTBLUE; - break; - case 10: - Foreground = EFI_LIGHTGREEN; - break; - case 11: - Foreground = EFI_LIGHTCYAN; - break; - case 12: - Foreground = EFI_LIGHTRED; - break; - case 13: - Foreground = EFI_LIGHTMAGENTA; - break; - case 14: - Foreground = EFI_YELLOW; - break; - case 15: - Foreground = EFI_WHITE; - break; - } - } - } else { - // - // Since foreground color is not modified, so retain - // existing foreground color without any change to it. - // - Foreground = gST->ConOut->Mode->Attribute & 0x0F; - } - - if (ShellStatus == SHELL_SUCCESS) { - Status = gST->ConOut->SetAttribute (gST->ConOut, (Foreground | Background) & 0x7F); - ASSERT_EFI_ERROR (Status); - Status = gST->ConOut->ClearScreen (gST->ConOut); - ASSERT_EFI_ERROR (Status); - } - } - } - } - } - } - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - - // - // return the status - // - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c deleted file mode 100644 index 302a1a0..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c +++ /dev/null @@ -1,121 +0,0 @@ -/** @file - Main file for Echo shell level 3 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-on", TypeFlag}, - {L"-off", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'echo' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEcho ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - CHAR16 *ProblemParam; - UINTN Size; - CHAR16 *PrintString; - - Size = 0; - ProblemParam = NULL; - PrintString = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"echo", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - if (ShellCommandLineGetFlag(Package, L"-on")) { - // - // Turn it on - // - ShellCommandSetEchoState(TRUE); - } else if (ShellCommandLineGetFlag(Package, L"-off")) { - // - // turn it off - // - ShellCommandSetEchoState(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // output its current state - // - if (ShellCommandGetEchoState()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_ON), gShellLevel3HiiHandle); - } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_OFF), gShellLevel3HiiHandle); - } - } else { - // - // print the line - // - for ( ParamCount = 1 - ; ShellCommandLineGetRawValue(Package, ParamCount) != NULL - ; ParamCount++ - ) { - StrnCatGrow(&PrintString, &Size, ShellCommandLineGetRawValue(Package, ParamCount), 0); - if (ShellCommandLineGetRawValue(Package, ParamCount+1) != NULL) { - StrnCatGrow(&PrintString, &Size, L" ", 0); - } - } - ShellPrintEx(-1, -1, L"%s\r\n", PrintString); - SHELL_FREE_NON_NULL(PrintString); - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c deleted file mode 100644 index 57e7c1e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c +++ /dev/null @@ -1,97 +0,0 @@ -/** @file - Main file for GetMtc shell level 3 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -/** - Function for 'getmtc' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunGetMtc ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT64 Mtc; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"getmtc", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"getmtc"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Get the monotonic counter count - // - Status = gBS->GetNextMonotonicCount(&Mtc); - if (Status == EFI_DEVICE_ERROR) { - ShellStatus = SHELL_DEVICE_ERROR; - } else if (Status == EFI_SECURITY_VIOLATION) { - ShellStatus = SHELL_SECURITY_VIOLATION; - } else if (EFI_ERROR(Status)) { - ShellStatus = SHELL_DEVICE_ERROR; - } - - // - // print it... - // - if (ShellStatus == SHELL_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GET_MTC_OUTPUT), gShellLevel3HiiHandle, Mtc); - } - } - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c deleted file mode 100644 index f9f3eac..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c +++ /dev/null @@ -1,474 +0,0 @@ -/** @file - Main file for Help shell level 3 function. - - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- Copyright (c) 2014, ARM Limited. All rights reserved.
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include -#include - -#include - -/** - function to insert string items into a list in the correct alphabetical place - - the resultant list is a double NULL terminated list of NULL terminated strings. - - upon successful return the memory must be caller freed (unless passed back in - via a loop where it will get reallocated). - - @param[in,out] DestList double pointer to the list. may be NULL. - @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL. - @param[in] Item the item to insert. - - @retval EFI_SUCCESS the operation was successful. -**/ -EFI_STATUS -LexicalInsertIntoList( - IN OUT CHAR16 **DestList, - IN OUT UINTN *DestSize, - IN CONST CHAR16 *Item - ) -{ - CHAR16 *NewList; - INTN LexicalMatchValue; - CHAR16 *LexicalSpot; - UINTN SizeOfAddedNameInBytes; - - // - // If there are none, then just return with success - // - if (Item == NULL || *Item == CHAR_NULL || StrLen(Item)==0) { - return (EFI_SUCCESS); - } - - NewList = *DestList; - - SizeOfAddedNameInBytes = StrSize(Item); - NewList = ReallocatePool(*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList); - (*DestSize) = (*DestSize) + SizeOfAddedNameInBytes; - - // - // Find the correct spot in the list - // - for (LexicalSpot = NewList - ; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize) - ; LexicalSpot += StrLen(LexicalSpot) + 1 - ) { - // - // Get Lexical Comparison Value between PrevCommand and Command list entry - // - LexicalMatchValue = gUnicodeCollation->StriColl ( - gUnicodeCollation, - (CHAR16 *)LexicalSpot, - (CHAR16 *)Item - ); - // - // The new item goes before this one. - // - if (LexicalMatchValue > 0 || StrLen(LexicalSpot) == 0) { - if (StrLen(LexicalSpot) != 0) { - // - // Move this and all other items out of the way - // - CopyMem( - LexicalSpot + (SizeOfAddedNameInBytes/sizeof(CHAR16)), - LexicalSpot, - (*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof(CHAR16)) - ); - } - - // - // Stick this one in place - // - StrCpyS(LexicalSpot, SizeOfAddedNameInBytes/sizeof(CHAR16), Item); - break; - } - } - - *DestList = NewList; - return (EFI_SUCCESS); -} - -/** - function to add each command name from the linked list to the string list. - - the resultant list is a double NULL terminated list of NULL terminated strings. - - @param[in,out] DestList double pointer to the list. may be NULL. - @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL. - @param[in] SourceList the double linked list of commands. - - @retval EFI_SUCCESS the operation was successful. -**/ -EFI_STATUS -CopyListOfCommandNames( - IN OUT CHAR16 **DestList, - IN OUT UINTN *DestSize, - IN CONST COMMAND_LIST *SourceList - ) -{ - CONST COMMAND_LIST *Node; - - for ( Node = (COMMAND_LIST*)GetFirstNode(&SourceList->Link) - ; SourceList != NULL && !IsListEmpty(&SourceList->Link) && !IsNull(&SourceList->Link, &Node->Link) - ; Node = (COMMAND_LIST*)GetNextNode(&SourceList->Link, &Node->Link) - ) { - LexicalInsertIntoList(DestList, DestSize, Node->CommandString); - } - return (EFI_SUCCESS); -} - -/** - function to add each dynamic command name to the string list. - - the resultant list is a double NULL terminated list of NULL terminated strings. - - @param[in,out] DestList double pointer to the list. may be NULL. - @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL. - - @retval EFI_SUCCESS the operation was successful. - @return an error from HandleProtocol -**/ -STATIC -EFI_STATUS -CopyListOfCommandNamesWithDynamic( - IN OUT CHAR16** DestList, - IN OUT UINTN *DestSize - ) -{ - EFI_HANDLE *CommandHandleList; - CONST EFI_HANDLE *NextCommand; - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; - EFI_STATUS Status; - - CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid); - - // - // If there are none, then just return with success - // - if (CommandHandleList == NULL) { - return (EFI_SUCCESS); - } - - Status = EFI_SUCCESS; - - // - // Append those to the list. - // - for (NextCommand = CommandHandleList ; *NextCommand != NULL && !EFI_ERROR(Status) ; NextCommand++) { - Status = gBS->HandleProtocol( - *NextCommand, - &gEfiShellDynamicCommandProtocolGuid, - (VOID **)&DynamicCommand - ); - - if (EFI_ERROR(Status)) { - continue; - } - - Status = LexicalInsertIntoList(DestList, DestSize, DynamicCommand->CommandName); - } - - SHELL_FREE_NON_NULL(CommandHandleList); - return (Status); -} - - -/** - Attempt to print help from a dynamically added command. - - @param[in] CommandToGetHelpOn The unicode name of the command that help is - requested on. - @param[in] SectionToGetHelpOn Pointer to the section specifier(s). - @param[in] PrintCommandText Print the command followed by the help content - or just help. - - @retval EFI_SUCCESS The help was displayed - @retval EFI_NOT_FOUND The command name could not be found - @retval EFI_DEVICE_ERROR The help data format was incorrect. -**/ -EFI_STATUS -PrintDynamicCommandHelp( - IN CONST CHAR16 *CommandToGetHelpOn, - IN CONST CHAR16 *SectionToGetHelpOn, - IN BOOLEAN PrintCommandText - ) -{ - EFI_STATUS Status; - BOOLEAN Found; - EFI_HANDLE *CommandHandleList; - EFI_HANDLE *NextCommand; - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; - - Status = EFI_NOT_FOUND; - Found = FALSE; - CommandHandleList = NULL; - - CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid); - - if (CommandHandleList == NULL) { - // - // not found or out of resources - // - return Status; - } - - for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) { - Status = gBS->HandleProtocol( - *NextCommand, - &gEfiShellDynamicCommandProtocolGuid, - (VOID **)&DynamicCommand - ); - - if (EFI_ERROR(Status)) { - continue; - } - - // - // Check execution break flag when printing multiple command help information. - // - if (ShellGetExecutionBreakFlag ()) { - break; - } - - if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)CommandToGetHelpOn)) || - (gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) { - // Print as Shell Help if in ManPage format. - Status = ShellPrintHelp (DynamicCommand->CommandName, SectionToGetHelpOn, - PrintCommandText); - if (Status == EFI_DEVICE_ERROR) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), - gShellLevel3HiiHandle, DynamicCommand->CommandName); - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), - gShellLevel3HiiHandle, DynamicCommand->CommandName); - } else { - Found = TRUE; - } - } - } - - SHELL_FREE_NON_NULL(CommandHandleList); - - return (Found ? EFI_SUCCESS : Status); - -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-usage", TypeFlag}, - {L"-section", TypeMaxValue}, - {L"-verbose", TypeFlag}, - {L"-v", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'help' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunHelp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - CHAR16 *SortedCommandList; - CONST CHAR16 *CurrentCommand; - CHAR16 *CommandToGetHelpOn; - CHAR16 *SectionToGetHelpOn; - CHAR16 *HiiString; - BOOLEAN Found; - BOOLEAN PrintCommandText; - UINTN SortedCommandListSize; - - PrintCommandText = TRUE; - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - CommandToGetHelpOn = NULL; - SectionToGetHelpOn = NULL; - SortedCommandList = NULL; - Found = FALSE; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"help", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // Check for conflicting parameters. - // - if (ShellCommandLineGetFlag(Package, L"-usage") - &&ShellCommandLineGetFlag(Package, L"-section") - &&(ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) - ){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // Get the command name we are getting help on - // - ASSERT(CommandToGetHelpOn == NULL); - StrnCatGrow(&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue(Package, 1), 0); - if (CommandToGetHelpOn == NULL && ShellCommandLineGetFlag(Package, L"-?")) { - // - // If we dont have a command and we got a simple -? - // we are looking for help on help command. - // - StrnCatGrow(&CommandToGetHelpOn, NULL, L"help", 0); - } - - if (CommandToGetHelpOn == NULL) { - StrnCatGrow(&CommandToGetHelpOn, NULL, L"*", 0); - ASSERT(SectionToGetHelpOn == NULL); - StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0); - } else { - PrintCommandText = FALSE; - ASSERT(SectionToGetHelpOn == NULL); - // - // Get the section name for the given command name - // - if (ShellCommandLineGetFlag(Package, L"-section")) { - StrnCatGrow(&SectionToGetHelpOn, NULL, ShellCommandLineGetValue(Package, L"-section"), 0); - } else if (ShellCommandLineGetFlag(Package, L"-usage")) { - StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0); - } else if (ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) { - } else { - // - // The output of help will display NAME, SYNOPSIS, OPTIONS, DESCRIPTION, and EXAMPLES sections. - // - StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS,OPTIONS,DESCRIPTION,EXAMPLES", 0); - } - } - - if (gUnicodeCollation->StriColl(gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) { - // - // we need info on the special characters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle); - HiiString = HiiGetString(gShellLevel3HiiHandle, STRING_TOKEN(STR_HELP_SC_DATA), NULL); - ShellPrintEx(-1, -1, L"%s", HiiString); - FreePool(HiiString); - Found = TRUE; - } else { - SortedCommandList = NULL; - SortedCommandListSize = 0; - CopyListOfCommandNames(&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList(TRUE)); - CopyListOfCommandNamesWithDynamic(&SortedCommandList, &SortedCommandListSize); - - for (CurrentCommand = SortedCommandList - ; CurrentCommand != NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16) && *CurrentCommand != CHAR_NULL - ; CurrentCommand += StrLen(CurrentCommand) + 1 - ) { - // - // Checking execution break flag when print multiple command help information. - // - if (ShellGetExecutionBreakFlag ()) { - break; - } - - if ((gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, CommandToGetHelpOn)) || - (gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) { - // - // We have a command to look for help on. - // - Status = ShellPrintHelp(CurrentCommand, SectionToGetHelpOn, PrintCommandText); - if (EFI_ERROR(Status)) { - // - // now try to match against the dynamic command list and print help - // - Status = PrintDynamicCommandHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText); - } - if (Status == EFI_DEVICE_ERROR) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand); - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand); - } else { - Found = TRUE; - } - } - } - - // - // Search the .man file for Shell applications (Shell external commands). - // - if (!Found) { - Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE); - if (Status == EFI_DEVICE_ERROR) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn); - } else if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn); - } else { - Found = TRUE; - } - } - } - - if (!Found) { - ShellStatus = SHELL_NOT_FOUND; - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - } - - if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){ - // - // If '*' then the command entered was 'Help' without qualifiers, This footer - // provides additional info on help switches - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle); - } - if (CommandToGetHelpOn != NULL) { - FreePool(CommandToGetHelpOn); - } - if (SectionToGetHelpOn != NULL) { - FreePool(SectionToGetHelpOn); - } - SHELL_FREE_NON_NULL(SortedCommandList); - - return (ShellStatus); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c deleted file mode 100644 index 7e28dfb..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c +++ /dev/null @@ -1,107 +0,0 @@ -/** @file - Main file for Pause shell level 3 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-q", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'pause' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPause ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - SHELL_PROMPT_RESPONSE *Resp; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - Resp = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - if (!gEfiShellProtocol->BatchIsActive()) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause"); - return (SHELL_UNSUPPORTED); - } - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"pause", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (!ShellCommandLineGetFlag(Package, L"-q")) { - Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID**)&Resp); - } else { - Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp); - } - - if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) { - ShellCommandRegisterExit(TRUE, 0); - ShellStatus = SHELL_ABORTED; - } - - if (Resp != NULL) { - FreePool(Resp); - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c deleted file mode 100644 index 651c043..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c +++ /dev/null @@ -1,292 +0,0 @@ -/** @file - Main file for Touch shell level 3 function. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -/** - Do the touch operation on a single handle. - - @param[in] Handle The handle to update the date/time on. - - @retval EFI_ACCESS_DENIED The file referenced by Handle is read only. - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -TouchFileByHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_STATUS Status; - EFI_FILE_INFO *FileInfo; - - FileInfo = gEfiShellProtocol->GetFileInfo(Handle); - if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) != 0){ - return (EFI_ACCESS_DENIED); - } - Status = gRT->GetTime(&FileInfo->ModificationTime, NULL); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status); - return (SHELL_DEVICE_ERROR); - } - - CopyMem(&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof(EFI_TIME)); - - Status = gEfiShellProtocol->SetFileInfo(Handle, FileInfo); - - FreePool(FileInfo); - - return (Status); -} - -/** - Touch a given file and potantially recurse down if it was a directory. - - @param[in] Name The name of this file. - @param[in] FS The name of the file system this file is on. - @param[in] Handle The handle of this file already opened. - @param[in] Rec TRUE to recurse if possible. - - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -DoTouchByHandle ( - IN CONST CHAR16 *Name, - IN CHAR16 *FS, - IN SHELL_FILE_HANDLE Handle, - IN BOOLEAN Rec - ) -{ - EFI_STATUS Status; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *Walker; - CHAR16 *TempSpot; - - Status = EFI_SUCCESS; - FileList = NULL; - Walker = NULL; - - if (FS == NULL) { - FS = StrnCatGrow(&FS, NULL, Name, 0); - if (FS != NULL) { - TempSpot = StrStr(FS, L"\\"); - if (TempSpot != NULL) { - *TempSpot = CHAR_NULL; - } - } - } - if (FS == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // do it - // - Status = TouchFileByHandle(Handle); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Name); - return (Status); - } - - // - // if it's a directory recurse... - // - if (FileHandleIsDirectory(Handle) == EFI_SUCCESS && Rec) { - // - // get each file under this directory - // - if (EFI_ERROR(gEfiShellProtocol->FindFilesInDir(Handle, &FileList))) { - Status = EFI_INVALID_PARAMETER; - } - - // - // recurse on each - // - for (Walker = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) - ; FileList != NULL && !IsNull(&FileList->Link, &Walker->Link) && !EFI_ERROR(Status) - ; Walker = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Walker->Link) - ){ - if ( (StrCmp(Walker->FileName, L".") != 0) - && (StrCmp(Walker->FileName, L"..") != 0) - ){ - // - // Open the file since we need that handle. - // - Status = gEfiShellProtocol->OpenFileByName (Walker->FullName, &Walker->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Walker->FullName); - Status = EFI_ACCESS_DENIED; - } else { - Status = DoTouchByHandle(Walker->FullName, FS, Walker->Handle, TRUE); - gEfiShellProtocol->CloseFile(Walker->Handle); - Walker->Handle = NULL; - } - } - } - - // - // free stuff - // - if (FileList != NULL && EFI_ERROR(gEfiShellProtocol->FreeFileList(&FileList))) { - Status = EFI_INVALID_PARAMETER; - } - } - - return (Status); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-r", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'touch' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTouch ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *Param; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *Node; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - ParamCount = 0; - FileList = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"touch", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // we insufficient parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"touch"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // get a list with each file specified by parameters - // if parameter is a directory then add all the files below it to the list - // - for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ; Param != NULL - ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ){ - Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, &FileList); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"touch", (CHAR16*)Param); - ShellStatus = SHELL_NOT_FOUND; - break; - } - // - // make sure we completed the param parsing sucessfully... - // Also make sure that any previous action was sucessful - // - if (ShellStatus == SHELL_SUCCESS) { - // - // check that we have at least 1 file - // - if (FileList == NULL || IsListEmpty(&FileList->Link)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"touch", Param); - continue; - } else { - // - // loop through the list and make sure we are not aborting... - // - for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag() - ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link) - ){ - // - // make sure the file opened ok - // - if (EFI_ERROR(Node->Status)){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName); - ShellStatus = SHELL_NOT_FOUND; - continue; - } - - Status = DoTouchByHandle(Node->FullName, NULL, Node->Handle, ShellCommandLineGetFlag(Package, L"-r")); - if (EFI_ERROR(Status) && Status != EFI_ACCESS_DENIED) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName); - ShellStatus = SHELL_NOT_FOUND; - } - } - } - } - // - // Free the fileList - // - if (FileList != NULL && !IsListEmpty(&FileList->Link)) { - Status = ShellCloseFileMetaArg(&FileList); - ASSERT_EFI_ERROR(Status); - } - FileList = NULL; - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - if (ShellGetExecutionBreakFlag()) { - return (SHELL_ABORTED); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c deleted file mode 100644 index 4fcfbf9..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c +++ /dev/null @@ -1,327 +0,0 @@ -/** @file - Main file for Type shell level 3 function. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -/** - Display a single file to StdOut. - - If both Ascii and UCS2 are FALSE attempt to discover the file type. - - @param[in] Handle The handle to the file to display. - @param[in] Ascii TRUE to force ASCII, FALSE othewise. - @param[in] UCS2 TRUE to force UCS2, FALSE othewise. - - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -TypeFileByHandle ( - IN SHELL_FILE_HANDLE Handle, - IN BOOLEAN Ascii, - IN BOOLEAN UCS2 - ) -{ - UINTN ReadSize; - VOID *Buffer; - VOID *AllocatedBuffer; - EFI_STATUS Status; - UINTN LoopVar; - UINTN LoopSize; - CHAR16 AsciiChar; - CHAR16 Ucs2Char; - - ReadSize = PcdGet32(PcdShellFileOperationSize); - AllocatedBuffer = AllocateZeroPool(ReadSize); - if (AllocatedBuffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - Status = ShellSetFilePosition(Handle, 0); - ASSERT_EFI_ERROR(Status); - - while (ReadSize == ((UINTN)PcdGet32(PcdShellFileOperationSize))) { - Buffer = AllocatedBuffer; - ZeroMem(Buffer, ReadSize); - Status = ShellReadFile(Handle, &ReadSize, Buffer); - if (EFI_ERROR(Status)){ - break; - } - - if (!(Ascii|UCS2)) { - if (*(UINT16*)Buffer == gUnicodeFileTag) { - UCS2 = TRUE; - } else { - Ascii = TRUE; - } - } - - if (Ascii) { - LoopSize = ReadSize; - for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) { - // - // The valid range of ASCII characters is 0x20-0x7E. - // Display "." when there is an invalid character. - // - AsciiChar = CHAR_NULL; - AsciiChar = ((CHAR8*)Buffer)[LoopVar]; - if (AsciiChar == '\r' || AsciiChar == '\n') { - // - // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD) - // characters to be displayed as is. - // - if (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r') { - // - // In case Line Feed (0xA) is encountered & Carriage Return (0xD) - // was not the previous character, print CR and LF. This is because - // Shell 2.0 requires carriage return with line feed for displaying - // each new line from left. - // - ShellPrintEx (-1, -1, L"\r\n"); - continue; - } - } else { - // - // For all other characters which are not printable, display '.' - // - if (AsciiChar < 0x20 || AsciiChar >= 0x7F) { - AsciiChar = '.'; - } - } - ShellPrintEx (-1, -1, L"%c", AsciiChar); - } - } else { - if (*(UINT16*)Buffer == gUnicodeFileTag) { - // - // For unicode files, skip displaying the byte order marker. - // - Buffer = ((UINT16*)Buffer) + 1; - LoopSize = (ReadSize / (sizeof (CHAR16))) - 1; - } else { - LoopSize = ReadSize / (sizeof (CHAR16)); - } - - for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) { - // - // An invalid range of characters is 0x0-0x1F. - // Display "." when there is an invalid character. - // - Ucs2Char = CHAR_NULL; - Ucs2Char = ((CHAR16*)Buffer)[LoopVar]; - if (Ucs2Char == '\r' || Ucs2Char == '\n') { - // - // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD) - // characters to be displayed as is. - // - if (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r') { - // - // In case Line Feed (0xA) is encountered & Carriage Return (0xD) - // was not the previous character, print CR and LF. This is because - // Shell 2.0 requires carriage return with line feed for displaying - // each new line from left. - // - ShellPrintEx (-1, -1, L"\r\n"); - continue; - } - } - else if (Ucs2Char < 0x20) { - // - // For all other characters which are not printable, display '.' - // - Ucs2Char = L'.'; - } - ShellPrintEx (-1, -1, L"%c", Ucs2Char); - } - } - - if (ShellGetExecutionBreakFlag()) { - break; - } - } - FreePool (AllocatedBuffer); - ShellPrintEx (-1, -1, L"\r\n"); - return (Status); -} - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-a", TypeFlag}, - {L"-u", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'type' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunType ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - CONST CHAR16 *Param; - SHELL_STATUS ShellStatus; - UINTN ParamCount; - EFI_SHELL_FILE_INFO *FileList; - EFI_SHELL_FILE_INFO *Node; - BOOLEAN AsciiMode; - BOOLEAN UnicodeMode; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - ParamCount = 0; - FileList = NULL; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"type", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - AsciiMode = ShellCommandLineGetFlag(Package, L"-a"); - UnicodeMode = ShellCommandLineGetFlag(Package, L"-u"); - - if (AsciiMode && UnicodeMode) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"type", L"-a & -u"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { - // - // we insufficient parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"type"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - // - // get a list with each file specified by parameters - // if parameter is a directory then add all the files below it to the list - // - for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ; Param != NULL - ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount) - ){ - Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ, &FileList); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", (CHAR16*)Param); - ShellStatus = SHELL_NOT_FOUND; - break; - } - // - // make sure we completed the param parsing sucessfully... - // Also make sure that any previous action was sucessful - // - if (ShellStatus == SHELL_SUCCESS) { - // - // check that we have at least 1 file - // - if (FileList == NULL || IsListEmpty(&FileList->Link)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"type", Param); - continue; - } else { - // - // loop through the list and make sure we are not aborting... - // - for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link) - ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag() - ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link) - ){ - - if (ShellGetExecutionBreakFlag()) { - break; - } - - // - // make sure the file opened ok - // - if (EFI_ERROR(Node->Status)){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", Node->FileName); - ShellStatus = SHELL_NOT_FOUND; - continue; - } - - // - // make sure its not a directory - // - if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_IS_DIR), gShellLevel3HiiHandle, L"type", Node->FileName); - ShellStatus = SHELL_NOT_FOUND; - continue; - } - - // - // do it - // - Status = TypeFileByHandle (Node->Handle, AsciiMode, UnicodeMode); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TYP_ERROR), gShellLevel3HiiHandle, L"type", Node->FileName); - ShellStatus = SHELL_INVALID_PARAMETER; - } - ASSERT(ShellStatus == SHELL_SUCCESS); - } - } - } - // - // Free the fileList - // - if (FileList != NULL && !IsListEmpty(&FileList->Link)) { - Status = ShellCloseFileMetaArg(&FileList); - } - ASSERT_EFI_ERROR(Status); - FileList = NULL; - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - if (ShellGetExecutionBreakFlag()) { - return (SHELL_ABORTED); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c deleted file mode 100644 index 9528fdc..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - Main file for NULL named library for level 3 shell command functions. - - (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "UefiShellLevel3CommandsLib.h" - -CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands"; -EFI_HANDLE gShellLevel3HiiHandle = NULL; - -/** - return the filename to get help from is not using HII. - - @retval The filename. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameLevel3 ( - VOID - ) -{ - return (gShellLevel3FileName); -} - -/** - Constructor for the Shell Level 3 Commands library. - - Install the handlers for level 3 UEFI Shell 2.0 commands. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the shell command handlers were installed sucessfully - @retval EFI_UNSUPPORTED the shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellLevel3CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - gShellLevel3HiiHandle = NULL; - // - // if shell level is less than 3 do nothing - // - if (PcdGet8(PcdShellSupportLevel) < 3) { - return (EFI_SUCCESS); - } - - gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL); - if (gShellLevel3HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - // - // install our shell command handlers that are always installed - // - // Note: that Time, Timezone, and Date are part of level 2 library - // - ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE)); - ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH)); - ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER)); - ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS)); - ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS)); - ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO)); - ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE)); - ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC)); - ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP)); - - ShellCommandRegisterAlias(L"type", L"cat"); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -ShellLevel3CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellLevel3HiiHandle != NULL) { - HiiRemovePackages(gShellLevel3HiiHandle); - } - return (EFI_SUCCESS); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h deleted file mode 100644 index 0e42491..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +++ /dev/null @@ -1,161 +0,0 @@ -/** @file - header file for NULL named library for level 3 shell command functions. - - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_ -#define _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_ - -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE gShellLevel3HiiHandle; - -/** - Function for 'type' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunType ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'touch' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunTouch ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'ver' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunVer ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'alias' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAlias ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'cls' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunCls ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'echo' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunEcho ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'pause' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPause ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'getmtc' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunGetMtc ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'help' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunHelp ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf deleted file mode 100644 index a1cf331..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf +++ /dev/null @@ -1,74 +0,0 @@ -## @file -# Provides shell level 3 functions -# Note that the interactive versions of the time, date, and timezone functions are handled in the level 2 library. -# -# (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
-# Copyright (c) 2009-2015, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellLevel3CommandsLib - FILE_GUID = 71374B42-85D7-4753-AD17-AA84C3A0EB93 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellLevel3CommandsLibConstructor - DESTRUCTOR = ShellLevel3CommandsLibDestructor - -[Sources.common] -# note that time, timezone, and date are part of the level 2 library - Type.c - Touch.c - Ver.c - UefiShellLevel3CommandsLib.uni - UefiShellLevel3CommandsLib.c - UefiShellLevel3CommandsLib.h - Cls.c - Alias.c - Echo.c - Pause.c - GetMtc.c - Help.c - - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - FileHandleLib - HandleParsingLib - -[Guids] - gEfiFileInfoGuid ## UNDEFINED - gShellLevel3HiiGuid ## SOMETIMES_CONSUMES ## HII - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## SOMETIMES_CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellSupplier ## SOMETIMES_CONSUMES - -[Protocols] - gEfiShellDynamicCommandProtocolGuid ## SOMETIMES_CONSUMES diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni deleted file mode 100644 index 1ea5522..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni +++ /dev/null @@ -1,545 +0,0 @@ -// /** -// -// (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellLevel3CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 level 3 commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_ERR_AD #language en-US "%H%s%N: Access denied.\r\n" -#string STR_GEN_ERR_NOT_FOUND #language en-US "%H%s%N: '%H%s%N' does not exist.\r\n" -#string STR_GEN_ERR_UK #language en-US "%H%s%N: Status: %r\r\n" -#string STR_GEN_PARAM_CON #language en-US "%H%s%N: Parameters conflict\r\n" -#string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags conflict with - '%H%s%N' and '%H%s%N'\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_FILE_AD #language en-US "%H%s%N: Access file error - '%H%s%N'\r\n" -#string STR_GEN_CRLF #language en-US "\r\n" -#string STR_GEN_NO_CWD #language en-US "%H%s%N: Current directory not specified\r\n" -#string STR_GEN_NO_FILES #language en-US "%H%s%N: No matching files were found\r\n" -#string STR_GEN_DIR_NF #language en-US "%H%s%N: Directory not found - '%H%s%N'\r\n" -#string STR_GEN_FILE_NF #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_GEN_IS_DIR #language en-US "%H%s%N: '%H%s%N' is a directory\r\n" -#string STR_GEN_SFO_HEADER #language en-US "ShellCommand,"%s"\r\n" -#string STR_NO_SCRIPT #language en-US "The command '%H%s%N' is not allowed outside of a script\r\n" - -#string STR_TYP_ERROR #language en-US "%H%s%N: Operation was not successful on '%H%s%N'\r\n" - -#string STR_TOUCH_ERROR #language en-US "%H%s%N: Operation was not successful on '%H%s%N'\r\n" - -#string STR_VER_OUTPUT_SHELL #language en-US "UEFI %s Shell v%d.%d\r\n" -#string STR_VER_OUTPUT_SIMPLE #language en-US "%d.%d\r\n" -#string STR_VER_OUTPUT_UEFI #language en-US "UEFI v%d.%02d (%s, 0x%08x)\r\n" -#string STR_VER_OUTPUT_SUPPLIER #language en-US "%s\r\n" - -#string STR_ECHO_ON #language en-US "Echo is on.\r\n" -#string STR_ECHO_OFF #language en-US "Echo is off.\r\n" - -#string STR_PAUSE_PROMPT #language en-US "Enter 'q' to quit, any other key to continue:\r\n" - -#string STR_HELP_NF #language en-US "No help could be found for command '%B%s%N'.\r\n" -#string STR_HELP_INV #language en-US "The help data for command '%B%s%N' was incorrect format.\r\n" -#string STR_HELP_SC_HEADER #language en-US "Character Description\r\n" - "--------- ---------------------------------------------- \r\n" -#string STR_HELP_SC_DATA #language en-US " Ends a command line.\r\n" - " Ends an argument, if it is not in a quotation.\r\n" - "# Starts a comment.\r\n" - "> Used for output redirection.\r\n" - "< Used for input redirection.\r\n" - "| Used for pipe command support.\r\n" - "% Used to delimit a variable or an argument.\r\n" - "\" Used to delimit a quotation.\r\n" - "^ Prevents the next character from being\r\n" - " interpreted as having special meaning.\r\n" - " Can be used inside quoted strings.\r\n" - "*, ?, [, ] Wildcards to specify multiple similar file names.\r\n" -#string STR_HELP_COMMAND #language en-US "%H%-14s%N- %s\r\n" -#string STR_HELP_FOOTER #language en-US "%N\r\nHelp usage:help [%Hcmd%N|%Hpattern%N|%Hspecial%N] [%H-usage%N] [%H-verbose%N] [%H-section name%N][%H-b%N]\r\n" - -#string STR_HELP_PAGE_COMMAND #language en-US "%N%s\r\n" - -#string STR_ALIAS_OUTPUT #language en-US "%1c %10s:%s\r\n" - -#string STR_GET_MTC_OUTPUT #language en-US "%016Lx\r\n" -#string STR_CLS_OUTPUT_SFO #language en-US "ConOutAttribInfo,"%d","%d","%d"\r\n" - -#string STR_GET_HELP_HELP #language en-US "" -".TH help 0 "Displays help information from the UEFI Shell."\r\n" -".SH NAME\r\n" -"Displays the UEFI Shell command list or verbose command help.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"HELP [cmd | pattern | special] [-usage] [-verbose] [-section sectionname][-b]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -usage - Displays the usage information for the command. The same as\r\n" -" specifying "-section NAME" and "-section SYNOPSIS" \r\n" -" -section - Displays the specified section of the help information.\r\n" -" -b - Displays one page on screen and allows user to continue\r\n" -" to next page\r\n" -" cmd - Specifies a command to display help about.\r\n" -" pattern - Specifies a pattern which describes the commands to be displayed.\r\n" -" special - Displays a list of the special characters used in the shell\r\n" -" command line.\r\n" -" sectionname - Specifies a section name. Supported options are:\r\n" -" - NAME\r\n" -" - SYNOPSIS\r\n" -" - OPTIONS\r\n" -" - DESCRIPTION\r\n" -" - EXAMPLES\r\n" -" - RETURNVALUES\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The HELP command displays information about one or more shell commands.\r\n" -" 2. If no other options are specified, each command will be displayed along\r\n" -" with a brief description of its function.\r\n" -" 3. If -verbose is specified, then display all help information for the\r\n" -" specified commands.\r\n" -" 4. If -section is specified, only the help section specified will be\r\n" -" displayed.\r\n" -" 5. If -usage is specified, then the command, a brief description\r\n" -" and the usage will be displayed.\r\n" -" 6. The help text is gathered from UCS-2 text files found in the directory\r\n" -" where the shell or shell command executable was located. The files have\r\n" -" the name commandname.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the list of commands in the UEFI Shell and break after one\r\n" -" screen:\r\n" -" Shell> help -b\r\n" -" \r\n" -" * To display help information of a Shell command - ls:\r\n" -" Shell> help ls\r\n" -" Shell> -? ls\r\n" -" Shell> ls -?\r\n" -" \r\n" -" * To display the list of commands that start with character 'p':\r\n" -" Shell> help p*\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" 0 The help was displayed\r\n" -" 1 No command help was displayed\r\n" - -#string STR_GET_HELP_ALIAS #language en-US "" -".TH alias 0 "Handles aliases in the Shell."\r\n" -".SH NAME\r\n" -"Displays, creates, or deletes UEFI Shell aliases.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"ALIAS [-d|-v] [alias-name] [command-name]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -d - Deletes an alias. Command-name must not be specified.\r\n" -" -v - Makes the alias volatile.\r\n" -" alias-name - Specifies an alias name.\r\n" -" command-name - Specifies an original command's name or path.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays, creates, or deletes aliases in the UEFI Shell\r\n" -" environment.\r\n" -" 2. An alias provides a new name for an existing UEFI Shell\r\n" -" command or UEFI application. Once the alias is created, it can be used\r\n" -" to run the command or launch the UEFI application.\r\n" -" 3. There are some aliases that are predefined in the UEFI Shell environment.\r\n" -" These aliases provide the MS-DOS and UNIX equivalent names for the file\r\n" -" manipulation commands.\r\n" -" 4. Aliases will be retained even after exiting the shell unless the -v option\r\n" -" is specified. If -v is specified then the alias will not be valid after\r\n" -" leaving the shell.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display all aliases in the UEFI Shell environment:\r\n" -" Shell> alias\r\n" -" \r\n" -" * To create an alias in the UEFI Shell environment:\r\n" -" Shell> alias shutdown "reset -s" \r\n" -" \r\n" -" * To delete an alias in the UEFI Shell environment:\r\n" -" Shell> alias -d shutdown\r\n" -" \r\n" -" * To add a volatile alias in the current UEFI environment, which has a star *\r\n" -" at the line head. This volatile alias will disappear at next boot.\r\n" -" Shell> alias -v fs0 floppy\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_OUT_OF_RESOURCES A request to set a variable in a non-volatile\r\n" -" fashion could not be completed. The resulting\r\n" -" non-volatile request has been converted into\r\n" -" a volatile request.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" - -#string STR_GET_HELP_CLS #language en-US "" -".TH cls 0 "clear screen"\r\n" -".SH NAME\r\n" -"Clears the console output and optionally changes the background and foreground color.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"CLS [background] [foreground] | [-sfo]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" background - Sets a new background color:\r\n" -" 0 - Black\r\n" -" 1 - Blue\r\n" -" 2 - Green\r\n" -" 3 - Cyan\r\n" -" 4 - Red\r\n" -" 5 - Magenta\r\n" -" 6 - Yellow\r\n" -" 7 - Light gray\r\n" -" foreground - Sets a new foreground color:\r\n" -" 0 - Black\r\n" -" 1 - Blue\r\n" -" 2 - Green\r\n" -" 3 - Cyan\r\n" -" 4 - Red\r\n" -" 5 - Magenta\r\n" -" 6 - Yellow\r\n" -" 7 - Light gray\r\n" -" 8 - Dark gray\r\n" -" 9 - Light blue\r\n" -" 10 - Light green\r\n" -" 11 - Light cyan\r\n" -" 12 - Light red\r\n" -" 13 - Light magenta\r\n" -" 14 - Yellow\r\n" -" 15 - White\r\n" -" -sfo - Displays current console color settings in Standard Format\r\n" -" Output.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command clears the standard output device with an optional\r\n" -" background and foreground color attribute.\r\n" -" 2. If background color is not specified, or if background and foreground\r\n" -" colors are not specified, then the colors do not change.\r\n" -" 3. When -sfo flag is used, console output is not cleared and instead it\r\n" -" displays current console foreground and background attribute settings.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To clear standard output without changing the background or foreground\r\n" -" color:\r\n" -" fs0:\> cls\r\n" -" \r\n" -" * To clear standard output and change the background color to cyan:\r\n" -" fs0:\> cls 3\r\n" -" \r\n" -" * To clear standard output and change the background to black and foreground\r\n" -" to white:\r\n" -" fs0:\> cls 0 15\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The requested file was not found.\r\n" - -#string STR_GET_HELP_ECHO #language en-US "" -".TH echo 0 "display text or control text output"\r\n" -".SH NAME\r\n" -"Controls script file command echoing or displays a message.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"ECHO [-on|-off]\r\n" -"ECHO [message]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -on - Enables display when reading commands from script files.\r\n" -" -off - Disables display when reading commands from script files.\r\n" -" message - Specifies a message to display.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The first form of this command controls whether script commands are\r\n" -" displayed as they are read from the script file. If no argument is given,\r\n" -" the current "on" or "off" status is displayed.\r\n" -" 2. The second form prints the given message to the display.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display a message string of 'Hello World':\r\n" -" fs0:\> echo Hello World\r\n" -" \r\n" -" * To turn command echoing on:\r\n" -" fs0:\> echo -on\r\n" -" \r\n" -" * To execute HelloWorld.nsh, and display when reading lines from the script\r\n" -" file:\r\n" -" fs0:\> HelloWorld.nsh\r\n" -" +HelloWorld.nsh> echo Hello World\r\n" -" \r\n" -" * To turn command echoing off:\r\n" -" fs0:\> echo -off\r\n" -" \r\n" -" * To display the current echo setting:\r\n" -" fs0:\> echo\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" - -#string STR_GET_HELP_GETMTC #language en-US "" -".TH getmtc 0 "gets the MTC count"\r\n" -".SH NAME\r\n" -"Gets the MTC from BootServices and displays it.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"GETMTC\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays the current monotonic counter value. The lower 32\r\n" -" bits increment every time this command is executed. Every time the system\r\n" -" is reset, the upper 32 bits will be incremented, and the lower 32 bits\r\n" -" will be reset to 0.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display the current monotonic counter value:\r\n" -" fs0:\> getmtc\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_DEVICE_ERROR The underlying device was not working correctly.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" - -#string STR_GET_HELP_PAUSE #language en-US "" -".TH pause 0 "pauses scripts"\r\n" -".SH NAME\r\n" -"Pauses a script and waits for an operator to press a key.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"PAUSE [-q]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -q - Does not display a test output prompt.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. The PAUSE command prints a message to the display, then suspends script\r\n" -" file execution, and waits for keyboard input. Pressing any key resumes\r\n" -" execution, except for q or Q. If either q or Q is pressed, script\r\n" -" processing terminates; otherwise, execution continues with the next line\r\n" -" after the pause command.\r\n" -" 2. The PAUSE command is available only in scripts. Switch -q can hide the\r\n" -" message and it's optional.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * Following script is a sample of 'pause' command:\r\n" -" fs0:\> type pause.nsh\r\n" -" #\r\n" -" # Example script for 'pause' command\r\n" -" #\r\n" -" echo pause.nsh begin..\r\n" -" date\r\n" -" time\r\n" -" pause\r\n" -" echo pause.nsh done.\r\n" -" \r\n" -" * To execute the script with echo on:\r\n" -" fs0:\> pause.nsh\r\n" -" +pause.nsh> echo pause.nsh begin..\r\n" -" pause.nsh begin..\r\n" -" +pause.nsh> date\r\n" -" 06/19/2001\r\n" -" +pause.nsh> time\r\n" -" 00:51:45\r\n" -" +pause.nsh> pause\r\n" -" Enter 'q' to quit, or any other key to continue:\r\n" -" +pause.nsh> echo pause.nsh done.\r\n" -" pause.nsh done.\r\n" -" \r\n" -" * To execute the script with echo off:\r\n" -" fs0:\> echo -off\r\n" -" fs0:\> pause.nsh\r\n" -" pause.nsh begin..\r\n" -" 06/19/2001\r\n" -" 00:52:50\r\n" -" Enter 'q' to quit, or any other key to continue: q\r\n" -" fs0:\>\r\n" - -#string STR_GET_HELP_TOUCH #language en-US "" -".TH touch 0 "Touch a file to update a directory"\r\n" -".SH NAME\r\n" -"Updates the filename timestamp with the current system date and time.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"TOUCH [-r] file [file ...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -r - Sets the update as recurse into subdirectories.\r\n" -" file - Specifies the name or pattern of the file or directory. There can be multiple \r\n" -" files on the command-line.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command updates to the current time and date the time and date on\r\n" -" the file that is specified by the file parameter.\r\n" -" 2. If multiple files are specified on the command line, it will continue\r\n" -" processing. It will touch the files one by one and errors will be\r\n" -" ignored.\r\n" -" 3. TOUCH cannot change the time and date of read-only files and directories.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To update the timestamp of a specific file:\r\n" -" fs0:\> touch for.nsh\r\n" -" \r\n" -" * To touch a directory recursively:\r\n" -" fs0:\> touch -r efi1.1\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_NOT_FOUND The target file or set of files were not found.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_WRITE_PROTECTED The media was write-protected or the file had a\r\n" -" read-only attribute associated with it.\r\n" - -#string STR_GET_HELP_TYPE #language en-US "" -".TH type 0 "print a file to StdOut"\r\n" -".SH NAME\r\n" -"Sends the contents of a file to the standard output device.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"TYPE [-a|-u] file [file...]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -a - Displays the file as if it is encoded as 8-bit ASCII\r\n" -" -u - Displays the file as if it were encoded as UCS-2 Unicode.\r\n" -" file - Specifies the name of the file to display.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command sends the contents of a file to the standard output device.\r\n" -" If no options are used, then the command attempts to automatically detect\r\n" -" the file type. If it fails, then UCS-2 is presumed.\r\n" -" 2. If the -a option is specified, the file is sent to the standard output\r\n" -" device as a stream of ASCII characters.\r\n" -" 3. If the -u option is specified, the file is sent to the standard output\r\n" -" device as a stream of Unicode (UCS-2) characters.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display a file in UCS-2 format:\r\n" -" fs0:\> type -u pause.nsh\r\n" -" \r\n" -" * To display a file in ASCII format:\r\n" -" fs0:\> type -a pause.nsh\r\n" -" \r\n" -" * To display multiple files:\r\n" -" fs0:\> type test.*\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" -" SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" -" violation.\r\n" -" SHELL_NOT_FOUND The target file or set of files were not found.\r\n" - -#string STR_GET_HELP_VER #language en-US "" -".TH ver 0 "prints out version info"\r\n" -".SH NAME\r\n" -"Displays UEFI Firmware version information.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"VER [-s|-terse]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -s - Displays only the UEFI Shell version.\r\n" -" -terse - Displays only the first part of the data.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command displays the version information for this UEFI Firmware, or\r\n" -" the version information for the UEFI Shell itself. The information is\r\n" -" retrieved through the UEFI System Table or the Shell image.\r\n" -" \r\n" -" 2. Standard format for ver output as shown below with a sample:\r\n" -" UEFI Shell v\r\n" -" shell-supplier-specific-data\r\n" -" UEFI v (, 0x )\r\n" -" #\r\n" -" # Sample \r\n" -" #\r\n" -" UEFI Basic Shell v2.0\r\n" -" Copyright 2008 by Intel(R) Corporation.\r\n" -" UEFI v2.31 (Intel(R) Corporation., 0x00010100)\r\n" -" \r\n" -" 3. UEFI version tag information:\r\n" -" \r\n" -" 0 = Minimal\r\n" -" 1 = Scripting\r\n" -" 2 = Basic\r\n" -" 3 = Interactive\r\n" -" \r\n" -" Comes from the Shell specification upon which the Shell\r\n" -" implementation is based.\r\n" -" \r\n" -" Build, copyright, etc.\r\n" -" \r\n" -" Comes from the UEFI specification upon which the firmware\r\n" -" implementation is based\r\n" -" \r\n" -" Indicates Vendor Name\r\n" -" \r\n" -" Indicates Vendor's firmware version\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To display UEFI Firmware version information:\r\n" -" fs0:\> ver\r\n" -" \r\n" -" * To display UEFI Shell version information only:\r\n" -" Shell> ver -s\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c deleted file mode 100644 index da43d7d..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c +++ /dev/null @@ -1,153 +0,0 @@ -/** @file - Main file for Ver shell level 3 function. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLevel3CommandsLib.h" - -#include - -STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-s", TypeFlag}, - {L"-terse", TypeFlag}, - {L"-t", TypeFlag}, - {L"-_pa", TypeFlag}, - {NULL, TypeMax} - }; - -/** - Function for 'ver' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunVer ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - LIST_ENTRY *Package; - CHAR16 *ProblemParam; - SHELL_STATUS ShellStatus; - UINT8 Level; - - Level = PcdGet8(PcdShellSupportLevel); - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - - // - // initialize the shell lib (we must be in non-auto-init...) - // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); - - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); - - // - // parse the command line - // - Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"ver", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - } else { - // - // check for "-?" - // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } - if (ShellCommandLineGetRawValue(Package, 1) != NULL) { - // - // we have too many parameters - // - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"ver"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetFlag(Package, L"-s")) { - if (ShellCommandLineGetFlag(Package, L"-terse") || ShellCommandLineGetFlag(Package, L"-t")){ - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel3HiiHandle, L"ver", L"-t or -terse", L"-s"); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_SIMPLE), - gShellLevel3HiiHandle, - gEfiShellProtocol->MajorVersion, - gEfiShellProtocol->MinorVersion - ); - } - } else { - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_SHELL), - gShellLevel3HiiHandle, - SupportLevel[Level], - gEfiShellProtocol->MajorVersion, - gEfiShellProtocol->MinorVersion - ); - if (!ShellCommandLineGetFlag(Package, L"-terse") && !ShellCommandLineGetFlag(Package, L"-t")){ - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER), - gShellLevel3HiiHandle, - (CHAR16 *) PcdGetPtr (PcdShellSupplier) - ); - - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_UEFI), - gShellLevel3HiiHandle, - (gST->Hdr.Revision&0xffff0000)>>16, - (gST->Hdr.Revision&0x0000ffff), - gST->FirmwareVendor, - gST->FirmwareRevision - ); - } - } - // - // implementation specific support for displaying processor architecture - // - if (ShellCommandLineGetFlag(Package, L"-_pa")) { - ShellPrintEx(-1, -1, L"%d\r\n", sizeof(UINTN)==sizeof(UINT64)?64:32); - } - } - - // - // free the command line package - // - ShellCommandLineFreeVarList (Package); - } - - return (ShellStatus); -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c deleted file mode 100644 index 8cff0ed..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ /dev/null @@ -1,4375 +0,0 @@ -/** @file - Provides interface to shell functionality for shell commands and applications. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- Copyright 2016-2018 Dell Technologies.
- Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellLib.h" -#include -#include - -// -// globals... -// -SHELL_PARAM_ITEM EmptyParamList[] = { - {NULL, TypeMax} - }; -SHELL_PARAM_ITEM SfoParamList[] = { - {L"-sfo", TypeFlag}, - {NULL, TypeMax} - }; -EFI_SHELL_ENVIRONMENT2 *mEfiShellEnvironment2; -EFI_SHELL_INTERFACE *mEfiShellInterface; -EFI_SHELL_PROTOCOL *gEfiShellProtocol; -EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol; -EFI_HANDLE mEfiShellEnvironment2Handle; -FILE_HANDLE_FUNCTION_MAP FileFunctionMap; -EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol; - -/** - Return a clean, fully-qualified version of an input path. If the return value - is non-NULL the caller must free the memory when it is no longer needed. - - If asserts are disabled, and if the input parameter is NULL, NULL is returned. - - If there is not enough memory available to create the fully-qualified path or - a copy of the input path, NULL is returned. - - If there is no working directory, a clean copy of Path is returned. - - Otherwise, the current file system or working directory (as appropriate) is - prepended to Path and the resulting path is cleaned and returned. - - NOTE: If the input path is an empty string, then the current working directory - (if it exists) is returned. In other words, an empty input path is treated - exactly the same as ".". - - @param[in] Path A pointer to some file or directory path. - - @retval NULL The input path is NULL or out of memory. - - @retval non-NULL A pointer to a clean, fully-qualified version of Path. - If there is no working directory, then a pointer to a - clean, but not necessarily fully-qualified version of - Path. The caller must free this memory when it is no - longer needed. -**/ -CHAR16* -EFIAPI -FullyQualifyPath( - IN CONST CHAR16 *Path - ) -{ - CONST CHAR16 *WorkingPath; - CONST CHAR16 *InputPath; - CHAR16 *CharPtr; - CHAR16 *InputFileSystem; - UINTN FileSystemCharCount; - CHAR16 *FullyQualifiedPath; - UINTN Size; - - FullyQualifiedPath = NULL; - - ASSERT(Path != NULL); - // - // Handle erroneous input when asserts are disabled. - // - if (Path == NULL) { - return NULL; - } - // - // In paths that contain ":", like fs0:dir/file.ext and fs2:\fqpath\file.ext, - // we have to consider the file system part separately from the "path" part. - // If there is a file system in the path, we have to get the current working - // directory for that file system. Then we need to use the part of the path - // following the ":". If a path does not contain ":", we use it as given. - // - InputPath = StrStr(Path, L":"); - if (InputPath != NULL) { - InputPath++; - FileSystemCharCount = ((UINTN)InputPath - (UINTN)Path + sizeof(CHAR16)) / sizeof(CHAR16); - InputFileSystem = AllocateCopyPool(FileSystemCharCount * sizeof(CHAR16), Path); - if (InputFileSystem != NULL) { - InputFileSystem[FileSystemCharCount - 1] = CHAR_NULL; - } - WorkingPath = ShellGetCurrentDir(InputFileSystem); - SHELL_FREE_NON_NULL(InputFileSystem); - } else { - InputPath = Path; - WorkingPath = ShellGetEnvironmentVariable(L"cwd"); - } - - if (WorkingPath == NULL) { - // - // With no working directory, all we can do is copy and clean the input path. - // - FullyQualifiedPath = AllocateCopyPool(StrSize(Path), Path); - } else { - // - // Allocate space for both strings plus one more character. - // - Size = StrSize(WorkingPath) + StrSize(InputPath); - FullyQualifiedPath = AllocateZeroPool(Size); - if (FullyQualifiedPath == NULL) { - // - // Try to copy and clean just the input. No harm if not enough memory. - // - FullyQualifiedPath = AllocateCopyPool(StrSize(Path), Path); - } else { - if (*InputPath == L'\\' || *InputPath == L'/') { - // - // Absolute path: start with the current working directory, then - // truncate the new path after the file system part. - // - StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath); - CharPtr = StrStr(FullyQualifiedPath, L":"); - if (CharPtr != NULL) { - *(CharPtr + 1) = CHAR_NULL; - } - } else { - // - // Relative path: start with the working directory and append "\". - // - StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath); - StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), L"\\"); - } - // - // Now append the absolute or relative path. - // - StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), InputPath); - } - } - - PathCleanUpDirectories(FullyQualifiedPath); - - return FullyQualifiedPath; -} - -/** - Check if a Unicode character is a hexadecimal character. - - This internal function checks if a Unicode character is a - numeric character. The valid hexadecimal characters are - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -ShellIsHexaDecimalDigitCharacter ( - IN CHAR16 Char - ) -{ - return (BOOLEAN) ((Char >= L'0' && Char <= L'9') || (Char >= L'A' && Char <= L'F') || (Char >= L'a' && Char <= L'f')); -} - -/** - Check if a Unicode character is a decimal character. - - This internal function checks if a Unicode character is a - decimal character. The valid characters are - L'0' to L'9'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -ShellIsDecimalDigitCharacter ( - IN CHAR16 Char - ) -{ - return (BOOLEAN) (Char >= L'0' && Char <= L'9'); -} - -/** - Helper function to find ShellEnvironment2 for constructor. - - @param[in] ImageHandle A copy of the calling image's handle. - - @retval EFI_OUT_OF_RESOURCES Memory allocation failed. -**/ -EFI_STATUS -ShellFindSE2 ( - IN EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - EFI_HANDLE *Buffer; - UINTN BufferSize; - UINTN HandleIndex; - - BufferSize = 0; - Buffer = NULL; - Status = gBS->OpenProtocol(ImageHandle, - &gEfiShellEnvironment2Guid, - (VOID **)&mEfiShellEnvironment2, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - // - // look for the mEfiShellEnvironment2 protocol at a higher level - // - if (EFI_ERROR (Status) || !(CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid))){ - // - // figure out how big of a buffer we need. - // - Status = gBS->LocateHandle (ByProtocol, - &gEfiShellEnvironment2Guid, - NULL, // ignored for ByProtocol - &BufferSize, - Buffer - ); - // - // maybe it's not there??? - // - if (Status == EFI_BUFFER_TOO_SMALL) { - Buffer = (EFI_HANDLE*)AllocateZeroPool(BufferSize); - if (Buffer == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - Status = gBS->LocateHandle (ByProtocol, - &gEfiShellEnvironment2Guid, - NULL, // ignored for ByProtocol - &BufferSize, - Buffer - ); - } - if (!EFI_ERROR (Status) && Buffer != NULL) { - // - // now parse the list of returned handles - // - Status = EFI_NOT_FOUND; - for (HandleIndex = 0; HandleIndex < (BufferSize/sizeof(Buffer[0])); HandleIndex++) { - Status = gBS->OpenProtocol(Buffer[HandleIndex], - &gEfiShellEnvironment2Guid, - (VOID **)&mEfiShellEnvironment2, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid)) { - mEfiShellEnvironment2Handle = Buffer[HandleIndex]; - Status = EFI_SUCCESS; - break; - } - } - } - } - if (Buffer != NULL) { - FreePool (Buffer); - } - return (Status); -} - -/** - Function to do most of the work of the constructor. Allows for calling - multiple times without complete re-initialization. - - @param[in] ImageHandle A copy of the ImageHandle. - @param[in] SystemTable A pointer to the SystemTable for the application. - - @retval EFI_SUCCESS The operationw as successful. -**/ -EFI_STATUS -ShellLibConstructorWorker ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - if (gEfiShellProtocol == NULL) { - // - // UEFI 2.0 shell interfaces (used preferentially) - // - Status = gBS->OpenProtocol ( - ImageHandle, - &gEfiShellProtocolGuid, - (VOID **)&gEfiShellProtocol, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - // - // Search for the shell protocol - // - Status = gBS->LocateProtocol ( - &gEfiShellProtocolGuid, - NULL, - (VOID **)&gEfiShellProtocol - ); - if (EFI_ERROR (Status)) { - gEfiShellProtocol = NULL; - } - } - } - - if (gEfiShellParametersProtocol == NULL) { - Status = gBS->OpenProtocol ( - ImageHandle, - &gEfiShellParametersProtocolGuid, - (VOID **)&gEfiShellParametersProtocol, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - gEfiShellParametersProtocol = NULL; - } - } - - if (gEfiShellProtocol == NULL) { - // - // Moved to seperate function due to complexity - // - Status = ShellFindSE2(ImageHandle); - - if (EFI_ERROR(Status)) { - DEBUG((DEBUG_ERROR, "Status: 0x%08x\r\n", Status)); - mEfiShellEnvironment2 = NULL; - } - Status = gBS->OpenProtocol(ImageHandle, - &gEfiShellInterfaceGuid, - (VOID **)&mEfiShellInterface, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR(Status)) { - mEfiShellInterface = NULL; - } - } - - // - // Getting either EDK Shell's ShellEnvironment2 and ShellInterface protocol - // or UEFI Shell's Shell protocol. - // When ShellLib is linked to a driver producing DynamicCommand protocol, - // ShellParameters protocol is set by DynamicCommand.Handler(). - // - if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) || - (gEfiShellProtocol != NULL) - ) { - if (gEfiShellProtocol != NULL) { - FileFunctionMap.GetFileInfo = gEfiShellProtocol->GetFileInfo; - FileFunctionMap.SetFileInfo = gEfiShellProtocol->SetFileInfo; - FileFunctionMap.ReadFile = gEfiShellProtocol->ReadFile; - FileFunctionMap.WriteFile = gEfiShellProtocol->WriteFile; - FileFunctionMap.CloseFile = gEfiShellProtocol->CloseFile; - FileFunctionMap.DeleteFile = gEfiShellProtocol->DeleteFile; - FileFunctionMap.GetFilePosition = gEfiShellProtocol->GetFilePosition; - FileFunctionMap.SetFilePosition = gEfiShellProtocol->SetFilePosition; - FileFunctionMap.FlushFile = gEfiShellProtocol->FlushFile; - FileFunctionMap.GetFileSize = gEfiShellProtocol->GetFileSize; - } else { - FileFunctionMap.GetFileInfo = (EFI_SHELL_GET_FILE_INFO)FileHandleGetInfo; - FileFunctionMap.SetFileInfo = (EFI_SHELL_SET_FILE_INFO)FileHandleSetInfo; - FileFunctionMap.ReadFile = (EFI_SHELL_READ_FILE)FileHandleRead; - FileFunctionMap.WriteFile = (EFI_SHELL_WRITE_FILE)FileHandleWrite; - FileFunctionMap.CloseFile = (EFI_SHELL_CLOSE_FILE)FileHandleClose; - FileFunctionMap.DeleteFile = (EFI_SHELL_DELETE_FILE)FileHandleDelete; - FileFunctionMap.GetFilePosition = (EFI_SHELL_GET_FILE_POSITION)FileHandleGetPosition; - FileFunctionMap.SetFilePosition = (EFI_SHELL_SET_FILE_POSITION)FileHandleSetPosition; - FileFunctionMap.FlushFile = (EFI_SHELL_FLUSH_FILE)FileHandleFlush; - FileFunctionMap.GetFileSize = (EFI_SHELL_GET_FILE_SIZE)FileHandleGetSize; - } - return (EFI_SUCCESS); - } - return (EFI_NOT_FOUND); -} -/** - Constructor for the Shell library. - - Initialize the library and determine if the underlying is a UEFI Shell 2.0 or an EFI shell. - - @param ImageHandle the image handle of the process - @param SystemTable the EFI System Table pointer - - @retval EFI_SUCCESS the initialization was complete sucessfully - @return others an error ocurred during initialization -**/ -EFI_STATUS -EFIAPI -ShellLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - mEfiShellEnvironment2 = NULL; - gEfiShellProtocol = NULL; - gEfiShellParametersProtocol = NULL; - mEfiShellInterface = NULL; - mEfiShellEnvironment2Handle = NULL; - mUnicodeCollationProtocol = NULL; - - // - // verify that auto initialize is not set false - // - if (PcdGetBool(PcdShellLibAutoInitialize) == 0) { - return (EFI_SUCCESS); - } - - return (ShellLibConstructorWorker(ImageHandle, SystemTable)); -} - -/** - Destructor for the library. free any resources. - - @param[in] ImageHandle A copy of the ImageHandle. - @param[in] SystemTable A pointer to the SystemTable for the application. - - @retval EFI_SUCCESS The operation was successful. - @return An error from the CloseProtocol function. -**/ -EFI_STATUS -EFIAPI -ShellLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - if (mEfiShellEnvironment2 != NULL) { - Status = gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle, - &gEfiShellEnvironment2Guid, - ImageHandle, - NULL); - if (!EFI_ERROR (Status)) { - mEfiShellEnvironment2 = NULL; - mEfiShellEnvironment2Handle = NULL; - } - } - if (mEfiShellInterface != NULL) { - Status = gBS->CloseProtocol(ImageHandle, - &gEfiShellInterfaceGuid, - ImageHandle, - NULL); - if (!EFI_ERROR (Status)) { - mEfiShellInterface = NULL; - } - } - if (gEfiShellProtocol != NULL) { - Status = gBS->CloseProtocol(ImageHandle, - &gEfiShellProtocolGuid, - ImageHandle, - NULL); - if (!EFI_ERROR (Status)) { - gEfiShellProtocol = NULL; - } - } - if (gEfiShellParametersProtocol != NULL) { - Status = gBS->CloseProtocol(ImageHandle, - &gEfiShellParametersProtocolGuid, - ImageHandle, - NULL); - if (!EFI_ERROR (Status)) { - gEfiShellParametersProtocol = NULL; - } - } - - return (EFI_SUCCESS); -} - -/** - This function causes the shell library to initialize itself. If the shell library - is already initialized it will de-initialize all the current protocol poitners and - re-populate them again. - - When the library is used with PcdShellLibAutoInitialize set to true this function - will return EFI_SUCCESS and perform no actions. - - This function is intended for internal access for shell commands only. - - @retval EFI_SUCCESS the initialization was complete sucessfully - -**/ -EFI_STATUS -EFIAPI -ShellInitialize ( - VOID - ) -{ - EFI_STATUS Status; - - // - // if auto initialize is not false then skip - // - if (PcdGetBool(PcdShellLibAutoInitialize) != 0) { - return (EFI_SUCCESS); - } - - // - // deinit the current stuff - // - Status = ShellLibDestructor (gImageHandle, gST); - ASSERT_EFI_ERROR (Status); - - // - // init the new stuff - // - return (ShellLibConstructorWorker(gImageHandle, gST)); -} - -/** - This function will retrieve the information about the file for the handle - specified and store it in allocated pool memory. - - This function allocates a buffer to store the file's information. It is the - caller's responsibility to free the buffer - - @param FileHandle The file handle of the file for which information is - being requested. - - @retval NULL information could not be retrieved. - - @return the information about the file -**/ -EFI_FILE_INFO* -EFIAPI -ShellGetFileInfo ( - IN SHELL_FILE_HANDLE FileHandle - ) -{ - return (FileFunctionMap.GetFileInfo(FileHandle)); -} - -/** - This function sets the information about the file for the opened handle - specified. - - @param[in] FileHandle The file handle of the file for which information - is being set. - - @param[in] FileInfo The information to set. - - @retval EFI_SUCCESS The information was set. - @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid. - @retval EFI_UNSUPPORTED The FileHandle does not support FileInfo. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -ShellSetFileInfo ( - IN SHELL_FILE_HANDLE FileHandle, - IN EFI_FILE_INFO *FileInfo - ) -{ - return (FileFunctionMap.SetFileInfo(FileHandle, FileInfo)); -} - - /** - This function will open a file or directory referenced by DevicePath. - - This function opens a file with the open mode according to the file path. The - Attributes is valid only for EFI_FILE_MODE_CREATE. - - @param FilePath on input the device path to the file. On output - the remaining device path. - @param FileHandle pointer to the file handle. - @param OpenMode the mode to open the file with. - @param Attributes the file's file attributes. - - @retval EFI_SUCCESS The information was set. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED Could not open the file path. - @retval EFI_NOT_FOUND The specified file could not be found on the - device or the file system could not be found on - the device. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the - medium is no longer supported. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the - file. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -ShellOpenFileByDevicePath( - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode, - IN UINT64 Attributes - ) -{ - CHAR16 *FileName; - EFI_STATUS Status; - EFI_FILE_PROTOCOL *File; - - if (FilePath == NULL || FileHandle == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // which shell interface should we use - // - if (gEfiShellProtocol != NULL) { - // - // use UEFI Shell 2.0 method. - // - FileName = gEfiShellProtocol->GetFilePathFromDevicePath(*FilePath); - if (FileName == NULL) { - return (EFI_INVALID_PARAMETER); - } - Status = ShellOpenFileByName(FileName, FileHandle, OpenMode, Attributes); - FreePool(FileName); - return (Status); - } - - - // - // use old shell method. - // - Status = EfiOpenFileByDevicePath (FilePath, &File, OpenMode, Attributes); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // This is a weak spot since if the undefined SHELL_FILE_HANDLE format changes this must change also! - // - *FileHandle = (VOID*)File; - return (EFI_SUCCESS); -} - -/** - This function will open a file or directory referenced by filename. - - If return is EFI_SUCCESS, the Filehandle is the opened file's handle; - otherwise, the Filehandle is NULL. The Attributes is valid only for - EFI_FILE_MODE_CREATE. - - if FileName is NULL then ASSERT() - - @param FileName pointer to file name - @param FileHandle pointer to the file handle. - @param OpenMode the mode to open the file with. - @param Attributes the file's file attributes. - - @retval EFI_SUCCESS The information was set. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED Could not open the file path. - @retval EFI_NOT_FOUND The specified file could not be found on the - device or the file system could not be found - on the device. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the - medium is no longer supported. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the - file. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -ShellOpenFileByName( - IN CONST CHAR16 *FileName, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode, - IN UINT64 Attributes - ) -{ - EFI_DEVICE_PATH_PROTOCOL *FilePath; - EFI_STATUS Status; - EFI_FILE_INFO *FileInfo; - CHAR16 *FileNameCopy; - EFI_STATUS Status2; - - // - // ASSERT if FileName is NULL - // - ASSERT(FileName != NULL); - - if (FileName == NULL) { - return (EFI_INVALID_PARAMETER); - } - - if (gEfiShellProtocol != NULL) { - if ((OpenMode & EFI_FILE_MODE_CREATE) == EFI_FILE_MODE_CREATE) { - - // - // Create only a directory - // - if ((Attributes & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { - return ShellCreateDirectory(FileName, FileHandle); - } - - // - // Create the directory to create the file in - // - FileNameCopy = AllocateCopyPool (StrSize (FileName), FileName); - if (FileNameCopy == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - PathCleanUpDirectories (FileNameCopy); - if (PathRemoveLastItem (FileNameCopy)) { - if (!EFI_ERROR(ShellCreateDirectory (FileNameCopy, FileHandle))) { - ShellCloseFile (FileHandle); - } - } - SHELL_FREE_NON_NULL (FileNameCopy); - } - - // - // Use UEFI Shell 2.0 method to create the file - // - Status = gEfiShellProtocol->OpenFileByName(FileName, - FileHandle, - OpenMode); - if (EFI_ERROR(Status)) { - return Status; - } - - if (mUnicodeCollationProtocol == NULL) { - Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol); - if (EFI_ERROR (Status)) { - gEfiShellProtocol->CloseFile (*FileHandle); - return Status; - } - } - - if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NUL") != 0) && - (mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NULL") != 0) && - !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){ - FileInfo = FileFunctionMap.GetFileInfo(*FileHandle); - ASSERT(FileInfo != NULL); - FileInfo->Attribute = Attributes; - Status2 = FileFunctionMap.SetFileInfo(*FileHandle, FileInfo); - FreePool(FileInfo); - if (EFI_ERROR (Status2)) { - gEfiShellProtocol->CloseFile(*FileHandle); - } - Status = Status2; - } - return (Status); - } - // - // Using EFI Shell version - // this means convert name to path and call that function - // since this will use EFI method again that will open it. - // - ASSERT(mEfiShellEnvironment2 != NULL); - FilePath = mEfiShellEnvironment2->NameToPath ((CHAR16*)FileName); - if (FilePath != NULL) { - return (ShellOpenFileByDevicePath(&FilePath, - FileHandle, - OpenMode, - Attributes)); - } - return (EFI_DEVICE_ERROR); -} -/** - This function create a directory - - If return is EFI_SUCCESS, the Filehandle is the opened directory's handle; - otherwise, the Filehandle is NULL. If the directory already existed, this - function opens the existing directory. - - @param DirectoryName pointer to directory name - @param FileHandle pointer to the file handle. - - @retval EFI_SUCCESS The information was set. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED Could not open the file path. - @retval EFI_NOT_FOUND The specified file could not be found on the - device or the file system could not be found - on the device. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the - medium is no longer supported. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the - file. - @retval EFI_VOLUME_FULL The volume is full. - @sa ShellOpenFileByName -**/ -EFI_STATUS -EFIAPI -ShellCreateDirectory( - IN CONST CHAR16 *DirectoryName, - OUT SHELL_FILE_HANDLE *FileHandle - ) -{ - if (gEfiShellProtocol != NULL) { - // - // Use UEFI Shell 2.0 method - // - return (gEfiShellProtocol->CreateFile(DirectoryName, - EFI_FILE_DIRECTORY, - FileHandle - )); - } else { - return (ShellOpenFileByName(DirectoryName, - FileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, - EFI_FILE_DIRECTORY - )); - } -} - -/** - This function reads information from an opened file. - - If FileHandle is not a directory, the function reads the requested number of - bytes from the file at the file's current position and returns them in Buffer. - If the read goes beyond the end of the file, the read length is truncated to the - end of the file. The file's current position is increased by the number of bytes - returned. If FileHandle is a directory, the function reads the directory entry - at the file's current position and returns the entry in Buffer. If the Buffer - is not large enough to hold the current directory entry, then - EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated. - BufferSize is set to be the size of the buffer needed to read the entry. On - success, the current position is updated to the next directory entry. If there - are no more directory entries, the read returns a zero-length buffer. - EFI_FILE_INFO is the structure returned as the directory entry. - - @param FileHandle the opened file handle - @param BufferSize on input the size of buffer in bytes. on return - the number of bytes written. - @param Buffer the buffer to put read data into. - - @retval EFI_SUCCESS Data was read. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required - size. - -**/ -EFI_STATUS -EFIAPI -ShellReadFile( - IN SHELL_FILE_HANDLE FileHandle, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ) -{ - return (FileFunctionMap.ReadFile(FileHandle, BufferSize, Buffer)); -} - - -/** - Write data to a file. - - This function writes the specified number of bytes to the file at the current - file position. The current file position is advanced the actual number of bytes - written, which is returned in BufferSize. Partial writes only occur when there - has been a data error during the write attempt (such as "volume space full"). - The file is automatically grown to hold the data if required. Direct writes to - opened directories are not supported. - - @param FileHandle The opened file for writing - @param BufferSize on input the number of bytes in Buffer. On output - the number of bytes written. - @param Buffer the buffer containing data to write is stored. - - @retval EFI_SUCCESS Data was written. - @retval EFI_UNSUPPORTED Writes to an open directory are not supported. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The device is write-protected. - @retval EFI_ACCESS_DENIED The file was open for read only. - @retval EFI_VOLUME_FULL The volume is full. -**/ -EFI_STATUS -EFIAPI -ShellWriteFile( - IN SHELL_FILE_HANDLE FileHandle, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ) -{ - return (FileFunctionMap.WriteFile(FileHandle, BufferSize, Buffer)); -} - -/** - Close an open file handle. - - This function closes a specified file handle. All "dirty" cached file data is - flushed to the device, and the file is closed. In all cases the handle is - closed. - -@param FileHandle the file handle to close. - -@retval EFI_SUCCESS the file handle was closed sucessfully. -**/ -EFI_STATUS -EFIAPI -ShellCloseFile ( - IN SHELL_FILE_HANDLE *FileHandle - ) -{ - return (FileFunctionMap.CloseFile(*FileHandle)); -} - -/** - Delete a file and close the handle - - This function closes and deletes a file. In all cases the file handle is closed. - If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is - returned, but the handle is still closed. - - @param FileHandle the file handle to delete - - @retval EFI_SUCCESS the file was closed sucessfully - @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not - deleted - @retval INVALID_PARAMETER One of the parameters has an invalid value. -**/ -EFI_STATUS -EFIAPI -ShellDeleteFile ( - IN SHELL_FILE_HANDLE *FileHandle - ) -{ - return (FileFunctionMap.DeleteFile(*FileHandle)); -} - -/** - Set the current position in a file. - - This function sets the current file position for the handle to the position - supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only - absolute positioning is supported, and seeking past the end of the file is - allowed (a subsequent write would grow the file). Seeking to position - 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file. - If FileHandle is a directory, the only position that may be set is zero. This - has the effect of starting the read process of the directory entries over. - - @param FileHandle The file handle on which the position is being set - @param Position Byte position from begining of file - - @retval EFI_SUCCESS Operation completed sucessfully. - @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on - directories. - @retval INVALID_PARAMETER One of the parameters has an invalid value. -**/ -EFI_STATUS -EFIAPI -ShellSetFilePosition ( - IN SHELL_FILE_HANDLE FileHandle, - IN UINT64 Position - ) -{ - return (FileFunctionMap.SetFilePosition(FileHandle, Position)); -} - -/** - Gets a file's current position - - This function retrieves the current file position for the file handle. For - directories, the current file position has no meaning outside of the file - system driver and as such the operation is not supported. An error is returned - if FileHandle is a directory. - - @param FileHandle The open file handle on which to get the position. - @param Position Byte position from begining of file. - - @retval EFI_SUCCESS the operation completed sucessfully. - @retval INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED the request is not valid on directories. -**/ -EFI_STATUS -EFIAPI -ShellGetFilePosition ( - IN SHELL_FILE_HANDLE FileHandle, - OUT UINT64 *Position - ) -{ - return (FileFunctionMap.GetFilePosition(FileHandle, Position)); -} -/** - Flushes data on a file - - This function flushes all modified data associated with a file to a device. - - @param FileHandle The file handle on which to flush data - - @retval EFI_SUCCESS The data was flushed. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened for read only. -**/ -EFI_STATUS -EFIAPI -ShellFlushFile ( - IN SHELL_FILE_HANDLE FileHandle - ) -{ - return (FileFunctionMap.FlushFile(FileHandle)); -} - -/** Retrieve first entry from a directory. - - This function takes an open directory handle and gets information from the - first entry in the directory. A buffer is allocated to contain - the information and a pointer to the buffer is returned in *Buffer. The - caller can use ShellFindNextFile() to get subsequent directory entries. - - The buffer will be freed by ShellFindNextFile() when the last directory - entry is read. Otherwise, the caller must free the buffer, using FreePool, - when finished with it. - - @param[in] DirHandle The file handle of the directory to search. - @param[out] Buffer The pointer to the buffer for the file's information. - - @retval EFI_SUCCESS Found the first file. - @retval EFI_NOT_FOUND Cannot find the directory. - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @return Others status of ShellGetFileInfo, ShellSetFilePosition, - or ShellReadFile -**/ -EFI_STATUS -EFIAPI -ShellFindFirstFile ( - IN SHELL_FILE_HANDLE DirHandle, - OUT EFI_FILE_INFO **Buffer - ) -{ - // - // pass to file handle lib - // - return (FileHandleFindFirstFile(DirHandle, Buffer)); -} -/** Retrieve next entries from a directory. - - To use this function, the caller must first call the ShellFindFirstFile() - function to get the first directory entry. Subsequent directory entries are - retrieved by using the ShellFindNextFile() function. This function can - be called several times to get each entry from the directory. If the call of - ShellFindNextFile() retrieved the last directory entry, the next call of - this function will set *NoFile to TRUE and free the buffer. - - @param[in] DirHandle The file handle of the directory. - @param[out] Buffer The pointer to buffer for file's information. - @param[out] NoFile The pointer to boolean when last file is found. - - @retval EFI_SUCCESS Found the next file, or reached last file - @retval EFI_NO_MEDIA The device has no media. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. -**/ -EFI_STATUS -EFIAPI -ShellFindNextFile( - IN SHELL_FILE_HANDLE DirHandle, - OUT EFI_FILE_INFO *Buffer, - OUT BOOLEAN *NoFile - ) -{ - // - // pass to file handle lib - // - return (FileHandleFindNextFile(DirHandle, Buffer, NoFile)); -} -/** - Retrieve the size of a file. - - if FileHandle is NULL then ASSERT() - if Size is NULL then ASSERT() - - This function extracts the file size info from the FileHandle's EFI_FILE_INFO - data. - - @param FileHandle file handle from which size is retrieved - @param Size pointer to size - - @retval EFI_SUCCESS operation was completed sucessfully - @retval EFI_DEVICE_ERROR cannot access the file -**/ -EFI_STATUS -EFIAPI -ShellGetFileSize ( - IN SHELL_FILE_HANDLE FileHandle, - OUT UINT64 *Size - ) -{ - return (FileFunctionMap.GetFileSize(FileHandle, Size)); -} -/** - Retrieves the status of the break execution flag - - this function is useful to check whether the application is being asked to halt by the shell. - - @retval TRUE the execution break is enabled - @retval FALSE the execution break is not enabled -**/ -BOOLEAN -EFIAPI -ShellGetExecutionBreakFlag( - VOID - ) -{ - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - - // - // We are using UEFI Shell 2.0; see if the event has been triggered - // - if (gBS->CheckEvent(gEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) { - return (FALSE); - } - return (TRUE); - } - - // - // using EFI Shell; call the function to check - // - if (mEfiShellEnvironment2 != NULL) { - return (mEfiShellEnvironment2->GetExecutionBreak()); - } - - return (FALSE); -} -/** - return the value of an environment variable - - this function gets the value of the environment variable set by the - ShellSetEnvironmentVariable function - - @param EnvKey The key name of the environment variable. - - @retval NULL the named environment variable does not exist. - @return != NULL pointer to the value of the environment variable -**/ -CONST CHAR16* -EFIAPI -ShellGetEnvironmentVariable ( - IN CONST CHAR16 *EnvKey - ) -{ - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - return (gEfiShellProtocol->GetEnv(EnvKey)); - } - - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - return (mEfiShellEnvironment2->GetEnv((CHAR16*)EnvKey)); - } - - return NULL; -} -/** - set the value of an environment variable - -This function changes the current value of the specified environment variable. If the -environment variable exists and the Value is an empty string, then the environment -variable is deleted. If the environment variable exists and the Value is not an empty -string, then the value of the environment variable is changed. If the environment -variable does not exist and the Value is an empty string, there is no action. If the -environment variable does not exist and the Value is a non-empty string, then the -environment variable is created and assigned the specified value. - - This is not supported pre-UEFI Shell 2.0. - - @param EnvKey The key name of the environment variable. - @param EnvVal The Value of the environment variable - @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE). - - @retval EFI_SUCCESS the operation was completed sucessfully - @retval EFI_UNSUPPORTED This operation is not allowed in pre UEFI 2.0 Shell environments -**/ -EFI_STATUS -EFIAPI -ShellSetEnvironmentVariable ( - IN CONST CHAR16 *EnvKey, - IN CONST CHAR16 *EnvVal, - IN BOOLEAN Volatile - ) -{ - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - return (gEfiShellProtocol->SetEnv(EnvKey, EnvVal, Volatile)); - } - - // - // This feature does not exist under EFI shell - // - return (EFI_UNSUPPORTED); -} - -/** - Cause the shell to parse and execute a command line. - - This function creates a nested instance of the shell and executes the specified - command (CommandLine) with the specified environment (Environment). Upon return, - the status code returned by the specified command is placed in StatusCode. - If Environment is NULL, then the current environment is used and all changes made - by the commands executed will be reflected in the current environment. If the - Environment is non-NULL, then the changes made will be discarded. - The CommandLine is executed from the current working directory on the current - device. - - The EnvironmentVariables pararemeter is ignored in a pre-UEFI Shell 2.0 - environment. The values pointed to by the parameters will be unchanged by the - ShellExecute() function. The Output parameter has no effect in a - UEFI Shell 2.0 environment. - - @param[in] ParentHandle The parent image starting the operation. - @param[in] CommandLine The pointer to a NULL terminated command line. - @param[in] Output True to display debug output. False to hide it. - @param[in] EnvironmentVariables Optional pointer to array of environment variables - in the form "x=y". If NULL, the current set is used. - @param[out] Status The status of the run command line. - - @retval EFI_SUCCESS The operation completed sucessfully. Status - contains the status code returned. - @retval EFI_INVALID_PARAMETER A parameter contains an invalid value. - @retval EFI_OUT_OF_RESOURCES Out of resources. - @retval EFI_UNSUPPORTED The operation is not allowed. -**/ -EFI_STATUS -EFIAPI -ShellExecute ( - IN EFI_HANDLE *ParentHandle, - IN CHAR16 *CommandLine OPTIONAL, - IN BOOLEAN Output OPTIONAL, - IN CHAR16 **EnvironmentVariables OPTIONAL, - OUT EFI_STATUS *Status OPTIONAL - ) -{ - EFI_STATUS CmdStatus; - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - // - // Call UEFI Shell 2.0 version (not using Output parameter) - // - return (gEfiShellProtocol->Execute(ParentHandle, - CommandLine, - EnvironmentVariables, - Status)); - } - - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - // - // Call EFI Shell version. - // Due to oddity in the EFI shell we want to dereference the ParentHandle here - // - CmdStatus = (mEfiShellEnvironment2->Execute(*ParentHandle, - CommandLine, - Output)); - // - // No Status output parameter so just use the returned status - // - if (Status != NULL) { - *Status = CmdStatus; - } - // - // If there was an error, we can't tell if it was from the command or from - // the Execute() function, so we'll just assume the shell ran successfully - // and the error came from the command. - // - return EFI_SUCCESS; - } - - return (EFI_UNSUPPORTED); -} - -/** - Retreives the current directory path - - If the DeviceName is NULL, it returns the current device's current directory - name. If the DeviceName is not NULL, it returns the current directory name - on specified drive. - - Note that the current directory string should exclude the tailing backslash character. - - @param DeviceName the name of the drive to get directory on - - @retval NULL the directory does not exist - @return != NULL the directory -**/ -CONST CHAR16* -EFIAPI -ShellGetCurrentDir ( - IN CHAR16 * CONST DeviceName OPTIONAL - ) -{ - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - return (gEfiShellProtocol->GetCurDir(DeviceName)); - } - - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - return (mEfiShellEnvironment2->CurDir(DeviceName)); - } - - return (NULL); -} -/** - sets (enabled or disabled) the page break mode - - when page break mode is enabled the screen will stop scrolling - and wait for operator input before scrolling a subsequent screen. - - @param CurrentState TRUE to enable and FALSE to disable -**/ -VOID -EFIAPI -ShellSetPageBreakMode ( - IN BOOLEAN CurrentState - ) -{ - // - // check for enabling - // - if (CurrentState != 0x00) { - // - // check for UEFI Shell 2.0 - // - if (gEfiShellProtocol != NULL) { - // - // Enable with UEFI 2.0 Shell - // - gEfiShellProtocol->EnablePageBreak(); - return; - } else { - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - // - // Enable with EFI Shell - // - mEfiShellEnvironment2->EnablePageBreak (DEFAULT_INIT_ROW, DEFAULT_AUTO_LF); - return; - } - } - } else { - // - // check for UEFI Shell 2.0 - // - if (gEfiShellProtocol != NULL) { - // - // Disable with UEFI 2.0 Shell - // - gEfiShellProtocol->DisablePageBreak(); - return; - } else { - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - // - // Disable with EFI Shell - // - mEfiShellEnvironment2->DisablePageBreak (); - return; - } - } - } -} - -/// -/// version of EFI_SHELL_FILE_INFO struct, except has no CONST pointers. -/// This allows for the struct to be populated. -/// -typedef struct { - LIST_ENTRY Link; - EFI_STATUS Status; - CHAR16 *FullName; - CHAR16 *FileName; - SHELL_FILE_HANDLE Handle; - EFI_FILE_INFO *Info; -} EFI_SHELL_FILE_INFO_NO_CONST; - -/** - Converts a EFI shell list of structures to the coresponding UEFI Shell 2.0 type of list. - - if OldStyleFileList is NULL then ASSERT() - - this function will convert a SHELL_FILE_ARG based list into a callee allocated - EFI_SHELL_FILE_INFO based list. it is up to the caller to free the memory via - the ShellCloseFileMetaArg function. - - @param[in] FileList the EFI shell list type - @param[in, out] ListHead the list to add to - - @retval the resultant head of the double linked new format list; -**/ -LIST_ENTRY* -InternalShellConvertFileListType ( - IN LIST_ENTRY *FileList, - IN OUT LIST_ENTRY *ListHead - ) -{ - SHELL_FILE_ARG *OldInfo; - LIST_ENTRY *Link; - EFI_SHELL_FILE_INFO_NO_CONST *NewInfo; - - // - // ASSERTs - // - ASSERT(FileList != NULL); - ASSERT(ListHead != NULL); - - // - // enumerate through each member of the old list and copy - // - for (Link = FileList->ForwardLink; Link != FileList; Link = Link->ForwardLink) { - OldInfo = CR (Link, SHELL_FILE_ARG, Link, SHELL_FILE_ARG_SIGNATURE); - ASSERT(OldInfo != NULL); - - // - // Skip ones that failed to open... - // - if (OldInfo->Status != EFI_SUCCESS) { - continue; - } - - // - // make sure the old list was valid - // - ASSERT(OldInfo->Info != NULL); - ASSERT(OldInfo->FullName != NULL); - ASSERT(OldInfo->FileName != NULL); - - // - // allocate a new EFI_SHELL_FILE_INFO object - // - NewInfo = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (NewInfo == NULL) { - ShellCloseFileMetaArg((EFI_SHELL_FILE_INFO**)(&ListHead)); - ListHead = NULL; - break; - } - - // - // copy the simple items - // - NewInfo->Handle = OldInfo->Handle; - NewInfo->Status = OldInfo->Status; - - // old shell checks for 0 not NULL - OldInfo->Handle = 0; - - // - // allocate new space to copy strings and structure - // - NewInfo->FullName = AllocateCopyPool(StrSize(OldInfo->FullName), OldInfo->FullName); - NewInfo->FileName = AllocateCopyPool(StrSize(OldInfo->FileName), OldInfo->FileName); - NewInfo->Info = AllocateCopyPool((UINTN)OldInfo->Info->Size, OldInfo->Info); - - // - // make sure all the memory allocations were sucessful - // - if (NULL == NewInfo->FullName || NewInfo->FileName == NULL || NewInfo->Info == NULL) { - // - // Free the partially allocated new node - // - SHELL_FREE_NON_NULL(NewInfo->FullName); - SHELL_FREE_NON_NULL(NewInfo->FileName); - SHELL_FREE_NON_NULL(NewInfo->Info); - SHELL_FREE_NON_NULL(NewInfo); - - // - // Free the previously converted stuff - // - ShellCloseFileMetaArg((EFI_SHELL_FILE_INFO**)(&ListHead)); - ListHead = NULL; - break; - } - - // - // add that to the list - // - InsertTailList(ListHead, &NewInfo->Link); - } - return (ListHead); -} -/** - Opens a group of files based on a path. - - This function uses the Arg to open all the matching files. Each matched - file has a SHELL_FILE_INFO structure to record the file information. These - structures are placed on the list ListHead. Users can get the SHELL_FILE_INFO - structures from ListHead to access each file. This function supports wildcards - and will process '?' and '*' as such. the list must be freed with a call to - ShellCloseFileMetaArg(). - - If you are NOT appending to an existing list *ListHead must be NULL. If - *ListHead is NULL then it must be callee freed. - - @param Arg pointer to path string - @param OpenMode mode to open files with - @param ListHead head of linked list of results - - @retval EFI_SUCCESS the operation was sucessful and the list head - contains the list of opened files - @return != EFI_SUCCESS the operation failed - - @sa InternalShellConvertFileListType -**/ -EFI_STATUS -EFIAPI -ShellOpenFileMetaArg ( - IN CHAR16 *Arg, - IN UINT64 OpenMode, - IN OUT EFI_SHELL_FILE_INFO **ListHead - ) -{ - EFI_STATUS Status; - LIST_ENTRY mOldStyleFileList; - CHAR16 *CleanFilePathStr; - - // - // ASSERT that Arg and ListHead are not NULL - // - ASSERT(Arg != NULL); - ASSERT(ListHead != NULL); - - CleanFilePathStr = NULL; - - Status = InternalShellStripQuotes (Arg, &CleanFilePathStr); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - if (*ListHead == NULL) { - *ListHead = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (*ListHead == NULL) { - FreePool(CleanFilePathStr); - return (EFI_OUT_OF_RESOURCES); - } - InitializeListHead(&((*ListHead)->Link)); - } - Status = gEfiShellProtocol->OpenFileList(CleanFilePathStr, - OpenMode, - ListHead); - if (EFI_ERROR(Status)) { - gEfiShellProtocol->RemoveDupInFileList(ListHead); - } else { - Status = gEfiShellProtocol->RemoveDupInFileList(ListHead); - } - if (*ListHead != NULL && IsListEmpty(&(*ListHead)->Link)) { - FreePool(*ListHead); - FreePool(CleanFilePathStr); - *ListHead = NULL; - return (EFI_NOT_FOUND); - } - FreePool(CleanFilePathStr); - return (Status); - } - - // - // Check for EFI shell - // - if (mEfiShellEnvironment2 != NULL) { - // - // make sure the list head is initialized - // - InitializeListHead(&mOldStyleFileList); - - // - // Get the EFI Shell list of files - // - Status = mEfiShellEnvironment2->FileMetaArg(CleanFilePathStr, &mOldStyleFileList); - if (EFI_ERROR(Status)) { - *ListHead = NULL; - FreePool(CleanFilePathStr); - return (Status); - } - - if (*ListHead == NULL) { - *ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); - if (*ListHead == NULL) { - FreePool(CleanFilePathStr); - return (EFI_OUT_OF_RESOURCES); - } - InitializeListHead(&((*ListHead)->Link)); - } - - // - // Convert that to equivalent of UEFI Shell 2.0 structure - // - InternalShellConvertFileListType(&mOldStyleFileList, &(*ListHead)->Link); - - // - // Free the EFI Shell version that was converted. - // - mEfiShellEnvironment2->FreeFileList(&mOldStyleFileList); - - if ((*ListHead)->Link.ForwardLink == (*ListHead)->Link.BackLink && (*ListHead)->Link.BackLink == &((*ListHead)->Link)) { - FreePool(*ListHead); - *ListHead = NULL; - Status = EFI_NOT_FOUND; - } - FreePool(CleanFilePathStr); - return (Status); - } - - FreePool(CleanFilePathStr); - return (EFI_UNSUPPORTED); -} -/** - Free the linked list returned from ShellOpenFileMetaArg. - - if ListHead is NULL then ASSERT(). - - @param ListHead the pointer to free. - - @retval EFI_SUCCESS the operation was sucessful. -**/ -EFI_STATUS -EFIAPI -ShellCloseFileMetaArg ( - IN OUT EFI_SHELL_FILE_INFO **ListHead - ) -{ - LIST_ENTRY *Node; - - // - // ASSERT that ListHead is not NULL - // - ASSERT(ListHead != NULL); - - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellProtocol != NULL) { - return (gEfiShellProtocol->FreeFileList(ListHead)); - } else if (mEfiShellEnvironment2 != NULL) { - // - // Since this is EFI Shell version we need to free our internally made copy - // of the list - // - for ( Node = GetFirstNode(&(*ListHead)->Link) - ; *ListHead != NULL && !IsListEmpty(&(*ListHead)->Link) - ; Node = GetFirstNode(&(*ListHead)->Link)) { - RemoveEntryList(Node); - ((EFI_FILE_PROTOCOL*)((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle)->Close(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle); - FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FullName); - FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FileName); - FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Info); - FreePool((EFI_SHELL_FILE_INFO_NO_CONST*)Node); - } - SHELL_FREE_NON_NULL(*ListHead); - return EFI_SUCCESS; - } - - return (EFI_UNSUPPORTED); -} - -/** - Find a file by searching the CWD and then the path. - - If FileName is NULL then ASSERT. - - If the return value is not NULL then the memory must be caller freed. - - @param FileName Filename string. - - @retval NULL the file was not found - @return !NULL the full path to the file. -**/ -CHAR16 * -EFIAPI -ShellFindFilePath ( - IN CONST CHAR16 *FileName - ) -{ - CONST CHAR16 *Path; - SHELL_FILE_HANDLE Handle; - EFI_STATUS Status; - CHAR16 *RetVal; - CHAR16 *TestPath; - CONST CHAR16 *Walker; - UINTN Size; - CHAR16 *TempChar; - - RetVal = NULL; - - // - // First make sure its not an absolute path. - // - Status = ShellOpenFileByName(FileName, &Handle, EFI_FILE_MODE_READ, 0); - if (!EFI_ERROR(Status)){ - if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) { - ASSERT(RetVal == NULL); - RetVal = StrnCatGrow(&RetVal, NULL, FileName, 0); - ShellCloseFile(&Handle); - return (RetVal); - } else { - ShellCloseFile(&Handle); - } - } - - Path = ShellGetEnvironmentVariable(L"cwd"); - if (Path != NULL) { - Size = StrSize(Path) + sizeof(CHAR16); - Size += StrSize(FileName); - TestPath = AllocateZeroPool(Size); - if (TestPath == NULL) { - return (NULL); - } - StrCpyS(TestPath, Size/sizeof(CHAR16), Path); - StrCatS(TestPath, Size/sizeof(CHAR16), L"\\"); - StrCatS(TestPath, Size/sizeof(CHAR16), FileName); - Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0); - if (!EFI_ERROR(Status)){ - if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) { - ASSERT(RetVal == NULL); - RetVal = StrnCatGrow(&RetVal, NULL, TestPath, 0); - ShellCloseFile(&Handle); - FreePool(TestPath); - return (RetVal); - } else { - ShellCloseFile(&Handle); - } - } - FreePool(TestPath); - } - Path = ShellGetEnvironmentVariable(L"path"); - if (Path != NULL) { - Size = StrSize(Path)+sizeof(CHAR16); - Size += StrSize(FileName); - TestPath = AllocateZeroPool(Size); - if (TestPath == NULL) { - return (NULL); - } - Walker = (CHAR16*)Path; - do { - CopyMem(TestPath, Walker, StrSize(Walker)); - if (TestPath != NULL) { - TempChar = StrStr(TestPath, L";"); - if (TempChar != NULL) { - *TempChar = CHAR_NULL; - } - if (TestPath[StrLen(TestPath)-1] != L'\\') { - StrCatS(TestPath, Size/sizeof(CHAR16), L"\\"); - } - if (FileName[0] == L'\\') { - FileName++; - } - StrCatS(TestPath, Size/sizeof(CHAR16), FileName); - if (StrStr(Walker, L";") != NULL) { - Walker = StrStr(Walker, L";") + 1; - } else { - Walker = NULL; - } - Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0); - if (!EFI_ERROR(Status)){ - if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) { - ASSERT(RetVal == NULL); - RetVal = StrnCatGrow(&RetVal, NULL, TestPath, 0); - ShellCloseFile(&Handle); - break; - } else { - ShellCloseFile(&Handle); - } - } - } - } while (Walker != NULL && Walker[0] != CHAR_NULL); - FreePool(TestPath); - } - return (RetVal); -} - -/** - Find a file by searching the CWD and then the path with a variable set of file - extensions. If the file is not found it will append each extension in the list - in the order provided and return the first one that is successful. - - If FileName is NULL, then ASSERT. - If FileExtension is NULL, then behavior is identical to ShellFindFilePath. - - If the return value is not NULL then the memory must be caller freed. - - @param[in] FileName Filename string. - @param[in] FileExtension Semi-colon delimeted list of possible extensions. - - @retval NULL The file was not found. - @retval !NULL The path to the file. -**/ -CHAR16 * -EFIAPI -ShellFindFilePathEx ( - IN CONST CHAR16 *FileName, - IN CONST CHAR16 *FileExtension - ) -{ - CHAR16 *TestPath; - CHAR16 *RetVal; - CONST CHAR16 *ExtensionWalker; - UINTN Size; - CHAR16 *TempChar; - CHAR16 *TempChar2; - - ASSERT(FileName != NULL); - if (FileExtension == NULL) { - return (ShellFindFilePath(FileName)); - } - RetVal = ShellFindFilePath(FileName); - if (RetVal != NULL) { - return (RetVal); - } - Size = StrSize(FileName); - Size += StrSize(FileExtension); - TestPath = AllocateZeroPool(Size); - if (TestPath == NULL) { - return (NULL); - } - for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16*)FileExtension; TempChar2 != NULL ; ExtensionWalker = TempChar2 + 1){ - StrCpyS(TestPath, Size/sizeof(CHAR16), FileName); - if (ExtensionWalker != NULL) { - StrCatS(TestPath, Size/sizeof(CHAR16), ExtensionWalker); - } - TempChar = StrStr(TestPath, L";"); - if (TempChar != NULL) { - *TempChar = CHAR_NULL; - } - RetVal = ShellFindFilePath(TestPath); - if (RetVal != NULL) { - break; - } - ASSERT(ExtensionWalker != NULL); - TempChar2 = StrStr(ExtensionWalker, L";"); - } - FreePool(TestPath); - return (RetVal); -} - -typedef struct { - LIST_ENTRY Link; - CHAR16 *Name; - SHELL_PARAM_TYPE Type; - CHAR16 *Value; - UINTN OriginalPosition; -} SHELL_PARAM_PACKAGE; - -/** - Checks the list of valid arguments and returns TRUE if the item was found. If the - return value is TRUE then the type parameter is set also. - - if CheckList is NULL then ASSERT(); - if Name is NULL then ASSERT(); - if Type is NULL then ASSERT(); - - @param Name pointer to Name of parameter found - @param CheckList List to check against - @param Type pointer to type of parameter if it was found - - @retval TRUE the Parameter was found. Type is valid. - @retval FALSE the Parameter was not found. Type is not valid. -**/ -BOOLEAN -InternalIsOnCheckList ( - IN CONST CHAR16 *Name, - IN CONST SHELL_PARAM_ITEM *CheckList, - OUT SHELL_PARAM_TYPE *Type - ) -{ - SHELL_PARAM_ITEM *TempListItem; - CHAR16 *TempString; - - // - // ASSERT that all 3 pointer parameters aren't NULL - // - ASSERT(CheckList != NULL); - ASSERT(Type != NULL); - ASSERT(Name != NULL); - - // - // question mark and page break mode are always supported - // - if ((StrCmp(Name, L"-?") == 0) || - (StrCmp(Name, L"-b") == 0) - ) { - *Type = TypeFlag; - return (TRUE); - } - - // - // Enumerate through the list - // - for (TempListItem = (SHELL_PARAM_ITEM*)CheckList ; TempListItem->Name != NULL ; TempListItem++) { - // - // If the Type is TypeStart only check the first characters of the passed in param - // If it matches set the type and return TRUE - // - if (TempListItem->Type == TypeStart) { - if (StrnCmp(Name, TempListItem->Name, StrLen(TempListItem->Name)) == 0) { - *Type = TempListItem->Type; - return (TRUE); - } - TempString = NULL; - TempString = StrnCatGrow(&TempString, NULL, Name, StrLen(TempListItem->Name)); - if (TempString != NULL) { - if (StringNoCaseCompare(&TempString, &TempListItem->Name) == 0) { - *Type = TempListItem->Type; - FreePool(TempString); - return (TRUE); - } - FreePool(TempString); - } - } else if (StringNoCaseCompare(&Name, &TempListItem->Name) == 0) { - *Type = TempListItem->Type; - return (TRUE); - } - } - - return (FALSE); -} -/** - Checks the string for indicators of "flag" status. this is a leading '/', '-', or '+' - - @param[in] Name pointer to Name of parameter found - @param[in] AlwaysAllowNumbers TRUE to allow numbers, FALSE to not. - @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise. - - @retval TRUE the Parameter is a flag. - @retval FALSE the Parameter not a flag. -**/ -BOOLEAN -InternalIsFlag ( - IN CONST CHAR16 *Name, - IN CONST BOOLEAN AlwaysAllowNumbers, - IN CONST BOOLEAN TimeNumbers - ) -{ - // - // ASSERT that Name isn't NULL - // - ASSERT(Name != NULL); - - // - // If we accept numbers then dont return TRUE. (they will be values) - // - if (((Name[0] == L'-' || Name[0] == L'+') && InternalShellIsHexOrDecimalNumber(Name+1, FALSE, FALSE, TimeNumbers)) && AlwaysAllowNumbers) { - return (FALSE); - } - - // - // If the Name has a /, +, or - as the first character return TRUE - // - if ((Name[0] == L'/') || - (Name[0] == L'-') || - (Name[0] == L'+') - ) { - return (TRUE); - } - return (FALSE); -} - -/** - Checks the command line arguments passed against the list of valid ones. - - If no initialization is required, then return RETURN_SUCCESS. - - @param[in] CheckList pointer to list of parameters to check - @param[out] CheckPackage pointer to pointer to list checked values - @param[out] ProblemParam optional pointer to pointer to unicode string for - the paramater that caused failure. If used then the - caller is responsible for freeing the memory. - @param[in] AutoPageBreak will automatically set PageBreakEnabled for "b" parameter - @param[in] Argv pointer to array of parameters - @param[in] Argc Count of parameters in Argv - @param[in] AlwaysAllowNumbers TRUE to allow numbers always, FALSE otherwise. - - @retval EFI_SUCCESS The operation completed sucessfully. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed - @retval EFI_INVALID_PARAMETER A parameter was invalid - @retval EFI_VOLUME_CORRUPTED the command line was corrupt. an argument was - duplicated. the duplicated command line argument - was returned in ProblemParam if provided. - @retval EFI_NOT_FOUND a argument required a value that was missing. - the invalid command line argument was returned in - ProblemParam if provided. -**/ -EFI_STATUS -InternalCommandLineParse ( - IN CONST SHELL_PARAM_ITEM *CheckList, - OUT LIST_ENTRY **CheckPackage, - OUT CHAR16 **ProblemParam OPTIONAL, - IN BOOLEAN AutoPageBreak, - IN CONST CHAR16 **Argv, - IN UINTN Argc, - IN BOOLEAN AlwaysAllowNumbers - ) -{ - UINTN LoopCounter; - SHELL_PARAM_TYPE CurrentItemType; - SHELL_PARAM_PACKAGE *CurrentItemPackage; - UINTN GetItemValue; - UINTN ValueSize; - UINTN Count; - CONST CHAR16 *TempPointer; - UINTN CurrentValueSize; - CHAR16 *NewValue; - - CurrentItemPackage = NULL; - GetItemValue = 0; - ValueSize = 0; - Count = 0; - - // - // If there is only 1 item we dont need to do anything - // - if (Argc < 1) { - *CheckPackage = NULL; - return (EFI_SUCCESS); - } - - // - // ASSERTs - // - ASSERT(CheckList != NULL); - ASSERT(Argv != NULL); - - // - // initialize the linked list - // - *CheckPackage = (LIST_ENTRY*)AllocateZeroPool(sizeof(LIST_ENTRY)); - if (*CheckPackage == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - - InitializeListHead(*CheckPackage); - - // - // loop through each of the arguments - // - for (LoopCounter = 0 ; LoopCounter < Argc ; ++LoopCounter) { - if (Argv[LoopCounter] == NULL) { - // - // do nothing for NULL argv - // - } else if (InternalIsOnCheckList(Argv[LoopCounter], CheckList, &CurrentItemType)) { - // - // We might have leftover if last parameter didnt have optional value - // - if (GetItemValue != 0) { - GetItemValue = 0; - InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); - } - // - // this is a flag - // - CurrentItemPackage = AllocateZeroPool(sizeof(SHELL_PARAM_PACKAGE)); - if (CurrentItemPackage == NULL) { - ShellCommandLineFreeVarList(*CheckPackage); - *CheckPackage = NULL; - return (EFI_OUT_OF_RESOURCES); - } - CurrentItemPackage->Name = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]); - if (CurrentItemPackage->Name == NULL) { - ShellCommandLineFreeVarList(*CheckPackage); - *CheckPackage = NULL; - return (EFI_OUT_OF_RESOURCES); - } - CurrentItemPackage->Type = CurrentItemType; - CurrentItemPackage->OriginalPosition = (UINTN)(-1); - CurrentItemPackage->Value = NULL; - - // - // Does this flag require a value - // - switch (CurrentItemPackage->Type) { - // - // possibly trigger the next loop(s) to populate the value of this item - // - case TypeValue: - case TypeTimeValue: - GetItemValue = 1; - ValueSize = 0; - break; - case TypeDoubleValue: - GetItemValue = 2; - ValueSize = 0; - break; - case TypeMaxValue: - GetItemValue = (UINTN)(-1); - ValueSize = 0; - break; - default: - // - // this item has no value expected; we are done - // - InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); - ASSERT(GetItemValue == 0); - break; - } - } else if (GetItemValue != 0 && CurrentItemPackage != NULL && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, (BOOLEAN)(CurrentItemPackage->Type == TypeTimeValue))) { - // - // get the item VALUE for a previous flag - // - CurrentValueSize = ValueSize + StrSize(Argv[LoopCounter]) + sizeof(CHAR16); - NewValue = ReallocatePool(ValueSize, CurrentValueSize, CurrentItemPackage->Value); - if (NewValue == NULL) { - SHELL_FREE_NON_NULL (CurrentItemPackage->Value); - SHELL_FREE_NON_NULL (CurrentItemPackage); - ShellCommandLineFreeVarList (*CheckPackage); - *CheckPackage = NULL; - return EFI_OUT_OF_RESOURCES; - } - CurrentItemPackage->Value = NewValue; - if (ValueSize == 0) { - StrCpyS( CurrentItemPackage->Value, - CurrentValueSize/sizeof(CHAR16), - Argv[LoopCounter] - ); - } else { - StrCatS( CurrentItemPackage->Value, - CurrentValueSize/sizeof(CHAR16), - L" " - ); - StrCatS( CurrentItemPackage->Value, - CurrentValueSize/sizeof(CHAR16), - Argv[LoopCounter] - ); - } - ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16); - - GetItemValue--; - if (GetItemValue == 0) { - InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); - } - } else if (!InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, FALSE)){ - // - // add this one as a non-flag - // - - TempPointer = Argv[LoopCounter]; - if ((*TempPointer == L'^' && *(TempPointer+1) == L'-') - || (*TempPointer == L'^' && *(TempPointer+1) == L'/') - || (*TempPointer == L'^' && *(TempPointer+1) == L'+') - ){ - TempPointer++; - } - CurrentItemPackage = AllocateZeroPool(sizeof(SHELL_PARAM_PACKAGE)); - if (CurrentItemPackage == NULL) { - ShellCommandLineFreeVarList(*CheckPackage); - *CheckPackage = NULL; - return (EFI_OUT_OF_RESOURCES); - } - CurrentItemPackage->Name = NULL; - CurrentItemPackage->Type = TypePosition; - CurrentItemPackage->Value = AllocateCopyPool(StrSize(TempPointer), TempPointer); - if (CurrentItemPackage->Value == NULL) { - ShellCommandLineFreeVarList(*CheckPackage); - *CheckPackage = NULL; - return (EFI_OUT_OF_RESOURCES); - } - CurrentItemPackage->OriginalPosition = Count++; - InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); - } else { - // - // this was a non-recognised flag... error! - // - if (ProblemParam != NULL) { - *ProblemParam = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]); - } - ShellCommandLineFreeVarList(*CheckPackage); - *CheckPackage = NULL; - return (EFI_VOLUME_CORRUPTED); - } - } - if (GetItemValue != 0) { - GetItemValue = 0; - InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); - } - // - // support for AutoPageBreak - // - if (AutoPageBreak && ShellCommandLineGetFlag(*CheckPackage, L"-b")) { - ShellSetPageBreakMode(TRUE); - } - return (EFI_SUCCESS); -} - -/** - Checks the command line arguments passed against the list of valid ones. - Optionally removes NULL values first. - - If no initialization is required, then return RETURN_SUCCESS. - - @param[in] CheckList The pointer to list of parameters to check. - @param[out] CheckPackage The package of checked values. - @param[out] ProblemParam Optional pointer to pointer to unicode string for - the paramater that caused failure. - @param[in] AutoPageBreak Will automatically set PageBreakEnabled. - @param[in] AlwaysAllowNumbers Will never fail for number based flags. - - @retval EFI_SUCCESS The operation completed sucessfully. - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @retval EFI_VOLUME_CORRUPTED The command line was corrupt. - @retval EFI_DEVICE_ERROR The commands contained 2 opposing arguments. One - of the command line arguments was returned in - ProblemParam if provided. - @retval EFI_NOT_FOUND A argument required a value that was missing. - The invalid command line argument was returned in - ProblemParam if provided. -**/ -EFI_STATUS -EFIAPI -ShellCommandLineParseEx ( - IN CONST SHELL_PARAM_ITEM *CheckList, - OUT LIST_ENTRY **CheckPackage, - OUT CHAR16 **ProblemParam OPTIONAL, - IN BOOLEAN AutoPageBreak, - IN BOOLEAN AlwaysAllowNumbers - ) -{ - // - // ASSERT that CheckList and CheckPackage aren't NULL - // - ASSERT(CheckList != NULL); - ASSERT(CheckPackage != NULL); - - // - // Check for UEFI Shell 2.0 protocols - // - if (gEfiShellParametersProtocol != NULL) { - return (InternalCommandLineParse(CheckList, - CheckPackage, - ProblemParam, - AutoPageBreak, - (CONST CHAR16**) gEfiShellParametersProtocol->Argv, - gEfiShellParametersProtocol->Argc, - AlwaysAllowNumbers)); - } - - // - // ASSERT That EFI Shell is not required - // - ASSERT (mEfiShellInterface != NULL); - return (InternalCommandLineParse(CheckList, - CheckPackage, - ProblemParam, - AutoPageBreak, - (CONST CHAR16**) mEfiShellInterface->Argv, - mEfiShellInterface->Argc, - AlwaysAllowNumbers)); -} - -/** - Frees shell variable list that was returned from ShellCommandLineParse. - - This function will free all the memory that was used for the CheckPackage - list of postprocessed shell arguments. - - this function has no return value. - - if CheckPackage is NULL, then return - - @param CheckPackage the list to de-allocate - **/ -VOID -EFIAPI -ShellCommandLineFreeVarList ( - IN LIST_ENTRY *CheckPackage - ) -{ - LIST_ENTRY *Node; - - // - // check for CheckPackage == NULL - // - if (CheckPackage == NULL) { - return; - } - - // - // for each node in the list - // - for ( Node = GetFirstNode(CheckPackage) - ; !IsListEmpty(CheckPackage) - ; Node = GetFirstNode(CheckPackage) - ){ - // - // Remove it from the list - // - RemoveEntryList(Node); - - // - // if it has a name free the name - // - if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) { - FreePool(((SHELL_PARAM_PACKAGE*)Node)->Name); - } - - // - // if it has a value free the value - // - if (((SHELL_PARAM_PACKAGE*)Node)->Value != NULL) { - FreePool(((SHELL_PARAM_PACKAGE*)Node)->Value); - } - - // - // free the node structure - // - FreePool((SHELL_PARAM_PACKAGE*)Node); - } - // - // free the list head node - // - FreePool(CheckPackage); -} -/** - Checks for presence of a flag parameter - - flag arguments are in the form of "-" or "/", but do not have a value following the key - - if CheckPackage is NULL then return FALSE. - if KeyString is NULL then ASSERT() - - @param CheckPackage The package of parsed command line arguments - @param KeyString the Key of the command line argument to check for - - @retval TRUE the flag is on the command line - @retval FALSE the flag is not on the command line - **/ -BOOLEAN -EFIAPI -ShellCommandLineGetFlag ( - IN CONST LIST_ENTRY * CONST CheckPackage, - IN CONST CHAR16 * CONST KeyString - ) -{ - LIST_ENTRY *Node; - CHAR16 *TempString; - - // - // return FALSE for no package or KeyString is NULL - // - if (CheckPackage == NULL || KeyString == NULL) { - return (FALSE); - } - - // - // enumerate through the list of parametrs - // - for ( Node = GetFirstNode(CheckPackage) - ; !IsNull (CheckPackage, Node) - ; Node = GetNextNode(CheckPackage, Node) - ){ - // - // If the Name matches, return TRUE (and there may be NULL name) - // - if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) { - // - // If Type is TypeStart then only compare the begining of the strings - // - if (((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart) { - if (StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0) { - return (TRUE); - } - TempString = NULL; - TempString = StrnCatGrow(&TempString, NULL, KeyString, StrLen(((SHELL_PARAM_PACKAGE*)Node)->Name)); - if (TempString != NULL) { - if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) { - FreePool(TempString); - return (TRUE); - } - FreePool(TempString); - } - } else if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) { - return (TRUE); - } - } - } - return (FALSE); -} -/** - Returns value from command line argument. - - Value parameters are in the form of "- value" or "/ value". - - If CheckPackage is NULL, then return NULL. - - @param[in] CheckPackage The package of parsed command line arguments. - @param[in] KeyString The Key of the command line argument to check for. - - @retval NULL The flag is not on the command line. - @retval !=NULL The pointer to unicode string of the value. -**/ -CONST CHAR16* -EFIAPI -ShellCommandLineGetValue ( - IN CONST LIST_ENTRY *CheckPackage, - IN CHAR16 *KeyString - ) -{ - LIST_ENTRY *Node; - CHAR16 *TempString; - - // - // return NULL for no package or KeyString is NULL - // - if (CheckPackage == NULL || KeyString == NULL) { - return (NULL); - } - - // - // enumerate through the list of parametrs - // - for ( Node = GetFirstNode(CheckPackage) - ; !IsNull (CheckPackage, Node) - ; Node = GetNextNode(CheckPackage, Node) - ){ - // - // If the Name matches, return TRUE (and there may be NULL name) - // - if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) { - // - // If Type is TypeStart then only compare the begining of the strings - // - if (((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart) { - if (StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0) { - return (((SHELL_PARAM_PACKAGE*)Node)->Name + StrLen(KeyString)); - } - TempString = NULL; - TempString = StrnCatGrow(&TempString, NULL, KeyString, StrLen(((SHELL_PARAM_PACKAGE*)Node)->Name)); - if (TempString != NULL) { - if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) { - FreePool(TempString); - return (((SHELL_PARAM_PACKAGE*)Node)->Name + StrLen(KeyString)); - } - FreePool(TempString); - } - } else if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) { - return (((SHELL_PARAM_PACKAGE*)Node)->Value); - } - } - } - return (NULL); -} - -/** - Returns raw value from command line argument. - - Raw value parameters are in the form of "value" in a specific position in the list. - - If CheckPackage is NULL, then return NULL. - - @param[in] CheckPackage The package of parsed command line arguments. - @param[in] Position The position of the value. - - @retval NULL The flag is not on the command line. - @retval !=NULL The pointer to unicode string of the value. - **/ -CONST CHAR16* -EFIAPI -ShellCommandLineGetRawValue ( - IN CONST LIST_ENTRY * CONST CheckPackage, - IN UINTN Position - ) -{ - LIST_ENTRY *Node; - - // - // check for CheckPackage == NULL - // - if (CheckPackage == NULL) { - return (NULL); - } - - // - // enumerate through the list of parametrs - // - for ( Node = GetFirstNode(CheckPackage) - ; !IsNull (CheckPackage, Node) - ; Node = GetNextNode(CheckPackage, Node) - ){ - // - // If the position matches, return the value - // - if (((SHELL_PARAM_PACKAGE*)Node)->OriginalPosition == Position) { - return (((SHELL_PARAM_PACKAGE*)Node)->Value); - } - } - return (NULL); -} - -/** - returns the number of command line value parameters that were parsed. - - this will not include flags. - - @param[in] CheckPackage The package of parsed command line arguments. - - @retval (UINTN)-1 No parsing has ocurred - @return other The number of value parameters found -**/ -UINTN -EFIAPI -ShellCommandLineGetCount( - IN CONST LIST_ENTRY *CheckPackage - ) -{ - LIST_ENTRY *Node1; - UINTN Count; - - if (CheckPackage == NULL) { - return (0); - } - for ( Node1 = GetFirstNode(CheckPackage), Count = 0 - ; !IsNull (CheckPackage, Node1) - ; Node1 = GetNextNode(CheckPackage, Node1) - ){ - if (((SHELL_PARAM_PACKAGE*)Node1)->Name == NULL) { - Count++; - } - } - return (Count); -} - -/** - Determines if a parameter is duplicated. - - If Param is not NULL then it will point to a callee allocated string buffer - with the parameter value if a duplicate is found. - - If CheckPackage is NULL, then ASSERT. - - @param[in] CheckPackage The package of parsed command line arguments. - @param[out] Param Upon finding one, a pointer to the duplicated parameter. - - @retval EFI_SUCCESS No parameters were duplicated. - @retval EFI_DEVICE_ERROR A duplicate was found. - **/ -EFI_STATUS -EFIAPI -ShellCommandLineCheckDuplicate ( - IN CONST LIST_ENTRY *CheckPackage, - OUT CHAR16 **Param - ) -{ - LIST_ENTRY *Node1; - LIST_ENTRY *Node2; - - ASSERT(CheckPackage != NULL); - - for ( Node1 = GetFirstNode(CheckPackage) - ; !IsNull (CheckPackage, Node1) - ; Node1 = GetNextNode(CheckPackage, Node1) - ){ - for ( Node2 = GetNextNode(CheckPackage, Node1) - ; !IsNull (CheckPackage, Node2) - ; Node2 = GetNextNode(CheckPackage, Node2) - ){ - if ((((SHELL_PARAM_PACKAGE*)Node1)->Name != NULL) && (((SHELL_PARAM_PACKAGE*)Node2)->Name != NULL) && StrCmp(((SHELL_PARAM_PACKAGE*)Node1)->Name, ((SHELL_PARAM_PACKAGE*)Node2)->Name) == 0) { - if (Param != NULL) { - *Param = NULL; - *Param = StrnCatGrow(Param, NULL, ((SHELL_PARAM_PACKAGE*)Node1)->Name, 0); - } - return (EFI_DEVICE_ERROR); - } - } - } - return (EFI_SUCCESS); -} - -/** - This is a find and replace function. Upon successful return the NewString is a copy of - SourceString with each instance of FindTarget replaced with ReplaceWith. - - If SourceString and NewString overlap the behavior is undefined. - - If the string would grow bigger than NewSize it will halt and return error. - - @param[in] SourceString The string with source buffer. - @param[in, out] NewString The string with resultant buffer. - @param[in] NewSize The size in bytes of NewString. - @param[in] FindTarget The string to look for. - @param[in] ReplaceWith The string to replace FindTarget with. - @param[in] SkipPreCarrot If TRUE will skip a FindTarget that has a '^' - immediately before it. - @param[in] ParameterReplacing If TRUE will add "" around items with spaces. - - @retval EFI_INVALID_PARAMETER SourceString was NULL. - @retval EFI_INVALID_PARAMETER NewString was NULL. - @retval EFI_INVALID_PARAMETER FindTarget was NULL. - @retval EFI_INVALID_PARAMETER ReplaceWith was NULL. - @retval EFI_INVALID_PARAMETER FindTarget had length < 1. - @retval EFI_INVALID_PARAMETER SourceString had length < 1. - @retval EFI_BUFFER_TOO_SMALL NewSize was less than the minimum size to hold - the new string (truncation occurred). - @retval EFI_SUCCESS The string was successfully copied with replacement. -**/ -EFI_STATUS -EFIAPI -ShellCopySearchAndReplace( - IN CHAR16 CONST *SourceString, - IN OUT CHAR16 *NewString, - IN UINTN NewSize, - IN CONST CHAR16 *FindTarget, - IN CONST CHAR16 *ReplaceWith, - IN CONST BOOLEAN SkipPreCarrot, - IN CONST BOOLEAN ParameterReplacing - ) -{ - UINTN Size; - CHAR16 *Replace; - - if ( (SourceString == NULL) - || (NewString == NULL) - || (FindTarget == NULL) - || (ReplaceWith == NULL) - || (StrLen(FindTarget) < 1) - || (StrLen(SourceString) < 1) - ){ - return (EFI_INVALID_PARAMETER); - } - Replace = NULL; - if (StrStr(ReplaceWith, L" ") == NULL || !ParameterReplacing) { - Replace = StrnCatGrow(&Replace, NULL, ReplaceWith, 0); - } else { - Replace = AllocateZeroPool(StrSize(ReplaceWith) + 2*sizeof(CHAR16)); - if (Replace != NULL) { - UnicodeSPrint(Replace, StrSize(ReplaceWith) + 2*sizeof(CHAR16), L"\"%s\"", ReplaceWith); - } - } - if (Replace == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - NewString = ZeroMem(NewString, NewSize); - while (*SourceString != CHAR_NULL) { - // - // if we find the FindTarget and either Skip == FALSE or Skip and we - // dont have a carrot do a replace... - // - if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0 - && ((SkipPreCarrot && *(SourceString-1) != L'^') || !SkipPreCarrot) - ){ - SourceString += StrLen(FindTarget); - Size = StrSize(NewString); - if ((Size + (StrLen(Replace)*sizeof(CHAR16))) > NewSize) { - FreePool(Replace); - return (EFI_BUFFER_TOO_SMALL); - } - StrCatS(NewString, NewSize/sizeof(CHAR16), Replace); - } else { - Size = StrSize(NewString); - if (Size + sizeof(CHAR16) > NewSize) { - FreePool(Replace); - return (EFI_BUFFER_TOO_SMALL); - } - StrnCatS(NewString, NewSize/sizeof(CHAR16), SourceString, 1); - SourceString++; - } - } - FreePool(Replace); - return (EFI_SUCCESS); -} - -/** - Internal worker function to output a string. - - This function will output a string to the correct StdOut. - - @param[in] String The string to print out. - - @retval EFI_SUCCESS The operation was sucessful. - @retval !EFI_SUCCESS The operation failed. -**/ -EFI_STATUS -InternalPrintTo ( - IN CONST CHAR16 *String - ) -{ - UINTN Size; - Size = StrSize(String) - sizeof(CHAR16); - if (Size == 0) { - return (EFI_SUCCESS); - } - if (gEfiShellParametersProtocol != NULL) { - return (gEfiShellProtocol->WriteFile(gEfiShellParametersProtocol->StdOut, &Size, (VOID*)String)); - } - if (mEfiShellInterface != NULL) { - if (mEfiShellInterface->RedirArgc == 0) { - // - // Divide in half for old shell. Must be string length not size. - // - Size /=2; // Divide in half only when no redirection. - } - return (mEfiShellInterface->StdOut->Write(mEfiShellInterface->StdOut, &Size, (VOID*)String)); - } - ASSERT(FALSE); - return (EFI_UNSUPPORTED); -} - -/** - Print at a specific location on the screen. - - This function will move the cursor to a given screen location and print the specified string - - If -1 is specified for either the Row or Col the current screen location for BOTH - will be used. - - if either Row or Col is out of range for the current console, then ASSERT - if Format is NULL, then ASSERT - - In addition to the standard %-based flags as supported by UefiLib Print() this supports - the following additional flags: - %N - Set output attribute to normal - %H - Set output attribute to highlight - %E - Set output attribute to error - %B - Set output attribute to blue color - %V - Set output attribute to green color - - Note: The background color is controlled by the shell command cls. - - @param[in] Col the column to print at - @param[in] Row the row to print at - @param[in] Format the format string - @param[in] Marker the marker for the variable argument list - - @return EFI_SUCCESS The operation was successful. - @return EFI_DEVICE_ERROR The console device reported an error. -**/ -EFI_STATUS -InternalShellPrintWorker( - IN INT32 Col OPTIONAL, - IN INT32 Row OPTIONAL, - IN CONST CHAR16 *Format, - IN VA_LIST Marker - ) -{ - EFI_STATUS Status; - CHAR16 *ResumeLocation; - CHAR16 *FormatWalker; - UINTN OriginalAttribute; - CHAR16 *mPostReplaceFormat; - CHAR16 *mPostReplaceFormat2; - - mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); - mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); - - if (mPostReplaceFormat == NULL || mPostReplaceFormat2 == NULL) { - SHELL_FREE_NON_NULL(mPostReplaceFormat); - SHELL_FREE_NON_NULL(mPostReplaceFormat2); - return (EFI_OUT_OF_RESOURCES); - } - - Status = EFI_SUCCESS; - OriginalAttribute = gST->ConOut->Mode->Attribute; - - // - // Back and forth each time fixing up 1 of our flags... - // - Status = ShellCopySearchAndReplace(Format, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%N", L"%%N", FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - Status = ShellCopySearchAndReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%E", L"%%E", FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - Status = ShellCopySearchAndReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%H", L"%%H", FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - Status = ShellCopySearchAndReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%B", L"%%B", FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - Status = ShellCopySearchAndReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%V", L"%%V", FALSE, FALSE); - ASSERT_EFI_ERROR(Status); - - // - // Use the last buffer from replacing to print from... - // - UnicodeVSPrint (mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), mPostReplaceFormat, Marker); - - if (Col != -1 && Row != -1) { - Status = gST->ConOut->SetCursorPosition(gST->ConOut, Col, Row); - } - - FormatWalker = mPostReplaceFormat2; - while (*FormatWalker != CHAR_NULL) { - // - // Find the next attribute change request - // - ResumeLocation = StrStr(FormatWalker, L"%"); - if (ResumeLocation != NULL) { - *ResumeLocation = CHAR_NULL; - } - // - // print the current FormatWalker string - // - if (StrLen(FormatWalker)>0) { - Status = InternalPrintTo(FormatWalker); - if (EFI_ERROR(Status)) { - break; - } - } - - // - // update the attribute - // - if (ResumeLocation != NULL) { - if ((ResumeLocation != mPostReplaceFormat2) && (*(ResumeLocation-1) == L'^')) { - // - // Move cursor back 1 position to overwrite the ^ - // - gST->ConOut->SetCursorPosition(gST->ConOut, gST->ConOut->Mode->CursorColumn - 1, gST->ConOut->Mode->CursorRow); - - // - // Print a simple '%' symbol - // - Status = InternalPrintTo(L"%"); - ResumeLocation = ResumeLocation - 1; - } else { - switch (*(ResumeLocation+1)) { - case (L'N'): - gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute); - break; - case (L'E'): - gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_YELLOW, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))); - break; - case (L'H'): - gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_WHITE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))); - break; - case (L'B'): - gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_LIGHTBLUE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))); - break; - case (L'V'): - gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_LIGHTGREEN, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))); - break; - default: - // - // Print a simple '%' symbol - // - Status = InternalPrintTo(L"%"); - if (EFI_ERROR(Status)) { - break; - } - ResumeLocation = ResumeLocation - 1; - break; - } - } - } else { - // - // reset to normal now... - // - break; - } - - // - // update FormatWalker to Resume + 2 (skip the % and the indicator) - // - FormatWalker = ResumeLocation + 2; - } - - gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute); - - SHELL_FREE_NON_NULL(mPostReplaceFormat); - SHELL_FREE_NON_NULL(mPostReplaceFormat2); - return (Status); -} - -/** - Print at a specific location on the screen. - - This function will move the cursor to a given screen location and print the specified string. - - If -1 is specified for either the Row or Col the current screen location for BOTH - will be used. - - If either Row or Col is out of range for the current console, then ASSERT. - If Format is NULL, then ASSERT. - - In addition to the standard %-based flags as supported by UefiLib Print() this supports - the following additional flags: - %N - Set output attribute to normal - %H - Set output attribute to highlight - %E - Set output attribute to error - %B - Set output attribute to blue color - %V - Set output attribute to green color - - Note: The background color is controlled by the shell command cls. - - @param[in] Col the column to print at - @param[in] Row the row to print at - @param[in] Format the format string - @param[in] ... The variable argument list. - - @return EFI_SUCCESS The printing was successful. - @return EFI_DEVICE_ERROR The console device reported an error. -**/ -EFI_STATUS -EFIAPI -ShellPrintEx( - IN INT32 Col OPTIONAL, - IN INT32 Row OPTIONAL, - IN CONST CHAR16 *Format, - ... - ) -{ - VA_LIST Marker; - EFI_STATUS RetVal; - if (Format == NULL) { - return (EFI_INVALID_PARAMETER); - } - VA_START (Marker, Format); - RetVal = InternalShellPrintWorker(Col, Row, Format, Marker); - VA_END(Marker); - return(RetVal); -} - -/** - Print at a specific location on the screen. - - This function will move the cursor to a given screen location and print the specified string. - - If -1 is specified for either the Row or Col the current screen location for BOTH - will be used. - - If either Row or Col is out of range for the current console, then ASSERT. - If Format is NULL, then ASSERT. - - In addition to the standard %-based flags as supported by UefiLib Print() this supports - the following additional flags: - %N - Set output attribute to normal. - %H - Set output attribute to highlight. - %E - Set output attribute to error. - %B - Set output attribute to blue color. - %V - Set output attribute to green color. - - Note: The background color is controlled by the shell command cls. - - @param[in] Col The column to print at. - @param[in] Row The row to print at. - @param[in] Language The language of the string to retrieve. If this parameter - is NULL, then the current platform language is used. - @param[in] HiiFormatStringId The format string Id for getting from Hii. - @param[in] HiiFormatHandle The format string Handle for getting from Hii. - @param[in] ... The variable argument list. - - @return EFI_SUCCESS The printing was successful. - @return EFI_DEVICE_ERROR The console device reported an error. -**/ -EFI_STATUS -EFIAPI -ShellPrintHiiEx( - IN INT32 Col OPTIONAL, - IN INT32 Row OPTIONAL, - IN CONST CHAR8 *Language OPTIONAL, - IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, - ... - ) -{ - VA_LIST Marker; - CHAR16 *HiiFormatString; - EFI_STATUS RetVal; - - RetVal = EFI_DEVICE_ERROR; - - VA_START (Marker, HiiFormatHandle); - HiiFormatString = HiiGetString(HiiFormatHandle, HiiFormatStringId, Language); - if (HiiFormatString != NULL) { - RetVal = InternalShellPrintWorker (Col, Row, HiiFormatString, Marker); - SHELL_FREE_NON_NULL (HiiFormatString); - } - VA_END(Marker); - - return (RetVal); -} - -/** - Function to determine if a given filename represents a file or a directory. - - @param[in] DirName Path to directory to test. - - @retval EFI_SUCCESS The Path represents a directory - @retval EFI_NOT_FOUND The Path does not represent a directory - @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @return The path failed to open -**/ -EFI_STATUS -EFIAPI -ShellIsDirectory( - IN CONST CHAR16 *DirName - ) -{ - EFI_STATUS Status; - SHELL_FILE_HANDLE Handle; - CHAR16 *TempLocation; - CHAR16 *TempLocation2; - - ASSERT(DirName != NULL); - - Handle = NULL; - TempLocation = NULL; - - Status = ShellOpenFileByName(DirName, &Handle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - // - // try good logic first. - // - if (gEfiShellProtocol != NULL) { - TempLocation = StrnCatGrow(&TempLocation, NULL, DirName, 0); - if (TempLocation == NULL) { - ShellCloseFile(&Handle); - return (EFI_OUT_OF_RESOURCES); - } - TempLocation2 = StrStr(TempLocation, L":"); - if (TempLocation2 != NULL && StrLen(StrStr(TempLocation, L":")) == 2) { - *(TempLocation2+1) = CHAR_NULL; - } - if (gEfiShellProtocol->GetDevicePathFromMap(TempLocation) != NULL) { - FreePool(TempLocation); - return (EFI_SUCCESS); - } - FreePool(TempLocation); - } else { - // - // probably a map name?!?!!? - // - TempLocation = StrStr(DirName, L"\\"); - if (TempLocation != NULL && *(TempLocation+1) == CHAR_NULL) { - return (EFI_SUCCESS); - } - } - return (Status); - } - - if (FileHandleIsDirectory(Handle) == EFI_SUCCESS) { - ShellCloseFile(&Handle); - return (EFI_SUCCESS); - } - ShellCloseFile(&Handle); - return (EFI_NOT_FOUND); -} - -/** - Function to determine if a given filename represents a file. - - @param[in] Name Path to file to test. - - @retval EFI_SUCCESS The Path represents a file. - @retval EFI_NOT_FOUND The Path does not represent a file. - @retval other The path failed to open. -**/ -EFI_STATUS -EFIAPI -ShellIsFile( - IN CONST CHAR16 *Name - ) -{ - EFI_STATUS Status; - SHELL_FILE_HANDLE Handle; - - ASSERT(Name != NULL); - - Handle = NULL; - - Status = ShellOpenFileByName(Name, &Handle, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR(Status)) { - return (Status); - } - - if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) { - ShellCloseFile(&Handle); - return (EFI_SUCCESS); - } - ShellCloseFile(&Handle); - return (EFI_NOT_FOUND); -} - -/** - Function to determine if a given filename represents a file. - - This will search the CWD and then the Path. - - If Name is NULL, then ASSERT. - - @param[in] Name Path to file to test. - - @retval EFI_SUCCESS The Path represents a file. - @retval EFI_NOT_FOUND The Path does not represent a file. - @retval other The path failed to open. -**/ -EFI_STATUS -EFIAPI -ShellIsFileInPath( - IN CONST CHAR16 *Name - ) -{ - CHAR16 *NewName; - EFI_STATUS Status; - - if (!EFI_ERROR(ShellIsFile(Name))) { - return (EFI_SUCCESS); - } - - NewName = ShellFindFilePath(Name); - if (NewName == NULL) { - return (EFI_NOT_FOUND); - } - Status = ShellIsFile(NewName); - FreePool(NewName); - return (Status); -} - -/** - Function return the number converted from a hex representation of a number. - - Note: this function cannot be used when (UINTN)(-1), (0xFFFFFFFF) may be a valid - result. Use ShellConvertStringToUint64 instead. - - @param[in] String String representation of a number. - - @return The unsigned integer result of the conversion. - @retval (UINTN)(-1) An error occured. -**/ -UINTN -EFIAPI -ShellHexStrToUintn( - IN CONST CHAR16 *String - ) -{ - UINT64 RetVal; - - if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, TRUE, TRUE))) { - return ((UINTN)RetVal); - } - - return ((UINTN)(-1)); -} - -/** - Function to determine whether a string is decimal or hex representation of a number - and return the number converted from the string. Spaces are always skipped. - - @param[in] String String representation of a number - - @return the number - @retval (UINTN)(-1) An error ocurred. -**/ -UINTN -EFIAPI -ShellStrToUintn( - IN CONST CHAR16 *String - ) -{ - UINT64 RetVal; - BOOLEAN Hex; - - Hex = FALSE; - - if (!InternalShellIsHexOrDecimalNumber(String, Hex, TRUE, FALSE)) { - Hex = TRUE; - } - - if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, Hex, TRUE))) { - return ((UINTN)RetVal); - } - return ((UINTN)(-1)); -} - -/** - Safely append with automatic string resizing given length of Destination and - desired length of copy from Source. - - append the first D characters of Source to the end of Destination, where D is - the lesser of Count and the StrLen() of Source. If appending those D characters - will fit within Destination (whose Size is given as CurrentSize) and - still leave room for a NULL terminator, then those characters are appended, - starting at the original terminating NULL of Destination, and a new terminating - NULL is appended. - - If appending D characters onto Destination will result in a overflow of the size - given in CurrentSize the string will be grown such that the copy can be performed - and CurrentSize will be updated to the new size. - - If Source is NULL, there is nothing to append, just return the current buffer in - Destination. - - if Destination is NULL, then ASSERT() - if Destination's current length (including NULL terminator) is already more then - CurrentSize, then ASSERT() - - @param[in, out] Destination The String to append onto - @param[in, out] CurrentSize on call the number of bytes in Destination. On - return possibly the new size (still in bytes). if NULL - then allocate whatever is needed. - @param[in] Source The String to append from - @param[in] Count Maximum number of characters to append. if 0 then - all are appended. - - @return Destination return the resultant string. -**/ -CHAR16* -EFIAPI -StrnCatGrow ( - IN OUT CHAR16 **Destination, - IN OUT UINTN *CurrentSize, - IN CONST CHAR16 *Source, - IN UINTN Count - ) -{ - UINTN DestinationStartSize; - UINTN NewSize; - - // - // ASSERTs - // - ASSERT(Destination != NULL); - - // - // If there's nothing to do then just return Destination - // - if (Source == NULL) { - return (*Destination); - } - - // - // allow for un-initialized pointers, based on size being 0 - // - if (CurrentSize != NULL && *CurrentSize == 0) { - *Destination = NULL; - } - - // - // allow for NULL pointers address as Destination - // - if (*Destination != NULL) { - ASSERT(CurrentSize != 0); - DestinationStartSize = StrSize(*Destination); - ASSERT(DestinationStartSize <= *CurrentSize); - } else { - DestinationStartSize = 0; -// ASSERT(*CurrentSize == 0); - } - - // - // Append all of Source? - // - if (Count == 0) { - Count = StrLen(Source); - } - - // - // Test and grow if required - // - if (CurrentSize != NULL) { - NewSize = *CurrentSize; - if (NewSize < DestinationStartSize + (Count * sizeof(CHAR16))) { - while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) { - NewSize += 2 * Count * sizeof(CHAR16); - } - *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination); - *CurrentSize = NewSize; - } - } else { - NewSize = (Count+1)*sizeof(CHAR16); - *Destination = AllocateZeroPool(NewSize); - } - - // - // Now use standard StrnCat on a big enough buffer - // - if (*Destination == NULL) { - return (NULL); - } - - StrnCatS(*Destination, NewSize/sizeof(CHAR16), Source, Count); - return *Destination; -} - -/** - Prompt the user and return the resultant answer to the requestor. - - This function will display the requested question on the shell prompt and then - wait for an appropriate answer to be input from the console. - - if the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, ShellPromptResponseTypeQuitContinue - or SHELL_PROMPT_REQUEST_TYPE_YESNOCANCEL then *Response is of type SHELL_PROMPT_RESPONSE. - - if the SHELL_PROMPT_REQUEST_TYPE is ShellPromptResponseTypeFreeform then *Response is of type - CHAR16*. - - In either case *Response must be callee freed if Response was not NULL; - - @param Type What type of question is asked. This is used to filter the input - to prevent invalid answers to question. - @param Prompt Pointer to string prompt to use to request input. - @param Response Pointer to Response which will be populated upon return. - - @retval EFI_SUCCESS The operation was sucessful. - @retval EFI_UNSUPPORTED The operation is not supported as requested. - @retval EFI_INVALID_PARAMETER A parameter was invalid. - @return other The operation failed. -**/ -EFI_STATUS -EFIAPI -ShellPromptForResponse ( - IN SHELL_PROMPT_REQUEST_TYPE Type, - IN CHAR16 *Prompt OPTIONAL, - IN OUT VOID **Response OPTIONAL - ) -{ - EFI_STATUS Status; - EFI_INPUT_KEY Key; - UINTN EventIndex; - SHELL_PROMPT_RESPONSE *Resp; - UINTN Size; - CHAR16 *Buffer; - - Status = EFI_UNSUPPORTED; - Resp = NULL; - Buffer = NULL; - Size = 0; - if (Type != ShellPromptResponseTypeFreeform) { - Resp = (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESPONSE)); - if (Resp == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - } - - switch(Type) { - case ShellPromptResponseTypeQuitContinue: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - // - // wait for valid response - // - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); - if (Key.UnicodeChar == L'Q' || Key.UnicodeChar ==L'q') { - *Resp = ShellPromptResponseQuit; - } else { - *Resp = ShellPromptResponseContinue; - } - break; - case ShellPromptResponseTypeYesNoCancel: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - // - // wait for valid response - // - *Resp = ShellPromptResponseMax; - while (*Resp == ShellPromptResponseMax) { - if (ShellGetExecutionBreakFlag()) { - Status = EFI_ABORTED; - break; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); - switch (Key.UnicodeChar) { - case L'Y': - case L'y': - *Resp = ShellPromptResponseYes; - break; - case L'N': - case L'n': - *Resp = ShellPromptResponseNo; - break; - case L'C': - case L'c': - *Resp = ShellPromptResponseCancel; - break; - } - } - break; - case ShellPromptResponseTypeYesNoAllCancel: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - // - // wait for valid response - // - *Resp = ShellPromptResponseMax; - while (*Resp == ShellPromptResponseMax) { - if (ShellGetExecutionBreakFlag()) { - Status = EFI_ABORTED; - break; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - - if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) { - ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar); - } - - switch (Key.UnicodeChar) { - case L'Y': - case L'y': - *Resp = ShellPromptResponseYes; - break; - case L'N': - case L'n': - *Resp = ShellPromptResponseNo; - break; - case L'A': - case L'a': - *Resp = ShellPromptResponseAll; - break; - case L'C': - case L'c': - *Resp = ShellPromptResponseCancel; - break; - } - } - break; - case ShellPromptResponseTypeEnterContinue: - case ShellPromptResponseTypeAnyKeyContinue: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - // - // wait for valid response - // - *Resp = ShellPromptResponseMax; - while (*Resp == ShellPromptResponseMax) { - if (ShellGetExecutionBreakFlag()) { - Status = EFI_ABORTED; - break; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - if (Type == ShellPromptResponseTypeEnterContinue) { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); - if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { - *Resp = ShellPromptResponseContinue; - break; - } - } - if (Type == ShellPromptResponseTypeAnyKeyContinue) { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); - *Resp = ShellPromptResponseContinue; - break; - } - } - break; - case ShellPromptResponseTypeYesNo: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - // - // wait for valid response - // - *Resp = ShellPromptResponseMax; - while (*Resp == ShellPromptResponseMax) { - if (ShellGetExecutionBreakFlag()) { - Status = EFI_ABORTED; - break; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); - switch (Key.UnicodeChar) { - case L'Y': - case L'y': - *Resp = ShellPromptResponseYes; - break; - case L'N': - case L'n': - *Resp = ShellPromptResponseNo; - break; - } - } - break; - case ShellPromptResponseTypeFreeform: - if (Prompt != NULL) { - ShellPrintEx(-1, -1, L"%s", Prompt); - } - while(1) { - if (ShellGetExecutionBreakFlag()) { - Status = EFI_ABORTED; - break; - } - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR(Status)) { - break; - } - ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); - if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { - break; - } - ASSERT((Buffer == NULL && Size == 0) || (Buffer != NULL)); - StrnCatGrow(&Buffer, &Size, &Key.UnicodeChar, 1); - } - break; - // - // This is the location to add new prompt types. - // If your new type loops remember to add ExecutionBreak support. - // - default: - ASSERT(FALSE); - } - - if (Response != NULL) { - if (Resp != NULL) { - *Response = Resp; - } else if (Buffer != NULL) { - *Response = Buffer; - } - } else { - if (Resp != NULL) { - FreePool(Resp); - } - if (Buffer != NULL) { - FreePool(Buffer); - } - } - - ShellPrintEx(-1, -1, L"\r\n"); - return (Status); -} - -/** - Prompt the user and return the resultant answer to the requestor. - - This function is the same as ShellPromptForResponse, except that the prompt is - automatically pulled from HII. - - @param Type What type of question is asked. This is used to filter the input - to prevent invalid answers to question. - @param[in] HiiFormatStringId The format string Id for getting from Hii. - @param[in] HiiFormatHandle The format string Handle for getting from Hii. - @param Response Pointer to Response which will be populated upon return. - - @retval EFI_SUCCESS the operation was sucessful. - @return other the operation failed. - - @sa ShellPromptForResponse -**/ -EFI_STATUS -EFIAPI -ShellPromptForResponseHii ( - IN SHELL_PROMPT_REQUEST_TYPE Type, - IN CONST EFI_STRING_ID HiiFormatStringId, - IN CONST EFI_HANDLE HiiFormatHandle, - IN OUT VOID **Response - ) -{ - CHAR16 *Prompt; - EFI_STATUS Status; - - Prompt = HiiGetString(HiiFormatHandle, HiiFormatStringId, NULL); - Status = ShellPromptForResponse(Type, Prompt, Response); - FreePool(Prompt); - return (Status); -} - -/** - Function to determin if an entire string is a valid number. - - If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. - - @param[in] String The string to evaluate. - @param[in] ForceHex TRUE - always assume hex. - @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going. - @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise. - - @retval TRUE It is all numeric (dec/hex) characters. - @retval FALSE There is a non-numeric character. -**/ -BOOLEAN -InternalShellIsHexOrDecimalNumber ( - IN CONST CHAR16 *String, - IN CONST BOOLEAN ForceHex, - IN CONST BOOLEAN StopAtSpace, - IN CONST BOOLEAN TimeNumbers - ) -{ - BOOLEAN Hex; - BOOLEAN LeadingZero; - - if (String == NULL) { - return FALSE; - } - - // - // chop off a single negative sign - // - if (*String == L'-') { - String++; - } - - if (*String == CHAR_NULL) { - return FALSE; - } - - // - // chop leading zeroes - // - LeadingZero = FALSE; - while(*String == L'0'){ - String++; - LeadingZero = TRUE; - } - // - // allow '0x' or '0X', but not 'x' or 'X' - // - if (*String == L'x' || *String == L'X') { - if (!LeadingZero) { - // - // we got an x without a preceeding 0 - // - return (FALSE); - } - String++; - Hex = TRUE; - } else if (ForceHex) { - Hex = TRUE; - } else { - Hex = FALSE; - } - - // - // loop through the remaining characters and use the lib function - // - for ( ; *String != CHAR_NULL && !(StopAtSpace && *String == L' ') ; String++){ - if (TimeNumbers && (String[0] == L':')) { - continue; - } - if (Hex) { - if (!ShellIsHexaDecimalDigitCharacter(*String)) { - return (FALSE); - } - } else { - if (!ShellIsDecimalDigitCharacter(*String)) { - return (FALSE); - } - } - } - - return (TRUE); -} - -/** - Function to determine if a given filename exists. - - @param[in] Name Path to test. - - @retval EFI_SUCCESS The Path represents a file. - @retval EFI_NOT_FOUND The Path does not represent a file. - @retval other The path failed to open. -**/ -EFI_STATUS -EFIAPI -ShellFileExists( - IN CONST CHAR16 *Name - ) -{ - EFI_STATUS Status; - EFI_SHELL_FILE_INFO *List; - - ASSERT(Name != NULL); - - List = NULL; - Status = ShellOpenFileMetaArg((CHAR16*)Name, EFI_FILE_MODE_READ, &List); - if (EFI_ERROR(Status)) { - return (Status); - } - - ShellCloseFileMetaArg(&List); - - return (EFI_SUCCESS); -} - -/** - Convert a Unicode character to numerical value. - - This internal function only deal with Unicode character - which maps to a valid hexadecimal ASII character, i.e. - L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other - Unicode character, the value returned does not make sense. - - @param Char The character to convert. - - @return The numerical value converted. - -**/ -UINTN -InternalShellHexCharToUintn ( - IN CHAR16 Char - ) -{ - if (ShellIsDecimalDigitCharacter (Char)) { - return Char - L'0'; - } - - return (10 + CharToUpper (Char) - L'A'); -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64. - - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a hexadecimal number. - The format of the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or - [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the - first valid hexadecimal digit. Then, the function stops at the first character that is - a not a valid hexadecimal character or NULL, whichever one comes first. - - If String has only pad spaces, then zero is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, - then zero is returned. - - @param[in] String A pointer to a Null-terminated Unicode string. - @param[out] Value Upon a successful return the value of the conversion. - @param[in] StopAtSpace FALSE to skip spaces. - - @retval EFI_SUCCESS The conversion was successful. - @retval EFI_INVALID_PARAMETER A parameter was NULL or invalid. - @retval EFI_DEVICE_ERROR An overflow occured. -**/ -EFI_STATUS -InternalShellStrHexToUint64 ( - IN CONST CHAR16 *String, - OUT UINT64 *Value, - IN CONST BOOLEAN StopAtSpace - ) -{ - UINT64 Result; - - if (String == NULL || StrSize(String) == 0 || Value == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - if (CharToUpper (*String) == L'X') { - if (*(String - 1) != L'0') { - return 0; - } - // - // Skip the 'X' - // - String++; - } - - Result = 0; - - // - // there is a space where there should't be - // - if (*String == L' ') { - return (EFI_INVALID_PARAMETER); - } - - while (ShellIsHexaDecimalDigitCharacter (*String)) { - // - // If the Hex Number represented by String overflows according - // to the range defined by UINT64, then return EFI_DEVICE_ERROR. - // - if (!(Result <= (RShiftU64((((UINT64) ~0) - InternalShellHexCharToUintn (*String)), 4)))) { -// if (!(Result <= ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)) >> 4))) { - return (EFI_DEVICE_ERROR); - } - - Result = (LShiftU64(Result, 4)); - Result += InternalShellHexCharToUintn (*String); - String++; - - // - // stop at spaces if requested - // - if (StopAtSpace && *String == L' ') { - break; - } - } - - *Value = Result; - return (EFI_SUCCESS); -} - -/** - Convert a Null-terminated Unicode decimal string to a value of - type UINT64. - - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a decimal number. The format - of the input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The - function will ignore the pad space, which includes spaces or - tab characters, before [decimal digits]. The running zero in the - beginning of [decimal digits] will be ignored. Then, the function - stops at the first character that is a not a valid decimal character - or a Null-terminator, whichever one comes first. - - If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, - then 0 is returned. - - @param[in] String A pointer to a Null-terminated Unicode string. - @param[out] Value Upon a successful return the value of the conversion. - @param[in] StopAtSpace FALSE to skip spaces. - - @retval EFI_SUCCESS The conversion was successful. - @retval EFI_INVALID_PARAMETER A parameter was NULL or invalid. - @retval EFI_DEVICE_ERROR An overflow occured. -**/ -EFI_STATUS -InternalShellStrDecimalToUint64 ( - IN CONST CHAR16 *String, - OUT UINT64 *Value, - IN CONST BOOLEAN StopAtSpace - ) -{ - UINT64 Result; - - if (String == NULL || StrSize (String) == 0 || Value == NULL) { - return (EFI_INVALID_PARAMETER); - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - Result = 0; - - // - // Stop upon space if requested - // (if the whole value was 0) - // - if (StopAtSpace && *String == L' ') { - *Value = Result; - return (EFI_SUCCESS); - } - - while (ShellIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according - // to the range defined by UINT64, then return EFI_DEVICE_ERROR. - // - - if (!(Result <= (DivU64x32((((UINT64) ~0) - (*String - L'0')),10)))) { - return (EFI_DEVICE_ERROR); - } - - Result = MultU64x32(Result, 10) + (*String - L'0'); - String++; - - // - // Stop at spaces if requested - // - if (StopAtSpace && *String == L' ') { - break; - } - } - - *Value = Result; - - return (EFI_SUCCESS); -} - -/** - Function to verify and convert a string to its numerical value. - - If Hex it must be preceeded with a 0x, 0X, or has ForceHex set TRUE. - - @param[in] String The string to evaluate. - @param[out] Value Upon a successful return the value of the conversion. - @param[in] ForceHex TRUE - always assume hex. - @param[in] StopAtSpace FALSE to skip spaces. - - @retval EFI_SUCCESS The conversion was successful. - @retval EFI_INVALID_PARAMETER String contained an invalid character. - @retval EFI_NOT_FOUND String was a number, but Value was NULL. -**/ -EFI_STATUS -EFIAPI -ShellConvertStringToUint64( - IN CONST CHAR16 *String, - OUT UINT64 *Value, - IN CONST BOOLEAN ForceHex, - IN CONST BOOLEAN StopAtSpace - ) -{ - UINT64 RetVal; - CONST CHAR16 *Walker; - EFI_STATUS Status; - BOOLEAN Hex; - - Hex = ForceHex; - - if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) { - if (!Hex) { - Hex = TRUE; - if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) { - return (EFI_INVALID_PARAMETER); - } - } else { - return (EFI_INVALID_PARAMETER); - } - } - - // - // Chop off leading spaces - // - for (Walker = String; Walker != NULL && *Walker != CHAR_NULL && *Walker == L' '; Walker++); - - // - // make sure we have something left that is numeric. - // - if (Walker == NULL || *Walker == CHAR_NULL || !InternalShellIsHexOrDecimalNumber(Walker, Hex, StopAtSpace, FALSE)) { - return (EFI_INVALID_PARAMETER); - } - - // - // do the conversion. - // - if (Hex || StrnCmp(Walker, L"0x", 2) == 0 || StrnCmp(Walker, L"0X", 2) == 0){ - Status = InternalShellStrHexToUint64(Walker, &RetVal, StopAtSpace); - } else { - Status = InternalShellStrDecimalToUint64(Walker, &RetVal, StopAtSpace); - } - - if (Value == NULL && !EFI_ERROR(Status)) { - return (EFI_NOT_FOUND); - } - - if (Value != NULL) { - *Value = RetVal; - } - - return (Status); -} - -/** - Function to determin if an entire string is a valid number. - - If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. - - @param[in] String The string to evaluate. - @param[in] ForceHex TRUE - always assume hex. - @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going. - - @retval TRUE It is all numeric (dec/hex) characters. - @retval FALSE There is a non-numeric character. -**/ -BOOLEAN -EFIAPI -ShellIsHexOrDecimalNumber ( - IN CONST CHAR16 *String, - IN CONST BOOLEAN ForceHex, - IN CONST BOOLEAN StopAtSpace - ) -{ - if (ShellConvertStringToUint64(String, NULL, ForceHex, StopAtSpace) == EFI_NOT_FOUND) { - return (TRUE); - } - return (FALSE); -} - -/** - Function to read a single line from a SHELL_FILE_HANDLE. The \n is not included in the returned - buffer. The returned buffer must be callee freed. - - If the position upon start is 0, then the Ascii Boolean will be set. This should be - maintained and not changed for all operations with the same file. - - @param[in] Handle SHELL_FILE_HANDLE to read from. - @param[in, out] Ascii Boolean value for indicating whether the file is - Ascii (TRUE) or UCS2 (FALSE). - - @return The line of text from the file. - @retval NULL There was not enough memory available. - - @sa ShellFileHandleReadLine -**/ -CHAR16* -EFIAPI -ShellFileHandleReturnLine( - IN SHELL_FILE_HANDLE Handle, - IN OUT BOOLEAN *Ascii - ) -{ - CHAR16 *RetVal; - UINTN Size; - EFI_STATUS Status; - - Size = 0; - RetVal = NULL; - - Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii); - if (Status == EFI_BUFFER_TOO_SMALL) { - RetVal = AllocateZeroPool(Size); - if (RetVal == NULL) { - return (NULL); - } - Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii); - - } - if (Status == EFI_END_OF_FILE && RetVal != NULL && *RetVal != CHAR_NULL) { - Status = EFI_SUCCESS; - } - if (EFI_ERROR(Status) && (RetVal != NULL)) { - FreePool(RetVal); - RetVal = NULL; - } - return (RetVal); -} - -/** - Function to read a single line (up to but not including the \n) from a SHELL_FILE_HANDLE. - - If the position upon start is 0, then the Ascii Boolean will be set. This should be - maintained and not changed for all operations with the same file. - - NOTE: LINES THAT ARE RETURNED BY THIS FUNCTION ARE UCS2, EVEN IF THE FILE BEING READ - IS IN ASCII FORMAT. - - @param[in] Handle SHELL_FILE_HANDLE to read from. - @param[in, out] Buffer The pointer to buffer to read into. If this function - returns EFI_SUCCESS, then on output Buffer will - contain a UCS2 string, even if the file being - read is ASCII. - @param[in, out] Size On input, pointer to number of bytes in Buffer. - On output, unchanged unless Buffer is too small - to contain the next line of the file. In that - case Size is set to the number of bytes needed - to hold the next line of the file (as a UCS2 - string, even if it is an ASCII file). - @param[in] Truncate If the buffer is large enough, this has no effect. - If the buffer is is too small and Truncate is TRUE, - the line will be truncated. - If the buffer is is too small and Truncate is FALSE, - then no read will occur. - - @param[in, out] Ascii Boolean value for indicating whether the file is - Ascii (TRUE) or UCS2 (FALSE). - - @retval EFI_SUCCESS The operation was successful. The line is stored in - Buffer. - @retval EFI_END_OF_FILE There are no more lines in the file. - @retval EFI_INVALID_PARAMETER Handle was NULL. - @retval EFI_INVALID_PARAMETER Size was NULL. - @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line. - Size was updated to the minimum space required. -**/ -EFI_STATUS -EFIAPI -ShellFileHandleReadLine( - IN SHELL_FILE_HANDLE Handle, - IN OUT CHAR16 *Buffer, - IN OUT UINTN *Size, - IN BOOLEAN Truncate, - IN OUT BOOLEAN *Ascii - ) -{ - EFI_STATUS Status; - CHAR16 CharBuffer; - UINTN CharSize; - UINTN CountSoFar; - UINT64 OriginalFilePosition; - - - if (Handle == NULL - ||Size == NULL - ){ - return (EFI_INVALID_PARAMETER); - } - if (Buffer == NULL) { - ASSERT(*Size == 0); - } else { - *Buffer = CHAR_NULL; - } - gEfiShellProtocol->GetFilePosition(Handle, &OriginalFilePosition); - if (OriginalFilePosition == 0) { - CharSize = sizeof(CHAR16); - Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer); - ASSERT_EFI_ERROR(Status); - if (CharBuffer == gUnicodeFileTag) { - *Ascii = FALSE; - } else { - *Ascii = TRUE; - gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition); - } - } - - if (*Ascii) { - CharSize = sizeof(CHAR8); - } else { - CharSize = sizeof(CHAR16); - } - for (CountSoFar = 0;;CountSoFar++){ - CharBuffer = 0; - Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer); - if ( EFI_ERROR(Status) - || CharSize == 0 - || (CharBuffer == L'\n' && !(*Ascii)) - || (CharBuffer == '\n' && *Ascii) - ){ - if (CharSize == 0) { - Status = EFI_END_OF_FILE; - } - break; - } - // - // if we have space save it... - // - if ((CountSoFar+1)*sizeof(CHAR16) < *Size){ - ASSERT(Buffer != NULL); - ((CHAR16*)Buffer)[CountSoFar] = CharBuffer; - ((CHAR16*)Buffer)[CountSoFar+1] = CHAR_NULL; - } - } - - // - // if we ran out of space tell when... - // - if ((CountSoFar+1)*sizeof(CHAR16) > *Size){ - *Size = (CountSoFar+1)*sizeof(CHAR16); - if (!Truncate) { - gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition); - } else { - DEBUG((DEBUG_WARN, "The line was truncated in ShellFileHandleReadLine")); - } - return (EFI_BUFFER_TOO_SMALL); - } - while(Buffer[StrLen(Buffer)-1] == L'\r') { - Buffer[StrLen(Buffer)-1] = CHAR_NULL; - } - - return (Status); -} - -/** - Function to print help file / man page content in the spec from the UEFI Shell protocol GetHelpText function. - - @param[in] CommandToGetHelpOn Pointer to a string containing the command name of help file to be printed. - @param[in] SectionToGetHelpOn Pointer to the section specifier(s). - @param[in] PrintCommandText If TRUE, prints the command followed by the help content, otherwise prints - the help content only. - @retval EFI_DEVICE_ERROR The help data format was incorrect. - @retval EFI_NOT_FOUND The help data could not be found. - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -EFIAPI -ShellPrintHelp ( - IN CONST CHAR16 *CommandToGetHelpOn, - IN CONST CHAR16 *SectionToGetHelpOn, - IN BOOLEAN PrintCommandText - ) -{ - EFI_STATUS Status; - CHAR16 *OutText; - - OutText = NULL; - - // - // Get the string to print based - // - Status = gEfiShellProtocol->GetHelpText (CommandToGetHelpOn, SectionToGetHelpOn, &OutText); - - // - // make sure we got a valid string - // - if (EFI_ERROR(Status)){ - return Status; - } - if (OutText == NULL || StrLen(OutText) == 0) { - return EFI_NOT_FOUND; - } - - // - // Chop off trailing stuff we dont need - // - while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') { - OutText[StrLen(OutText)-1] = CHAR_NULL; - } - - // - // Print this out to the console - // - if (PrintCommandText) { - ShellPrintEx(-1, -1, L"%H%-14s%N- %s\r\n", CommandToGetHelpOn, OutText); - } else { - ShellPrintEx(-1, -1, L"%N%s\r\n", OutText); - } - - SHELL_FREE_NON_NULL(OutText); - - return EFI_SUCCESS; -} - -/** - Function to delete a file by name - - @param[in] FileName Pointer to file name to delete. - - @retval EFI_SUCCESS the file was deleted sucessfully - @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not - deleted - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_NOT_FOUND The specified file could not be found on the - device or the file system could not be found - on the device. - @retval EFI_NO_MEDIA The device has no medium. - @retval EFI_MEDIA_CHANGED The device has a different medium in it or the - medium is no longer supported. - @retval EFI_DEVICE_ERROR The device reported an error. - @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. - @retval EFI_WRITE_PROTECTED The file or medium is write protected. - @retval EFI_ACCESS_DENIED The file was opened read only. - @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the - file. - @retval other The file failed to open -**/ -EFI_STATUS -EFIAPI -ShellDeleteFileByName( - IN CONST CHAR16 *FileName - ) -{ - EFI_STATUS Status; - SHELL_FILE_HANDLE FileHandle; - - Status = ShellFileExists(FileName); - - if (Status == EFI_SUCCESS){ - Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0x0); - if (Status == EFI_SUCCESS){ - Status = ShellDeleteFile(&FileHandle); - } - } - - return(Status); - -} - -/** - Cleans off all the quotes in the string. - - @param[in] OriginalString pointer to the string to be cleaned. - @param[out] CleanString The new string with all quotes removed. - Memory allocated in the function and free - by caller. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -InternalShellStripQuotes ( - IN CONST CHAR16 *OriginalString, - OUT CHAR16 **CleanString - ) -{ - CHAR16 *Walker; - - if (OriginalString == NULL || CleanString == NULL) { - return EFI_INVALID_PARAMETER; - } - - *CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString); - if (*CleanString == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { - if (*Walker == L'\"') { - CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); - } - } - - return EFI_SUCCESS; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.h deleted file mode 100644 index bcada33..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.h +++ /dev/null @@ -1,96 +0,0 @@ -/** @file - Provides interface to shell functionality for shell commands and applications. - - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_LIB_INTERNAL_H_ -#define _UEFI_SHELL_LIB_INTERNAL_H_ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef struct { - EFI_SHELL_GET_FILE_INFO GetFileInfo; - EFI_SHELL_SET_FILE_INFO SetFileInfo; - EFI_SHELL_READ_FILE ReadFile; - EFI_SHELL_WRITE_FILE WriteFile; - EFI_SHELL_CLOSE_FILE CloseFile; - EFI_SHELL_DELETE_FILE DeleteFile; - EFI_SHELL_GET_FILE_POSITION GetFilePosition; - EFI_SHELL_SET_FILE_POSITION SetFilePosition; - EFI_SHELL_FLUSH_FILE FlushFile; - EFI_SHELL_GET_FILE_SIZE GetFileSize; -} FILE_HANDLE_FUNCTION_MAP; - -/** - Function to determin if an entire string is a valid number. - - If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. - - @param[in] String The string to evaluate. - @param[in] ForceHex TRUE - always assume hex. - @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going. - @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise. - - @retval TRUE It is all numeric (dec/hex) characters. - @retval FALSE There is a non-numeric character. -**/ -BOOLEAN -InternalShellIsHexOrDecimalNumber ( - IN CONST CHAR16 *String, - IN CONST BOOLEAN ForceHex, - IN CONST BOOLEAN StopAtSpace, - IN CONST BOOLEAN TimeNumbers - ); - -/** - Cleans off all the quotes in the string. - - @param[in] OriginalString pointer to the string to be cleaned. - @param[out] CleanString The new string with all quotes removed. - Memory allocated in the function and free - by caller. - - @retval EFI_SUCCESS The operation was successful. -**/ -EFI_STATUS -InternalShellStripQuotes ( - IN CONST CHAR16 *OriginalString, - OUT CHAR16 **CleanString - ); - - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.inf deleted file mode 100644 index 065a179..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.inf +++ /dev/null @@ -1,70 +0,0 @@ -## @file -# Provides interface to shell functionality for shell commands and applications. -# -# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellLib - FILE_GUID = 449D0F00-2148-4a43-9836-F10B3980ECF5 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.2 - LIBRARY_CLASS = ShellLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER DXE_DRIVER - CONSTRUCTOR = ShellLibConstructor - DESTRUCTOR = ShellLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources.common] - UefiShellLib.c - UefiShellLib.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - MemoryAllocationLib - DevicePathLib - BaseLib - BaseMemoryLib - DebugLib - FileHandleLib - PrintLib - UefiLib - HiiLib - SortLib - -[Protocols] - gEfiUnicodeCollation2ProtocolGuid ## CONSUMES - - # shell 2.0 - gEfiShellProtocolGuid ## SOMETIMES_CONSUMES - gEfiShellParametersProtocolGuid ## SOMETIMES_CONSUMES - - # 'old' shell - gEfiShellEnvironment2Guid ## SOMETIMES_CONSUMES - gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES - -[Guids] - gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID - gEfiShellEnvironment2ExtGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd.common] - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize ## CONSUMES - gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ## CONSUMES diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c deleted file mode 100644 index 8e96630..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ /dev/null @@ -1,1447 +0,0 @@ -/** @file - The implementation for Shell command ifconfig based on IP4Config2 protocol. - - (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellNetwork1CommandsLib.h" - -typedef enum { - IfConfigOpList = 1, - IfConfigOpSet = 2, - IfConfigOpClear = 3 -} IFCONFIG_OPCODE; - -typedef enum { - VarCheckReserved = -1, - VarCheckOk = 0, - VarCheckDuplicate, - VarCheckConflict, - VarCheckUnknown, - VarCheckLackValue, - VarCheckOutOfMem -} VAR_CHECK_CODE; - -typedef enum { - FlagTypeSingle = 0, - FlagTypeNeedVar, - FlagTypeNeedSet, - FlagTypeSkipUnknown -} VAR_CHECK_FLAG_TYPE; - -#define MACADDRMAXSIZE 32 - -typedef struct _IFCONFIG_INTERFACE_CB { - EFI_HANDLE NicHandle; - LIST_ENTRY Link; - EFI_IP4_CONFIG2_PROTOCOL *IfCfg; - EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo; - EFI_IP4_CONFIG2_POLICY Policy; - UINT32 DnsCnt; - EFI_IPv4_ADDRESS DnsAddr[1]; -} IFCONFIG_INTERFACE_CB; - -typedef struct _ARG_LIST ARG_LIST; - -struct _ARG_LIST { - ARG_LIST *Next; - CHAR16 *Arg; -}; - -typedef struct _IFCONFIG4_PRIVATE_DATA { - LIST_ENTRY IfList; - - UINT32 OpCode; - CHAR16 *IfName; - ARG_LIST *VarArg; -} IFCONFIG_PRIVATE_DATA; - -typedef struct _VAR_CHECK_ITEM{ - CHAR16 *FlagStr; - UINT32 FlagID; - UINT32 ConflictMask; - VAR_CHECK_FLAG_TYPE FlagType; -} VAR_CHECK_ITEM; - -SHELL_PARAM_ITEM mIfConfigCheckList[] = { - { - L"-b", - TypeFlag - }, - { - L"-l", - TypeValue - }, - { - L"-r", - TypeValue - }, - { - L"-c", - TypeValue - }, - { - L"-s", - TypeMaxValue - }, - { - NULL, - TypeMax - }, -}; - -VAR_CHECK_ITEM mSetCheckList[] = { - { - L"static", - 0x00000001, - 0x00000001, - FlagTypeSingle - }, - { - L"dhcp", - 0x00000002, - 0x00000001, - FlagTypeSingle - }, - { - L"dns", - 0x00000008, - 0x00000004, - FlagTypeSingle - }, - { - NULL, - 0x0, - 0x0, - FlagTypeSkipUnknown - }, -}; - -STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT"; - -/** - Free the ARG_LIST. - - @param List Pointer to ARG_LIST to free. -**/ -VOID -FreeArgList ( - ARG_LIST *List -) -{ - ARG_LIST *Next; - while (List->Next != NULL) { - Next = List->Next; - FreePool (List); - List = Next; - } - - FreePool (List); -} - -/** - Split a string with specified separator and save the substring to a list. - - @param[in] String The pointer of the input string. - @param[in] Separator The specified separator. - - @return The pointer of headnode of ARG_LIST. - -**/ -ARG_LIST * -SplitStrToList ( - IN CONST CHAR16 *String, - IN CHAR16 Separator - ) -{ - CHAR16 *Str; - CHAR16 *ArgStr; - ARG_LIST *ArgList; - ARG_LIST *ArgNode; - - if (*String == L'\0') { - return NULL; - } - - // - // Copy the CONST string to a local copy. - // - Str = AllocateCopyPool (StrSize (String), String); - if (Str == NULL) { - return NULL; - } - ArgStr = Str; - - // - // init a node for the list head. - // - ArgNode = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST)); - if (ArgNode == NULL) { - return NULL; - } - ArgList = ArgNode; - - // - // Split the local copy and save in the list node. - // - while (*Str != L'\0') { - if (*Str == Separator) { - *Str = L'\0'; - ArgNode->Arg = ArgStr; - ArgStr = Str + 1; - ArgNode->Next = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST)); - if (ArgNode->Next == NULL) { - // - // Free the local copy of string stored in the first node - // - FreePool (ArgList->Arg); - FreeArgList (ArgList); - return NULL; - } - ArgNode = ArgNode->Next; - } - - Str++; - } - - ArgNode->Arg = ArgStr; - ArgNode->Next = NULL; - - return ArgList; -} - -/** - Check the correctness of input Args with '-s' option. - - @param[in] CheckList The pointer of VAR_CHECK_ITEM array. - @param[in] Name The pointer of input arg. - @param[in] Init The switch to execute the check. - - @return VarCheckOk Valid parameter or Initialize check successfully. - @return VarCheckDuplicate Duplicated parameter happened. - @return VarCheckConflict Conflicted parameter happened - @return VarCheckUnknown Unknown parameter. - -**/ -VAR_CHECK_CODE -IfConfigRetriveCheckListByName( - IN VAR_CHECK_ITEM *CheckList, - IN CHAR16 *Name, - IN BOOLEAN Init -) -{ - STATIC UINT32 CheckDuplicate; - STATIC UINT32 CheckConflict; - VAR_CHECK_CODE RtCode; - UINT32 Index; - VAR_CHECK_ITEM Arg; - - if (Init) { - CheckDuplicate = 0; - CheckConflict = 0; - return VarCheckOk; - } - - RtCode = VarCheckOk; - Index = 0; - Arg = CheckList[Index]; - - // - // Check the Duplicated/Conflicted/Unknown input Args. - // - while (Arg.FlagStr != NULL) { - if (StrCmp (Arg.FlagStr, Name) == 0) { - - if (CheckDuplicate & Arg.FlagID) { - RtCode = VarCheckDuplicate; - break; - } - - if (CheckConflict & Arg.ConflictMask) { - RtCode = VarCheckConflict; - break; - } - - CheckDuplicate |= Arg.FlagID; - CheckConflict |= Arg.ConflictMask; - break; - } - - Arg = CheckList[++Index]; - } - - if (Arg.FlagStr == NULL) { - RtCode = VarCheckUnknown; - } - - return RtCode; -} - -/** - The notify function of create event when performing a manual config. - - @param[in] Event The event this notify function registered to. - @param[in] Context Pointer to the context data registered to the event. - -**/ -VOID -EFIAPI -IfConfigManualAddressNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - *((BOOLEAN *) Context) = TRUE; -} - -/** - Print MAC address. - - @param[in] Node The pointer of MAC address buffer. - @param[in] Size The size of MAC address buffer. - -**/ -VOID -IfConfigPrintMacAddr ( - IN UINT8 *Node, - IN UINT32 Size - ) -{ - UINTN Index; - - ASSERT (Size <= MACADDRMAXSIZE); - - for (Index = 0; Index < Size; Index++) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MAC_ADDR_BODY), gShellNetwork1HiiHandle, Node[Index]); - if (Index + 1 < Size) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_COLON), gShellNetwork1HiiHandle); - } - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_NEWLINE), gShellNetwork1HiiHandle); -} - - -/** - The get current status of all handles. - - @param[in] IfName The pointer of IfName(interface name). - @param[in] IfList The pointer of IfList(interface list). - - @retval EFI_SUCCESS The get status processed successfully. - @retval others The get status process failed. - -**/ -EFI_STATUS -IfConfigGetInterfaceInfo ( - IN CHAR16 *IfName, - IN LIST_ENTRY *IfList - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - UINTN HandleNum; - EFI_HANDLE *HandleBuffer; - EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2; - EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo; - IFCONFIG_INTERFACE_CB *IfCb; - UINTN DataSize; - - HandleBuffer = NULL; - HandleNum = 0; - - IfInfo = NULL; - IfCb = NULL; - - // - // Locate all the handles with ip4 service binding protocol. - // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiIp4ServiceBindingProtocolGuid, - NULL, - &HandleNum, - &HandleBuffer - ); - if (EFI_ERROR (Status) || (HandleNum == 0)) { - return Status; - } - - // - // Enumerate all handles that installed with ip4 service binding protocol. - // - for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) { - IfCb = NULL; - IfInfo = NULL; - DataSize = 0; - - // - // Ip4config protocol and ip4 service binding protocol are installed - // on the same handle. - // - ASSERT (HandleBuffer != NULL); - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - &gEfiIp4Config2ProtocolGuid, - (VOID **) &Ip4Cfg2 - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - // - // Get the interface information size. - // - Status = Ip4Cfg2->GetData ( - Ip4Cfg2, - Ip4Config2DataTypeInterfaceInfo, - &DataSize, - NULL - ); - - if (Status != EFI_BUFFER_TOO_SMALL) { - goto ON_ERROR; - } - - IfInfo = AllocateZeroPool (DataSize); - - if (IfInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - - // - // Get the interface info. - // - Status = Ip4Cfg2->GetData ( - Ip4Cfg2, - Ip4Config2DataTypeInterfaceInfo, - &DataSize, - IfInfo - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - // - // Check the interface name if required. - // - if ((IfName != NULL) && (StrCmp (IfName, IfInfo->Name) != 0)) { - FreePool (IfInfo); - continue; - } - - DataSize = 0; - - // - // Get the size of dns server list. - // - Status = Ip4Cfg2->GetData ( - Ip4Cfg2, - Ip4Config2DataTypeDnsServer, - &DataSize, - NULL - ); - - if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) { - goto ON_ERROR; - } - - IfCb = AllocateZeroPool (sizeof (IFCONFIG_INTERFACE_CB) + DataSize); - - if (IfCb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - - IfCb->NicHandle = HandleBuffer[HandleIndex]; - IfCb->IfInfo = IfInfo; - IfCb->IfCfg = Ip4Cfg2; - IfCb->DnsCnt = (UINT32) (DataSize / sizeof (EFI_IPv4_ADDRESS)); - - // - // Get the dns server list if has. - // - if (DataSize > 0) { - Status = Ip4Cfg2->GetData ( - Ip4Cfg2, - Ip4Config2DataTypeDnsServer, - &DataSize, - IfCb->DnsAddr - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - } - - // - // Get the config policy. - // - DataSize = sizeof (EFI_IP4_CONFIG2_POLICY); - Status = Ip4Cfg2->GetData ( - Ip4Cfg2, - Ip4Config2DataTypePolicy, - &DataSize, - &IfCb->Policy - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - InsertTailList (IfList, &IfCb->Link); - - if ((IfName != NULL) && (StrCmp (IfName, IfInfo->Name) == 0)) { - // - // Only need the appointed interface, keep the allocated buffer. - // - IfCb = NULL; - IfInfo = NULL; - break; - } - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return EFI_SUCCESS; - -ON_ERROR: - - if (IfInfo != NULL) { - FreePool (IfInfo); - } - - if (IfCb != NULL) { - FreePool (IfCb); - } - - return Status; -} - -/** - The list process of the ifconfig command. - - @param[in] IfList The pointer of IfList(interface list). - - @retval SHELL_SUCCESS The ifconfig command list processed successfully. - @retval others The ifconfig command list process failed. - -**/ -SHELL_STATUS -IfConfigShowInterfaceInfo ( - IN LIST_ENTRY *IfList - ) -{ - LIST_ENTRY *Entry; - LIST_ENTRY *Next; - IFCONFIG_INTERFACE_CB *IfCb; - EFI_STATUS MediaStatus; - EFI_IPv4_ADDRESS Gateway; - UINT32 Index; - - MediaStatus = EFI_SUCCESS; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); - } - - // - // Go through the interface list. - // - NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) { - IfCb = NET_LIST_USER_STRUCT (Entry, IFCONFIG_INTERFACE_CB, Link); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK), gShellNetwork1HiiHandle); - - // - // Print interface name. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), gShellNetwork1HiiHandle, IfCb->IfInfo->Name); - - // - // Get Media State. - // - if (EFI_SUCCESS == NetLibDetectMediaWaitTimeout (IfCb->NicHandle, 0, &MediaStatus)) { - if (MediaStatus != EFI_SUCCESS) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media disconnected"); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media present"); - } - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media state unknown"); - } - - // - // Print interface config policy. - // - if (IfCb->Policy == Ip4Config2PolicyDhcp) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_POLICY_DHCP), gShellNetwork1HiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_POLICY_MAN), gShellNetwork1HiiHandle); - } - - // - // Print mac address of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MAC_ADDR_HEAD), gShellNetwork1HiiHandle); - - IfConfigPrintMacAddr ( - IfCb->IfInfo->HwAddress.Addr, - IfCb->IfInfo->HwAddressSize - ); - - // - // Print IPv4 address list of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_HEAD), gShellNetwork1HiiHandle); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY), - gShellNetwork1HiiHandle, - (UINTN)IfCb->IfInfo->StationAddress.Addr[0], - (UINTN)IfCb->IfInfo->StationAddress.Addr[1], - (UINTN)IfCb->IfInfo->StationAddress.Addr[2], - (UINTN)IfCb->IfInfo->StationAddress.Addr[3] - ); - - // - // Print subnet mask list of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_SUBNET_MASK_HEAD), gShellNetwork1HiiHandle); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY), - gShellNetwork1HiiHandle, - (UINTN)IfCb->IfInfo->SubnetMask.Addr[0], - (UINTN)IfCb->IfInfo->SubnetMask.Addr[1], - (UINTN)IfCb->IfInfo->SubnetMask.Addr[2], - (UINTN)IfCb->IfInfo->SubnetMask.Addr[3] - ); - - // - // Print default gateway of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_GATEWAY_HEAD), gShellNetwork1HiiHandle); - - ZeroMem (&Gateway, sizeof (EFI_IPv4_ADDRESS)); - - for (Index = 0; Index < IfCb->IfInfo->RouteTableSize; Index++) { - if ((CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetAddress, &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) && - (CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetMask , &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) ){ - CopyMem (&Gateway, &IfCb->IfInfo->RouteTable[Index].GatewayAddress, sizeof (EFI_IPv4_ADDRESS)); - } - } - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY), - gShellNetwork1HiiHandle, - (UINTN)Gateway.Addr[0], - (UINTN)Gateway.Addr[1], - (UINTN)Gateway.Addr[2], - (UINTN)Gateway.Addr[3] - ); - - // - // Print route table entry. - // - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_ROUTES_SIZE), gShellNetwork1HiiHandle, IfCb->IfInfo->RouteTableSize); - - for (Index = 0; Index < IfCb->IfInfo->RouteTableSize; Index++) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_ROUTES_ENTRY_INDEX), gShellNetwork1HiiHandle, Index); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR), - gShellNetwork1HiiHandle, - L"Subnet ", - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[0], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[1], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[2], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[3] - ); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR), - gShellNetwork1HiiHandle, - L"Netmask", - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[0], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[1], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[2], - (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[3] - ); - - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR), - gShellNetwork1HiiHandle, - L"Gateway", - (UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[0], - (UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[1], - (UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[2], - (UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[3] - ); - } - - // - // Print dns server addresses list of the interface if has. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_HEAD), gShellNetwork1HiiHandle); - - for (Index = 0; Index < IfCb->DnsCnt; Index++) { - ShellPrintHiiEx( - -1, - -1, - NULL, - STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_BODY), - gShellNetwork1HiiHandle, - (UINTN) IfCb->DnsAddr[Index].Addr[0], - (UINTN) IfCb->DnsAddr[Index].Addr[1], - (UINTN) IfCb->DnsAddr[Index].Addr[2], - (UINTN) IfCb->DnsAddr[Index].Addr[3] - ); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_NEWLINE), gShellNetwork1HiiHandle); - } - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK), gShellNetwork1HiiHandle); - - return SHELL_SUCCESS; -} - -/** - The clean process of the ifconfig command to clear interface info. - - @param[in] IfList The pointer of IfList(interface list). - @param[in] IfName The pointer of interface name. - - @retval SHELL_SUCCESS The ifconfig command clean processed successfully. - @retval others The ifconfig command clean process failed. - -**/ -SHELL_STATUS -IfConfigClearInterfaceInfo ( - IN LIST_ENTRY *IfList, - IN CHAR16 *IfName - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - LIST_ENTRY *Entry; - LIST_ENTRY *Next; - IFCONFIG_INTERFACE_CB *IfCb; - EFI_IP4_CONFIG2_POLICY Policy; - - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); - } - - // - // Go through the interface list. - // If the interface name is specified, DHCP DORA process will be - // triggered by the policy transition (static -> dhcp). - // - NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) { - IfCb = NET_LIST_USER_STRUCT (Entry, IFCONFIG_INTERFACE_CB, Link); - - if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) { - Policy = Ip4Config2PolicyStatic; - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypePolicy, - sizeof (EFI_IP4_CONFIG2_POLICY), - &Policy - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - } - - Policy = Ip4Config2PolicyDhcp; - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypePolicy, - sizeof (EFI_IP4_CONFIG2_POLICY), - &Policy - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - } - - return ShellStatus; -} - -/** - The set process of the ifconfig command. - - @param[in] IfList The pointer of IfList(interface list). - @param[in] VarArg The pointer of ARG_LIST(Args with "-s" option). - - @retval SHELL_SUCCESS The ifconfig command set processed successfully. - @retval others The ifconfig command set process failed. - -**/ -SHELL_STATUS -IfConfigSetInterfaceInfo ( - IN LIST_ENTRY *IfList, - IN ARG_LIST *VarArg - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - IFCONFIG_INTERFACE_CB *IfCb; - VAR_CHECK_CODE CheckCode; - EFI_EVENT TimeOutEvt; - EFI_EVENT MappedEvt; - BOOLEAN IsAddressOk; - - EFI_IP4_CONFIG2_POLICY Policy; - EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress; - UINTN DataSize; - EFI_IPv4_ADDRESS Gateway; - IP4_ADDR SubnetMask; - IP4_ADDR TempGateway; - EFI_IPv4_ADDRESS *Dns; - ARG_LIST *Tmp; - UINTN Index; - - CONST CHAR16* TempString; - - Dns = NULL; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); - return SHELL_INVALID_PARAMETER; - } - - // - // Make sure to set only one interface each time. - // - IfCb = NET_LIST_USER_STRUCT (IfList->ForwardLink, IFCONFIG_INTERFACE_CB, Link); - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - - // - // Initialize check list mechanism. - // - CheckCode = IfConfigRetriveCheckListByName( - NULL, - NULL, - TRUE - ); - - // - // Create events & timers for asynchronous settings. - // - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &TimeOutEvt - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - IfConfigManualAddressNotify, - &IsAddressOk, - &MappedEvt - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Parse the setting variables. - // - while (VarArg != NULL) { - // - // Check invalid parameters (duplication & unknown & conflict). - // - CheckCode = IfConfigRetriveCheckListByName( - mSetCheckList, - VarArg->Arg, - FALSE - ); - - if (VarCheckOk != CheckCode) { - switch (CheckCode) { - case VarCheckDuplicate: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_DUPLICATE_COMMAND), gShellNetwork1HiiHandle, VarArg->Arg); - break; - - case VarCheckConflict: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_CONFLICT_COMMAND), gShellNetwork1HiiHandle, VarArg->Arg); - break; - - case VarCheckUnknown: - // - // To handle unsupported option. - // - TempString = PermanentString; - if (StringNoCaseCompare(&VarArg->Arg, &TempString) == 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle, PermanentString); - goto ON_EXIT; - } - - // - // To handle unknown option. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_UNKNOWN_COMMAND), gShellNetwork1HiiHandle, VarArg->Arg); - break; - - default: - break; - } - - VarArg = VarArg->Next; - continue; - } - - // - // Process valid variables. - // - if (StrCmp(VarArg->Arg, L"dhcp") == 0) { - // - // Set dhcp config policy - // - Policy = Ip4Config2PolicyDhcp; - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypePolicy, - sizeof (EFI_IP4_CONFIG2_POLICY), - &Policy - ); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - VarArg= VarArg->Next; - - } else if (StrCmp (VarArg->Arg, L"static") == 0) { - VarArg= VarArg->Next; - if (VarArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - ZeroMem (&ManualAddress, sizeof (ManualAddress)); - - // - // Get manual IP address. - // - Status = NetLibStrToIp4 (VarArg->Arg, &ManualAddress.Address); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // Get subnetmask. - // - VarArg = VarArg->Next; - if (VarArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - Status = NetLibStrToIp4 (VarArg->Arg, &ManualAddress.SubnetMask); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // Get gateway. - // - VarArg = VarArg->Next; - if (VarArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - Status = NetLibStrToIp4 (VarArg->Arg, &Gateway); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // Need to check the gateway validity before set Manual Address. - // In case we can set manual address but fail to configure Gateway. - // - CopyMem (&SubnetMask, &ManualAddress.SubnetMask, sizeof (IP4_ADDR)); - CopyMem (&TempGateway, &Gateway, sizeof (IP4_ADDR)); - SubnetMask = NTOHL (SubnetMask); - TempGateway = NTOHL (TempGateway); - if ((SubnetMask != 0) && - (SubnetMask != 0xFFFFFFFFu) && - !NetIp4IsUnicast (TempGateway, SubnetMask)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_GATEWAY), gShellNetwork1HiiHandle, VarArg->Arg); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // Set manual config policy. - // - Policy = Ip4Config2PolicyStatic; - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypePolicy, - sizeof (EFI_IP4_CONFIG2_POLICY), - &Policy - ); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Set Manual Address. - // - IsAddressOk = FALSE; - - Status = IfCb->IfCfg->RegisterDataNotify ( - IfCb->IfCfg, - Ip4Config2DataTypeManualAddress, - MappedEvt - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_SET_ADDR_FAILED), gShellNetwork1HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - DataSize = sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS); - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypeManualAddress, - DataSize, - &ManualAddress - ); - - if (Status == EFI_NOT_READY) { - gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000); - - while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) { - if (IsAddressOk) { - Status = EFI_SUCCESS; - break; - } - } - } - - IfCb->IfCfg->UnregisterDataNotify ( - IfCb->IfCfg, - Ip4Config2DataTypeManualAddress, - MappedEvt - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_SET_ADDR_FAILED), gShellNetwork1HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Set gateway. - // - DataSize = sizeof (EFI_IPv4_ADDRESS); - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypeGateway, - DataSize, - &Gateway - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_SET_ADDR_FAILED), gShellNetwork1HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - VarArg = VarArg->Next; - - } else if (StrCmp (VarArg->Arg, L"dns") == 0) { - // - // Get DNS addresses. - // - VarArg = VarArg->Next; - Tmp = VarArg; - Index = 0; - while (Tmp != NULL) { - Index ++; - Tmp = Tmp->Next; - } - - Dns = AllocatePool (Index * sizeof (EFI_IPv4_ADDRESS)); - if (Dns == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - Tmp = VarArg; - Index = 0; - while (Tmp != NULL) { - Status = NetLibStrToIp4 (Tmp->Arg, Dns + Index); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, Tmp->Arg); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - Index ++; - Tmp = Tmp->Next; - } - - VarArg = Tmp; - - // - // Set DNS addresses. - // - DataSize = Index * sizeof (EFI_IPv4_ADDRESS); - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip4Config2DataTypeDnsServer, - DataSize, - Dns - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - } - } - -ON_EXIT: - if (Dns != NULL) { - FreePool (Dns); - } - - return ShellStatus; - -} - -/** - The ifconfig command main process. - - @param[in] Private The pointer of IFCONFIG_PRIVATE_DATA. - - @retval SHELL_SUCCESS ifconfig command processed successfully. - @retval others The ifconfig command process failed. - -**/ -SHELL_STATUS -IfConfig ( - IN IFCONFIG_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - - // - // Get configure information of all interfaces. - // - Status = IfConfigGetInterfaceInfo ( - Private->IfName, - &Private->IfList - ); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_NOT_FOUND; - goto ON_EXIT; - } - - switch (Private->OpCode) { - case IfConfigOpList: - ShellStatus = IfConfigShowInterfaceInfo (&Private->IfList); - break; - - case IfConfigOpClear: - ShellStatus = IfConfigClearInterfaceInfo (&Private->IfList, Private->IfName); - break; - - case IfConfigOpSet: - ShellStatus = IfConfigSetInterfaceInfo (&Private->IfList, Private->VarArg); - break; - - default: - ShellStatus = SHELL_UNSUPPORTED; - } - -ON_EXIT: - return ShellStatus; -} - -/** - The ifconfig command cleanup process, free the allocated memory. - - @param[in] Private The pointer of IFCONFIG_PRIVATE_DATA. - -**/ -VOID -IfConfigCleanup ( - IN IFCONFIG_PRIVATE_DATA *Private - ) -{ - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - IFCONFIG_INTERFACE_CB *IfCb; - - ASSERT (Private != NULL); - - // - // Clean the list which save the set config Args. - // - if (Private->VarArg != NULL) { - FreeArgList (Private->VarArg); - } - - if (Private->IfName != NULL) { - FreePool (Private->IfName); - } - - // - // Clean the IFCONFIG_INTERFACE_CB list. - // - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->IfList) { - IfCb = NET_LIST_USER_STRUCT (Entry, IFCONFIG_INTERFACE_CB, Link); - - RemoveEntryList (&IfCb->Link); - - if (IfCb->IfInfo != NULL) { - - FreePool (IfCb->IfInfo); - } - - FreePool (IfCb); - } - - FreePool (Private); -} - -/** - Function for 'ifconfig' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval EFI_SUCCESS ifconfig command processed successfully. - @retval others The ifconfig command process failed. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIfconfig ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - IFCONFIG_PRIVATE_DATA *Private; - LIST_ENTRY *ParamPackage; - SHELL_STATUS ShellStatus; - CONST CHAR16 *ValueStr; - ARG_LIST *ArgList; - CHAR16 *ProblemParam; - CHAR16 *Str; - - Status = EFI_INVALID_PARAMETER; - Private = NULL; - ShellStatus = SHELL_SUCCESS; - - Status = ShellCommandLineParseEx (mIfConfigCheckList, &ParamPackage, &ProblemParam, TRUE, FALSE); - if (EFI_ERROR (Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ifconfig", ProblemParam); - FreePool(ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - } else { - ASSERT(FALSE); - } - - goto ON_EXIT; - } - - // - // To handle unsupported option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-c")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle,L"-c"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // To handle no option. - // - if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") && - !ShellCommandLineGetFlag (ParamPackage, L"-l")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_OPTION), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // To handle conflict options. - // - if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l")))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - Private = AllocateZeroPool (sizeof (IFCONFIG_PRIVATE_DATA)); - if (Private == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - InitializeListHead (&Private->IfList); - - // - // To get interface name for the list option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-l")) { - Private->OpCode = IfConfigOpList; - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); - if (ValueStr != NULL) { - Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); - if (Str == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - Private->IfName = Str; - } - } - - // - // To get interface name for the clear option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-r")) { - Private->OpCode = IfConfigOpClear; - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r"); - if (ValueStr != NULL) { - Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); - if (Str == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - Private->IfName = Str; - } - } - - // - // To get interface name and corresponding Args for the set option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-s")) { - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); - if (ValueStr == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_INTERFACE), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // To split the configuration into multi-section. - // - ArgList = SplitStrToList (ValueStr, L' '); - if (ArgList == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork1HiiHandle, L"ifconfig"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - Private->OpCode = IfConfigOpSet; - Private->IfName = ArgList->Arg; - - Private->VarArg = ArgList->Next; - - if (Private->IfName == NULL || Private->VarArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - - // - // Main process of ifconfig. - // - ShellStatus = IfConfig (Private); - -ON_EXIT: - - ShellCommandLineFreeVarList (ParamPackage); - - if (Private != NULL) { - IfConfigCleanup (Private); - } - - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c deleted file mode 100644 index 35d581b..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ /dev/null @@ -1,1713 +0,0 @@ -/** @file - The implementation for Ping shell command. - - (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellNetwork1CommandsLib.h" - -#define PING_IP4_COPY_ADDRESS(Dest, Src) (CopyMem ((Dest), (Src), sizeof (EFI_IPv4_ADDRESS))) - -UINT64 mCurrentTick = 0; - -// -// Function templates to match the IPv4 and IPv6 commands that we use. -// -typedef -EFI_STATUS -(EFIAPI *PING_IPX_POLL)( - IN VOID *This - ); - -typedef -EFI_STATUS -(EFIAPI *PING_IPX_TRANSMIT)( - IN VOID *This, - IN VOID *Token - ); - -typedef -EFI_STATUS -(EFIAPI *PING_IPX_RECEIVE)( - IN VOID *This, - IN VOID *Token - ); - -typedef -EFI_STATUS -(EFIAPI *PING_IPX_CANCEL)( - IN VOID *This, - IN VOID *Token OPTIONAL - ); - -/// -/// A set of pointers to either IPv6 or IPv4 functions. -/// Unknown which one to the ping command. -/// -typedef struct { - PING_IPX_TRANSMIT Transmit; - PING_IPX_RECEIVE Receive; - PING_IPX_CANCEL Cancel; - PING_IPX_POLL Poll; -}PING_IPX_PROTOCOL; - - -typedef union { - VOID *RxData; - VOID *TxData; -} PING_PACKET; - -// -// PING_IPX_COMPLETION_TOKEN -// structures are used for both transmit and receive operations. -// This version is IP-unaware. -// -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - PING_PACKET Packet; -} PING_IPX_COMPLETION_TOKEN; - -#pragma pack(1) -typedef struct _ICMPX_ECHO_REQUEST_REPLY { - UINT8 Type; - UINT8 Code; - UINT16 Checksum; - UINT16 Identifier; - UINT16 SequenceNum; - UINT32 TimeStamp; - UINT8 Data[1]; -} ICMPX_ECHO_REQUEST_REPLY; -#pragma pack() - -typedef struct _PING_ICMP_TX_INFO { - LIST_ENTRY Link; - UINT16 SequenceNum; - UINT32 TimeStamp; - PING_IPX_COMPLETION_TOKEN *Token; -} PING_ICMPX_TX_INFO; - -#define DEFAULT_TIMEOUT 5000 -#define MAX_SEND_NUMBER 10000 -#define MAX_BUFFER_SIZE 32768 -#define DEFAULT_TIMER_PERIOD 358049 -#define ONE_SECOND 10000000 -#define PING_IP_CHOICE_IP4 1 -#define PING_IP_CHOICE_IP6 2 -#define DEFAULT_SEND_COUNT 10 -#define DEFAULT_BUFFER_SIZE 16 -#define ICMP_V4_ECHO_REQUEST 0x8 -#define ICMP_V4_ECHO_REPLY 0x0 -#define STALL_1_MILLI_SECOND 1000 - -#define PING_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'i', 'n', 'g') -typedef struct _PING_PRIVATE_DATA { - UINT32 Signature; - EFI_HANDLE NicHandle; - EFI_HANDLE IpChildHandle; - EFI_EVENT Timer; - - UINT32 TimerPeriod; - UINT32 RttTimerTick; - EFI_EVENT RttTimer; - - EFI_STATUS Status; - LIST_ENTRY TxList; - UINT16 RxCount; - UINT16 TxCount; - UINT64 RttSum; - UINT64 RttMin; - UINT64 RttMax; - UINT32 SequenceNum; - - UINT32 SendNum; - UINT32 BufferSize; - UINT32 IpChoice; - - PING_IPX_PROTOCOL ProtocolPointers; - VOID *IpProtocol; - UINT8 SrcAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )]; - UINT8 DstAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )]; - PING_IPX_COMPLETION_TOKEN RxToken; - UINT16 FailedCount; -} PING_PRIVATE_DATA; - -/** - Calculate the internet checksum (see RFC 1071). - - @param[in] Packet Buffer which contains the data to be checksummed. - @param[in] Length Length to be checksummed. - - @retval Checksum Returns the 16 bit ones complement of - ones complement sum of 16 bit words -**/ -UINT16 -NetChecksum ( - IN UINT8 *Buffer, - IN UINT32 Length - ) -{ - UINT32 Sum; - UINT8 Odd; - UINT16 *Packet; - - Packet = (UINT16 *) Buffer; - - Sum = 0; - Odd = (UINT8) (Length & 1); - Length >>= 1; - while ((Length--) != 0) { - Sum += *Packet++; - } - - if (Odd != 0) { - Sum += *(UINT8 *) Packet; - } - - Sum = (Sum & 0xffff) + (Sum >> 16); - - // - // in case above carried - // - Sum += Sum >> 16; - - return (UINT16) Sum; -} - -/** - Reads and returns the current value of register. - In IA64, the register is the Interval Timer Vector (ITV). - In X86(IA32/X64), the register is the Time Stamp Counter (TSC) - - @return The current value of the register. - -**/ - -STATIC CONST SHELL_PARAM_ITEM PingParamList[] = { - { - L"-l", - TypeValue - }, - { - L"-n", - TypeValue - }, - { - L"-s", - TypeValue - }, - { - L"-_s", - TypeValue - }, - { - L"-_ip6", - TypeFlag - }, - { - NULL, - TypeMax - }, -}; - -// -// Global Variables in Ping command. -// -STATIC CONST CHAR16 *mDstString; -STATIC CONST CHAR16 *mSrcString; - -/** - RTT timer tick routine. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -RttTimerTickRoutine ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINT32 *RttTimerTick; - - RttTimerTick = (UINT32*) Context; - (*RttTimerTick)++; -} - -/** - Get the timer period of the system. - - This function tries to get the system timer period by creating - an 1ms period timer. - - @return System timer period in MS, or 0 if operation failed. - -**/ -UINT32 -GetTimerPeriod( - VOID - ) -{ - EFI_STATUS Status; - UINT32 RttTimerTick; - EFI_EVENT TimerEvent; - UINT32 StallCounter; - EFI_TPL OldTpl; - - RttTimerTick = 0; - StallCounter = 0; - - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - RttTimerTickRoutine, - &RttTimerTick, - &TimerEvent - ); - if (EFI_ERROR (Status)) { - return 0; - } - - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); - Status = gBS->SetTimer ( - TimerEvent, - TimerPeriodic, - TICKS_PER_MS - ); - if (EFI_ERROR (Status)) { - gBS->CloseEvent (TimerEvent); - return 0; - } - - while (RttTimerTick < 10) { - gBS->Stall (STALL_1_MILLI_SECOND); - ++StallCounter; - } - - gBS->RestoreTPL (OldTpl); - - gBS->SetTimer (TimerEvent, TimerCancel, 0); - gBS->CloseEvent (TimerEvent); - - return StallCounter / RttTimerTick; -} - -/** - Initialize the timer event for RTT (round trip time). - - @param[in] Private The pointer to PING_PRIVATE_DATA. - - @retval EFI_SUCCESS RTT timer is started. - @retval Others Failed to start the RTT timer. - -**/ -EFI_STATUS -PingInitRttTimer ( - PING_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - - Private->TimerPeriod = GetTimerPeriod (); - if (Private->TimerPeriod == 0) { - return EFI_ABORTED; - } - - Private->RttTimerTick = 0; - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - RttTimerTickRoutine, - &Private->RttTimerTick, - &Private->RttTimer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->SetTimer ( - Private->RttTimer, - TimerPeriodic, - TICKS_PER_MS - ); - if (EFI_ERROR (Status)) { - gBS->CloseEvent (Private->RttTimer); - return Status; - } - - return EFI_SUCCESS; -} - -/** - Free RTT timer event resource. - - @param[in] Private The pointer to PING_PRIVATE_DATA. - -**/ -VOID -PingFreeRttTimer ( - PING_PRIVATE_DATA *Private - ) -{ - if (Private->RttTimer != NULL) { - gBS->SetTimer (Private->RttTimer, TimerCancel, 0); - gBS->CloseEvent (Private->RttTimer); - } -} - -/** - Read the current time. - - @param[in] Private The pointer to PING_PRIVATE_DATA. - - @retval the current tick value. -**/ -UINT32 -ReadTime ( - PING_PRIVATE_DATA *Private - ) -{ - return Private->RttTimerTick; -} - -/** - Calculate a duration in ms. - - @param[in] Private The pointer to PING_PRIVATE_DATA. - @param[in] Begin The start point of time. - @param[in] End The end point of time. - - @return The duration in ms. - @retval 0 The parameters were not valid. -**/ -UINT32 -CalculateTick ( - PING_PRIVATE_DATA *Private, - IN UINT32 Begin, - IN UINT32 End - ) -{ - if (End < Begin) { - return (0); - } - - return (End - Begin) * Private->TimerPeriod; -} - -/** - Destroy PING_ICMPX_TX_INFO, and recollect the memory. - - @param[in] TxInfo The pointer to PING_ICMPX_TX_INFO. - @param[in] IpChoice Whether the token is IPv4 or IPv6 -**/ -VOID -PingDestroyTxInfo ( - IN PING_ICMPX_TX_INFO *TxInfo, - IN UINT32 IpChoice - ) -{ - EFI_IP6_TRANSMIT_DATA *Ip6TxData; - EFI_IP4_TRANSMIT_DATA *Ip4TxData; - EFI_IP6_FRAGMENT_DATA *FragData; - UINTN Index; - - if (TxInfo == NULL) { - return; - } - - if (TxInfo->Token != NULL) { - - if (TxInfo->Token->Event != NULL) { - gBS->CloseEvent (TxInfo->Token->Event); - } - - if (TxInfo->Token->Packet.TxData != NULL) { - if (IpChoice == PING_IP_CHOICE_IP6) { - Ip6TxData = TxInfo->Token->Packet.TxData; - - if (Ip6TxData->OverrideData != NULL) { - FreePool (Ip6TxData->OverrideData); - } - - if (Ip6TxData->ExtHdrs != NULL) { - FreePool (Ip6TxData->ExtHdrs); - } - - for (Index = 0; Index < Ip6TxData->FragmentCount; Index++) { - FragData = Ip6TxData->FragmentTable[Index].FragmentBuffer; - if (FragData != NULL) { - FreePool (FragData); - } - } - } else { - Ip4TxData = TxInfo->Token->Packet.TxData; - - if (Ip4TxData->OverrideData != NULL) { - FreePool (Ip4TxData->OverrideData); - } - - for (Index = 0; Index < Ip4TxData->FragmentCount; Index++) { - FragData = Ip4TxData->FragmentTable[Index].FragmentBuffer; - if (FragData != NULL) { - FreePool (FragData); - } - } - } - } - - FreePool (TxInfo->Token); - } - - FreePool (TxInfo); -} - -/** - Match the request, and reply with SequenceNum/TimeStamp. - - @param[in] Private The pointer to PING_PRIVATE_DATA. - @param[in] Packet The pointer to ICMPX_ECHO_REQUEST_REPLY. - - @retval EFI_SUCCESS The match is successful. - @retval EFI_NOT_FOUND The reply can't be matched with any request. - -**/ -EFI_STATUS -Ping6MatchEchoReply ( - IN PING_PRIVATE_DATA *Private, - IN ICMPX_ECHO_REQUEST_REPLY *Packet - ) -{ - PING_ICMPX_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING_ICMPX_TX_INFO, Link); - - if ((TxInfo->SequenceNum == Packet->SequenceNum) && (TxInfo->TimeStamp == Packet->TimeStamp)) { - Private->RxCount++; - RemoveEntryList (&TxInfo->Link); - PingDestroyTxInfo (TxInfo, Private->IpChoice); - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - The original intention is to send a request. - Currently, the application retransmits an icmp6 echo request packet - per second in sendnumber times that is specified by the user. - Because nothing can be done here, all things move to the timer rountine. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -Ping6OnEchoRequestSent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ -} - -/** - receive reply, match and print reply infomation. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to context. - -**/ -VOID -EFIAPI -Ping6OnEchoReplyReceived ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - PING_PRIVATE_DATA *Private; - ICMPX_ECHO_REQUEST_REPLY *Reply; - UINT32 PayLoad; - UINT32 Rtt; - - Private = (PING_PRIVATE_DATA *) Context; - - if (Private == NULL || Private->Status == EFI_ABORTED || Private->Signature != PING_PRIVATE_DATA_SIGNATURE) { - return; - } - - if (Private->RxToken.Packet.RxData == NULL) { - return; - } - - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - Reply = ((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer; - PayLoad = ((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->DataLength; - if (((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->NextHeader != IP6_ICMP) { - goto ON_EXIT; - } - if (!IP6_IS_MULTICAST ((EFI_IPv6_ADDRESS*)&Private->DstAddress) && - !EFI_IP6_EQUAL (&((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv6_ADDRESS*)&Private->DstAddress)) { - goto ON_EXIT; - } - - if ((Reply->Type != ICMP_V6_ECHO_REPLY) || (Reply->Code != 0)) { - goto ON_EXIT; - } - } else { - Reply = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer; - PayLoad = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->DataLength; - if (!IP4_IS_MULTICAST (EFI_IP4(*(EFI_IPv4_ADDRESS*)Private->DstAddress)) && - !EFI_IP4_EQUAL (&((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv4_ADDRESS*)&Private->DstAddress)) { - goto ON_EXIT; - } - - if ((Reply->Type != ICMP_V4_ECHO_REPLY) || (Reply->Code != 0)) { - goto ON_EXIT; - } - } - - - if (PayLoad != Private->BufferSize) { - goto ON_EXIT; - } - // - // Check whether the reply matches the sent request before. - // - Status = Ping6MatchEchoReply (Private, Reply); - if (EFI_ERROR(Status)) { - goto ON_EXIT; - } - // - // Display statistics on this icmp6 echo reply packet. - // - Rtt = CalculateTick (Private, Reply->TimeStamp, ReadTime (Private)); - - Private->RttSum += Rtt; - Private->RttMin = Private->RttMin > Rtt ? Rtt : Private->RttMin; - Private->RttMax = Private->RttMax < Rtt ? Rtt : Private->RttMax; - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING_REPLY_INFO), - gShellNetwork1HiiHandle, - PayLoad, - mDstString, - Reply->SequenceNum, - Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->HopLimit:0, - Rtt, - Rtt + Private->TimerPeriod - ); - -ON_EXIT: - - if (Private->RxCount < Private->SendNum) { - // - // Continue to receive icmp echo reply packets. - // - Private->RxToken.Status = EFI_ABORTED; - - Status = Private->ProtocolPointers.Receive (Private->IpProtocol, &Private->RxToken); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_RECEIVE), gShellNetwork1HiiHandle, Status); - Private->Status = EFI_ABORTED; - } - } else { - // - // All reply have already been received from the dest host. - // - Private->Status = EFI_SUCCESS; - } - // - // Singal to recycle the each rxdata here, not at the end of process. - // - gBS->SignalEvent (Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal); -} - -/** - Create a PING_IPX_COMPLETION_TOKEN. - - @param[in] Private The pointer of PING_PRIVATE_DATA. - @param[in] TimeStamp The TimeStamp of request. - @param[in] SequenceNum The SequenceNum of request. - - @return The pointer of PING_IPX_COMPLETION_TOKEN. - -**/ -PING_IPX_COMPLETION_TOKEN * -PingGenerateToken ( - IN PING_PRIVATE_DATA *Private, - IN UINT32 TimeStamp, - IN UINT16 SequenceNum - ) -{ - EFI_STATUS Status; - PING_IPX_COMPLETION_TOKEN *Token; - VOID *TxData; - ICMPX_ECHO_REQUEST_REPLY *Request; - UINT16 HeadSum; - UINT16 TempChecksum; - - Request = AllocateZeroPool (Private->BufferSize); - if (Request == NULL) { - return NULL; - } - TxData = AllocateZeroPool (Private->IpChoice==PING_IP_CHOICE_IP6?sizeof (EFI_IP6_TRANSMIT_DATA):sizeof (EFI_IP4_TRANSMIT_DATA)); - if (TxData == NULL) { - FreePool (Request); - return NULL; - } - Token = AllocateZeroPool (sizeof (PING_IPX_COMPLETION_TOKEN)); - if (Token == NULL) { - FreePool (Request); - FreePool (TxData); - return NULL; - } - - // - // Assembly echo request packet. - // - Request->Type = (UINT8)(Private->IpChoice==PING_IP_CHOICE_IP6?ICMP_V6_ECHO_REQUEST:ICMP_V4_ECHO_REQUEST); - Request->Code = 0; - Request->SequenceNum = SequenceNum; - Request->Identifier = 0; - Request->Checksum = 0; - - // - // Assembly token for transmit. - // - if (Private->IpChoice==PING_IP_CHOICE_IP6) { - Request->TimeStamp = TimeStamp; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrsLength = 0; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrs = NULL; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->OverrideData = 0; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->DataLength = Private->BufferSize; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentCount = 1; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentBuffer = (VOID *) Request; - ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize; - } else { - ((EFI_IP4_TRANSMIT_DATA*)TxData)->OptionsLength = 0; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->OptionsBuffer = NULL; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->OverrideData = 0; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->TotalDataLength = Private->BufferSize; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentCount = 1; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentBuffer = (VOID *) Request; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[0] = Private->DstAddress[0]; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[1] = Private->DstAddress[1]; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[2] = Private->DstAddress[2]; - ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[3] = Private->DstAddress[3]; - - HeadSum = NetChecksum ((UINT8 *) Request, Private->BufferSize); - Request->TimeStamp = TimeStamp; - TempChecksum = NetChecksum ((UINT8 *) &Request->TimeStamp, sizeof (UINT64)); - Request->Checksum = (UINT16)(~NetAddChecksum (HeadSum, TempChecksum)); - } - - - Token->Status = EFI_ABORTED; - Token->Packet.TxData = TxData; - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnEchoRequestSent, - Private, - &Token->Event - ); - - if (EFI_ERROR (Status)) { - FreePool (Request); - FreePool (TxData); - FreePool (Token); - return NULL; - } - - return Token; -} - -/** - Transmit the PING_IPX_COMPLETION_TOKEN. - - @param[in] Private The pointer of PING_PRIVATE_DATA. - - @retval EFI_SUCCESS Transmitted successfully. - @retval EFI_OUT_OF_RESOURCES No memory is available on the platform. - @retval others Transmitted unsuccessfully. - -**/ -EFI_STATUS -PingSendEchoRequest ( - IN PING_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - PING_ICMPX_TX_INFO *TxInfo; - - TxInfo = AllocateZeroPool (sizeof (PING_ICMPX_TX_INFO)); - - if (TxInfo == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - TxInfo->TimeStamp = ReadTime (Private); - TxInfo->SequenceNum = (UINT16) (Private->TxCount + 1); - TxInfo->Token = PingGenerateToken ( - Private, - TxInfo->TimeStamp, - TxInfo->SequenceNum - ); - - if (TxInfo->Token == NULL) { - PingDestroyTxInfo (TxInfo, Private->IpChoice); - return EFI_OUT_OF_RESOURCES; - } - - ASSERT(Private->ProtocolPointers.Transmit != NULL); - - InsertTailList (&Private->TxList, &TxInfo->Link); - - Status = Private->ProtocolPointers.Transmit (Private->IpProtocol, TxInfo->Token); - - if (EFI_ERROR (Status)) { - RemoveEntryList (&TxInfo->Link); - PingDestroyTxInfo (TxInfo, Private->IpChoice); - return Status; - } - - Private->TxCount++; - - return EFI_SUCCESS; -} - -/** - Place a completion token into the receive packet queue to receive the echo reply. - - @param[in] Private The pointer of PING_PRIVATE_DATA. - - @retval EFI_SUCCESS Put the token into the receive packet queue successfully. - @retval others Put the token into the receive packet queue unsuccessfully. - -**/ -EFI_STATUS -Ping6ReceiveEchoReply ( - IN PING_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - - ZeroMem (&Private->RxToken, sizeof (PING_IPX_COMPLETION_TOKEN)); - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnEchoReplyReceived, - Private, - &Private->RxToken.Event - ); - - if (EFI_ERROR (Status)) { - return Status; - } - - Private->RxToken.Status = EFI_NOT_READY; - - Status = Private->ProtocolPointers.Receive (Private->IpProtocol, &Private->RxToken); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_RECEIVE), gShellNetwork1HiiHandle, Status); - } - return Status; -} - -/** - Remove the timeout request from the list. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -Ping6OnTimerRoutine ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - PING_PRIVATE_DATA *Private; - PING_ICMPX_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - UINT64 Time; - - Private = (PING_PRIVATE_DATA *) Context; - if (Private->Signature != PING_PRIVATE_DATA_SIGNATURE) { - Private->Status = EFI_NOT_FOUND; - return; - } - - // - // Retransmit icmp6 echo request packets per second in sendnumber times. - // - if (Private->TxCount < Private->SendNum) { - - Status = PingSendEchoRequest (Private); - if (Private->TxCount != 0){ - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_SEND_REQUEST), gShellNetwork1HiiHandle, Private->TxCount + 1); - } - } - } - // - // Check whether any icmp6 echo request in the list timeout. - // - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING_ICMPX_TX_INFO, Link); - Time = CalculateTick (Private, TxInfo->TimeStamp, ReadTime (Private)); - - // - // Remove the timeout echo request from txlist. - // - if (Time > DEFAULT_TIMEOUT) { - - if (EFI_ERROR (TxInfo->Token->Status)) { - Private->ProtocolPointers.Cancel (Private->IpProtocol, TxInfo->Token); - } - // - // Remove the timeout icmp6 echo request from list. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_TIMEOUT), gShellNetwork1HiiHandle, TxInfo->SequenceNum); - - RemoveEntryList (&TxInfo->Link); - PingDestroyTxInfo (TxInfo, Private->IpChoice); - - Private->RxCount++; - Private->FailedCount++; - - if (IsListEmpty (&Private->TxList) && (Private->TxCount == Private->SendNum)) { - // - // All the left icmp6 echo request in the list timeout. - // - Private->Status = EFI_TIMEOUT; - } - } - } -} - -/** - Determine if a IP4 address is Link Local. - - 169.254.1.0 through 169.254.254.255 is link local. - - @param[in] Address The address to test. - - @retval TRUE It is. - @retval FALSE It is not. -**/ -BOOLEAN -PingNetIp4IsLinkLocalAddr ( - IN CONST EFI_IPv4_ADDRESS *Address - ) -{ - return ((BOOLEAN)(Address->Addr[0] == 169 && Address->Addr[1] == 254 && Address->Addr[2] >= 1 && Address->Addr[2] <= 254)); -} - -/** - Determine if a IP4 address is unspecified. - - @param[in] Address The address to test. - - @retval TRUE It is. - @retval FALSE It is not. -**/ -BOOLEAN -PingNetIp4IsUnspecifiedAddr ( - IN CONST EFI_IPv4_ADDRESS *Address - ) -{ - return ((BOOLEAN)((ReadUnaligned32 ((UINT32*)&Address->Addr[0])) == 0x00000000)); -} - -/** - Create a valid IP instance. - - @param[in] Private The pointer of PING_PRIVATE_DATA. - - @retval EFI_SUCCESS Create a valid IPx instance successfully. - @retval EFI_ABORTED Locate handle with ipx service binding protocol unsuccessfully. - @retval EFI_INVALID_PARAMETER The source address is unspecified when the destination address is a link-local address. - @retval EFI_OUT_OF_RESOURCES No memory is available on the platform. - @retval EFI_NOT_FOUND The source address is not found. -**/ -EFI_STATUS -PingCreateIpInstance ( - IN PING_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - UINTN HandleNum; - EFI_HANDLE *HandleBuffer; - BOOLEAN UnspecifiedSrc; - EFI_STATUS MediaStatus; - EFI_SERVICE_BINDING_PROTOCOL *EfiSb; - VOID *IpXCfg; - EFI_IP6_CONFIG_DATA Ip6Config; - EFI_IP4_CONFIG_DATA Ip4Config; - VOID *IpXInterfaceInfo; - UINTN IfInfoSize; - EFI_IPv6_ADDRESS *Addr; - UINTN AddrIndex; - - HandleBuffer = NULL; - UnspecifiedSrc = FALSE; - MediaStatus = EFI_SUCCESS; - EfiSb = NULL; - IpXInterfaceInfo = NULL; - IfInfoSize = 0; - - // - // Locate all the handles with ip6 service binding protocol. - // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid, - NULL, - &HandleNum, - &HandleBuffer - ); - if (EFI_ERROR (Status) || (HandleNum == 0) || (HandleBuffer == NULL)) { - return EFI_ABORTED; - } - - if (Private->IpChoice == PING_IP_CHOICE_IP6 ? NetIp6IsUnspecifiedAddr ((EFI_IPv6_ADDRESS*)&Private->SrcAddress) : \ - PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS*)&Private->SrcAddress)) { - // - // SrcAddress is unspecified. So, both connected and configured interface will be automatic selected. - // - UnspecifiedSrc = TRUE; - } - - // - // Source address is required when pinging a link-local address. - // - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - if (NetIp6IsLinkLocalAddr ((EFI_IPv6_ADDRESS*)&Private->DstAddress) && UnspecifiedSrc) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle); - Status = EFI_INVALID_PARAMETER; - goto ON_ERROR; - } - } else { - ASSERT(Private->IpChoice == PING_IP_CHOICE_IP4); - if (PingNetIp4IsLinkLocalAddr ((EFI_IPv4_ADDRESS*)&Private->DstAddress) && UnspecifiedSrc) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle); - Status = EFI_INVALID_PARAMETER; - goto ON_ERROR; - } - } - - // - // For each ip6 protocol, check interface addresses list. - // - for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) { - EfiSb = NULL; - IpXInterfaceInfo = NULL; - IfInfoSize = 0; - - if (UnspecifiedSrc) { - // - // Check media. - // - NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus); - if (MediaStatus != EFI_SUCCESS) { - // - // Skip this one. - // - continue; - } - } - - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid, - (VOID **) &EfiSb - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - // - // Ip6config protocol and ip6 service binding protocol are installed - // on the same handle. - // - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4Config2ProtocolGuid, - (VOID **) &IpXCfg - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - // - // Get the interface information size. - // - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - Status = ((EFI_IP6_CONFIG_PROTOCOL*)IpXCfg)->GetData ( - IpXCfg, - Ip6ConfigDataTypeInterfaceInfo, - &IfInfoSize, - NULL - ); - } else { - Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData ( - IpXCfg, - Ip4Config2DataTypeInterfaceInfo, - &IfInfoSize, - NULL - ); - } - - // - // Skip the ones not in current use. - // - if (Status == EFI_NOT_STARTED) { - continue; - } - - if (Status != EFI_BUFFER_TOO_SMALL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_GETDATA), gShellNetwork1HiiHandle, Status); - goto ON_ERROR; - } - - IpXInterfaceInfo = AllocateZeroPool (IfInfoSize); - - if (IpXInterfaceInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - // - // Get the interface info. - // - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - Status = ((EFI_IP6_CONFIG_PROTOCOL*)IpXCfg)->GetData ( - IpXCfg, - Ip6ConfigDataTypeInterfaceInfo, - &IfInfoSize, - IpXInterfaceInfo - ); - } else { - Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData ( - IpXCfg, - Ip4Config2DataTypeInterfaceInfo, - &IfInfoSize, - IpXInterfaceInfo - ); - } - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_GETDATA), gShellNetwork1HiiHandle, Status); - goto ON_ERROR; - } - // - // Check whether the source address is one of the interface addresses. - // - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - for (AddrIndex = 0; AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfoCount; AddrIndex++) { - Addr = &(((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfo[AddrIndex].Address); - - if (UnspecifiedSrc) { - if (!NetIp6IsUnspecifiedAddr (Addr) && !NetIp6IsLinkLocalAddr (Addr)) { - // - // Select the interface automatically. - // - CopyMem(&Private->SrcAddress, Addr, sizeof(Private->SrcAddress)); - break; - } - } else if (EFI_IP6_EQUAL (&Private->SrcAddress, Addr)) { - // - // Match a certain interface address. - // - break; - } - } - - if (AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfoCount) { - // - // Found a nic handle with right interface address. - // - break; - } - } else { - if (UnspecifiedSrc) { - if (!PingNetIp4IsUnspecifiedAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress) && - !PingNetIp4IsLinkLocalAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) { - // - // Select the interface automatically. - // - break; - } - } else if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) { - // - // Match a certain interface address. - // - break; - } - } - - FreePool (IpXInterfaceInfo); - IpXInterfaceInfo = NULL; - } - // - // No exact interface address matched. - // - - if (HandleIndex == HandleNum) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIGD_NIC_NF), gShellNetwork1HiiHandle, L"ping"); - Status = EFI_NOT_FOUND; - goto ON_ERROR; - } - - Private->NicHandle = HandleBuffer[HandleIndex]; - - ASSERT (EfiSb != NULL); - Status = EfiSb->CreateChild (EfiSb, &Private->IpChildHandle); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - if (Private->IpChoice == PING_IP_CHOICE_IP6) { - Status = gBS->OpenProtocol ( - Private->IpChildHandle, - &gEfiIp6ProtocolGuid, - &Private->IpProtocol, - gImageHandle, - Private->IpChildHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - - ZeroMem (&Ip6Config, sizeof (EFI_IP6_CONFIG_DATA)); - - // - // Configure the ip6 instance for icmp6 packet exchange. - // - Ip6Config.DefaultProtocol = 58; - Ip6Config.AcceptAnyProtocol = FALSE; - Ip6Config.AcceptIcmpErrors = TRUE; - Ip6Config.AcceptPromiscuous = FALSE; - Ip6Config.TrafficClass = 0; - Ip6Config.HopLimit = 128; - Ip6Config.FlowLabel = 0; - Ip6Config.ReceiveTimeout = 0; - Ip6Config.TransmitTimeout = 0; - - IP6_COPY_ADDRESS (&Ip6Config.StationAddress, &Private->SrcAddress); - IP6_COPY_ADDRESS (&Ip6Config.DestinationAddress, &Private->DstAddress); - - Status = ((EFI_IP6_PROTOCOL*)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip6Config); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIG), gShellNetwork1HiiHandle, Status); - goto ON_ERROR; - } - - Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Transmit; - Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Receive; - Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Cancel; - Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Poll; - } else { - Status = gBS->OpenProtocol ( - Private->IpChildHandle, - &gEfiIp4ProtocolGuid, - &Private->IpProtocol, - gImageHandle, - Private->IpChildHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - - ZeroMem (&Ip4Config, sizeof (EFI_IP4_CONFIG_DATA)); - - // - // Configure the ip4 instance for icmp4 packet exchange. - // - Ip4Config.DefaultProtocol = 1; - Ip4Config.AcceptAnyProtocol = FALSE; - Ip4Config.AcceptBroadcast = FALSE; - Ip4Config.AcceptIcmpErrors = TRUE; - Ip4Config.AcceptPromiscuous = FALSE; - Ip4Config.DoNotFragment = FALSE; - Ip4Config.RawData = FALSE; - Ip4Config.ReceiveTimeout = 0; - Ip4Config.TransmitTimeout = 0; - Ip4Config.UseDefaultAddress = TRUE; - Ip4Config.TimeToLive = 128; - Ip4Config.TypeOfService = 0; - - Status = ((EFI_IP4_PROTOCOL*)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip4Config); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIG), gShellNetwork1HiiHandle, Status); - goto ON_ERROR; - } - - Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Transmit; - Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Receive; - Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Cancel; - Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Poll; - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return EFI_SUCCESS; - -ON_ERROR: - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - if (IpXInterfaceInfo != NULL) { - FreePool (IpXInterfaceInfo); - } - - if ((EfiSb != NULL) && (Private->IpChildHandle != NULL)) { - EfiSb->DestroyChild (EfiSb, Private->IpChildHandle); - } - - return Status; -} - -/** - Destroy the IP instance. - - @param[in] Private The pointer of PING_PRIVATE_DATA. - -**/ -VOID -Ping6DestroyIp6Instance ( - IN PING_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - EFI_SERVICE_BINDING_PROTOCOL *IpSb; - - gBS->CloseProtocol ( - Private->IpChildHandle, - Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ProtocolGuid:&gEfiIp4ProtocolGuid, - gImageHandle, - Private->IpChildHandle - ); - - Status = gBS->HandleProtocol ( - Private->NicHandle, - Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid, - (VOID **) &IpSb - ); - - if (!EFI_ERROR(Status)) { - IpSb->DestroyChild (IpSb, Private->IpChildHandle); - } -} - - -/** - The Ping Process. - - @param[in] SendNumber The send request count. - @param[in] BufferSize The send buffer size. - @param[in] SrcAddress The source address. - @param[in] DstAddress The destination address. - @param[in] IpChoice The choice between IPv4 and IPv6. - - @retval SHELL_SUCCESS The ping processed successfullly. - @retval others The ping processed unsuccessfully. -**/ -SHELL_STATUS -ShellPing ( - IN UINT32 SendNumber, - IN UINT32 BufferSize, - IN EFI_IPv6_ADDRESS *SrcAddress, - IN EFI_IPv6_ADDRESS *DstAddress, - IN UINT32 IpChoice - ) -{ - EFI_STATUS Status; - PING_PRIVATE_DATA *Private; - PING_ICMPX_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - Private = AllocateZeroPool (sizeof (PING_PRIVATE_DATA)); - - if (Private == NULL) { - return (SHELL_OUT_OF_RESOURCES); - } - - Private->IpChoice = IpChoice; - Private->Signature = PING_PRIVATE_DATA_SIGNATURE; - Private->SendNum = SendNumber; - Private->BufferSize = BufferSize; - Private->RttMin = ~((UINT64 )(0x0)); - Private->Status = EFI_NOT_READY; - - CopyMem(&Private->SrcAddress, SrcAddress, sizeof(Private->SrcAddress)); - CopyMem(&Private->DstAddress, DstAddress, sizeof(Private->DstAddress)); - - InitializeListHead (&Private->TxList); - - // - // Open and configure a ip instance for us. - // - Status = PingCreateIpInstance (Private); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Print the command line itself. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_START), gShellNetwork1HiiHandle, mDstString, Private->BufferSize); - // - // Create a ipv6 token to receive the first icmp6 echo reply packet. - // - Status = Ping6ReceiveEchoReply (Private); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Create and start timer to send icmp6 echo request packet per second. - // - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnTimerRoutine, - Private, - &Private->Timer - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Start a timer to calculate the RTT. - // - Status = PingInitRttTimer (Private); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Create a ipv6 token to send the first icmp6 echo request packet. - // - Status = PingSendEchoRequest (Private); - // - // EFI_NOT_READY for IPsec is enable and IKE is not established. - // - if (EFI_ERROR (Status) && (Status != EFI_NOT_READY)) { - ShellStatus = SHELL_ACCESS_DENIED; - if(Status == EFI_NOT_FOUND) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOSOURCE_INDO), gShellNetwork1HiiHandle, mDstString); - } else if (Status == RETURN_NO_MAPPING) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOROUTE_FOUND), gShellNetwork1HiiHandle, mDstString, mSrcString); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NETWORK_ERROR), gShellNetwork1HiiHandle, L"ping", Status); - } - - goto ON_EXIT; - } - - Status = gBS->SetTimer ( - Private->Timer, - TimerPeriodic, - ONE_SECOND - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Control the ping6 process by two factors: - // 1. Hot key - // 2. Private->Status - // 2.1. success means all icmp6 echo request packets get reply packets. - // 2.2. timeout means the last icmp6 echo reply request timeout to get reply. - // 2.3. noready means ping6 process is on-the-go. - // - while (Private->Status == EFI_NOT_READY) { - Status = Private->ProtocolPointers.Poll (Private->IpProtocol); - if (ShellGetExecutionBreakFlag()) { - Private->Status = EFI_ABORTED; - goto ON_STAT; - } - } - -ON_STAT: - // - // Display the statistics in all. - // - gBS->SetTimer (Private->Timer, TimerCancel, 0); - - if (Private->TxCount != 0) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING_STAT), - gShellNetwork1HiiHandle, - Private->TxCount, - (Private->RxCount - Private->FailedCount), - (100 - ((100 * (Private->RxCount - Private->FailedCount)) / Private->TxCount)), - Private->RttSum - ); - } - - if (Private->RxCount > Private->FailedCount) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING_RTT), - gShellNetwork1HiiHandle, - Private->RttMin, - Private->RttMin + Private->TimerPeriod, - Private->RttMax, - Private->RttMax + Private->TimerPeriod, - DivU64x64Remainder (Private->RttSum, (Private->RxCount - Private->FailedCount), NULL), - DivU64x64Remainder (Private->RttSum, (Private->RxCount - Private->FailedCount), NULL) + Private->TimerPeriod - ); - } - -ON_EXIT: - - if (Private != NULL) { - - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING_ICMPX_TX_INFO, Link); - - if (Private->IpProtocol != NULL && Private->ProtocolPointers.Cancel != NULL) { - Status = Private->ProtocolPointers.Cancel (Private->IpProtocol, TxInfo->Token); - } - - RemoveEntryList (&TxInfo->Link); - PingDestroyTxInfo (TxInfo, Private->IpChoice); - } - - PingFreeRttTimer (Private); - - if (Private->Timer != NULL) { - gBS->CloseEvent (Private->Timer); - } - - if (Private->IpProtocol != NULL && Private->ProtocolPointers.Cancel != NULL) { - Status = Private->ProtocolPointers.Cancel (Private->IpProtocol, &Private->RxToken); - } - - if (Private->RxToken.Event != NULL) { - gBS->CloseEvent (Private->RxToken.Event); - } - - if (Private->IpChildHandle != NULL) { - Ping6DestroyIp6Instance (Private); - } - - FreePool (Private); - } - - return ShellStatus; -} - -/** - Function for 'ping' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval SHELL_SUCCESS The ping processed successfullly. - @retval others The ping processed unsuccessfully. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPing ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - EFI_IPv6_ADDRESS DstAddress; - EFI_IPv6_ADDRESS SrcAddress; - UINT64 BufferSize; - UINTN SendNumber; - LIST_ENTRY *ParamPackage; - CONST CHAR16 *ValueStr; - UINTN NonOptionCount; - UINT32 IpChoice; - CHAR16 *ProblemParam; - - // - // we use IPv6 buffers to hold items... - // make sure this is enough space! - // - ASSERT(sizeof(EFI_IPv4_ADDRESS ) <= sizeof(EFI_IPv6_ADDRESS )); - ASSERT(sizeof(EFI_IP4_COMPLETION_TOKEN) <= sizeof(EFI_IP6_COMPLETION_TOKEN )); - - IpChoice = PING_IP_CHOICE_IP4; - - ShellStatus = SHELL_SUCCESS; - ProblemParam = NULL; - - Status = ShellCommandLineParseEx (PingParamList, &ParamPackage, &ProblemParam, TRUE, FALSE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - if (ShellCommandLineGetFlag (ParamPackage, L"-_ip6")) { - IpChoice = PING_IP_CHOICE_IP6; - } - - // - // Parse the parameter of count number. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-n"); - if (ValueStr != NULL) { - SendNumber = ShellStrToUintn (ValueStr); - - // - // ShellStrToUintn will return 0 when input is 0 or an invalid input string. - // - if ((SendNumber == 0) || (SendNumber > MAX_SEND_NUMBER)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } else { - SendNumber = DEFAULT_SEND_COUNT; - } - // - // Parse the parameter of buffer size. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); - if (ValueStr != NULL) { - BufferSize = ShellStrToUintn (ValueStr); - - // - // ShellStrToUintn will return 0 when input is 0 or an invalid input string. - // - if ((BufferSize < 16) || (BufferSize > MAX_BUFFER_SIZE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } else { - BufferSize = DEFAULT_BUFFER_SIZE; - } - - ZeroMem (&SrcAddress, sizeof (EFI_IPv6_ADDRESS)); - ZeroMem (&DstAddress, sizeof (EFI_IPv6_ADDRESS)); - - // - // Parse the parameter of source ip address. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); - if (ValueStr == NULL) { - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-_s"); - } - - if (ValueStr != NULL) { - mSrcString = ValueStr; - if (IpChoice == PING_IP_CHOICE_IP6) { - Status = NetLibStrToIp6 (ValueStr, &SrcAddress); - } else { - Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&SrcAddress); - } - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - // - // Parse the parameter of destination ip address. - // - NonOptionCount = ShellCommandLineGetCount(ParamPackage); - if (NonOptionCount < 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ping"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - if (NonOptionCount > 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle, L"ping"); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - ValueStr = ShellCommandLineGetRawValue (ParamPackage, 1); - if (ValueStr != NULL) { - mDstString = ValueStr; - if (IpChoice == PING_IP_CHOICE_IP6) { - Status = NetLibStrToIp6 (ValueStr, &DstAddress); - } else { - Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&DstAddress); - } - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - - // - // Enter into ping process. - // - ShellStatus = ShellPing ( - (UINT32)SendNumber, - (UINT32)BufferSize, - &SrcAddress, - &DstAddress, - IpChoice - ); - -ON_EXIT: - ShellCommandLineFreeVarList (ParamPackage); - return ShellStatus; -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c deleted file mode 100644 index aeac3d7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c +++ /dev/null @@ -1,90 +0,0 @@ -/** @file - Main file for NULL named library for network1 shell command functions. - - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "UefiShellNetwork1CommandsLib.h" - -CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands"; -EFI_HANDLE gShellNetwork1HiiHandle = NULL; - -/** - return the file name of the help text file if not using HII. - - @return The string pointer to the file name. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameNetwork1 ( - VOID - ) -{ - return (gShellNetwork1FileName); -} - -/** - Constructor for the Shell Network1 Commands library. - - Install the handlers for Network1 UEFI Shell 2.0 profile commands. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS The shell command handlers were installed sucessfully. - @retval EFI_UNSUPPORTED The shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellNetwork1CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - gShellNetwork1HiiHandle = NULL; - - // - // check our bit of the profiles mask - // - if ((PcdGet8(PcdShellProfileMask) & BIT3) == 0) { - return (EFI_SUCCESS); - } - - gShellNetwork1HiiHandle = HiiAddPackages (&gShellNetwork1HiiGuid, gImageHandle, UefiShellNetwork1CommandsLibStrings, NULL); - if (gShellNetwork1HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - // - // install our shell command handlers - // - ShellCommandRegisterCommandName(L"ping", ShellCommandRunPing , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_PING)); - ShellCommandRegisterCommandName(L"ifconfig",ShellCommandRunIfconfig , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG)); - - return (EFI_SUCCESS); -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -ShellNetwork1CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellNetwork1HiiHandle != NULL) { - HiiRemovePackages(gShellNetwork1HiiHandle); - } - return (EFI_SUCCESS); -} diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h deleted file mode 100644 index 6df747a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h +++ /dev/null @@ -1,76 +0,0 @@ -/** @file - header file for NULL named library for network1 shell command functions. - - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_ -#define _UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE gShellNetwork1HiiHandle; - -/** - Function for 'ping' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPing ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'ifconfig' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIfconfig ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf deleted file mode 100644 index b7c81d7..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf +++ /dev/null @@ -1,68 +0,0 @@ -## @file -# Provides shell network1 functions -# -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellNetwork1CommandsLib - FILE_GUID = 9A929F7E-3861-45ce-87AB-7371219AE255 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellNetwork1CommandsLibConstructor - DESTRUCTOR = ShellNetwork1CommandsLibDestructor - -[Sources.common] - UefiShellNetwork1CommandsLib.uni - UefiShellNetwork1CommandsLib.c - UefiShellNetwork1CommandsLib.h - Ping.c - Ifconfig.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - FileHandleLib - NetLib - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Protocols] - gEfiCpuArchProtocolGuid ## CONSUMES - gEfiTimerArchProtocolGuid ## CONSUMES - gEfiIp6ProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp6ConfigProtocolGuid ## SOMETIMES_CONSUMES - - gEfiIp4ProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp4Config2ProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gShellNetwork1HiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni deleted file mode 100644 index e281e67..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni +++ /dev/null @@ -1,182 +0,0 @@ -// /** -// -// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-// (C) Copyright 2017 Hewlett Packard Enterprise Development LP
-// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// Module Name: -// -// UefiShellNetwork1CommandsLib.uni -// -// Abstract: -// -// String definitions for UEFI Shell 2.0 network 1 commands -// -// -// **/ - -/=# - -#langdef en-US "english" - -#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments.\r\n" -#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments.\r\n" -#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n" -#string STR_GEN_PROBLEM_OP2 #language en-US "%H%s%N: Invalid argument - '%H%s%N'. Expected '%B%s%N' or '%B%s%N'.\r\n" -#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n" -#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n" -#string STR_GEN_ERR_AD #language en-US "%H%s%N: Access denied.\r\n" -#string STR_GEN_ERR_UK #language en-US "%H%s%N: Status: %r\r\n" -#string STR_GEN_PARAM_CON #language en-US "%H%s%N: Parameters conflict.\r\n" -#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open file - '%H%s%N'\r\n" -#string STR_GEN_FILE_AD #language en-US "%H%s%N: Access file error - '%H%s%N'\r\n" -#string STR_GEN_CRLF #language en-US "\r\n" -#string STR_GEN_NO_FILES #language en-US "%H%s%N: No matching files were found.\r\n" -#string STR_GEN_DIR_NF #language en-US "%H%s%N: Directory not found - '%H%s%N'\r\n" -#string STR_GEN_FILE_NF #language en-US "%H%s%N: File not found - '%H%s%N'\r\n" -#string STR_GEN_IS_DIR #language en-US "%H%s%N: '%H%s%N' is a directory\r\n" -#string STR_GEN_PROTOCOL_NF #language en-US "%H%s%N: The protocol '%H%s%N' is required and not found (%g).\r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful.\r\n" - -#string STR_PING_INVALID_SOURCE #language en-US "%Ping: Require source interface option\r\n" -#string STR_PING_CONFIG #language en-US "Config %r\r\n" -#string STR_PING_GETMODE #language en-US "GetModeData %r\r\n" -#string STR_PING_GETDATA #language en-US "GetData %r\r\n" -#string STR_PING_RECEIVE #language en-US "Receive %r\r\n" -#string STR_PING_SEND_REQUEST #language en-US "Echo request sequence %d did not complete successfully.\r\n" -#string STR_PING_NOSOURCE_INDO #language en-US "There are no sources in %s's multicast domain.\r\n" -#string STR_PING_NETWORK_ERROR #language en-US "%H%s%N: Network function failed with %r\r\n" -#string STR_PING_CONFIGD_NIC_NF #language en-US "%H%s%N: No configured interfaces were found.\r\n" -#string STR_PING_NOROUTE_FOUND #language en-US "There is no route to the destination '%B%s%N' from the source '%B%s%N' was found.\r\n" -#string STR_PING_START #language en-US "Ping %s %d data bytes.\r\n" -#string STR_PING_TIMEOUT #language en-US "Echo request sequence %d timeout.\r\n" -#string STR_PING_REPLY_INFO #language en-US "%d bytes from %s : icmp_seq=%d ttl=%d time%d~%dms\r\n" -#string STR_PING_STAT #language en-US "\n%d packets transmitted, %d received, %d%% packet loss, time %dms\r\n" -#string STR_PING_RTT #language en-US "\nRtt(round trip time) min=%d~%dms max=%d~%dms avg=%d~%dms\r\n" - -#string STR_IFCONFIG_UNSUPPORTED_OPTION #language en-US "The option '%H%s%N' is unsupported now.\n" -#string STR_IFCONFIG_LACK_OPTION #language en-US "Flags lack. Please type 'ifConfig -?' for help info.\n" -#string STR_IFCONFIG_LACK_INTERFACE #language en-US "Lack interface name.\n" -#string STR_IFCONFIG_LACK_COMMAND #language en-US "Lack interface config option.\n" -#string STR_IFCONFIG_INVALID_INTERFACE #language en-US "Invalid interface name.\n" -#string STR_IFCONFIG_INVALID_IPADDRESS #language en-US "Invalid ipv4 address: '%H%s%N'\n" -#string STR_IFCONFIG_INVALID_GATEWAY #language en-US "Invalid gateway address: '%H%s%N'\n" -#string STR_IFCONFIG_DUPLICATE_COMMAND #language en-US "Duplicate commands. Bad command %H%s%N is skipped.\n" -#string STR_IFCONFIG_CONFLICT_COMMAND #language en-US "Conflict commands. Bad command %H%s%N is skipped.\n" -#string STR_IFCONFIG_UNKNOWN_COMMAND #language en-US "Unknown commands. Bad command %H%s%N is skipped.\n" -#string STR_IFCONFIG_SET_ADDR_FAILED #language en-US "Failed to set address.\n" -#string STR_IFCONFIG_ROUTES_SIZE #language en-US "\n%H Routes (%d entries):\n" -#string STR_IFCONFIG_ROUTES_ENTRY_INDEX #language en-US "%H Entry[%d]\n" -#string STR_IFCONFIG_SHOW_IP_ADDR #language en-US "%12s: %N%d.%d.%d.%d\n" -#string STR_IFCONFIG_INFO_NEWLINE #language en-US "\n" -#string STR_IFCONFIG_INFO_DNS_ADDR_BODY #language en-US "%8d.%d.%d.%d\n" -#string STR_IFCONFIG_INFO_BREAK #language en-US "\n-----------------------------------------------------------------\n" -#string STR_IFCONFIG_INFO_COLON #language en-US ":" -#string STR_IFCONFIG_INFO_IF_NAME #language en-US "\n%Hname : %s%N\n" -#string STR_IFCONFIG_INFO_MEDIA_STATE #language en-US "%HMedia State : %s%N\n" -#string STR_IFCONFIG_INFO_POLICY_DHCP #language en-US "%Hpolicy : dhcp%N\n" -#string STR_IFCONFIG_INFO_POLICY_MAN #language en-US "%Hpolicy : static%N\n" -#string STR_IFCONFIG_INFO_MAC_ADDR_HEAD #language en-US "%Hmac addr : %N" -#string STR_IFCONFIG_INFO_MAC_ADDR_BODY #language en-US "%02x" -#string STR_IFCONFIG_INFO_IP_ADDR_HEAD #language en-US "\n%Hipv4 address : %N" -#string STR_IFCONFIG_INFO_SUBNET_MASK_HEAD #language en-US "\n%Hsubnet mask : %N" -#string STR_IFCONFIG_INFO_GATEWAY_HEAD #language en-US "\n%Hdefault gateway: %N" -#string STR_IFCONFIG_INFO_DNS_ADDR_HEAD #language en-US "\n%HDNS server : %N\n" -#string STR_IFCONFIG_INFO_IP_ADDR_BODY #language en-US "%d.%d.%d.%d\n" - -#string STR_GET_HELP_PING #language en-US "" -".TH ping 0 "Ping the target host with an IPv4 stack."\r\n" -".SH NAME\r\n" -"Ping the target host with an IPv4 stack.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"PING [-n count] [-l size] [-s SourceIp] TargetIp\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -n - Specifies the number of echo request datagrams to be sent.\r\n" -" -l - Specifies the size of the data buffer in the echo request datagram.\r\n" -" -s - Specifies the source adapter as IPv4 address.\r\n" -" SourceIp - Specifies the IPv4 address of the source machine.\r\n" -" TargetIp - Specifies the IPv4 address of the target machine.\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command uses the ICMPv4 ECHO_REQUEST datagram to elicit an\r\n" -" ECHO_REPLY from a host.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To ping the target host with 64 bytes data:\r\n" -" fs0:\> ping -l 64 192.168.0.1\r\n" -" \r\n" -" * To ping the target host by sending 20 echo request datagrams:\r\n" -" fs0:\> ping -n 20 202.120.100.1\r\n" -" \r\n" -" * To ping the target host by specifying the source adapter as IPv4 address:\r\n" -" fs0:\> ping -s 202.120.100.12 202.120.100.1\r\n" -".SH RETURNVALUES\r\n" -" \r\n" -"RETURN VALUES:\r\n" -" SHELL_SUCCESS The action was completed as requested.\r\n" -" SHELL_INVALID_PARAMETER One of the passed-in parameters was incorrectly\r\n" -" formatted or its value was out of bounds.\r\n" - -#string STR_GET_HELP_IFCONFIG #language en-US "" -".TH ifconfig 0 "Modifies the default IP address of the UEFI IPv4 Network Stack."\r\n" -".SH NAME\r\n" -"Modifies the default IP address of the UEFI IPv4 Network Stack.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"IFCONFIG [-r [Name]] [-l [Name]]\r\n" -"IFCONFIG [-s dhcp | > | >]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -r - Renew configuration of interface and set dhcp policy.\r\n" -" -l - Lists the configuration.\r\n" -" -s - Sets the configuration.\r\n" -" Name - Specifies an adapter name (for example, eth0).\r\n" -" IP - Specifies the IPv4 address in four integer values:\r\n" -" - Example: 192.168.0.10\r\n" -" SubnetMask - Specifies a subnet mask in four integer values:\r\n" -" - Example: 255.255.255.0\r\n" -" GatewayMask - Specifies a default gateway in four integer values:\r\n" -" - Example: 192.168.0.1\r\n" -".SH DESCRIPTION\r\n" -" \r\n" -"NOTES:\r\n" -" 1. This command modifies the default IP address for the UEFI IPv4\r\n" -" network stack.\r\n" -" 2. Use '-r' to renew configuration of interface and set dhcp policy.\r\n" -" 3. Use '-l' to list the DNS and other address related settings for all\r\n" -" interfaces or the specified interface.\r\n" -" 4. Use '-s static ' with \r\n" -" static IPv4 address configuration for specified interface.\r\n" -" 5. Use '-s dhcp' for DHCPv4 to request the IPv4 address\r\n" -" configuration dynamically for specified interface.\r\n" -" 6. Use '-s dns ' must under manual policy.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To list the configuration for the eth0 interface:\r\n" -" fs0:\> ifconfig -l eth0\r\n" -" \r\n" -" * To use DHCPv4 to request the IPv4 address configuration dynamically for the\r\n" -" eth0 interface:\r\n" -" fs0:\> ifconfig -s eth0 dhcp\r\n" -" \r\n" -" * To use the static IPv4 address configuration for the eth0 interface:\r\n" -" fs0:\> ifconfig -s eth0 static 192.168.0.5 255.255.255.0 192.168.0.1\r\n" -" \r\n" -" * To configure DNS server address for the eth0 interface:\r\n" -" fs0:\> ifconfig -s eth0 dns 192.168.0.8 192.168.0.9\r\n" - - - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c deleted file mode 100644 index 5ff0d60..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c +++ /dev/null @@ -1,1912 +0,0 @@ -/** @file - The implementation for Shell command IfConfig6. - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- (C) Copyright 2017 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "UefiShellNetwork2CommandsLib.h" - -enum { - IfConfig6OpList = 1, - IfConfig6OpSet = 2, - IfConfig6OpClear = 3 -}; - -typedef enum { - VarCheckReserved = -1, - VarCheckOk = 0, - VarCheckDuplicate, - VarCheckConflict, - VarCheckUnknown, - VarCheckLackValue, - VarCheckOutOfMem -} VAR_CHECK_CODE; - -typedef enum { - FlagTypeSingle = 0, - FlagTypeNeedVar, - FlagTypeNeedSet, - FlagTypeSkipUnknown -} VAR_CHECK_FLAG_TYPE; - -#define MACADDRMAXSIZE 32 -#define PREFIXMAXLEN 16 - -typedef struct _IFCONFIG6_INTERFACE_CB { - EFI_HANDLE NicHandle; - LIST_ENTRY Link; - EFI_IP6_CONFIG_PROTOCOL *IfCfg; - EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; - EFI_IP6_CONFIG_INTERFACE_ID *IfId; - EFI_IP6_CONFIG_POLICY Policy; - EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS Xmits; - UINT32 DnsCnt; - EFI_IPv6_ADDRESS DnsAddr[1]; -} IFCONFIG6_INTERFACE_CB; - -typedef struct _ARG_LIST ARG_LIST; - -struct _ARG_LIST { - ARG_LIST *Next; - CHAR16 *Arg; -}; - -typedef struct _IFCONFIG6_PRIVATE_DATA { - EFI_HANDLE ImageHandle; - LIST_ENTRY IfList; - - UINT32 OpCode; - CHAR16 *IfName; - ARG_LIST *VarArg; -} IFCONFIG6_PRIVATE_DATA; - -typedef struct _VAR_CHECK_ITEM{ - CHAR16 *FlagStr; - UINT32 FlagID; - UINT32 ConflictMask; - VAR_CHECK_FLAG_TYPE FlagType; -} VAR_CHECK_ITEM; - - -SHELL_PARAM_ITEM mIfConfig6CheckList[] = { - { - L"-b", - TypeFlag - }, - { - L"-s", - TypeMaxValue - }, - { - L"-l", - TypeValue - }, - { - L"-r", - TypeValue - }, - { - L"-?", - TypeFlag - }, - { - NULL, - TypeMax - }, -}; - -VAR_CHECK_ITEM mIfConfig6SetCheckList[] = { - { - L"auto", - 0x00000001, - 0x00000001, - FlagTypeSingle - }, - { - L"man", - 0x00000002, - 0x00000001, - FlagTypeSingle - }, - { - L"host", - 0x00000004, - 0x00000002, - FlagTypeSingle - }, - { - L"dad", - 0x00000008, - 0x00000004, - FlagTypeSingle - }, - { - L"gw", - 0x00000010, - 0x00000008, - FlagTypeSingle - }, - { - L"dns", - 0x00000020, - 0x00000010, - FlagTypeSingle - }, - { - L"id", - 0x00000040, - 0x00000020, - FlagTypeSingle - }, - { - NULL, - 0x0, - 0x0, - FlagTypeSkipUnknown - }, -}; - -/** - Free the ARG_LIST. - - @param List Pointer to ARG_LIST to free. -**/ -VOID -IfConfig6FreeArgList ( - ARG_LIST *List -) -{ - ARG_LIST *Next; - while (List->Next != NULL) { - Next = List->Next; - FreePool (List); - List = Next; - } - - FreePool (List); -} - -/** - Split a string with specified separator and save the substring to a list. - - @param[in] String The pointer of the input string. - @param[in] Separator The specified separator. - - @return The pointer of headnode of ARG_LIST. - -**/ -ARG_LIST * -IfConfig6SplitStrToList ( - IN CONST CHAR16 *String, - IN CHAR16 Separator - ) -{ - CHAR16 *Str; - CHAR16 *ArgStr; - ARG_LIST *ArgList; - ARG_LIST *ArgNode; - - if (String == NULL || *String == L'\0') { - return NULL; - } - - // - // Copy the CONST string to a local copy. - // - Str = AllocateCopyPool (StrSize (String), String); - if (Str == NULL) { - return NULL; - } - ArgStr = Str; - - // - // init a node for the list head. - // - ArgNode = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST)); - if (ArgNode == NULL) { - return NULL; - } - ArgList = ArgNode; - - // - // Split the local copy and save in the list node. - // - while (*Str != L'\0') { - if (*Str == Separator) { - *Str = L'\0'; - ArgNode->Arg = ArgStr; - ArgStr = Str + 1; - ArgNode->Next = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST)); - if (ArgNode->Next == NULL) { - // - // Free the local copy of string stored in the first node - // - FreePool (ArgList->Arg); - IfConfig6FreeArgList (ArgList); - return NULL; - } - ArgNode = ArgNode->Next; - } - - Str++; - } - - ArgNode->Arg = ArgStr; - ArgNode->Next = NULL; - - return ArgList; -} - -/** - Check the correctness of input Args with '-s' option. - - @param[in] CheckList The pointer of VAR_CHECK_ITEM array. - @param[in] Name The pointer of input arg. - @param[in] Init The switch to execute the check. - - @return The value of VAR_CHECK_CODE. - -**/ -VAR_CHECK_CODE -IfConfig6RetriveCheckListByName( - IN VAR_CHECK_ITEM *CheckList, - IN CHAR16 *Name, - IN BOOLEAN Init -) -{ - STATIC UINT32 CheckDuplicate; - STATIC UINT32 CheckConflict; - VAR_CHECK_CODE RtCode; - UINT32 Index; - VAR_CHECK_ITEM Arg; - - if (Init) { - CheckDuplicate = 0; - CheckConflict = 0; - return VarCheckOk; - } - - RtCode = VarCheckOk; - Index = 0; - Arg = CheckList[Index]; - - // - // Check the Duplicated/Conflicted/Unknown input Args. - // - while (Arg.FlagStr != NULL) { - if (StrCmp (Arg.FlagStr, Name) == 0) { - - if (CheckDuplicate & Arg.FlagID) { - RtCode = VarCheckDuplicate; - break; - } - - if (CheckConflict & Arg.ConflictMask) { - RtCode = VarCheckConflict; - break; - } - - CheckDuplicate |= Arg.FlagID; - CheckConflict |= Arg.ConflictMask; - break; - } - - Arg = CheckList[++Index]; - } - - if (Arg.FlagStr == NULL) { - RtCode = VarCheckUnknown; - } - - return RtCode; -} - -/** - The notify function of create event when performing a manual config. - - @param[in] Event The event this notify function registered to. - @param[in] Context Pointer to the context data registered to the event. - -**/ -VOID -EFIAPI -IfConfig6ManualAddressNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - *((BOOLEAN *) Context) = TRUE; -} - -/** - Print MAC address. - - @param[in] Node The pointer of MAC address buffer. - @param[in] Size The size of MAC address buffer. - -**/ -VOID -IfConfig6PrintMacAddr ( - IN UINT8 *Node, - IN UINT32 Size - ) -{ - UINTN Index; - - ASSERT (Size <= MACADDRMAXSIZE); - - for (Index = 0; Index < Size; Index++) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_MAC_ADDR_BODY), gShellNetwork2HiiHandle, Node[Index]); - if (Index + 1 < Size) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle); - } - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); -} - -/** - Print IPv6 address. - - @param[in] Ip The pointer of Ip bufffer in EFI_IPv6_ADDRESS format. - @param[in] PrefixLen The pointer of PrefixLen that describes the size Prefix. - -**/ -VOID -IfConfig6PrintIpAddr ( - IN EFI_IPv6_ADDRESS *Ip, - IN UINT8 *PrefixLen - ) -{ - UINTN Index; - BOOLEAN Short; - - Short = FALSE; - - for (Index = 0; Index < PREFIXMAXLEN; Index = Index + 2) { - - if (!Short && (Index + 1 < PREFIXMAXLEN) && (Index % 2 == 0) && (Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0)) { - // - // Deal with the case of ::. - // - if (Index == 0) { - // - // :: is at the beginning of the address. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle); - } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle); - - while ((Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0) && (Index < PREFIXMAXLEN)) { - Index = Index + 2; - if (Index > PREFIXMAXLEN - 2) { - break; - } - } - - Short = TRUE; - - if (Index == PREFIXMAXLEN) { - // - // :: is at the end of the address. - // - break; - } - } - - if (Index < PREFIXMAXLEN - 1) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_IP_ADDR_BODY), gShellNetwork2HiiHandle, Ip->Addr[Index]); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_IP_ADDR_BODY), gShellNetwork2HiiHandle, Ip->Addr[Index + 1]); - } - - if (Index + 2 < PREFIXMAXLEN) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle); - } - } - - if (PrefixLen != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_PREFIX_LEN), gShellNetwork2HiiHandle, *PrefixLen); - } -} - -/** - Pick up host IPv6 address in string format from Args with "-s" option and convert it to EFI_IP6_CONFIG_MANUAL_ADDRESS format. - - @param[in, out] Arg The pointer of the address of ARG_LIST which save Args with the "-s" option. - @param[out] Buf The pointer of the address of EFI_IP6_CONFIG_MANUAL_ADDRESS. - @param[out] BufSize The pointer of BufSize that describes the size of Buf in bytes. - - @retval EFI_SUCCESS The convertion is successful. - @retval Others Does't find the host address, or it is an invalid IPv6 address in string format. - -**/ -EFI_STATUS -IfConfig6ParseManualAddressList ( - IN OUT ARG_LIST **Arg, - OUT EFI_IP6_CONFIG_MANUAL_ADDRESS **Buf, - OUT UINTN *BufSize - ) -{ - EFI_STATUS Status; - EFI_IP6_CONFIG_MANUAL_ADDRESS *AddrBuf; - ARG_LIST *VarArg; - EFI_IPv6_ADDRESS Address; - UINT8 Prefix; - UINT8 AddrCnt; - - Prefix = 0; - AddrCnt = 0; - *BufSize = 0; - *Buf = NULL; - VarArg = *Arg; - Status = EFI_SUCCESS; - - // - // Go through the list to check the correctness of input host ip6 address. - // - while ((!EFI_ERROR (Status)) && (VarArg != NULL)) { - - Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix); - - if (EFI_ERROR (Status)) { - // - // host ip ip ... gw - // - break; - } - - VarArg = VarArg->Next; - AddrCnt++; - } - - if (AddrCnt == 0) { - return EFI_INVALID_PARAMETER; - } - - AddrBuf = AllocateZeroPool (AddrCnt * sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)); - ASSERT (AddrBuf != NULL); - - AddrCnt = 0; - VarArg = *Arg; - Status = EFI_SUCCESS; - - // - // Go through the list to fill in the EFI_IP6_CONFIG_MANUAL_ADDRESS structure. - // - while ((!EFI_ERROR (Status)) && (VarArg != NULL)) { - - Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix); - - if (EFI_ERROR (Status)) { - break; - } - - // - // If prefix length is not set, set it as Zero here. In the IfConfigSetInterfaceInfo() - // Zero prefix, length will be transfered to default prefix length. - // - if (Prefix == 0xFF) { - Prefix = 0; - } - AddrBuf[AddrCnt].IsAnycast = FALSE; - AddrBuf[AddrCnt].PrefixLength = Prefix; - IP6_COPY_ADDRESS (&AddrBuf[AddrCnt].Address, &Address); - VarArg = VarArg->Next; - AddrCnt++; - } - - *Arg = VarArg; - - if (EFI_ERROR (Status) && (Status != EFI_INVALID_PARAMETER)) { - goto ON_ERROR; - } - - *Buf = AddrBuf; - *BufSize = AddrCnt * sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS); - - return EFI_SUCCESS; - -ON_ERROR: - - FreePool (AddrBuf); - return Status; -} - -/** - Pick up gw/dns IPv6 address in string format from Args with "-s" option and convert it to EFI_IPv6_ADDRESS format. - - @param[in, out] Arg The pointer of the address of ARG_LIST that save Args with the "-s" option. - @param[out] Buf The pointer of the address of EFI_IPv6_ADDRESS. - @param[out] BufSize The pointer of BufSize that describes the size of Buf in bytes. - - @retval EFI_SUCCESS The conversion is successful. - @retval Others Doesn't find the host address, or it is an invalid IPv6 address in string format. - -**/ -EFI_STATUS -IfConfig6ParseGwDnsAddressList ( - IN OUT ARG_LIST **Arg, - OUT EFI_IPv6_ADDRESS **Buf, - OUT UINTN *BufSize - ) -{ - EFI_STATUS Status; - EFI_IPv6_ADDRESS *AddrBuf; - ARG_LIST *VarArg; - EFI_IPv6_ADDRESS Address; - UINT8 Prefix; - UINT8 AddrCnt; - - AddrCnt = 0; - *BufSize = 0; - *Buf = NULL; - VarArg = *Arg; - Status = EFI_SUCCESS; - - // - // Go through the list to check the correctness of input gw/dns address. - // - while ((!EFI_ERROR (Status)) && (VarArg != NULL)) { - - Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix); - - if (EFI_ERROR (Status)) { - // - // gw ip ip ... host - // - break; - } - - VarArg = VarArg->Next; - AddrCnt++; - } - - if (AddrCnt == 0) { - return EFI_INVALID_PARAMETER; - } - - AddrBuf = AllocateZeroPool (AddrCnt * sizeof (EFI_IPv6_ADDRESS)); - ASSERT (AddrBuf != NULL); - - AddrCnt = 0; - VarArg = *Arg; - Status = EFI_SUCCESS; - - // - // Go through the list to fill in the EFI_IPv6_ADDRESS structure. - // - while ((!EFI_ERROR (Status)) && (VarArg != NULL)) { - - Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix); - - if (EFI_ERROR (Status)) { - break; - } - - IP6_COPY_ADDRESS (&AddrBuf[AddrCnt], &Address); - - VarArg = VarArg->Next; - AddrCnt++; - } - - *Arg = VarArg; - - if (EFI_ERROR (Status) && (Status != EFI_INVALID_PARAMETER)) { - goto ON_ERROR; - } - - *Buf = AddrBuf; - *BufSize = AddrCnt * sizeof (EFI_IPv6_ADDRESS); - - return EFI_SUCCESS; - -ON_ERROR: - - FreePool (AddrBuf); - return Status; -} - -/** - Parse InterfaceId in string format from Args with the "-s" option and convert it to EFI_IP6_CONFIG_INTERFACE_ID format. - - @param[in, out] Arg The pointer of the address of ARG_LIST that saves Args with the "-s" option. - @param[out] IfId The pointer of EFI_IP6_CONFIG_INTERFACE_ID. - - @retval EFI_SUCCESS The get status processed successfullly. - @retval EFI_INVALID_PARAMETER The get status process failed. - -**/ -EFI_STATUS -IfConfig6ParseInterfaceId ( - IN OUT ARG_LIST **Arg, - OUT EFI_IP6_CONFIG_INTERFACE_ID **IfId - ) -{ - UINT8 Index; - UINT8 NodeVal; - CHAR16 *IdStr; - - if (*Arg == NULL) { - return EFI_INVALID_PARAMETER; - } - - Index = 0; - IdStr = (*Arg)->Arg; - ASSERT (IfId != NULL); - *IfId = AllocateZeroPool (sizeof (EFI_IP6_CONFIG_INTERFACE_ID)); - ASSERT (*IfId != NULL); - - while ((*IdStr != L'\0') && (Index < 8)) { - - NodeVal = 0; - while ((*IdStr != L':') && (*IdStr != L'\0')) { - - if ((*IdStr <= L'F') && (*IdStr >= L'A')) { - NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L'A' + 10); - } else if ((*IdStr <= L'f') && (*IdStr >= L'a')) { - NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L'a' + 10); - } else if ((*IdStr <= L'9') && (*IdStr >= L'0')) { - NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L'0'); - } else { - FreePool (*IfId); - return EFI_INVALID_PARAMETER; - } - - IdStr++; - } - - (*IfId)->Id[Index++] = NodeVal; - - if (*IdStr == L':') { - IdStr++; - } - } - - *Arg = (*Arg)->Next; - return EFI_SUCCESS; -} - -/** - Parse dad in string format from Args with the "-s" option and convert it to UINT32 format. - - @param[in, out] Arg The pointer of the address of ARG_LIST that saves Args with the "-s" option. - @param[out] Xmits The pointer of Xmits. - - @retval EFI_SUCCESS The get status processed successfully. - @retval others The get status process failed. - -**/ -EFI_STATUS -IfConfig6ParseDadXmits ( - IN OUT ARG_LIST **Arg, - OUT UINT32 *Xmits - ) -{ - CHAR16 *ValStr; - - if (*Arg == NULL) { - return EFI_INVALID_PARAMETER; - } - - ValStr = (*Arg)->Arg; - *Xmits = 0; - - while (*ValStr != L'\0') { - - if ((*ValStr <= L'9') && (*ValStr >= L'0')) { - - *Xmits = (*Xmits * 10) + (*ValStr - L'0'); - - } else { - - return EFI_INVALID_PARAMETER; - } - - ValStr++; - } - - *Arg = (*Arg)->Next; - return EFI_SUCCESS; -} - -/** - The get current status of all handles. - - @param[in] ImageHandle The handle of ImageHandle. - @param[in] IfName The pointer of IfName(interface name). - @param[in] IfList The pointer of IfList(interface list). - - @retval EFI_SUCCESS The get status processed successfully. - @retval others The get status process failed. - -**/ -EFI_STATUS -IfConfig6GetInterfaceInfo ( - IN EFI_HANDLE ImageHandle, - IN CHAR16 *IfName, - IN LIST_ENTRY *IfList - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - UINTN HandleNum; - EFI_HANDLE *HandleBuffer; - EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg; - EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; - IFCONFIG6_INTERFACE_CB *IfCb; - UINTN DataSize; - - HandleBuffer = NULL; - HandleNum = 0; - - IfInfo = NULL; - IfCb = NULL; - - // - // Locate all the handles with ip6 service binding protocol. - // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiIp6ServiceBindingProtocolGuid, - NULL, - &HandleNum, - &HandleBuffer - ); - if (EFI_ERROR (Status) || (HandleNum == 0)) { - return Status; - } - - // - // Enumerate all handles that installed with ip6 service binding protocol. - // - for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) { - IfCb = NULL; - IfInfo = NULL; - DataSize = 0; - - // - // Ip6config protocol and ip6 service binding protocol are installed - // on the same handle. - // - ASSERT (HandleBuffer != NULL); - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - &gEfiIp6ConfigProtocolGuid, - (VOID **) &Ip6Cfg - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - // - // Get the interface information size. - // - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeInterfaceInfo, - &DataSize, - NULL - ); - - if (Status != EFI_BUFFER_TOO_SMALL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - IfInfo = AllocateZeroPool (DataSize); - - if (IfInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - // - // Get the interface info. - // - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeInterfaceInfo, - &DataSize, - IfInfo - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - // - // Check the interface name if required. - // - if ((IfName != NULL) && (StrCmp (IfName, IfInfo->Name) != 0)) { - FreePool (IfInfo); - continue; - } - - DataSize = 0; - // - // Get the size of dns server list. - // - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeDnsServer, - &DataSize, - NULL - ); - - if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - IfCb = AllocateZeroPool (sizeof (IFCONFIG6_INTERFACE_CB) + DataSize); - - if (IfCb == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - - IfCb->NicHandle = HandleBuffer[HandleIndex]; - IfCb->IfInfo = IfInfo; - IfCb->IfCfg = Ip6Cfg; - IfCb->DnsCnt = (UINT32) (DataSize / sizeof (EFI_IPv6_ADDRESS)); - - // - // Get the dns server list if has. - // - if (DataSize > 0) { - - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeDnsServer, - &DataSize, - IfCb->DnsAddr - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - } - // - // Get the interface id if has. - // - DataSize = sizeof (EFI_IP6_CONFIG_INTERFACE_ID); - IfCb->IfId = AllocateZeroPool (DataSize); - - if (IfCb->IfId == NULL) { - goto ON_ERROR; - } - - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeAltInterfaceId, - &DataSize, - IfCb->IfId - ); - - if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - if (Status == EFI_NOT_FOUND) { - FreePool (IfCb->IfId); - IfCb->IfId = NULL; - } - // - // Get the config policy. - // - DataSize = sizeof (EFI_IP6_CONFIG_POLICY); - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypePolicy, - &DataSize, - &IfCb->Policy - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - // - // Get the dad transmits. - // - DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS); - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeDupAddrDetectTransmits, - &DataSize, - &IfCb->Xmits - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - InsertTailList (IfList, &IfCb->Link); - - if ((IfName != NULL) && (StrCmp (IfName, IfInfo->Name) == 0)) { - // - // Only need the appointed interface, keep the allocated buffer. - // - IfCb = NULL; - IfInfo = NULL; - break; - } - } - - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - return EFI_SUCCESS; - -ON_ERROR: - - if (IfInfo != NULL) { - FreePool (IfInfo); - } - - if (IfCb != NULL) { - if (IfCb->IfId != NULL) { - FreePool (IfCb->IfId); - } - - FreePool (IfCb); - } - - return Status; -} - -/** - The list process of the IfConfig6 application. - - @param[in] IfList The pointer of IfList(interface list). - - @retval SHELL_SUCCESS The IfConfig6 list processed successfully. - @retval others The IfConfig6 list process failed. - -**/ -SHELL_STATUS -IfConfig6ShowInterfaceInfo ( - IN LIST_ENTRY *IfList - ) -{ - LIST_ENTRY *Entry; - IFCONFIG6_INTERFACE_CB *IfCb; - UINTN Index; - - Entry = IfList->ForwardLink; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_INTERFACE), gShellNetwork2HiiHandle); - } - - // - // Go through the interface list. - // - while (Entry != IfList) { - - IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_BREAK), gShellNetwork2HiiHandle); - - // - // Print interface name. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_IF_NAME), gShellNetwork2HiiHandle, IfCb->IfInfo->Name); - - // - // Print interface config policy. - // - if (IfCb->Policy == Ip6ConfigPolicyAutomatic) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_POLICY_AUTO), gShellNetwork2HiiHandle); - } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_POLICY_MAN), gShellNetwork2HiiHandle); - } - - // - // Print dad transmit. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_DAD_TRANSMITS), gShellNetwork2HiiHandle, IfCb->Xmits); - - // - // Print interface id if has. - // - if (IfCb->IfId != NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_INTERFACE_ID_HEAD), gShellNetwork2HiiHandle); - - IfConfig6PrintMacAddr ( - IfCb->IfId->Id, - 8 - ); - } - // - // Print mac address of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_MAC_ADDR_HEAD), gShellNetwork2HiiHandle); - - IfConfig6PrintMacAddr ( - IfCb->IfInfo->HwAddress.Addr, - IfCb->IfInfo->HwAddressSize - ); - - // - // Print ip addresses list of the interface. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_IP_ADDR_HEAD), gShellNetwork2HiiHandle); - - for (Index = 0; Index < IfCb->IfInfo->AddressInfoCount; Index++) { - IfConfig6PrintIpAddr ( - &IfCb->IfInfo->AddressInfo[Index].Address, - &IfCb->IfInfo->AddressInfo[Index].PrefixLength - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); - } - - // - // Print dns server addresses list of the interface if has. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_DNS_ADDR_HEAD), gShellNetwork2HiiHandle); - - for (Index = 0; Index < IfCb->DnsCnt; Index++) { - IfConfig6PrintIpAddr ( - &IfCb->DnsAddr[Index], - NULL - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); - } - - // - // Print route table of the interface if has. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_ROUTE_HEAD), gShellNetwork2HiiHandle); - - for (Index = 0; Index < IfCb->IfInfo->RouteCount; Index++) { - IfConfig6PrintIpAddr ( - &IfCb->IfInfo->RouteTable[Index].Destination, - &IfCb->IfInfo->RouteTable[Index].PrefixLength - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_JOINT), gShellNetwork2HiiHandle); - - IfConfig6PrintIpAddr ( - &IfCb->IfInfo->RouteTable[Index].Gateway, - NULL - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); - } - - Entry = Entry->ForwardLink; - } - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_BREAK), gShellNetwork2HiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); - - return SHELL_SUCCESS; -} - -/** - The clean process of the IfConfig6 application. - - @param[in] IfList The pointer of IfList(interface list). - @param[in] IfName The pointer of interface name. - - @retval SHELL_SUCCESS The IfConfig6 clean processed successfully. - @retval others The IfConfig6 clean process failed. - -**/ -SHELL_STATUS -IfConfig6ClearInterfaceInfo ( - IN LIST_ENTRY *IfList, - IN CHAR16 *IfName - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - LIST_ENTRY *Entry; - IFCONFIG6_INTERFACE_CB *IfCb; - EFI_IP6_CONFIG_POLICY Policy; - - Entry = IfList->ForwardLink; - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_INTERFACE), gShellNetwork2HiiHandle); - } - - // - // Go through the interface list.If the interface name is specified, then - // need to refresh the configuration. - // - while (Entry != IfList) { - - IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link); - - if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) { - Policy = Ip6ConfigPolicyManual; - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypePolicy, - sizeof (EFI_IP6_CONFIG_POLICY), - &Policy - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork2HiiHandle, L"ifconfig6"); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - } - - Policy = Ip6ConfigPolicyAutomatic; - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypePolicy, - sizeof (EFI_IP6_CONFIG_POLICY), - &Policy - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork2HiiHandle, L"ifconfig6"); - ShellStatus = SHELL_ACCESS_DENIED; - break; - } - - Entry = Entry->ForwardLink; - } - - return ShellStatus; -} - -/** - The set process of the IfConfig6 application. - - @param[in] IfList The pointer of IfList(interface list). - @param[in] VarArg The pointer of ARG_LIST(Args with "-s" option). - - @retval SHELL_SUCCESS The IfConfig6 set processed successfully. - @retval others The IfConfig6 set process failed. - -**/ -SHELL_STATUS -IfConfig6SetInterfaceInfo ( - IN LIST_ENTRY *IfList, - IN ARG_LIST *VarArg - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - IFCONFIG6_INTERFACE_CB *IfCb; - EFI_IP6_CONFIG_MANUAL_ADDRESS *CfgManAddr; - EFI_IPv6_ADDRESS *CfgAddr; - UINTN AddrSize; - EFI_IP6_CONFIG_INTERFACE_ID *InterfaceId; - UINT32 DadXmits; - UINT32 CurDadXmits; - UINTN CurDadXmitsLen; - EFI_IP6_CONFIG_POLICY Policy; - - VAR_CHECK_CODE CheckCode; - EFI_EVENT TimeOutEvt; - EFI_EVENT MappedEvt; - BOOLEAN IsAddressOk; - - UINTN DataSize; - UINT32 Index; - UINT32 Index2; - BOOLEAN IsAddressSet; - EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; - - CfgManAddr = NULL; - CfgAddr = NULL; - TimeOutEvt = NULL; - MappedEvt = NULL; - IfInfo = NULL; - InterfaceId = NULL; - CurDadXmits = 0; - - if (IsListEmpty (IfList)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_INTERFACE), gShellNetwork2HiiHandle); - return SHELL_INVALID_PARAMETER; - } - // - // Make sure to set only one interface each time. - // - IfCb = BASE_CR (IfList->ForwardLink, IFCONFIG6_INTERFACE_CB, Link); - Status = EFI_SUCCESS; - ShellStatus = SHELL_SUCCESS; - - // - // Initialize check list mechanism. - // - CheckCode = IfConfig6RetriveCheckListByName( - NULL, - NULL, - TRUE - ); - - // - // Create events & timers for asynchronous settings. - // - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &TimeOutEvt - ); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - IfConfig6ManualAddressNotify, - &IsAddressOk, - &MappedEvt - ); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Parse the setting variables. - // - while (VarArg != NULL) { - // - // Check invalid parameters (duplication & unknown & conflict). - // - CheckCode = IfConfig6RetriveCheckListByName( - mIfConfig6SetCheckList, - VarArg->Arg, - FALSE - ); - - if (VarCheckOk != CheckCode) { - switch (CheckCode) { - case VarCheckDuplicate: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_DUPLICATE_COMMAND), gShellNetwork2HiiHandle, VarArg->Arg); - break; - - case VarCheckConflict: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_CONFLICT_COMMAND), gShellNetwork2HiiHandle, VarArg->Arg); - break; - - case VarCheckUnknown: - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_UNKNOWN_COMMAND), gShellNetwork2HiiHandle, VarArg->Arg); - break; - - default: - break; - } - - VarArg = VarArg->Next; - continue; - } - // - // Process valid variables. - // - if (StrCmp(VarArg->Arg, L"auto") == 0) { - // - // Set automaic config policy - // - Policy = Ip6ConfigPolicyAutomatic; - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypePolicy, - sizeof (EFI_IP6_CONFIG_POLICY), - &Policy - ); - - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - VarArg= VarArg->Next; - - if (VarArg != NULL) { - if (StrCmp (VarArg->Arg, L"host") == 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } else if (StrCmp (VarArg->Arg, L"gw") == 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } else if (StrCmp (VarArg->Arg, L"dns") == 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - } else if (StrCmp (VarArg->Arg, L"man") == 0) { - // - // Set manual config policy. - // - Policy = Ip6ConfigPolicyManual; - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypePolicy, - sizeof (EFI_IP6_CONFIG_POLICY), - &Policy - ); - - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - VarArg= VarArg->Next; - - } else if (StrCmp (VarArg->Arg, L"host") == 0) { - // - // Parse till the next tag or the end of command line. - // - VarArg = VarArg->Next; - Status = IfConfig6ParseManualAddressList ( - &VarArg, - &CfgManAddr, - &AddrSize - ); - - if (EFI_ERROR (Status)) { - if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_ARGUMENTS), gShellNetwork2HiiHandle, L"host"); - continue; - } else { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - } - // - // Set static host ip6 address list. - // This is a asynchronous process. - // - IsAddressOk = FALSE; - - Status = IfCb->IfCfg->RegisterDataNotify ( - IfCb->IfCfg, - Ip6ConfigDataTypeManualAddress, - MappedEvt - ); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeManualAddress, - AddrSize, - CfgManAddr - ); - - if (Status == EFI_NOT_READY) { - // - // Get current dad transmits count. - // - CurDadXmitsLen = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS); - IfCb->IfCfg->GetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeDupAddrDetectTransmits, - &CurDadXmitsLen, - &CurDadXmits - ); - - gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000 + 10000000 * CurDadXmits); - - while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) { - if (IsAddressOk) { - Status = EFI_SUCCESS; - break; - } - } - } - - IfCb->IfCfg->UnregisterDataNotify ( - IfCb->IfCfg, - Ip6ConfigDataTypeManualAddress, - MappedEvt - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_MAN_HOST), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Check whether the address is set successfully. - // - DataSize = 0; - - Status = IfCb->IfCfg->GetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeInterfaceInfo, - &DataSize, - NULL - ); - - if (Status != EFI_BUFFER_TOO_SMALL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - IfInfo = AllocateZeroPool (DataSize); - - if (IfInfo == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - Status = IfCb->IfCfg->GetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeInterfaceInfo, - &DataSize, - IfInfo - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - for ( Index = 0; Index < (UINTN) (AddrSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)); Index++) { - IsAddressSet = FALSE; - // - // By default, the prefix length 0 is regarded as 64. - // - if (CfgManAddr[Index].PrefixLength == 0) { - CfgManAddr[Index].PrefixLength = 64; - } - - for (Index2 = 0; Index2 < IfInfo->AddressInfoCount; Index2++) { - if (EFI_IP6_EQUAL (&IfInfo->AddressInfo[Index2].Address, &CfgManAddr[Index].Address) && - (IfInfo->AddressInfo[Index2].PrefixLength == CfgManAddr[Index].PrefixLength)) { - IsAddressSet = TRUE; - break; - } - } - - if (!IsAddressSet) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_ADDRESS_FAILED), gShellNetwork2HiiHandle); - IfConfig6PrintIpAddr ( - &CfgManAddr[Index].Address, - &CfgManAddr[Index].PrefixLength - ); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle); - } - } - - } else if (StrCmp (VarArg->Arg, L"gw") == 0) { - // - // Parse till the next tag or the end of command line. - // - VarArg = VarArg->Next; - Status = IfConfig6ParseGwDnsAddressList ( - &VarArg, - &CfgAddr, - &AddrSize - ); - - if (EFI_ERROR (Status)) { - if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_ARGUMENTS), gShellNetwork2HiiHandle, L"gw"); - continue; - } else { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - } - // - // Set static gateway ip6 address list. - // - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeGateway, - AddrSize, - CfgAddr - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status); - goto ON_EXIT; - } - - } else if (StrCmp (VarArg->Arg, L"dns") == 0) { - // - // Parse till the next tag or the end of command line. - // - VarArg = VarArg->Next; - Status = IfConfig6ParseGwDnsAddressList ( - &VarArg, - &CfgAddr, - &AddrSize - ); - - if (EFI_ERROR (Status)) { - if (Status == EFI_INVALID_PARAMETER) { - ShellStatus = SHELL_INVALID_PARAMETER; - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_ARGUMENTS), gShellNetwork2HiiHandle, L"dns"); - continue; - } else { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - } - // - // Set static DNS server ip6 address list. - // - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeDnsServer, - AddrSize, - CfgAddr - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - } else if (StrCmp (VarArg->Arg, L"id") == 0) { - // - // Parse till the next tag or the end of command line. - // - VarArg = VarArg->Next; - Status = IfConfig6ParseInterfaceId (&VarArg, &InterfaceId); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - // - // Set alternative interface id. - // - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeAltInterfaceId, - sizeof (EFI_IP6_CONFIG_INTERFACE_ID), - InterfaceId - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - } else if (StrCmp (VarArg->Arg, L"dad") == 0) { - // - // Parse till the next tag or the end of command line. - // - VarArg = VarArg->Next; - Status = IfConfig6ParseDadXmits (&VarArg, &DadXmits); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Set dad transmits count. - // - Status = IfCb->IfCfg->SetData ( - IfCb->IfCfg, - Ip6ConfigDataTypeDupAddrDetectTransmits, - sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS), - &DadXmits - ); - - if (EFI_ERROR(Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - } - } - -ON_EXIT: - - if (CfgManAddr != NULL) { - FreePool (CfgManAddr); - } - - if (CfgAddr != NULL) { - FreePool (CfgAddr); - } - - if (MappedEvt != NULL) { - gBS->CloseEvent (MappedEvt); - } - - if (TimeOutEvt != NULL) { - gBS->CloseEvent (TimeOutEvt); - } - - if (IfInfo != NULL) { - FreePool (IfInfo); - } - - return ShellStatus; - -} - -/** - The IfConfig6 main process. - - @param[in] Private The pointer of IFCONFIG6_PRIVATE_DATA. - - @retval SHELL_SUCCESS IfConfig6 processed successfully. - @retval others The IfConfig6 process failed. - -**/ -SHELL_STATUS -IfConfig6 ( - IN IFCONFIG6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - - // - // Get configure information of all interfaces. - // - Status = IfConfig6GetInterfaceInfo ( - Private->ImageHandle, - Private->IfName, - &Private->IfList - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_NOT_FOUND; - goto ON_EXIT; - } - - switch (Private->OpCode) { - case IfConfig6OpList: - ShellStatus = IfConfig6ShowInterfaceInfo (&Private->IfList); - break; - - case IfConfig6OpClear: - ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList, Private->IfName); - break; - - case IfConfig6OpSet: - ShellStatus = IfConfig6SetInterfaceInfo (&Private->IfList, Private->VarArg); - break; - - default: - ShellStatus = SHELL_UNSUPPORTED; - } - -ON_EXIT: - - return ShellStatus; -} - -/** - The IfConfig6 cleanup process, free the allocated memory. - - @param[in] Private The pointer of IFCONFIG6_PRIVATE_DATA. - -**/ -VOID -IfConfig6Cleanup ( - IN IFCONFIG6_PRIVATE_DATA *Private - ) -{ - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - IFCONFIG6_INTERFACE_CB *IfCb; - - ASSERT (Private != NULL); - - // - // Clean the list which save the set config Args. - // - if (Private->VarArg != NULL) { - IfConfig6FreeArgList (Private->VarArg); - } - - if (Private->IfName != NULL) - FreePool (Private->IfName); - - - // - // Clean the IFCONFIG6_INTERFACE_CB list. - // - Entry = Private->IfList.ForwardLink; - NextEntry = Entry->ForwardLink; - - while (Entry != &Private->IfList) { - - IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link); - - RemoveEntryList (&IfCb->Link); - - if (IfCb->IfId != NULL) { - - FreePool (IfCb->IfId); - } - - if (IfCb->IfInfo != NULL) { - - FreePool (IfCb->IfInfo); - } - - FreePool (IfCb); - - Entry = NextEntry; - NextEntry = Entry->ForwardLink; - } - - FreePool (Private); -} - -/** - Function for 'ifconfig6' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval SHELL_SUCCESS ifconfig6 command processed successfully. - @retval others The ifconfig6 command process failed. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIfconfig6 ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - IFCONFIG6_PRIVATE_DATA *Private; - LIST_ENTRY *ParamPackage; - CONST CHAR16 *ValueStr; - ARG_LIST *ArgList; - CHAR16 *ProblemParam; - CHAR16 *Str; - - Private = NULL; - Status = EFI_INVALID_PARAMETER; - ShellStatus = SHELL_SUCCESS; - - Status = ShellCommandLineParseEx (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_COMMAND), gShellNetwork2HiiHandle, L"ifconfig6", ProblemParam); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - // - // To handle no option. - // - if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") && - !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - // - // To handle conflict options. - // - if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - Private = AllocateZeroPool (sizeof (IFCONFIG6_PRIVATE_DATA)); - - if (Private == NULL) { - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - InitializeListHead (&Private->IfList); - - // - // To get interface name for the list option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-l")) { - Private->OpCode = IfConfig6OpList; - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); - if (ValueStr != NULL) { - Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); - if (Str == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"ifconfig6"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - Private->IfName = Str; - } - } - // - // To get interface name for the clear option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-r")) { - Private->OpCode = IfConfig6OpClear; - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r"); - if (ValueStr != NULL) { - Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); - if (Str == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"ifconfig6"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - Private->IfName = Str; - } - } - // - // To get interface name and corresponding Args for the set option. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-s")) { - - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); - if (ValueStr == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_INTERFACE), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - // - // To split the configuration into multi-section. - // - ArgList = IfConfig6SplitStrToList (ValueStr, L' '); - if (ArgList == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"ifconfig6"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - Private->OpCode = IfConfig6OpSet; - Private->IfName = ArgList->Arg; - - Private->VarArg = ArgList->Next; - - if (Private->IfName == NULL || Private->VarArg == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_COMMAND), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - // - // Main process of ifconfig6. - // - ShellStatus = IfConfig6 (Private); - -ON_EXIT: - - ShellCommandLineFreeVarList (ParamPackage); - if (Private != NULL) { - IfConfig6Cleanup (Private); - } - return ShellStatus; - -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c deleted file mode 100644 index 222a95a..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c +++ /dev/null @@ -1,1373 +0,0 @@ -/** @file - The implementation for Ping6 application. - - Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "UefiShellNetwork2CommandsLib.h" - -#define PING6_DEFAULT_TIMEOUT 5000 -#define PING6_MAX_SEND_NUMBER 10000 -#define PING6_MAX_BUFFER_SIZE 32768 -#define PING6_ONE_SECOND 10000000 -#define STALL_1_MILLI_SECOND 1000 - -#pragma pack(1) - -typedef struct _ICMP6_ECHO_REQUEST_REPLY { - UINT8 Type; - UINT8 Code; - UINT16 Checksum; - UINT16 Identifier; - UINT16 SequenceNum; - UINT32 TimeStamp; - UINT8 Data[1]; -} ICMP6_ECHO_REQUEST_REPLY; - -#pragma pack() - -typedef struct _PING6_ICMP6_TX_INFO { - LIST_ENTRY Link; - UINT16 SequenceNum; - UINT32 TimeStamp; - EFI_IP6_COMPLETION_TOKEN *Token; -} PING6_ICMP6_TX_INFO; - -typedef struct _PING6_PRIVATE_DATA { - EFI_HANDLE ImageHandle; - EFI_HANDLE NicHandle; - EFI_HANDLE Ip6ChildHandle; - EFI_IP6_PROTOCOL *Ip6; - EFI_EVENT Timer; - - UINT32 TimerPeriod; - UINT32 RttTimerTick; - EFI_EVENT RttTimer; - - EFI_STATUS Status; - LIST_ENTRY TxList; - EFI_IP6_COMPLETION_TOKEN RxToken; - UINT16 RxCount; - UINT16 TxCount; - UINT64 RttSum; - UINT64 RttMin; - UINT64 RttMax; - UINT32 SequenceNum; - - EFI_IPv6_ADDRESS SrcAddress; - EFI_IPv6_ADDRESS DstAddress; - UINT32 SendNum; - UINT32 BufferSize; -} PING6_PRIVATE_DATA; - - -SHELL_PARAM_ITEM Ping6ParamList[] = { - { - L"-l", - TypeValue - }, - { - L"-n", - TypeValue - }, - { - L"-s", - TypeValue - }, - { - L"-?", - TypeFlag - }, - { - NULL, - TypeMax - }, -}; - -// -// Global Variables in Ping6 application. -// -CONST CHAR16 *mIp6DstString; -CONST CHAR16 *mIp6SrcString; -EFI_CPU_ARCH_PROTOCOL *Cpu = NULL; - -/** - RTT timer tick routine. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -Ping6RttTimerTickRoutine ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINT32 *RttTimerTick; - - RttTimerTick = (UINT32*) Context; - (*RttTimerTick)++; -} - -/** - Get the timer period of the system. - - This function tries to get the system timer period by creating - an 1ms period timer. - - @return System timer period in MS, or 0 if operation failed. - -**/ -UINT32 -Ping6GetTimerPeriod( - VOID - ) -{ - EFI_STATUS Status; - UINT32 RttTimerTick; - EFI_EVENT TimerEvent; - UINT32 StallCounter; - EFI_TPL OldTpl; - - RttTimerTick = 0; - StallCounter = 0; - - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - Ping6RttTimerTickRoutine, - &RttTimerTick, - &TimerEvent - ); - if (EFI_ERROR (Status)) { - return 0; - } - - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); - Status = gBS->SetTimer ( - TimerEvent, - TimerPeriodic, - TICKS_PER_MS - ); - if (EFI_ERROR (Status)) { - gBS->CloseEvent (TimerEvent); - return 0; - } - - while (RttTimerTick < 10) { - gBS->Stall (STALL_1_MILLI_SECOND); - ++StallCounter; - } - - gBS->RestoreTPL (OldTpl); - - gBS->SetTimer (TimerEvent, TimerCancel, 0); - gBS->CloseEvent (TimerEvent); - - return StallCounter / RttTimerTick; -} - - -/** - Initialize the timer event for RTT (round trip time). - - @param[in] Private The pointer to PING6_PRIVATE_DATA. - - @retval EFI_SUCCESS RTT timer is started. - @retval Others Failed to start the RTT timer. - -**/ -EFI_STATUS -Ping6InitRttTimer ( - IN PING6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - - Private->TimerPeriod = Ping6GetTimerPeriod (); - if (Private->TimerPeriod == 0) { - return EFI_ABORTED; - } - - Private->RttTimerTick = 0; - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - Ping6RttTimerTickRoutine, - &Private->RttTimerTick, - &Private->RttTimer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->SetTimer ( - Private->RttTimer, - TimerPeriodic, - TICKS_PER_MS - ); - if (EFI_ERROR (Status)) { - gBS->CloseEvent (Private->RttTimer); - return Status; - } - - return EFI_SUCCESS; - -} - -/** - Free RTT timer event resource. - - @param[in] Private The pointer to PING6_PRIVATE_DATA. - -**/ -VOID -Ping6FreeRttTimer ( - IN PING6_PRIVATE_DATA *Private - ) -{ - if (Private->RttTimer != NULL) { - gBS->SetTimer (Private->RttTimer, TimerCancel, 0); - gBS->CloseEvent (Private->RttTimer); - } -} - -/** - Read the current time. - - @param[in] Private The pointer to PING6_PRIVATE_DATA. - - @retval the current tick value. -**/ -UINT32 -Ping6ReadTime ( - IN PING6_PRIVATE_DATA *Private - ) -{ - return Private->RttTimerTick; -} - -/** - Get and calculate the duration in ms. - - @param[in] Private The pointer to PING6_PRIVATE_DATA. - @param[in] Begin The start point of time. - @param[in] End The end point of time. - - @return The duration in ms. - -**/ -UINT32 -Ping6CalculateTick ( - IN PING6_PRIVATE_DATA *Private, - IN UINT32 Begin, - IN UINT32 End - ) -{ - if (End < Begin) { - return (0); - } - - return (End - Begin) * Private->TimerPeriod; - -} - -/** - Destroy IPING6_ICMP6_TX_INFO, and recollect the memory. - - @param[in] TxInfo The pointer to PING6_ICMP6_TX_INFO. - -**/ -VOID -Ping6DestroyTxInfo ( - IN PING6_ICMP6_TX_INFO *TxInfo - ) -{ - EFI_IP6_TRANSMIT_DATA *TxData; - EFI_IP6_FRAGMENT_DATA *FragData; - UINTN Index; - - ASSERT (TxInfo != NULL); - - if (TxInfo->Token != NULL) { - - if (TxInfo->Token->Event != NULL) { - gBS->CloseEvent (TxInfo->Token->Event); - } - - TxData = TxInfo->Token->Packet.TxData; - if (TxData != NULL) { - - if (TxData->OverrideData != NULL) { - FreePool (TxData->OverrideData); - } - - if (TxData->ExtHdrs != NULL) { - FreePool (TxData->ExtHdrs); - } - - for (Index = 0; Index < TxData->FragmentCount; Index++) { - FragData = TxData->FragmentTable[Index].FragmentBuffer; - if (FragData != NULL) { - FreePool (FragData); - } - } - } - - FreePool (TxInfo->Token); - } - - FreePool (TxInfo); -} - -/** - Match the request, and reply with SequenceNum/TimeStamp. - - @param[in] Private The pointer to PING6_PRIVATE_DATA. - @param[in] Packet The pointer to ICMP6_ECHO_REQUEST_REPLY. - - @retval EFI_SUCCESS The match is successful. - @retval EFI_NOT_FOUND The reply can't be matched with any request. - -**/ -EFI_STATUS -Ping6OnMatchEchoReply ( - IN PING6_PRIVATE_DATA *Private, - IN ICMP6_ECHO_REQUEST_REPLY *Packet - ) -{ - PING6_ICMP6_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING6_ICMP6_TX_INFO, Link); - - if ((TxInfo->SequenceNum == Packet->SequenceNum) && (TxInfo->TimeStamp == Packet->TimeStamp)) { - Private->RxCount++; - RemoveEntryList (&TxInfo->Link); - Ping6DestroyTxInfo (TxInfo); - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - -/** - The original intention is to send a request. - Currently, the application retransmits an icmp6 echo request packet - per second in sendnumber times that is specified by the user. - Because nothing can be done here, all things move to the timer rountine. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -Ping6OnEchoRequestSent6 ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ -} - -/** - receive reply, match and print reply infomation. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to context. - -**/ -VOID -EFIAPI -Ping6OnEchoReplyReceived6 ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - PING6_PRIVATE_DATA *Private; - EFI_IP6_COMPLETION_TOKEN *RxToken; - EFI_IP6_RECEIVE_DATA *RxData; - ICMP6_ECHO_REQUEST_REPLY *Reply; - UINT32 PayLoad; - UINT32 Rtt; - - Private = (PING6_PRIVATE_DATA *) Context; - - if (Private->Status == EFI_ABORTED) { - return; - } - - RxToken = &Private->RxToken; - RxData = RxToken->Packet.RxData; - Reply = RxData->FragmentTable[0].FragmentBuffer; - PayLoad = RxData->DataLength; - - if (RxData->Header->NextHeader != IP6_ICMP) { - goto ON_EXIT; - } - - if (!IP6_IS_MULTICAST (&Private->DstAddress) && - !EFI_IP6_EQUAL (&RxData->Header->SourceAddress, &Private->DstAddress)) { - goto ON_EXIT; - } - - if ((Reply->Type != ICMP_V6_ECHO_REPLY) || (Reply->Code != 0)) { - goto ON_EXIT; - } - - if (PayLoad != Private->BufferSize) { - goto ON_EXIT; - } - // - // Check whether the reply matches the sent request before. - // - Status = Ping6OnMatchEchoReply (Private, Reply); - if (EFI_ERROR(Status)) { - goto ON_EXIT; - } - // - // Display statistics on this icmp6 echo reply packet. - // - Rtt = Ping6CalculateTick (Private, Reply->TimeStamp, Ping6ReadTime (Private)); - - Private->RttSum += Rtt; - Private->RttMin = Private->RttMin > Rtt ? Rtt : Private->RttMin; - Private->RttMax = Private->RttMax < Rtt ? Rtt : Private->RttMax; - - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING6_REPLY_INFO), - gShellNetwork2HiiHandle, - PayLoad, - mIp6DstString, - Reply->SequenceNum, - RxData->Header->HopLimit, - Rtt, - Rtt + Private->TimerPeriod - ); - -ON_EXIT: - - if (Private->RxCount < Private->SendNum) { - // - // Continue to receive icmp6 echo reply packets. - // - RxToken->Status = EFI_ABORTED; - - Status = Private->Ip6->Receive (Private->Ip6, RxToken); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6_RECEIVE), gShellNetwork2HiiHandle, Status); - Private->Status = EFI_ABORTED; - } - } else { - // - // All reply have already been received from the dest host. - // - Private->Status = EFI_SUCCESS; - } - // - // Singal to recycle the each rxdata here, not at the end of process. - // - gBS->SignalEvent (RxData->RecycleSignal); -} - -/** - Initial EFI_IP6_COMPLETION_TOKEN. - - @param[in] Private The pointer of PING6_PRIVATE_DATA. - @param[in] TimeStamp The TimeStamp of request. - @param[in] SequenceNum The SequenceNum of request. - - @return The pointer of EFI_IP6_COMPLETION_TOKEN. - -**/ -EFI_IP6_COMPLETION_TOKEN * -Ping6GenerateToken ( - IN PING6_PRIVATE_DATA *Private, - IN UINT32 TimeStamp, - IN UINT16 SequenceNum - ) -{ - EFI_STATUS Status; - EFI_IP6_COMPLETION_TOKEN *Token; - EFI_IP6_TRANSMIT_DATA *TxData; - ICMP6_ECHO_REQUEST_REPLY *Request; - - Request = AllocateZeroPool (Private->BufferSize); - - if (Request == NULL) { - return NULL; - } - // - // Assembly icmp6 echo request packet. - // - Request->Type = ICMP_V6_ECHO_REQUEST; - Request->Code = 0; - Request->SequenceNum = SequenceNum; - Request->TimeStamp = TimeStamp; - Request->Identifier = 0; - // - // Leave check sum to ip6 layer, since it has no idea of source address - // selection. - // - Request->Checksum = 0; - - TxData = AllocateZeroPool (sizeof (EFI_IP6_TRANSMIT_DATA)); - - if (TxData == NULL) { - FreePool (Request); - return NULL; - } - // - // Assembly ipv6 token for transmit. - // - TxData->OverrideData = 0; - TxData->ExtHdrsLength = 0; - TxData->ExtHdrs = NULL; - TxData->DataLength = Private->BufferSize; - TxData->FragmentCount = 1; - TxData->FragmentTable[0].FragmentBuffer = (VOID *) Request; - TxData->FragmentTable[0].FragmentLength = Private->BufferSize; - - Token = AllocateZeroPool (sizeof (EFI_IP6_COMPLETION_TOKEN)); - - if (Token == NULL) { - FreePool (Request); - FreePool (TxData); - return NULL; - } - - Token->Status = EFI_ABORTED; - Token->Packet.TxData = TxData; - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnEchoRequestSent6, - Private, - &Token->Event - ); - - if (EFI_ERROR (Status)) { - FreePool (Request); - FreePool (TxData); - FreePool (Token); - return NULL; - } - - return Token; -} - -/** - Transmit the EFI_IP6_COMPLETION_TOKEN. - - @param[in] Private The pointer of PING6_PRIVATE_DATA. - - @retval EFI_SUCCESS Transmitted successfully. - @retval EFI_OUT_OF_RESOURCES No memory is available on the platform. - @retval others Transmitted unsuccessfully. - -**/ -EFI_STATUS -Ping6SendEchoRequest ( - IN PING6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - PING6_ICMP6_TX_INFO *TxInfo; - - TxInfo = AllocateZeroPool (sizeof (PING6_ICMP6_TX_INFO)); - - if (TxInfo == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - TxInfo->TimeStamp = Ping6ReadTime (Private); - TxInfo->SequenceNum = (UINT16) (Private->TxCount + 1); - - TxInfo->Token = Ping6GenerateToken ( - Private, - TxInfo->TimeStamp, - TxInfo->SequenceNum - ); - - if (TxInfo->Token == NULL) { - Ping6DestroyTxInfo (TxInfo); - return EFI_OUT_OF_RESOURCES; - } - - Status = Private->Ip6->Transmit (Private->Ip6, TxInfo->Token); - - if (EFI_ERROR (Status)) { - Ping6DestroyTxInfo (TxInfo); - return Status; - } - - InsertTailList (&Private->TxList, &TxInfo->Link); - Private->TxCount++; - - return EFI_SUCCESS; -} - -/** - Place a completion token into the receive packet queue to receive the echo reply. - - @param[in] Private The pointer of PING6_PRIVATE_DATA. - - @retval EFI_SUCCESS Put the token into the receive packet queue successfully. - @retval others Put the token into the receive packet queue unsuccessfully. - -**/ -EFI_STATUS -Ping6OnReceiveEchoReply ( - IN PING6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - - ZeroMem (&Private->RxToken, sizeof (EFI_IP6_COMPLETION_TOKEN)); - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnEchoReplyReceived6, - Private, - &Private->RxToken.Event - ); - - if (EFI_ERROR (Status)) { - return Status; - } - - Private->RxToken.Status = EFI_NOT_READY; - - Status = Private->Ip6->Receive (Private->Ip6, &Private->RxToken); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6_RECEIVE), gShellNetwork2HiiHandle, Status); - } - return Status; -} - -/** - Remove the timeout request from the list. - - @param[in] Event A EFI_EVENT type event. - @param[in] Context The pointer to Context. - -**/ -VOID -EFIAPI -Ping6OnTimerRoutine6 ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - PING6_PRIVATE_DATA *Private; - PING6_ICMP6_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - UINT64 Time; - - Private = (PING6_PRIVATE_DATA *) Context; - - // - // Retransmit icmp6 echo request packets per second in sendnumber times. - // - if (Private->TxCount < Private->SendNum) { - - Status = Ping6SendEchoRequest (Private); - if (Private->TxCount != 0){ - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_SEND_REQUEST), gShellNetwork2HiiHandle, Private->TxCount + 1); - } - } - } - // - // Check whether any icmp6 echo request in the list timeout. - // - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING6_ICMP6_TX_INFO, Link); - Time = Ping6CalculateTick (Private, TxInfo->TimeStamp, Ping6ReadTime (Private)); - - // - // Remove the timeout echo request from txlist. - // - if (Time > PING6_DEFAULT_TIMEOUT) { - - if (EFI_ERROR (TxInfo->Token->Status)) { - Private->Ip6->Cancel (Private->Ip6, TxInfo->Token); - } - // - // Remove the timeout icmp6 echo request from list. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_TIMEOUT), gShellNetwork2HiiHandle, TxInfo->SequenceNum); - - RemoveEntryList (&TxInfo->Link); - Ping6DestroyTxInfo (TxInfo); - - if (IsListEmpty (&Private->TxList) && (Private->TxCount == Private->SendNum)) { - // - // All the left icmp6 echo request in the list timeout. - // - Private->Status = EFI_TIMEOUT; - } - } - } -} - -/** - Create a valid IP6 instance. - - @param[in] Private The pointer of PING6_PRIVATE_DATA. - - @retval EFI_SUCCESS Create a valid IP6 instance successfully. - @retval EFI_ABORTED Locate handle with ip6 service binding protocol unsuccessfully. - @retval EFI_INVALID_PARAMETER The source address is unspecified when the destination address is a link -ocal address. - @retval EFI_OUT_OF_RESOURCES No memory is available on the platform. - @retval EFI_NOT_FOUND The source address is not found. -**/ -EFI_STATUS -Ping6CreateIpInstance ( - IN PING6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - UINTN HandleIndex; - UINTN HandleNum; - EFI_HANDLE *HandleBuffer; - BOOLEAN UnspecifiedSrc; - EFI_STATUS MediaStatus; - EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb; - EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg; - EFI_IP6_CONFIG_DATA Ip6Config; - EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; - UINTN IfInfoSize; - EFI_IPv6_ADDRESS *Addr; - UINTN AddrIndex; - - HandleBuffer = NULL; - UnspecifiedSrc = FALSE; - MediaStatus = EFI_SUCCESS; - Ip6Sb = NULL; - IfInfo = NULL; - IfInfoSize = 0; - - // - // Locate all the handles with ip6 service binding protocol. - // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiIp6ServiceBindingProtocolGuid, - NULL, - &HandleNum, - &HandleBuffer - ); - if (EFI_ERROR (Status) || (HandleNum == 0)) { - return EFI_ABORTED; - } - - if (NetIp6IsUnspecifiedAddr (&Private->SrcAddress)) { - // - // SrcAddress is unspecified. So, both connected and configured interface will be automatic selected. - // - UnspecifiedSrc = TRUE; - } - - // - // Source address is required when pinging a link-local address. - // - if (NetIp6IsLinkLocalAddr (&Private->DstAddress) && UnspecifiedSrc) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_SOURCE), gShellNetwork2HiiHandle); - Status = EFI_INVALID_PARAMETER; - goto ON_ERROR; - } - - // - // For each ip6 protocol, check interface addresses list. - // - for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) { - - Ip6Sb = NULL; - IfInfo = NULL; - IfInfoSize = 0; - - if (UnspecifiedSrc) { - // - // Check media. - // - NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus); - if (MediaStatus != EFI_SUCCESS) { - // - // Skip this one. - // - continue; - } - } - - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - &gEfiIp6ServiceBindingProtocolGuid, - (VOID **) &Ip6Sb - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - // - // Ip6config protocol and ip6 service binding protocol are installed - // on the same handle. - // - Status = gBS->HandleProtocol ( - HandleBuffer[HandleIndex], - &gEfiIp6ConfigProtocolGuid, - (VOID **) &Ip6Cfg - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - // - // Get the interface information size. - // - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeInterfaceInfo, - &IfInfoSize, - NULL - ); - - if (Status != EFI_BUFFER_TOO_SMALL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - IfInfo = AllocateZeroPool (IfInfoSize); - - if (IfInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ON_ERROR; - } - // - // Get the interface info. - // - Status = Ip6Cfg->GetData ( - Ip6Cfg, - Ip6ConfigDataTypeInterfaceInfo, - &IfInfoSize, - IfInfo - ); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - // - // Check whether the source address is one of the interface addresses. - // - for (AddrIndex = 0; AddrIndex < IfInfo->AddressInfoCount; AddrIndex++) { - Addr = &(IfInfo->AddressInfo[AddrIndex].Address); - - if (UnspecifiedSrc) { - if (!NetIp6IsUnspecifiedAddr (Addr) && !NetIp6IsLinkLocalAddr (Addr)) { - // - // Select the interface automatically. - // - CopyMem(&Private->SrcAddress, Addr, sizeof(Private->SrcAddress)); - break; - } - } else if (EFI_IP6_EQUAL (&Private->SrcAddress, Addr)) { - // - // Match a certain interface address. - // - break; - } - } - - if (AddrIndex < IfInfo->AddressInfoCount) { - // - // Found a nic handle with right interface address. - // - break; - } - - FreePool (IfInfo); - IfInfo = NULL; - } - // - // No exact interface address matched. - // - - if (HandleIndex == HandleNum) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_CONFIGD_NIC_NF), gShellNetwork2HiiHandle); - Status = EFI_NOT_FOUND; - goto ON_ERROR; - } - - Private->NicHandle = HandleBuffer[HandleIndex]; - - ASSERT (Ip6Sb != NULL); - Status = Ip6Sb->CreateChild (Ip6Sb, &Private->Ip6ChildHandle); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - Status = gBS->OpenProtocol ( - Private->Ip6ChildHandle, - &gEfiIp6ProtocolGuid, - (VOID **) &Private->Ip6, - Private->ImageHandle, - Private->Ip6ChildHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - ZeroMem (&Ip6Config, sizeof (EFI_IP6_CONFIG_DATA)); - - // - // Configure the ip6 instance for icmp6 packet exchange. - // - Ip6Config.DefaultProtocol = 58; - Ip6Config.AcceptAnyProtocol = FALSE; - Ip6Config.AcceptIcmpErrors = TRUE; - Ip6Config.AcceptPromiscuous = FALSE; - Ip6Config.TrafficClass = 0; - Ip6Config.HopLimit = 128; - Ip6Config.FlowLabel = 0; - Ip6Config.ReceiveTimeout = 0; - Ip6Config.TransmitTimeout = 0; - - IP6_COPY_ADDRESS (&Ip6Config.StationAddress, &Private->SrcAddress); - - IP6_COPY_ADDRESS (&Ip6Config.DestinationAddress, &Private->DstAddress); - - Status = Private->Ip6->Configure (Private->Ip6, &Ip6Config); - - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6_CONFIG), gShellNetwork2HiiHandle, Status); - goto ON_ERROR; - } - - return EFI_SUCCESS; - -ON_ERROR: - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - - if (IfInfo != NULL) { - FreePool (IfInfo); - } - - if ((Ip6Sb != NULL) && (Private->Ip6ChildHandle != NULL)) { - Ip6Sb->DestroyChild (Ip6Sb, Private->Ip6ChildHandle); - } - - return Status; -} - -/** - Destroy the IP6 instance. - - @param[in] Private The pointer of PING6_PRIVATE_DATA. - -**/ -VOID -Ping6DestroyIpInstance ( - IN PING6_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb; - - gBS->CloseProtocol ( - Private->Ip6ChildHandle, - &gEfiIp6ProtocolGuid, - Private->ImageHandle, - Private->Ip6ChildHandle - ); - - Status = gBS->HandleProtocol ( - Private->NicHandle, - &gEfiIp6ServiceBindingProtocolGuid, - (VOID **) &Ip6Sb - ); - - if (!EFI_ERROR(Status)) { - Ip6Sb->DestroyChild (Ip6Sb, Private->Ip6ChildHandle); - } -} - -/** - The Ping6 Process. - - @param[in] ImageHandle The firmware allocated handle for the UEFI image. - @param[in] SendNumber The send request count. - @param[in] BufferSize The send buffer size. - @param[in] SrcAddress The source IPv6 address. - @param[in] DstAddress The destination IPv6 address. - - @retval SHELL_SUCCESS The ping6 processed successfullly. - @retval others The ping6 processed unsuccessfully. - -**/ -SHELL_STATUS -ShellPing6 ( - IN EFI_HANDLE ImageHandle, - IN UINT32 SendNumber, - IN UINT32 BufferSize, - IN EFI_IPv6_ADDRESS *SrcAddress, - IN EFI_IPv6_ADDRESS *DstAddress - ) -{ - EFI_STATUS Status; - EFI_INPUT_KEY Key; - PING6_PRIVATE_DATA *Private; - PING6_ICMP6_TX_INFO *TxInfo; - LIST_ENTRY *Entry; - LIST_ENTRY *NextEntry; - SHELL_STATUS ShellStatus; - - ShellStatus = SHELL_SUCCESS; - Private = AllocateZeroPool (sizeof (PING6_PRIVATE_DATA)); - - if (Private == NULL) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"Ping6"); - ShellStatus = SHELL_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - Private->ImageHandle = ImageHandle; - Private->SendNum = SendNumber; - Private->BufferSize = BufferSize; - Private->RttMin = ~((UINT64 )(0x0)); - Private->Status = EFI_NOT_READY; - - InitializeListHead (&Private->TxList); - - IP6_COPY_ADDRESS (&Private->SrcAddress, SrcAddress); - IP6_COPY_ADDRESS (&Private->DstAddress, DstAddress); - - // - // Open and configure a ip6 instance for ping6. - // - Status = Ping6CreateIpInstance (Private); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Print the command line itself. - // - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_START), gShellNetwork2HiiHandle, mIp6DstString, Private->BufferSize); - // - // Create a ipv6 token to receive the first icmp6 echo reply packet. - // - Status = Ping6OnReceiveEchoReply (Private); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Create and start timer to send icmp6 echo request packet per second. - // - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - Ping6OnTimerRoutine6, - Private, - &Private->Timer - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Start a timer to calculate the RTT. - // - Status = Ping6InitRttTimer (Private); - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - - // - // Create a ipv6 token to send the first icmp6 echo request packet. - // - Status = Ping6SendEchoRequest (Private); - // - // EFI_NOT_READY for IPsec is enable and IKE is not established. - // - if (EFI_ERROR (Status) && (Status != EFI_NOT_READY)) { - ShellStatus = SHELL_ACCESS_DENIED; - if(Status == EFI_NOT_FOUND) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_NOSOURCE_INDOMAIN), gShellNetwork2HiiHandle, mIp6DstString); - } - - goto ON_EXIT; - } - - Status = gBS->SetTimer ( - Private->Timer, - TimerPeriodic, - PING6_ONE_SECOND - ); - - if (EFI_ERROR (Status)) { - ShellStatus = SHELL_ACCESS_DENIED; - goto ON_EXIT; - } - // - // Control the ping6 process by two factors: - // 1. Hot key - // 2. Private->Status - // 2.1. success means all icmp6 echo request packets get reply packets. - // 2.2. timeout means the last icmp6 echo reply request timeout to get reply. - // 2.3. noready means ping6 process is on-the-go. - // - while (Private->Status == EFI_NOT_READY) { - Private->Ip6->Poll (Private->Ip6); - - // - // Terminate the ping6 process by 'esc' or 'ctl-c'. - // - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - - if (!EFI_ERROR(Status)) { - if ((Key.UnicodeChar == 0x1b) || (Key.UnicodeChar == 0x03) || - ((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_ESC))) { - goto ON_STAT; - } - } - } - -ON_STAT: - // - // Display the statistics in all. - // - gBS->SetTimer (Private->Timer, TimerCancel, 0); - - if (Private->TxCount != 0) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING6_STAT), - gShellNetwork2HiiHandle, - Private->TxCount, - Private->RxCount, - (100 * (Private->TxCount - Private->RxCount)) / Private->TxCount, - Private->RttSum - ); - } - - if (Private->RxCount != 0) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_PING6_RTT), - gShellNetwork2HiiHandle, - Private->RttMin, - Private->RttMin + Private->TimerPeriod, - Private->RttMax, - Private->RttMax + Private->TimerPeriod, - DivU64x64Remainder (Private->RttSum, Private->RxCount, NULL), - DivU64x64Remainder (Private->RttSum, Private->RxCount, NULL) + Private->TimerPeriod - ); - } - -ON_EXIT: - - if (Private != NULL) { - Private->Status = EFI_ABORTED; - - NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) { - TxInfo = BASE_CR (Entry, PING6_ICMP6_TX_INFO, Link); - - Status = Private->Ip6->Cancel (Private->Ip6, TxInfo->Token); - - RemoveEntryList (&TxInfo->Link); - Ping6DestroyTxInfo (TxInfo); - } - - Ping6FreeRttTimer (Private); - - if (Private->Timer != NULL) { - gBS->CloseEvent (Private->Timer); - } - - if (Private->Ip6 != NULL) { - Status = Private->Ip6->Cancel (Private->Ip6, &Private->RxToken); - } - - if (Private->RxToken.Event != NULL) { - gBS->CloseEvent (Private->RxToken.Event); - } - - if (Private->Ip6ChildHandle != NULL) { - Ping6DestroyIpInstance (Private); - } - - FreePool (Private); - } - - return ShellStatus; -} - -/** - Function for 'ping6' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval SHELL_SUCCESS The ping6 processed successfullly. - @retval others The ping6 processed unsuccessfully. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPing6 ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - EFI_IPv6_ADDRESS DstAddress; - EFI_IPv6_ADDRESS SrcAddress; - UINT64 BufferSize; - UINTN SendNumber; - LIST_ENTRY *ParamPackage; - CONST CHAR16 *ValueStr; - CONST CHAR16 *ValueStrPtr; - UINTN NonOptionCount; - CHAR16 *ProblemParam; - - ProblemParam = NULL; - ShellStatus = SHELL_SUCCESS; - - Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, &ProblemParam, TRUE, FALSE); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_INPUT), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - - SendNumber = 10; - BufferSize = 16; - - // - // Parse the parameter of count number. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-n"); - ValueStrPtr = ValueStr; - if (ValueStr != NULL) { - SendNumber = ShellStrToUintn (ValueStrPtr); - - // - // ShellStrToUintn will return 0 when input is 0 or an invalid input string. - // - if ((SendNumber == 0) || (SendNumber > PING6_MAX_SEND_NUMBER)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_SEND_NUMBER), gShellNetwork2HiiHandle, ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - // - // Parse the parameter of buffer size. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); - ValueStrPtr = ValueStr; - if (ValueStr != NULL) { - BufferSize = ShellStrToUintn (ValueStrPtr); - - // - // ShellStrToUintn will return 0 when input is 0 or an invalid input string. - // - if ((BufferSize < 16) || (BufferSize > PING6_MAX_BUFFER_SIZE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_BUFFER_SIZE), gShellNetwork2HiiHandle, ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - - ZeroMem (&SrcAddress, sizeof (EFI_IPv6_ADDRESS)); - ZeroMem (&DstAddress, sizeof (EFI_IPv6_ADDRESS)); - - // - // Parse the parameter of source ip address. - // - ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); - ValueStrPtr = ValueStr; - if (ValueStr != NULL) { - mIp6SrcString = ValueStr; - Status = NetLibStrToIp6 (ValueStrPtr, &SrcAddress); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_IP), gShellNetwork2HiiHandle, ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - // - // Parse the parameter of destination ip address. - // - NonOptionCount = ShellCommandLineGetCount(ParamPackage); - ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32)(NonOptionCount-1)); - if (NonOptionCount != 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_INPUT), gShellNetwork2HiiHandle); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - ValueStrPtr = ValueStr; - if (ValueStr != NULL) { - mIp6DstString = ValueStr; - Status = NetLibStrToIp6 (ValueStrPtr, &DstAddress); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_IP), gShellNetwork2HiiHandle, ValueStr); - ShellStatus = SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } - } - - // - // Enter into ping6 process. - // - ShellStatus = ShellPing6 ( - ImageHandle, - (UINT32)SendNumber, - (UINT32)BufferSize, - &SrcAddress, - &DstAddress - ); - -ON_EXIT: - ShellCommandLineFreeVarList (ParamPackage); - return ShellStatus; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c deleted file mode 100644 index 3e5c337..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c +++ /dev/null @@ -1,91 +0,0 @@ -/** @file - Main file for NULL named library for network2 shell command functions. - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License which accompanies this distribution. - The full text of the license may be found at http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -#include "UefiShellNetwork2CommandsLib.h" - -CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands"; -EFI_HANDLE gShellNetwork2HiiHandle = NULL; - -/** - return the file name of the help text file if not using HII. - - @return The string pointer to the file name. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameNetwork2 ( - VOID - ) -{ - return (gShellNetwork2FileName); -} - -/** - Constructor for the Shell Network2 Commands library. - - Install the handlers for Network2 UEFI Shell 2.0 profile commands. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. - - @retval EFI_SUCCESS The shell command handlers were installed sucessfully. - @retval EFI_UNSUPPORTED The shell level required was not found. -**/ -EFI_STATUS -EFIAPI -ShellNetwork2CommandsLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - gShellNetwork2HiiHandle = NULL; - - // - // check our bit of the profiles mask - // - if ((PcdGet8(PcdShellProfileMask) & BIT4) == 0) { - return (EFI_SUCCESS); - } - - gShellNetwork2HiiHandle = HiiAddPackages (&gShellNetwork2HiiGuid, gImageHandle, UefiShellNetwork2CommandsLibStrings, NULL); - if (gShellNetwork2HiiHandle == NULL) { - return (EFI_DEVICE_ERROR); - } - // - // install our shell command handlers - // - ShellCommandRegisterCommandName(L"ping6", ShellCommandRunPing6 , ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE , gShellNetwork2HiiHandle, STRING_TOKEN(STR_GET_HELP_PING6)); - ShellCommandRegisterCommandName(L"ifconfig6",ShellCommandRunIfconfig6 , ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE , gShellNetwork2HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG6)); - - return EFI_SUCCESS; - -} - -/** - Destructor for the library. free any resources. - - @param ImageHandle The image handle of the process. - @param SystemTable The EFI System Table pointer. -**/ -EFI_STATUS -EFIAPI -ShellNetwork2CommandsLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellNetwork2HiiHandle != NULL) { - HiiRemovePackages(gShellNetwork2HiiHandle); - } - return EFI_SUCCESS; -} - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h deleted file mode 100644 index e4671af..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h +++ /dev/null @@ -1,72 +0,0 @@ -/** @file - Main file for NULL named library for network2 shell command functions. - - Copyright (c) 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License which accompanies this distribution. - The full text of the license may be found at http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _UEFI_SHELL_NETWORK2_COMMANDS_LIB_H_ -#define _UEFI_SHELL_NETWORK2_COMMANDS_LIB_H_ - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern EFI_HANDLE gShellNetwork2HiiHandle; - -/** - Function for 'ping6' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval SHELL_SUCCESS The ping6 processed successfullly. - @retval others The ping6 processed unsuccessfully. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunPing6 ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/** - Function for 'ifconfig6' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). - - @retval SHELL_SUCCESS The ifconfig6 command processed successfully. - @retval others The ifconfig6 command process failed. - -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunIfconfig6 ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -#endif - diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf deleted file mode 100644 index d3adbff..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf +++ /dev/null @@ -1,64 +0,0 @@ -## @file -# Provides shell network2 functions -# -# Copyright (c) 2016, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = UefiShellNetwork2CommandsLib - FILE_GUID = D94E3B82-908E-46bf-A7B9-C7B7F17B1B7D - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = ShellNetwork2CommandsLibConstructor - DESTRUCTOR = ShellNetwork2CommandsLibDestructor - -[Sources.common] - UefiShellNetwork2CommandsLib.uni - UefiShellNetwork2CommandsLib.c - UefiShellNetwork2CommandsLib.h - Ping6.c - Ifconfig6.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MemoryAllocationLib - BaseLib - BaseMemoryLib - DebugLib - ShellCommandLib - ShellLib - UefiLib - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - FileHandleLib - NetLib - -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - -[Protocols] - gEfiCpuArchProtocolGuid ## CONSUMES - gEfiTimerArchProtocolGuid ## CONSUMES - gEfiIp6ProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES - gEfiIp6ConfigProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gShellNetwork2HiiGuid ## SOMETIMES_CONSUMES ## HII diff --git a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni b/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni deleted file mode 100644 index fef856e..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni +++ /dev/null @@ -1,167 +0,0 @@ -/** @file - - String definitions for UEFI Shell network 2 commands - Copyright (c) 2016, Intel Corporation. All rights reserved.
- (C) Copyright 2017 Hewlett Packard Enterprise Development LP
- - This program and the accompanying materials - are licensed and made available under the terms and conditions - of the BSD License which accompanies this distribution. The full - text of the license may be found at
- http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - Module Name: - - UefiShellNetwork2CommandsLib.uni - - Abstract: - - String definitions for UEFI Shell 2.0 network 2 commands -**/ - -#langdef en-US "english" - -#string STR_GEN_ERR_AD #language en-US "%H%s%N: Access denied.\r\n" -#string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory allocation was not successful.\r\n" - -#string STR_PING6_INVALID_IP #language en-US "%Ping6: Invalid IP6 address, %s\r\n" -#string STR_PING6_INVALID_INPUT #language en-US "%Ping6: Invalid input, please type 'Ping6 -?'for help\r\n" -#string STR_PING6_INVALID_SEND_NUMBER #language en-US "%Ping6: Invalid send number, %s\r\n" -#string STR_PING6_INVALID_BUFFER_SIZE #language en-US "%Ping6: Invalid buffer size, %s\r\n" -#string STR_PING6_INVALID_SOURCE #language en-US "%Ping6: Require source interface option\r\n" -#string STR_PING6_IP6_CONFIG #language en-US "%Ping6: The process of Ip6 Configure %r\r\n" -#string STR_PING6_IP6_RECEIVE #language en-US "%Ping6: Place the receive token %r\r\n" -#string STR_PING6_IP6CFG_GETDATA #language en-US "%Ping6: Get data of the interface information %r\r\n" -#string STR_PING6_SEND_REQUEST #language en-US "Echo request sequence %d fails.\r\n" -#string STR_PING6_CONFIGD_NIC_NF #language en-US "%Ping6: No configured interfaces were found.\r\n" -#string STR_PING6_NOSOURCE_INDOMAIN #language en-US "No sources in %s's multicast domain.\r\n" -#string STR_PING6_START #language en-US "Ping %s %d data bytes\r\n" -#string STR_PING6_TIMEOUT #language en-US "Echo request sequence %d timeout.\r\n" -#string STR_PING6_REPLY_INFO #language en-US "%d bytes from %s : icmp_seq=%d ttl=%d time%d~%dms\r\n" -#string STR_PING6_STAT #language en-US "\n%d packets transmitted, %d received, %d%% packet loss, time %dms\r\n" -#string STR_PING6_RTT #language en-US "\nRtt(round trip time) min=%d~%dms max=%d~%dms avg=%d~%dms\r\n" - -#string STR_IFCONFIG6_ERR_IP6CFG_GETDATA #language en-US "Get data of the interface information %hr\r\n" -#string STR_IFCONFIG6_INFO_BREAK #language en-US "-----------------------------------------------------------------" -#string STR_IFCONFIG6_INFO_COLON #language en-US ":" -#string STR_IFCONFIG6_INFO_JOINT #language en-US " >> " -#string STR_IFCONFIG6_INFO_NEWLINE #language en-US "\r\n" -#string STR_IFCONFIG6_INFO_IF_NAME #language en-US "\n%Hname : %s%N\r\n" -#string STR_IFCONFIG6_INFO_POLICY_AUTO #language en-US "%Hpolicy : automatic%N\r\n" -#string STR_IFCONFIG6_INFO_POLICY_MAN #language en-US "%Hpolicy : manual%N\r\n" -#string STR_IFCONFIG6_INFO_DAD_TRANSMITS #language en-US "%Hdad xmits : %d%N\r\n" -#string STR_IFCONFIG6_INFO_INTERFACE_ID_HEAD #language en-US "%Hinterface id : %N" -#string STR_IFCONFIG6_INFO_MAC_ADDR_HEAD #language en-US "%Hmac addr : %N" -#string STR_IFCONFIG6_INFO_MAC_ADDR_BODY #language en-US "%02x" -#string STR_IFCONFIG6_INFO_IP_ADDR_HEAD #language en-US "\n%Hhost addr : %N\r\n" -#string STR_IFCONFIG6_INFO_DNS_ADDR_HEAD #language en-US "\n%Hdns server : %N\r\n" -#string STR_IFCONFIG6_INFO_IP_ADDR_BODY #language en-US "%02x" -#string STR_IFCONFIG6_INFO_IP_ADDR_BODY4BIT #language en-US "%x" -#string STR_IFCONFIG6_INFO_ROUTE_HEAD #language en-US "\n%Hroute table : %N\r\n" -#string STR_IFCONFIG6_INFO_PREFIX_LEN #language en-US "/%d" -#string STR_IFCONFIG6_LINE_HELP #language en-US "Displays or modifies the IPv6 configuration" -#string STR_IFCONFIG6_ERR_LACK_INTERFACE #language en-US "Lack interface name.\r\n" - "Usage: IfConfig6 -s \r\n" - "Example: IfConfig6 -s eth0 auto\r\n" -#string STR_IFCONFIG6_LACK_OPTION #language en-US "Flags lack. Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_CONFLICT_OPTIONS #language en-US "Flags conflict. Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_LACK_COMMAND #language en-US "Lack interface config option.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_INVALID_INTERFACE #language en-US "Invalid interface name.\r\n" - "Hint: Use {IfConfig6 -l} to check existing interface names.\r\n" -#string STR_IFCONFIG6_ERR_INVALID_COMMAND #language en-US "Invalid command. Bad command %H%s%N is skipped.\r\n" - "Hint: Incorrect option or arguments. Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_LACK_ARGUMENTS #language en-US "Lack arguments. Bad command %H%s%N is skipped.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_LACK_OPTION #language en-US "Lack options.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_MAN_HOST #language en-US "Manual address configuration failed. Please retry.\r\n" - -#string STR_IFCONFIG6_ERR_MAN_GW #language en-US "Gateway address configuration failed. Please check the argument.\r\n" - -#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG #language en-US "The IP address is not configurable when the policy is Ip6ConfigPolicyAutomatic.\r\n" - -#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG #language en-US "The gateway address is not configurable when the policy is Ip6ConfigPolicyAutomatic.\r\n" - -#string STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG #language en-US "The DNS server address is not configurable when the policy is Ip6ConfigPolicyAutomatic.\r\n" - -#string STR_IFCONFIG6_ERR_DUPLICATE_COMMAND #language en-US "Duplicate commands. Bad command %H%s%N is skipped.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_CONFLICT_COMMAND #language en-US "Conflict commands. Bad command %H%s%N is skipped.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_UNKNOWN_COMMAND #language en-US "Unknown commands. Bad command %H%s%N is skipped.\r\n" - "Hint: Please type 'IfConfig6 -?' for help info.\r\n" -#string STR_IFCONFIG6_ERR_ADDRESS_FAILED #language en-US "Failed to configure IPv6 address: " - - -#string STR_GET_HELP_PING6 #language en-US "" -".TH ping6 0 "Ping a target machine with UEFI IPv6 network stack."\r\n" -".SH NAME\r\n" -"Ping a target machine with UEFI IPv6 network stack.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"Ping6 [-l size] [-n count] [-s SourceIp] TargetIp\r\n" -".SH OPTIONS\r\n" -" \r\n" -" -l size Send buffer size, in bytes(default=16, min=16, max=32768).\r\n" -" -n count Send request count, (default=10, min=1, max=10000).\r\n" -" -s SourceIp Source IPv6 address.\r\n" -" TargetIp Target IPv6 address.\r\n" -"NOTES:\r\n" -" 1. When TargetIp is a link local address, SourceIp needs to be specified.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"Examples:\r\n" -" * To ping the target host by sending 5 request with 1000 bytes from 2002::1\r\n" -" Shell:\> Ping6 -s 2002::1 2002::2 -l 1000 -n 5\r\n" -" \r\n" -" * To ping the target host with 1000 bytes\r\n" -" Shell:\> Ping6 2002::2 -l 1000\r\n" - -#string STR_GET_HELP_IFCONFIG6 #language en-US "" -".TH ifconfig6 0 "Displays or modifies IPv6 configuration for network interface."\r\n" -".SH NAME\r\n" -"Displays or modifies IPv6 configuration for network interface.\r\n" -".SH SYNOPSIS\r\n" -" \r\n" -"IfConfig6 -r [Name] | -l [Name] \r\n" -"IfConfig6 -s [dad ] [auto | [man [id ] [host gw ]\r\n" -" [dns ]]]\r\n" -".SH OPTIONS\r\n" -" \r\n" -" Name Adapter name, i.e., eth0\r\n" -" -r [Name] Reconfigure all or specified interface, and set\r\n" -" automatic policy. If specified interface is already\r\n" -" set to automatic,then refresh the IPv6 configuration.\r\n" -" -l [Name] List the configuration of the specified interface.\r\n" -" -s dad Set dad transmits count of the specified interface.\r\n" -" -s auto Set automatic policy of the specified interface.\r\n" -" -s man id Set alternative interface id of the specified \r\n" -" interface. Must under manual policy.\r\n" -" -s man host gw \r\n" -" Set static host IP and gateway address of the\r\n" -" specified interface. Must under manual policy.\r\n" -" -s man dns Set DNS server IP addresses of the specified\r\n" -" interface.Must under manual policy.\r\n" -".SH EXAMPLES\r\n" -" \r\n" -"EXAMPLES:\r\n" -" * To list the configuration for the interface eth0:\r\n" -" Shell:\> ifConfig6 -l eth0\r\n" -" \r\n" -" * To use automatic configuration to request the IPv6 address configuration\r\n" -" dynamically for the interface eth0:\r\n" -" Shell:\> ifconfig6 -s eth0 auto\r\n" -" \r\n" -" * To set the dad transmits count for eth0 under automatic policy:\r\n" -" Shell:\> ifconfig6 -s eth0 auto dad 10\r\n" -" \r\n" -" * To set the alternative interface id of eth0 under manual policy:\r\n" -" Shell:\> ifconfig6 -s eth0 man id ff:dd:aa:88:66:cc\r\n" -" \r\n" -" * To use the static IP6 addresses configuration for the interface eth0,\r\n" -" and this configuration survives the network reload:\r\n" -" Shell:\> ifconfig6 -s eth0 man host 2002::1/64 2002::2/64 gw 2002::3/64\r\n" diff --git a/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dec b/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dec deleted file mode 100644 index c407cc4..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dec +++ /dev/null @@ -1,140 +0,0 @@ -## @file ShellPkg.dec -# This Package provides all definitions for EFI and UEFI Shell -# -# (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License which accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = ShellPkg - PACKAGE_GUID = C1014BB7-4092-43D4-984F-0738EB424DBF - PACKAGE_VERSION = 1.02 - -[Includes] - Include - -[LibraryClasses] - ## @libraryclass Provides most Shell APIs. Only available for Shell applications - ShellLib|Include/Library/ShellLib.h - - ## @libraryclass Provides shell internal support Only available for shell internal commands - ShellCommandLib|Include/Library/ShellCommandLib.h - - ## @libraryclass Allows for a shell application to have a C style entry point - ShellCEntryLib|Include/Library/ShellCEntryLib.h - - ## @libraryclass Provides advanced parsing functions - HandleParsingLib|Include/Library/HandleParsingLib.h - - ## @libraryclass provides BCFG command - BcfgCommandLib|Include/Library/BcfgCommandLib.h - -[Guids] - gEfiShellEnvironment2ExtGuid = {0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87}} - gEfiShellPkgTokenSpaceGuid = {0x171e9188, 0x31d3, 0x40f5, {0xb1, 0x0c, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd}} - gShellVariableGuid = {0x158def5a, 0xf656, 0x419c, {0xb0, 0x27, 0x7a, 0x31, 0x92, 0xc0, 0x79, 0xd2}} - gShellMapGuid = {0x51271e13, 0x7de3, 0x43af, {0x8b, 0xc2, 0x71, 0xad, 0x3b, 0x82, 0x43, 0x25}} - gShellAliasGuid = {0x0053d9d6, 0x2659, 0x4599, {0xa2, 0x6b, 0xef, 0x45, 0x36, 0xe6, 0x31, 0xa9}} - gHandleParsingHiiGuid = {0xb8969637, 0x81de, 0x43af, {0xbc, 0x9a, 0x24, 0xd9, 0x89, 0x13, 0xf2, 0xf6}} - gShellDebug1HiiGuid = {0x25f200aa, 0xd3cb, 0x470a, {0xbf, 0x51, 0xe7, 0xd1, 0x62, 0xd2, 0x2e, 0x6f}} - gShellDriver1HiiGuid = {0xaf0b742, 0x63ec, 0x45bd, {0x8d, 0xb6, 0x71, 0xad, 0x7f, 0x2f, 0xe8, 0xe8}} - gShellInstall1HiiGuid = {0x7d574d54, 0xd364, 0x4d4a, {0x95, 0xe3, 0x49, 0x45, 0xdb, 0x7a, 0xd3, 0xee}} - gShellLevel1HiiGuid = {0xdec5daa4, 0x6781, 0x4820, {0x9c, 0x63, 0xa7, 0xb0, 0xe4, 0xf1, 0xdb, 0x31}} - gShellLevel2HiiGuid = {0xf95a7ccc, 0x4c55, 0x4426, {0xa7, 0xb4, 0xdc, 0x89, 0x61, 0x95, 0xb, 0xae}} - gShellLevel3HiiGuid = {0x4344558d, 0x4ef9, 0x4725, {0xb1, 0xe4, 0x33, 0x76, 0xe8, 0xd6, 0x97, 0x4f}} - gShellNetwork1HiiGuid = {0xf3d301bb, 0xf4a5, 0x45a8, {0xb0, 0xb7, 0xfa, 0x99, 0x9c, 0x62, 0x37, 0xae}} - gShellNetwork2HiiGuid = {0x174b2b5, 0xf505, 0x4b12, {0xaa, 0x60, 0x59, 0xdf, 0xf8, 0xd6, 0xea, 0x37}} - gShellTftpHiiGuid = {0x738a9314, 0x82c1, 0x4592, {0x8f, 0xf7, 0xc1, 0xbd, 0xf1, 0xb2, 0x0e, 0xd4}} - gShellBcfgHiiGuid = {0x5f5f605d, 0x1583, 0x4a2d, {0xa6, 0xb2, 0xeb, 0x12, 0xda, 0xb4, 0xa2, 0xb6}} - gShellAcpiViewHiiGuid = {0xda8ccdf4, 0xed8f, 0x4ffc, {0xb5, 0xef, 0x2e, 0xf5, 0x5e, 0x24, 0x93, 0x2a}} - # FILE_GUID as defined in ShellPkg/Application/Shell/Shell.inf - gUefiShellFileGuid = {0x7c04a583, 0x9e3e, 0x4f1c, {0xad, 0x65, 0xe0, 0x52, 0x68, 0xd0, 0xb4, 0xd1}} - -[Protocols] - gEfiShellEnvironment2Guid = {0x47c7b221, 0xc42a, 0x11d2, {0x8e, 0x57, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} - gEfiShellInterfaceGuid = {0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}} - -[PcdsFeatureFlag] - ## This flag is used to control whether the shell includes NT32 platform Guids - # and thereby prevents dependancy on that Pkg - gEfiShellPkgTokenSpaceGuid.PcdShellIncludeNtGuids|TRUE|BOOLEAN|0x0000000E - - ## This flag is used to control HII required by the shell - gEfiShellPkgTokenSpaceGuid.PcdShellRequireHiiPlatform|TRUE|BOOLEAN|0x00000003 - - ## This flag is used to control HII required by the shell - gEfiShellPkgTokenSpaceGuid.PcdShellSupportFrameworkHii|FALSE|BOOLEAN|0x00000004 - - ## This flag forces the shell to present a user console. Allows for earlier debugging of platforms. - gEfiShellPkgTokenSpaceGuid.PcdShellForceConsole|FALSE|BOOLEAN|0x0000000F - -[PcdsFixedAtBuild] - ## This flag is used to control initialization of the shell library - # This should be FALSE for compiling the shell application itself only. - # This should be FALSE for compiling the dynamic command drivers. - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|TRUE|BOOLEAN|0x00000005 - - ## This is the max buffer for ShellLib and internal Shell printings. - gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize|16000|UINT16|0x0000000C - - ## This flag is used to control the commands available in the shell - gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel|3|UINT8|0x00000001 - - ## This flag is used to control the profiles available in the shell - # don't forget to update the text file if you change this. - # bit 0 = Drivers1 - # bit 1 = Debug1 - # bit 2 = Install1 - # bit 3 = Network1 - # bit 4 = Network2 - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0xFF|UINT8|0x0000000D - - ## This is the character count for allocation for consistent mappings - gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength|50|UINT8|0x00000009 - - ## This determines how many bytes are read out of files at a time for file operations (type, copy, etc...) - gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x1000|UINT32|0x0000000A - - ## This determines the max count of history commands - gEfiShellPkgTokenSpaceGuid.PcdShellMaxHistoryCommandCount|0x0020|UINT16|0x00000014 - -[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] - ## This flag is used to control the protocols produced by the shell - # If TRUE the shell will produce EFI_SHELL_ENVIRONMENT2 and EFI_SHELL_INTERFACE - gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols|FALSE|BOOLEAN|0x00000002 - - ## this flag determines whether Page Break (-b) defaults to on or off in the shell - gEfiShellPkgTokenSpaceGuid.PcdShellPageBreakDefault|FALSE|BOOLEAN|0x00000006 - - ## this flag determines whether insert mode for typing is default (FALSE means typeover) - gEfiShellPkgTokenSpaceGuid.PcdShellInsertModeDefault|TRUE|BOOLEAN|0x00000007 - - ## this flag determines the default number of screens kept for history log. - # the spec defines 3 as the minimum - gEfiShellPkgTokenSpaceGuid.PcdShellScreenLogCount|3|UINT8|0x00000008 - - ## Unicode string of the shell supplier - gEfiShellPkgTokenSpaceGuid.PcdShellSupplier|L"EDK II"|VOID*|0x00000010 - - ## Do extended decode of USB for determining media type - gEfiShellPkgTokenSpaceGuid.PcdUsbExtendedDecode|TRUE|BOOLEAN|0x00000011 - - ## Do iSCSI decode for map names. - # This is disabled by default due to the length of generated strings - gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames|FALSE|BOOLEAN|0x00000012 - - ## Controls Extended decode for Vendor device path nodes for map names. - # Up to this many bytes of vendor specific data will be used. Default is 0 - # (disabled). - gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode|0|UINT32|0x00000013 diff --git a/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dsc b/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dsc deleted file mode 100644 index 0fac7d2..0000000 --- a/Voyager/Voyager/edk2/ShellPkg/ShellPkg.dsc +++ /dev/null @@ -1,136 +0,0 @@ -## @file -# Shell Package -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Arm Limited. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - PLATFORM_NAME = Shell - PLATFORM_GUID = E1DC9BF8-7013-4c99-9437-795DAA45F3BD - PLATFORM_VERSION = 1.02 - DSC_SPECIFICATION = 0x00010006 - OUTPUT_DIRECTORY = Build/Shell - SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64 - BUILD_TARGETS = DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER = DEFAULT - -[LibraryClasses.common] - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf -!if $(TARGET) == RELEASE - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf -!else - DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf -!endif - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf - SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf - - ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf - ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf - ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf - HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf - - PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf - BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - - UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf - DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf - -[LibraryClasses.ARM] - # - # It is not possible to prevent the ARM compiler for generic intrinsic functions. - # This library provides the instrinsic functions generate by a given compiler. - # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. - # - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - - # Add support for GCC stack protector - NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf - -[LibraryClasses.AARCH64] - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - -[PcdsFixedAtBuild] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF - gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|16000 -!ifdef $(NO_SHELL_PROFILES) - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0x00 -!endif #$(NO_SHELL_PROFILES) - -[Components] - # - # Build all the libraries when building this package. - # This helps developers test changes and how they affect the package. - # - ShellPkg/Library/UefiShellLib/UefiShellLib.inf - ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf - ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf - ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf - ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf - ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf - ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf - ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf - ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf - ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf - ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf - ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf - ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf - - ShellPkg/Application/Shell/Shell.inf { - - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE - - NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf - NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf - NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf -!ifndef $(NO_SHELL_PROFILES) - NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf - NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf - NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf - NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf - NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf -!endif #$(NO_SHELL_PROFILES) - } - - ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { - - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE - } - ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf - ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf { - - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE - } - ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf - -[BuildOptions] - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES